|
FRODO Version 2.19.1
An open-source framework for Distributed Constraint Optimization (DCOP)
|
A JUnit test case for LowestCommonAncestors. More...

Public Member Functions | |
| LowestCommonAncestorsTest (String method) | |
| Constructor that instantiates a test only for the input method. | |
| void | test () throws Exception |
| Tests the output of the LowestCommonAncestors module. | |
| Collection< MessageType > | getMsgTypes () |
| void | notifyIn (Message msg) |
| 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 () |
Protected Member Functions | |
| void | setUp () |
| void | tearDown () throws Exception |
| void | checkOutput () |
| Checks the output of the module. | |
| void | setModules () throws Exception |
| Creates the modules. | |
Protected Attributes | |
| final int | maxNbrVars = 20 |
| Maximum number of variables in the random graph. | |
| RandGraphFactory.Graph | graph |
| Random graph. | |
| HashMap< String, HashSet< String > > | allFlags |
| For each node, its set of flags. | |
| HashMap< String, HashSet< String > > | lcas = new HashMap< String, HashSet<String> > () |
| For each node, the set of flags it is the lca of. | |
| Map< String, Queue > | queues |
| List of queues, indexed by agent name. | |
| Map< String, QueueOutputPipeInterface > | pipes |
| One output pipe used to send messages to each queue, indexed by the queue's agent name. | |
| int | remainingOutputs |
| Current number of outputs yet to be received from the LowestCommonAncestors module. | |
| 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, ? extends DFSview<?, ?> > | dfs |
| The chosen DFS. | |
Private Member Functions | |
| boolean | subtreeHasFlag (String root, String flag) |
| Checks whether a subtree contains a given flag. | |
Private Attributes | |
| final int | maxNbrEdges = 200 |
| Maximum number of edges in the random graph. | |
| final int | maxNbrAgents = 20 |
| Maximum number of agents. | |
| final int | nbrFlags = 20 |
| The number of flag types. | |
| final double | flagProb = 0.2 |
| For each flag type and each node, the probability that the node has that flag. | |
A JUnit test case for LowestCommonAncestors.
| frodo2.algorithms.dpop.stochastic.test.LowestCommonAncestorsTest.LowestCommonAncestorsTest | ( | String | method | ) |
Constructor that instantiates a test only for the input method.
| method | test method |
Referenced by suite().
|
protected |
Checks the output of the module.
Reimplemented in frodo2.algorithms.dpop.stochastic.test.SamplingPhaseTest.
References allFlags, dfs, 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(), lcas, and subtreeHasFlag().
Referenced by test().

| Collection< MessageType > frodo2.algorithms.dpop.stochastic.test.LowestCommonAncestorsTest.getMsgTypes | ( | ) |
Implements frodo2.communication.MessageListener< T >.
Reimplemented in frodo2.algorithms.dpop.stochastic.test.SamplingPhaseTest.
References frodo2.algorithms.dpop.stochastic.LowestCommonAncestors.OUTPUT_MSG_TYPE.
| void frodo2.algorithms.dpop.stochastic.test.LowestCommonAncestorsTest.notifyIn | ( | Message | msg | ) |
Implements frodo2.communication.IncomingMsgPolicyInterface< T >.
Reimplemented in frodo2.algorithms.dpop.stochastic.test.SamplingPhaseTest.
References frodo2.communication.MessageType.equals(), frodo2.algorithms.dpop.stochastic.LCAmsg2.getFlags(), frodo2.algorithms.dpop.stochastic.LCAmsg2.getNode(), frodo2.communication.Message.getType(), lcas, and frodo2.algorithms.dpop.stochastic.LowestCommonAncestors.OUTPUT_MSG_TYPE.

|
protected |
Creates the modules.
| Exception | if an error occurs |
Reimplemented in frodo2.algorithms.dpop.stochastic.test.SamplingPhaseTest.
References frodo2.communication.Queue.addIncomingMessagePolicy(), allFlags, graph, and queues.
Referenced by test().

| void frodo2.algorithms.dpop.stochastic.test.LowestCommonAncestorsTest.setQueue | ( | Queue | queue | ) |
Does nothing in this case.
| queue | the queue |
Implements frodo2.communication.MessageListener< T >.
|
protected |
Reimplemented in frodo2.algorithms.dpop.stochastic.test.SamplingPhaseTest.
References allFlags, frodo2.algorithms.dpop.test.UTILpropagationTest< U extends Addable< U > >.computeDFS(), dfs, flagProb, frodo2.algorithms.test.AllTests.generateProblem(), frodo2.algorithms.RandGraphFactory.getRandGraph(), graph, lcas, maxNbrAgents, maxNbrEdges, maxNbrVars, nbrFlags, and frodo2.algorithms.XCSPparser< V extends Addable< V >, U extends Addable< U > >.parse().

|
private |
Checks whether a subtree contains a given flag.
| root | the root of the subtree |
| flag | the flag |
true iff the subtree contains the flag References allFlags, dfs, and subtreeHasFlag().
Referenced by checkOutput(), and subtreeHasFlag().

|
static |
Reimplemented in frodo2.algorithms.dpop.stochastic.test.SamplingPhaseTest.
References LowestCommonAncestorsTest().
Referenced by frodo2.algorithms.dpop.stochastic.test.AllTestsStochDPOP.suite().

|
protected |
| void frodo2.algorithms.dpop.stochastic.test.LowestCommonAncestorsTest.test | ( | ) | throws Exception |
Tests the output of the LowestCommonAncestors module.
| Exception | if an error occurs |
References checkOutput(), frodo2.algorithms.test.AllTests.createQueueNetwork(), frodo2.communication.Queue.end(), graph, pipes, queues, frodo2.communication.Queue.sendMessageToSelf(), setModules(), frodo2.algorithms.AgentInterface< V extends Addable< V > >.START_AGENT, frodo2.algorithms.AgentInterface< V extends Addable< V > >.STATS_MONITOR, and test().
Referenced by test().

|
protected |
For each node, its set of flags.
Referenced by checkOutput(), frodo2.algorithms.dpop.stochastic.test.SamplingPhaseTest.checkOutput(), setModules(), setUp(), frodo2.algorithms.dpop.stochastic.test.SamplingPhaseTest.setUp(), subtreeHasFlag(), and tearDown().
|
protected |
The chosen DFS.
For each variable, stores its relationships with neighboring variables
Referenced by checkOutput(), frodo2.algorithms.dpop.stochastic.test.SamplingPhaseTest.checkOutput(), setUp(), subtreeHasFlag(), and tearDown().
|
protected |
Used to wake up the test thread when all agents have finished.
Referenced by frodo2.algorithms.dpop.stochastic.test.SamplingPhaseTest.notifyIn().
|
protected |
Used to make the test thread wait.
Referenced by frodo2.algorithms.dpop.stochastic.test.SamplingPhaseTest.notifyIn().
|
private |
For each flag type and each node, the probability that the node has that flag.
Referenced by setUp().
|
protected |
Random graph.
Referenced by frodo2.algorithms.dpop.stochastic.test.SamplingPhaseTest.checkOutput(), setModules(), setUp(), frodo2.algorithms.dpop.stochastic.test.SamplingPhaseTest.setUp(), tearDown(), and test().
|
protected |
For each node, the set of flags it is the lca of.
Referenced by checkOutput(), frodo2.algorithms.dpop.stochastic.test.SamplingPhaseTest.checkOutput(), notifyIn(), frodo2.algorithms.dpop.stochastic.test.SamplingPhaseTest.notifyIn(), setUp(), and tearDown().
|
private |
Maximum number of agents.
Referenced by setUp().
|
private |
Maximum number of edges in the random graph.
Referenced by setUp().
|
protected |
|
private |
The number of flag types.
Referenced by setUp().
|
protected |
One output pipe used to send messages to each queue, indexed by the queue's agent name.
Referenced by tearDown(), and test().
|
protected |
List of queues, indexed by agent name.
Referenced by setModules(), frodo2.algorithms.dpop.stochastic.test.SamplingPhaseTest.setModules(), tearDown(), and test().
|
protected |
Current number of outputs yet to be received from the LowestCommonAncestors module.
Referenced by frodo2.algorithms.dpop.stochastic.test.SamplingPhaseTest.notifyIn().