|
FRODO Version 2.19.1
An open-source framework for Distributed Constraint Optimization (DCOP)
|
JUnit test for the class DFSgeneration. More...

Public Member Functions | |
| DFSgenerationTest (boolean useTCP, boolean useXML, Class< ? extends ScoringHeuristic<?> > heuristic) | |
| Constructor. | |
| void | testRandom () throws IOException, NoSuchMethodException, IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException |
| Tests the DFS generation protocol on a random graph. | |
| Collection< MessageType > | getMsgTypes () |
| void | notifyIn (Message msg) |
| Keeps track of the output of the DFS generation protocol sent by each variable. | |
| void | setQueue (Queue queue) |
| Does nothing in this case. | |
| 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 void | checkDFS (Map< String, ? extends DFSview<?, ?> > dfs, Map< String, Set< String > > neighborhoods, LinkedList< String > path) |
| Checks that the input is indeed a DFS tree. | |
Protected Member Functions | |
| void | setUp () |
| void | tearDown () throws Exception |
| Ends all queues. | |
| Class<?> | getDFSclass () |
| void | sendLEoutputs (String agent, Map< String, String > rootForVar) |
| Sends the LEoutput messages. | |
| Element | createDFSparams (Element heuristicParams) |
| Create the XML parameters for the DFS module. | |
| MessageType | getOutputMsgType () |
Protected Attributes | |
| int | nbrOutputMessagesPerVar = 2 |
| Number of output messages expected per variable. | |
| int | remainingOutputs |
| Current number of variables that still need to send their output of the DFS generation protocol. | |
| Map< String, DFSview< AddableInteger, AddableReal > > | dfs = new HashMap< String, DFSview<AddableInteger, AddableReal> > (maxNbrVars) |
| Output of the DFS generation protocol. | |
| RandGraphFactory.Graph | graph |
| Random graph used to generate a constraint graph. | |
Private Member Functions | |
| void | checkMostConnected () |
| Checks that the DFS implements the Most Connected heuristicClass. | |
Private Attributes | |
| final int | maxNbrVars = 15 |
| Maximum number of variables in the random graph. | |
| final int | maxNbrEdges = 100 |
| Maximum number of edges in the random graph. | |
| final int | maxNbrAgents = 5 |
| Maximum number of agents. | |
| final ReentrantLock | finished_lock = new ReentrantLock () |
| Used to make the test thread wait. | |
| final Condition | finished = finished_lock.newCondition() |
| Used to wake up the test thread when all agents have finished. | |
| Map< String, Queue > | queues |
| List of queues, indexed by agent name. | |
| XCSPparser< AddableInteger, AddableReal > | parser |
| Parser for the random XCSP problem. | |
| Map< String, QueueOutputPipeInterface > | pipes |
| One output pipe used to send messages to each queue, indexed by the queue's agent name. | |
| boolean | useTCP |
| Whether to use TCP or SharedMemory pipes. | |
| boolean | useXML |
| Whether to use the XML-based constructor. | |
| Class< ? extends ScoringHeuristic<?> > | heuristicClass |
| The ScoringHeuristic. | |
JUnit test for the class DFSgeneration.
| frodo2.algorithms.varOrdering.dfs.tests.DFSgenerationTest.DFSgenerationTest | ( | boolean | useTCP, |
| boolean | useXML, | ||
| Class< ? extends ScoringHeuristic<?> > | heuristic ) |
Constructor.
| useTCP | true whether TCP pipes should be used instead of QueueIOPipes |
| useXML | whether we should use the DFSgeneration constructor that takes in XML elements |
| heuristic | the class of the ScoringHeuristic used |
References useTCP, and useXML.
Referenced by suite().
|
static |
Checks that the input is indeed a DFS tree.
| dfs | for each variable, its view of the DFS |
| neighborhoods | for each node, the list of its neighbors in the graph based on which the DFS was built |
| path | a collection of variables that belong to the current path/branch |
References checkDFS(), dfs, frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.DFSview< V extends Addable< V >, U extends Addable< U > >.getAllPseudoChildren(), frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.DFSview< V extends Addable< V >, U extends Addable< U > >.getChildren(), frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.DFSview< V extends Addable< V >, U extends Addable< U > >.getParent(), and frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.DFSview< V extends Addable< V >, U extends Addable< U > >.getPseudoParents().
Referenced by checkDFS(), frodo2.algorithms.dpop.test.UTILpropagationTest< U extends Addable< U > >.testComputeDFS(), and testRandom().

|
private |
Checks that the DFS implements the Most Connected heuristicClass.
The idea of the Most Connected heuristicClass is that, for any variable, its least connected child is more connected than any of its pseudo-children.
References graph.
Referenced by testRandom().
|
protected |
Create the XML parameters for the DFS module.
| heuristicParams | the parameters for the DFS heuristic |
Reimplemented in frodo2.algorithms.varOrdering.dfs.tests.DFSgenerationParallelTest, and frodo2.algorithms.varOrdering.dfs.tests.DFSgenerationWithOrderTest.
|
protected |
Reimplemented in frodo2.algorithms.varOrdering.dfs.tests.DFSgenerationParallelTest, and frodo2.algorithms.varOrdering.dfs.tests.DFSgenerationWithOrderTest.
Referenced by testRandom().
| Collection< MessageType > frodo2.algorithms.varOrdering.dfs.tests.DFSgenerationTest.getMsgTypes | ( | ) |
It listens to the output of the DFS generation protocol.
Implements frodo2.communication.MessageListener< T >.
Reimplemented in frodo2.algorithms.varOrdering.dfs.tests.DFSgenerationWithOrderTest.
References getOutputMsgType().

|
protected |
Reimplemented in frodo2.algorithms.varOrdering.dfs.tests.DFSgenerationWithOrderTest.
Referenced by getMsgTypes().
| void frodo2.algorithms.varOrdering.dfs.tests.DFSgenerationTest.notifyIn | ( | Message | msg | ) |
Keeps track of the output of the DFS generation protocol sent by each variable.
Implements frodo2.communication.IncomingMsgPolicyInterface< T >.
Reimplemented in frodo2.algorithms.varOrdering.dfs.tests.DFSgenerationWithOrderTest.
References dfs, frodo2.communication.MessageType.equals(), frodo2.communication.Message.getType(), and frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.STATS_MSG_TYPE.

|
protected |
Sends the LEoutput messages.
| agent | the name of the current agent |
| rootForVar | for each variable, its root |
Reimplemented in frodo2.algorithms.varOrdering.dfs.tests.DFSgenerationParallelTest.
Referenced by testRandom().
| void frodo2.algorithms.varOrdering.dfs.tests.DFSgenerationTest.setQueue | ( | Queue | queue | ) |
Does nothing in this case.
| queue | the queue |
Implements frodo2.communication.MessageListener< T >.
|
protected |
References frodo2.algorithms.test.AllTests.generateProblem(), frodo2.algorithms.RandGraphFactory.getRandGraph(), graph, maxNbrAgents, maxNbrEdges, maxNbrVars, and parser.

|
static |
Reimplemented in frodo2.algorithms.varOrdering.dfs.tests.DFSgenerationParallelTest, and frodo2.algorithms.varOrdering.dfs.tests.DFSgenerationWithOrderTest.
References DFSgenerationTest().
Referenced by frodo2.algorithms.varOrdering.dfs.tests.AllTestsDFS.suite().

|
protected |
| void frodo2.algorithms.varOrdering.dfs.tests.DFSgenerationTest.testRandom | ( | ) | throws IOException, NoSuchMethodException, IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException |
Tests the DFS generation protocol on a random graph.
| IOException | if the method fails to create pipes |
| NoSuchMethodException | if the DFSgeneration class does not have a public constructor that takes in a ProblemInterface and a JDOM Element |
| InvocationTargetException | if the DFSgeneration constructor throws an exception |
| IllegalAccessException | if the DFSgeneration class does not have a public constructor that takes in a ProblemInterface and a JDOM Element |
| InstantiationException | if the heuristicClass class is abstract |
| IllegalArgumentException | if the DFSgeneration constructor does not take the proper arguments |
Reimplemented in frodo2.algorithms.varOrdering.dfs.tests.DFSgenerationWithOrderTest.
References frodo2.communication.Queue.addIncomingMessagePolicy(), checkDFS(), checkMostConnected(), frodo2.algorithms.varOrdering.election.tests.LeaderElectionMaxIDTest< S extends Comparable< S > >.computeLeaders(), frodo2.algorithms.test.AllTests.createQueueNetwork(), dfs, frodo2.communication.Queue.end(), frodo2.solutionSpaces.ProblemInterface< V extends Addable< V >, U extends Addable< U > >.getAgents(), getDFSclass(), frodo2.solutionSpaces.ProblemInterface< V extends Addable< V >, U extends Addable< U > >.getDomClass(), 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.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.getStatsFromQueue(), frodo2.solutionSpaces.ProblemInterface< V extends Addable< V >, U extends Addable< U > >.getUtilClass(), frodo2.solutionSpaces.DCOPProblemInterface< V extends Addable< V >, U extends Addable< U > >.getVarScopes(), graph, parser, pipes, queues, remainingOutputs, sendLEoutputs(), frodo2.communication.Queue.setProblem(), frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.setSilent(), frodo2.algorithms.AgentInterface< V extends Addable< V > >.START_AGENT, frodo2.algorithms.AgentInterface< V extends Addable< V > >.STATS_MONITOR, frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.STATS_MSG_TYPE, testRandom(), useTCP, and useXML.
Referenced by testRandom().

|
protected |
Output of the DFS generation protocol.
For each variable, stores its relationships with neighboring variables
Referenced by checkDFS(), notifyIn(), tearDown(), and testRandom().
|
private |
Used to wake up the test thread when all agents have finished.
|
private |
Used to make the test thread wait.
|
protected |
Random graph used to generate a constraint graph.
Referenced by checkMostConnected(), frodo2.algorithms.varOrdering.dfs.tests.DFSgenerationWithOrderTest.notifyIn(), sendLEoutputs(), setUp(), tearDown(), testRandom(), and frodo2.algorithms.varOrdering.dfs.tests.DFSgenerationWithOrderTest.testRandom().
|
private |
The ScoringHeuristic.
|
private |
Maximum number of agents.
Referenced by setUp().
|
private |
Maximum number of edges in the random graph.
Referenced by setUp().
|
private |
|
protected |
Number of output messages expected per variable.
Referenced by frodo2.algorithms.varOrdering.dfs.tests.DFSgenerationWithOrderTest.testRandom().
|
private |
Parser for the random XCSP problem.
Referenced by setUp(), tearDown(), and testRandom().
|
private |
One output pipe used to send messages to each queue, indexed by the queue's agent name.
Referenced by tearDown(), and testRandom().
|
private |
List of queues, indexed by agent name.
Referenced by sendLEoutputs(), tearDown(), and testRandom().
|
protected |
Current number of variables that still need to send their output of the DFS generation protocol.
Referenced by testRandom().
|
private |
Whether to use TCP or SharedMemory pipes.
Referenced by frodo2.algorithms.varOrdering.dfs.tests.DFSgenerationParallelTest.DFSgenerationParallelTest(), DFSgenerationTest(), frodo2.algorithms.varOrdering.dfs.tests.DFSgenerationWithOrderTest.DFSgenerationWithOrderTest(), and testRandom().
|
private |
Whether to use the XML-based constructor.
Referenced by DFSgenerationTest(), and testRandom().