FRODO Version 2.19.1
An open-source framework for Distributed Constraint Optimization (DCOP)
Loading...
Searching...
No Matches
frodo2.algorithms.asodpop.tests.ASODPOPTest< V extends Addable< V >, U extends Addable< U > > Class Template Reference

JUnit test for the class ASODPOP. More...

Inheritance diagram for frodo2.algorithms.asodpop.tests.ASODPOPTest< V extends Addable< V >, U extends Addable< U > >:

Public Member Functions

 ASODPOPTest (String method, Class< V > domClass, Class< U > utilClass)
 Constructor that instantiates a test only for the input method.
void testRandomSharedMemory () throws Exception
 Tests the ADOPT protocol on a random graph using QueueIOPipes.
void testRandomTCP () throws Exception
 Tests the ADOPT protocol on a random graph using TCP pipes.
void testRandomSharedMemoryNoXML () throws Exception
 Tests the ADOPT protocol on a random graph using QueueIOPipes.
Collection< MessageTypegetMsgTypes ()
void notifyIn (Message msg)
void setQueue (Queue queue)
Public Member Functions inherited from frodo2.communication.IncomingMsgPolicyInterface< T >
default void notifyIn (Message msg, Object toAgent)
 Notifies the listener of an incoming message.

Static Public Member Functions

static TestSuite suite ()
static< V extends Addable< V > U extends Addable< U > void startUTILpropagation (RandGraphFactory.Graph graph, Map< String, DFSview< V, U > > dfs, Map< String, Queue > queues)

Protected Member Functions

void setUp () throws Exception
void tearDown () throws Exception

Protected Attributes

XCSPparser< V, U > parser
 The XCSP parser.

Private Member Functions

void test (String combination, boolean useTCP, boolean useXML) throws Exception
 Runs a random test.

Private Attributes

final int maxNbrVars = 5
 Maximum number of variables in the random graph.
final int maxNbrEdges = 10
 Maximum number of edges in the random graph.
final int maxNbrAgents = 5
 Maximum number of agents.
int nbrMsgsRemaining
 The number of output messages remaining to be received from the UTIL propagation protocol.
final Object nbrMsgsRemaining_lock = new Object ()
 Used to synchronize the access to nbrMsgsRemaining.
Map< String, Queuequeues
 List of queues, indexed by agent name.
Element parameters
 The parameters for adopt.
RandGraphFactory.Graph graph
 Random graph used to generate a constraint graph.
Map< String, DFSview< V, U > > dfs
 The DFS corresponding to the random graph.
Document problem
 The problem to be solved.
DPOPsolver< V, U > solver
 Solver used to calculate the optimal utility.
HashMap< String, V > assignments
 The assignments reported by the variables.
Class< V > domClass
 The class of variable values.
Class< U > utilClass
 The class of utility values.

Detailed Description

JUnit test for the class ASODPOP.

Author
Brammert Ottens, Thomas Leaute
Parameters
<V>the type used for variable values
<U>the type used for utility values

Constructor & Destructor Documentation

◆ ASODPOPTest()

frodo2.algorithms.asodpop.tests.ASODPOPTest< V extends Addable< V >, U extends Addable< U > >.ASODPOPTest ( String method,
Class< V > domClass,
Class< U > utilClass )

Constructor that instantiates a test only for the input method.

Parameters
methodtest method
domClassthe class of variable values
utilClassthe class of utility values

References domClass, and utilClass.

Referenced by suite().

Member Function Documentation

◆ getMsgTypes()

◆ notifyIn()

◆ setQueue()

◆ setUp()

◆ startUTILpropagation()

static< V extends Addable< V > U extends Addable< U > void frodo2.algorithms.asodpop.tests.ASODPOPTest< V extends Addable< V >, U extends Addable< U > >.startUTILpropagation ( RandGraphFactory.Graph graph,
Map< String, DFSview< V, U > > dfs,
Map< String, Queue > queues )
static

◆ suite()

TestSuite frodo2.algorithms.asodpop.tests.ASODPOPTest< V extends Addable< V >, U extends Addable< U > >.suite ( )
static
Returns
the test suite for this test

References ASODPOPTest().

Referenced by frodo2.algorithms.asodpop.tests.AllTestsASODPOP.suite().

Here is the call graph for this function:

◆ tearDown()

void frodo2.algorithms.asodpop.tests.ASODPOPTest< V extends Addable< V >, U extends Addable< U > >.tearDown ( ) throws Exception
protected
See also
junit.framework.TestCase#tearDown()

References dfs, graph, and queues.

◆ test()

void frodo2.algorithms.asodpop.tests.ASODPOPTest< V extends Addable< V >, U extends Addable< U > >.test ( String combination,
boolean useTCP,
boolean useXML ) throws Exception
private

Runs a random test.

Parameters
combinationthe version of ADOPT
useTCPwhether to use TCP pipes or shared memory pipes
useXMLwhether to use the XML-based constructor
Exceptions
Exceptionif an error occurs

References frodo2.communication.Queue.addIncomingMessagePolicy(), assignments, frodo2.algorithms.test.AllTests.createQueueNetwork(), dfs, frodo2.communication.Queue.end(), frodo2.solutionSpaces.ProblemInterface< V extends Addable< V >, U extends Addable< U > >.getAgents(), frodo2.solutionSpaces.DCOPProblemInterface< V extends Addable< V >, U extends Addable< U > >.getDomain(), frodo2.solutionSpaces.ProblemInterface< V extends Addable< V >, U extends Addable< U > >.getDomClass(), frodo2.solutionSpaces.DCOPProblemInterface< V extends Addable< V >, U extends Addable< U > >.getOwners(), frodo2.solutionSpaces.DCOPProblemInterface< V extends Addable< V >, U extends Addable< U > >.getProbabilitySpacePerRandVar(), frodo2.solutionSpaces.DCOPProblemInterface< V extends Addable< V >, U extends Addable< U > >.getRandVars(), frodo2.solutionSpaces.DCOPProblemInterface< V extends Addable< V >, U extends Addable< U > >.getSolutionSpaces(), frodo2.solutionSpaces.DCOPProblemInterface< V extends Addable< V >, U extends Addable< U > >.getSubProblem(), frodo2.solutionSpaces.ProblemInterface< V extends Addable< V >, U extends Addable< U > >.getUtilClass(), frodo2.algorithms.Solution< V, U >.getUtility(), frodo2.solutionSpaces.DCOPProblemInterface< V extends Addable< V >, U extends Addable< U > >.getVariables(), frodo2.solutionSpaces.DCOPProblemInterface< V extends Addable< V >, U extends Addable< U > >.getVarScopes(), graph, nbrMsgsRemaining, nbrMsgsRemaining_lock, parameters, frodo2.algorithms.XCSPparser< V extends Addable< V >, U extends Addable< U > >.parse(), parser, problem, queues, frodo2.communication.Queue.setProblem(), solver, startUTILpropagation(), frodo2.algorithms.AgentInterface< V extends Addable< V > >.STATS_MONITOR, and test().

Referenced by test(), testRandomSharedMemory(), testRandomSharedMemoryNoXML(), and testRandomTCP().

Here is the call graph for this function:

◆ testRandomSharedMemory()

void frodo2.algorithms.asodpop.tests.ASODPOPTest< V extends Addable< V >, U extends Addable< U > >.testRandomSharedMemory ( ) throws Exception

Tests the ADOPT protocol on a random graph using QueueIOPipes.

Exceptions
Exceptionif an error occurs

References test().

Here is the call graph for this function:

◆ testRandomSharedMemoryNoXML()

void frodo2.algorithms.asodpop.tests.ASODPOPTest< V extends Addable< V >, U extends Addable< U > >.testRandomSharedMemoryNoXML ( ) throws Exception

Tests the ADOPT protocol on a random graph using QueueIOPipes.

Exceptions
Exceptionif an error occurs

References test().

Here is the call graph for this function:

◆ testRandomTCP()

void frodo2.algorithms.asodpop.tests.ASODPOPTest< V extends Addable< V >, U extends Addable< U > >.testRandomTCP ( ) throws Exception

Tests the ADOPT protocol on a random graph using TCP pipes.

Exceptions
Exceptionif an error occurs

References test().

Here is the call graph for this function:

Member Data Documentation

◆ assignments

HashMap<String, V> frodo2.algorithms.asodpop.tests.ASODPOPTest< V extends Addable< V >, U extends Addable< U > >.assignments
private

The assignments reported by the variables.

Referenced by setUp(), and test().

◆ dfs

Map< String, DFSview<V, U> > frodo2.algorithms.asodpop.tests.ASODPOPTest< V extends Addable< V >, U extends Addable< U > >.dfs
private

The DFS corresponding to the random graph.

Referenced by setUp(), startUTILpropagation(), tearDown(), and test().

◆ domClass

Class<V> frodo2.algorithms.asodpop.tests.ASODPOPTest< V extends Addable< V >, U extends Addable< U > >.domClass
private

The class of variable values.

Referenced by ASODPOPTest(), and setUp().

◆ graph

RandGraphFactory.Graph frodo2.algorithms.asodpop.tests.ASODPOPTest< V extends Addable< V >, U extends Addable< U > >.graph
private

Random graph used to generate a constraint graph.

Referenced by setUp(), startUTILpropagation(), tearDown(), and test().

◆ maxNbrAgents

final int frodo2.algorithms.asodpop.tests.ASODPOPTest< V extends Addable< V >, U extends Addable< U > >.maxNbrAgents = 5
private

Maximum number of agents.

Referenced by setUp().

◆ maxNbrEdges

final int frodo2.algorithms.asodpop.tests.ASODPOPTest< V extends Addable< V >, U extends Addable< U > >.maxNbrEdges = 10
private

Maximum number of edges in the random graph.

Referenced by setUp().

◆ maxNbrVars

final int frodo2.algorithms.asodpop.tests.ASODPOPTest< V extends Addable< V >, U extends Addable< U > >.maxNbrVars = 5
private

Maximum number of variables in the random graph.

Note
Must be at least 2.

Referenced by setUp().

◆ nbrMsgsRemaining

int frodo2.algorithms.asodpop.tests.ASODPOPTest< V extends Addable< V >, U extends Addable< U > >.nbrMsgsRemaining
private

The number of output messages remaining to be received from the UTIL propagation protocol.

Referenced by test().

◆ nbrMsgsRemaining_lock

final Object frodo2.algorithms.asodpop.tests.ASODPOPTest< V extends Addable< V >, U extends Addable< U > >.nbrMsgsRemaining_lock = new Object ()
private

Used to synchronize the access to nbrMsgsRemaining.

We cannot synchronize directly over nbrMsgsRemaining because it will be decremented, and hence the object will change.

Referenced by test().

◆ parameters

Element frodo2.algorithms.asodpop.tests.ASODPOPTest< V extends Addable< V >, U extends Addable< U > >.parameters
private

The parameters for adopt.

Referenced by setUp(), and test().

◆ parser

XCSPparser<V, U> frodo2.algorithms.asodpop.tests.ASODPOPTest< V extends Addable< V >, U extends Addable< U > >.parser
protected

The XCSP parser.

Referenced by setUp(), and test().

◆ problem

Document frodo2.algorithms.asodpop.tests.ASODPOPTest< V extends Addable< V >, U extends Addable< U > >.problem
private

The problem to be solved.

Referenced by setUp(), and test().

◆ queues

Map<String, Queue> frodo2.algorithms.asodpop.tests.ASODPOPTest< V extends Addable< V >, U extends Addable< U > >.queues
private

List of queues, indexed by agent name.

Referenced by startUTILpropagation(), tearDown(), and test().

◆ solver

DPOPsolver<V, U> frodo2.algorithms.asodpop.tests.ASODPOPTest< V extends Addable< V >, U extends Addable< U > >.solver
private

Solver used to calculate the optimal utility.

Referenced by setUp(), and test().

◆ utilClass

Class<U> frodo2.algorithms.asodpop.tests.ASODPOPTest< V extends Addable< V >, U extends Addable< U > >.utilClass
private

The class of utility values.

Referenced by ASODPOPTest(), and setUp().


The documentation for this class was generated from the following file: