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

Public Member Functions | |
| DUCTagentTest (boolean useTCP, boolean useCentralMailer, boolean measureMsgs, String samplingMethodClass, String termination, String bound) | |
| Creates a JUnit test case corresponding to the input method. | |
| DUCTagentTest (boolean useTCP, boolean useCentralMailer, Class< ? extends XCSPparser< AddableInteger, AddableReal > > parserClass, boolean measureMsgs, String samplingMethod, String termination, String bound) | |
| Creates a JUnit test case corresponding to the input method. | |
| void | setUp () throws Exception |
| void | testRandom () throws Exception |
| Tests the DPOPagent on a random problem. | |
| Collection< MessageType > | getMsgTypes () |
| void | notifyIn (Message msg) |
| void | setQueue (Queue queue) |
| Does nothing. | |
| 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 | setStartMsgType (MessageType startMsgType) throws JDOMException |
| Sets the type of the start message for all modules. | |
| void | tearDown () throws Exception |
| void | checkOutput () throws Exception |
| Checks that the output of the algorithm is correct. | |
Protected Attributes | |
| final int | maxNbrVars = 5 |
| Maximum number of variables in the problem. | |
| final int | maxNbrEdges = 20 |
| Maximum number of binary constraints in the problem. | |
| final int | maxNbrAgents = 5 |
| Maximum number of agents. | |
| Document | agentConfig |
| The agent configuration file. | |
| Queue | queue |
| The queue used to listen to the agents. | |
| Map< Object, QueueOutputPipeInterface > | pipes |
| For each agent, the output pipe to it. | |
| RandGraphFactory.Graph | graph |
| Random graph used to generate a constraint graph. | |
| int | nbrMsgsReceived |
| Used to track the number of various types of messages received from the agents. | |
| int | nbrAgentsFinished |
| Number of agents finished. | |
| boolean | useCentralMailer = false |
true if the algorithm should be tested with the central mailer | |
| boolean | measureMsgs |
| Whether to measure message numbers and sizes. | |
| Document | problemDoc |
| The XCSP random problem file. | |
| Class< ? extends XCSPparser< AddableInteger, AddableReal > > | parserClass |
| The class of the parser/subsolver to use. | |
| DCOPProblemInterface< AddableInteger, AddableReal > | problem |
| The problem. | |
| Normalize< AddableInteger > | normModule |
| The module listening for the optimal utility to the problem. | |
| Sampling< AddableInteger > | samplingModule |
| The module listening for the optimal assignment to the problem. | |
| String | samplingMethod |
| The sampling method to be used. | |
| String | terminationMethod |
| The termination method to be used. | |
| String | bound |
| The bound to be used. | |
| MessageType | startMsgType |
| The type of the start message. | |
| boolean | maximize = true |
| Whether we should maximize or minimize. | |
| CentralMailer | mailman |
| The CentralMailer. | |
Private Attributes | |
| QueueIOPipe | pipe |
| The testers pipe. | |
| Map< String, AgentInterface< AddableInteger > > | agents |
| All agents, indexed by their IDs. | |
| int | nbrAgents |
| Total 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. | |
| boolean | useTCP |
| Whether TCP pipes should be used for communication between agents. | |
JUnit test for DUCT.
| frodo2.algorithms.duct.tests.DUCTagentTest.DUCTagentTest | ( | boolean | useTCP, |
| boolean | useCentralMailer, | ||
| boolean | measureMsgs, | ||
| String | samplingMethodClass, | ||
| String | termination, | ||
| String | bound ) |
Creates a JUnit test case corresponding to the input method.
| useTCP | whether TCP pipes should be used for communication between agents |
| useCentralMailer | true when the central mailer should be tested |
| measureMsgs | true when message sizes have to be measured |
| samplingMethodClass | The sampling method to be used |
| termination | The termination method to be used |
| bound | The bound to be used |
References bound, DUCTagentTest(), measureMsgs, useCentralMailer, and useTCP.
Referenced by DUCTagentTest(), and suite().

| frodo2.algorithms.duct.tests.DUCTagentTest.DUCTagentTest | ( | boolean | useTCP, |
| boolean | useCentralMailer, | ||
| Class< ? extends XCSPparser< AddableInteger, AddableReal > > | parserClass, | ||
| boolean | measureMsgs, | ||
| String | samplingMethod, | ||
| String | termination, | ||
| String | bound ) |
Creates a JUnit test case corresponding to the input method.
| useTCP | whether TCP pipes should be used for communication between agents |
| useCentralMailer | true when the central mailer should be tested |
| parserClass | the class of the parser/subsolver |
| measureMsgs | whether to measure message numbers and sizes |
| samplingMethod | The sampling method to be used |
| termination | The termination method to be used |
| bound | The bound to be used |
References bound, measureMsgs, parserClass, samplingMethod, useCentralMailer, and useTCP.
|
protected |
Checks that the output of the algorithm is correct.
| Exception | if an error occurs |
Referenced by testRandom().
| Collection< MessageType > frodo2.algorithms.duct.tests.DUCTagentTest.getMsgTypes | ( | ) |
Implements frodo2.communication.MessageListener< T >.
References frodo2.algorithms.AgentInterface< V extends Addable< V > >.AGENT_CONNECTED, frodo2.algorithms.AgentInterface< V extends Addable< V > >.AGENT_FINISHED, frodo2.algorithms.AgentInterface< V extends Addable< V > >.LOCAL_AGENT_ADDRESS_REQUEST, and frodo2.algorithms.AgentInterface< V extends Addable< V > >.LOCAL_AGENT_REPORTING.
| void frodo2.algorithms.duct.tests.DUCTagentTest.notifyIn | ( | Message | msg | ) |
Implements frodo2.communication.IncomingMsgPolicyInterface< T >.
References frodo2.algorithms.AgentInterface< V extends Addable< V > >.LOCAL_AGENT_REPORTING, nbrAgents, notifyIn(), pipe, and pipes.
Referenced by notifyIn().

| void frodo2.algorithms.duct.tests.DUCTagentTest.setQueue | ( | Queue | queue | ) |
|
protected |
Sets the type of the start message for all modules.
| startMsgType | the new type for the start message |
| JDOMException | if parsing the agent configuration file failed |
Reimplemented in frodo2.algorithms.duct.tests.DUCTagentPruningSearchTest, and frodo2.algorithms.duct.tests.DUCTagentPruningTest.
References agentConfig, frodo2.algorithms.AgentInterface< V extends Addable< V > >.START_AGENT, and startMsgType.
Referenced by frodo2.algorithms.duct.tests.DUCTagentChildSearchTest.setUp(), frodo2.algorithms.duct.tests.DUCTagentChildTest.setUp(), and setUp().
| void frodo2.algorithms.duct.tests.DUCTagentTest.setUp | ( | ) | throws Exception |
Reimplemented in frodo2.algorithms.duct.tests.DUCTagentChildSearchTest, frodo2.algorithms.duct.tests.DUCTagentChildTest, frodo2.algorithms.duct.tests.DUCTagentPruningSearchTest, and frodo2.algorithms.duct.tests.DUCTagentPruningTest.
References agentConfig, frodo2.algorithms.test.AllTests.generateProblem(), frodo2.algorithms.RandGraphFactory.getRandGraph(), frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.getStatsFromQueue(), graph, mailman, maxNbrAgents, maxNbrEdges, maxNbrVars, nbrAgentsFinished, nbrMsgsReceived, frodo2.algorithms.XCSPparser< V extends Addable< V >, U extends Addable< U > >.newInstance(), frodo2.algorithms.XCSPparser< V extends Addable< V >, U extends Addable< U > >.parse(), parserClass, pipes, problem, problemDoc, queue, samplingModule, frodo2.algorithms.XCSPparser< V extends Addable< V >, U extends Addable< U > >.setDomClass(), frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.setSilent(), setStartMsgType(), frodo2.algorithms.XCSPparser< V extends Addable< V >, U extends Addable< U > >.setUtilClass(), and frodo2.algorithms.AgentInterface< V extends Addable< V > >.STATS_MONITOR.

|
static |
Reimplemented in frodo2.algorithms.duct.tests.DUCTagentChildSearchTest, frodo2.algorithms.duct.tests.DUCTagentChildTest, frodo2.algorithms.duct.tests.DUCTagentPruningSearchTest, and frodo2.algorithms.duct.tests.DUCTagentPruningTest.
References DUCTagentTest(), and suite().
Referenced by frodo2.algorithms.duct.tests.AllTestsDUCT.suite(), and suite().

|
protected |
References agents, graph, mailman, normModule, pipe, pipes, problem, problemDoc, queue, and samplingModule.
| void frodo2.algorithms.duct.tests.DUCTagentTest.testRandom | ( | ) | throws Exception |
Tests the DPOPagent on a random problem.
| Exception | if an error occurs |
References agentConfig, agents, checkOutput(), frodo2.algorithms.AgentFactory< V extends Addable< V >, U extends Addable< U > >.createAgent(), frodo2.communication.mailer.CentralMailer.execute(), graph, mailman, nbrAgents, nbrAgentsFinished, pipe, problem, queue, useCentralMailer, and useTCP.

|
protected |
The agent configuration file.
Referenced by frodo2.algorithms.duct.tests.DUCTagentPruningSearchTest.setStartMsgType(), frodo2.algorithms.duct.tests.DUCTagentPruningTest.setStartMsgType(), setStartMsgType(), frodo2.algorithms.duct.tests.DUCTagentChildSearchTest.setUp(), frodo2.algorithms.duct.tests.DUCTagentChildTest.setUp(), frodo2.algorithms.duct.tests.DUCTagentPruningSearchTest.setUp(), frodo2.algorithms.duct.tests.DUCTagentPruningTest.setUp(), setUp(), and testRandom().
|
private |
All agents, indexed by their IDs.
Referenced by tearDown(), and testRandom().
|
protected |
The bound to be used.
Referenced by frodo2.algorithms.duct.tests.DUCTagentChildSearchTest.DUCTagentChildSearchTest(), frodo2.algorithms.duct.tests.DUCTagentChildSearchTest.DUCTagentChildSearchTest(), frodo2.algorithms.duct.tests.DUCTagentChildTest.DUCTagentChildTest(), frodo2.algorithms.duct.tests.DUCTagentChildTest.DUCTagentChildTest(), frodo2.algorithms.duct.tests.DUCTagentPruningSearchTest.DUCTagentPruningSearchTest(), frodo2.algorithms.duct.tests.DUCTagentPruningSearchTest.DUCTagentPruningSearchTest(), frodo2.algorithms.duct.tests.DUCTagentPruningTest.DUCTagentPruningTest(), frodo2.algorithms.duct.tests.DUCTagentPruningTest.DUCTagentPruningTest(), DUCTagentTest(), DUCTagentTest(), frodo2.algorithms.duct.tests.DUCTagentChildSearchTest.setUp(), frodo2.algorithms.duct.tests.DUCTagentChildTest.setUp(), frodo2.algorithms.duct.tests.DUCTagentPruningSearchTest.setUp(), and frodo2.algorithms.duct.tests.DUCTagentPruningTest.setUp().
|
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 frodo2.algorithms.duct.tests.DUCTagentChildSearchTest.setUp(), frodo2.algorithms.duct.tests.DUCTagentChildTest.setUp(), frodo2.algorithms.duct.tests.DUCTagentPruningSearchTest.setUp(), frodo2.algorithms.duct.tests.DUCTagentPruningTest.setUp(), setUp(), tearDown(), and testRandom().
|
protected |
The CentralMailer.
Referenced by frodo2.algorithms.duct.tests.DUCTagentChildSearchTest.setUp(), frodo2.algorithms.duct.tests.DUCTagentChildTest.setUp(), frodo2.algorithms.duct.tests.DUCTagentPruningSearchTest.setUp(), frodo2.algorithms.duct.tests.DUCTagentPruningTest.setUp(), setUp(), tearDown(), and testRandom().
|
protected |
Whether we should maximize or minimize.
|
protected |
|
protected |
Maximum number of binary constraints in the problem.
Referenced by frodo2.algorithms.duct.tests.DUCTagentChildSearchTest.setUp(), frodo2.algorithms.duct.tests.DUCTagentChildTest.setUp(), frodo2.algorithms.duct.tests.DUCTagentPruningSearchTest.setUp(), frodo2.algorithms.duct.tests.DUCTagentPruningTest.setUp(), and setUp().
|
protected |
Maximum number of variables in the problem.
Referenced by frodo2.algorithms.duct.tests.DUCTagentChildSearchTest.setUp(), frodo2.algorithms.duct.tests.DUCTagentChildTest.setUp(), frodo2.algorithms.duct.tests.DUCTagentPruningSearchTest.setUp(), frodo2.algorithms.duct.tests.DUCTagentPruningTest.setUp(), and setUp().
|
protected |
Whether to measure message numbers and sizes.
Referenced by frodo2.algorithms.duct.tests.DUCTagentChildSearchTest.DUCTagentChildSearchTest(), frodo2.algorithms.duct.tests.DUCTagentChildSearchTest.DUCTagentChildSearchTest(), frodo2.algorithms.duct.tests.DUCTagentChildTest.DUCTagentChildTest(), frodo2.algorithms.duct.tests.DUCTagentChildTest.DUCTagentChildTest(), frodo2.algorithms.duct.tests.DUCTagentPruningSearchTest.DUCTagentPruningSearchTest(), frodo2.algorithms.duct.tests.DUCTagentPruningSearchTest.DUCTagentPruningSearchTest(), frodo2.algorithms.duct.tests.DUCTagentPruningTest.DUCTagentPruningTest(), frodo2.algorithms.duct.tests.DUCTagentPruningTest.DUCTagentPruningTest(), DUCTagentTest(), DUCTagentTest(), frodo2.algorithms.duct.tests.DUCTagentChildSearchTest.setUp(), frodo2.algorithms.duct.tests.DUCTagentChildTest.setUp(), frodo2.algorithms.duct.tests.DUCTagentPruningSearchTest.setUp(), and frodo2.algorithms.duct.tests.DUCTagentPruningTest.setUp().
|
private |
Total number of agents.
Referenced by notifyIn(), and testRandom().
|
protected |
Number of agents finished.
Referenced by frodo2.algorithms.duct.tests.DUCTagentChildSearchTest.setUp(), frodo2.algorithms.duct.tests.DUCTagentChildTest.setUp(), frodo2.algorithms.duct.tests.DUCTagentPruningSearchTest.setUp(), frodo2.algorithms.duct.tests.DUCTagentPruningTest.setUp(), setUp(), and testRandom().
|
protected |
Used to track the number of various types of messages received from the agents.
Referenced by frodo2.algorithms.duct.tests.DUCTagentChildSearchTest.setUp(), frodo2.algorithms.duct.tests.DUCTagentChildTest.setUp(), frodo2.algorithms.duct.tests.DUCTagentPruningSearchTest.setUp(), frodo2.algorithms.duct.tests.DUCTagentPruningTest.setUp(), and setUp().
|
protected |
The module listening for the optimal utility to the problem.
Referenced by tearDown().
|
protected |
The class of the parser/subsolver to use.
Referenced by frodo2.algorithms.duct.tests.DUCTagentChildSearchTest.DUCTagentChildSearchTest(), frodo2.algorithms.duct.tests.DUCTagentChildTest.DUCTagentChildTest(), frodo2.algorithms.duct.tests.DUCTagentPruningSearchTest.DUCTagentPruningSearchTest(), frodo2.algorithms.duct.tests.DUCTagentPruningTest.DUCTagentPruningTest(), DUCTagentTest(), frodo2.algorithms.duct.tests.DUCTagentChildSearchTest.setUp(), frodo2.algorithms.duct.tests.DUCTagentChildTest.setUp(), frodo2.algorithms.duct.tests.DUCTagentPruningSearchTest.setUp(), frodo2.algorithms.duct.tests.DUCTagentPruningTest.setUp(), and setUp().
|
private |
The testers pipe.
Referenced by notifyIn(), tearDown(), and testRandom().
|
protected |
For each agent, the output pipe to it.
Referenced by notifyIn(), frodo2.algorithms.duct.tests.DUCTagentChildSearchTest.setUp(), frodo2.algorithms.duct.tests.DUCTagentChildTest.setUp(), frodo2.algorithms.duct.tests.DUCTagentPruningSearchTest.setUp(), frodo2.algorithms.duct.tests.DUCTagentPruningTest.setUp(), setUp(), and tearDown().
|
protected |
The problem.
Referenced by frodo2.algorithms.duct.tests.DUCTagentChildSearchTest.setUp(), frodo2.algorithms.duct.tests.DUCTagentChildTest.setUp(), frodo2.algorithms.duct.tests.DUCTagentPruningSearchTest.setUp(), frodo2.algorithms.duct.tests.DUCTagentPruningTest.setUp(), setUp(), tearDown(), and testRandom().
|
protected |
The XCSP random problem file.
Referenced by frodo2.algorithms.duct.tests.DUCTagentChildSearchTest.setUp(), frodo2.algorithms.duct.tests.DUCTagentChildTest.setUp(), frodo2.algorithms.duct.tests.DUCTagentPruningSearchTest.setUp(), frodo2.algorithms.duct.tests.DUCTagentPruningTest.setUp(), setUp(), and tearDown().
|
protected |
The queue used to listen to the agents.
Referenced by setQueue(), frodo2.algorithms.duct.tests.DUCTagentChildSearchTest.setUp(), frodo2.algorithms.duct.tests.DUCTagentChildTest.setUp(), frodo2.algorithms.duct.tests.DUCTagentPruningSearchTest.setUp(), frodo2.algorithms.duct.tests.DUCTagentPruningTest.setUp(), setUp(), tearDown(), and testRandom().
|
protected |
The sampling method to be used.
Referenced by frodo2.algorithms.duct.tests.DUCTagentChildSearchTest.DUCTagentChildSearchTest(), frodo2.algorithms.duct.tests.DUCTagentChildTest.DUCTagentChildTest(), frodo2.algorithms.duct.tests.DUCTagentPruningSearchTest.DUCTagentPruningSearchTest(), frodo2.algorithms.duct.tests.DUCTagentPruningTest.DUCTagentPruningTest(), DUCTagentTest(), frodo2.algorithms.duct.tests.DUCTagentChildSearchTest.setUp(), frodo2.algorithms.duct.tests.DUCTagentChildTest.setUp(), frodo2.algorithms.duct.tests.DUCTagentPruningSearchTest.setUp(), and frodo2.algorithms.duct.tests.DUCTagentPruningTest.setUp().
|
protected |
The module listening for the optimal assignment to the problem.
Referenced by frodo2.algorithms.duct.tests.DUCTagentChildSearchTest.setUp(), frodo2.algorithms.duct.tests.DUCTagentChildTest.setUp(), frodo2.algorithms.duct.tests.DUCTagentPruningSearchTest.setUp(), frodo2.algorithms.duct.tests.DUCTagentPruningTest.setUp(), setUp(), and tearDown().
|
protected |
The type of the start message.
Referenced by frodo2.algorithms.duct.tests.DUCTagentPruningSearchTest.setStartMsgType(), frodo2.algorithms.duct.tests.DUCTagentPruningTest.setStartMsgType(), setStartMsgType(), frodo2.algorithms.duct.tests.DUCTagentChildSearchTest.setUp(), frodo2.algorithms.duct.tests.DUCTagentChildTest.setUp(), frodo2.algorithms.duct.tests.DUCTagentPruningSearchTest.setUp(), and frodo2.algorithms.duct.tests.DUCTagentPruningTest.setUp().
|
protected |
The termination method to be used.
Referenced by frodo2.algorithms.duct.tests.DUCTagentChildSearchTest.setUp(), frodo2.algorithms.duct.tests.DUCTagentChildTest.setUp(), frodo2.algorithms.duct.tests.DUCTagentPruningSearchTest.setUp(), and frodo2.algorithms.duct.tests.DUCTagentPruningTest.setUp().
|
protected |
true if the algorithm should be tested with the central mailer
Referenced by frodo2.algorithms.duct.tests.DUCTagentChildSearchTest.DUCTagentChildSearchTest(), frodo2.algorithms.duct.tests.DUCTagentChildSearchTest.DUCTagentChildSearchTest(), frodo2.algorithms.duct.tests.DUCTagentChildTest.DUCTagentChildTest(), frodo2.algorithms.duct.tests.DUCTagentChildTest.DUCTagentChildTest(), frodo2.algorithms.duct.tests.DUCTagentPruningSearchTest.DUCTagentPruningSearchTest(), frodo2.algorithms.duct.tests.DUCTagentPruningSearchTest.DUCTagentPruningSearchTest(), frodo2.algorithms.duct.tests.DUCTagentPruningTest.DUCTagentPruningTest(), frodo2.algorithms.duct.tests.DUCTagentPruningTest.DUCTagentPruningTest(), DUCTagentTest(), DUCTagentTest(), frodo2.algorithms.duct.tests.DUCTagentChildSearchTest.setUp(), frodo2.algorithms.duct.tests.DUCTagentChildTest.setUp(), frodo2.algorithms.duct.tests.DUCTagentPruningSearchTest.setUp(), frodo2.algorithms.duct.tests.DUCTagentPruningTest.setUp(), and testRandom().
|
private |
Whether TCP pipes should be used for communication between agents.
Referenced by frodo2.algorithms.duct.tests.DUCTagentChildSearchTest.DUCTagentChildSearchTest(), frodo2.algorithms.duct.tests.DUCTagentChildSearchTest.DUCTagentChildSearchTest(), frodo2.algorithms.duct.tests.DUCTagentChildTest.DUCTagentChildTest(), frodo2.algorithms.duct.tests.DUCTagentChildTest.DUCTagentChildTest(), frodo2.algorithms.duct.tests.DUCTagentPruningSearchTest.DUCTagentPruningSearchTest(), frodo2.algorithms.duct.tests.DUCTagentPruningSearchTest.DUCTagentPruningSearchTest(), frodo2.algorithms.duct.tests.DUCTagentPruningTest.DUCTagentPruningTest(), frodo2.algorithms.duct.tests.DUCTagentPruningTest.DUCTagentPruningTest(), DUCTagentTest(), DUCTagentTest(), and testRandom().