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

Public Member Functions | |
| ADOPTagentTest (boolean useCentralMailer, boolean useDelay, MessageType startMsgType, Class< V > domClass, Class< U > utilClass, boolean useXCSP, boolean useTCP, boolean countNCCCs, boolean maximize, int sign) | |
| Creates a JUnit test case. | |
| void | setUp () throws Exception |
| void | testRandom () |
| 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 | tearDown () throws Exception |
Private Member Functions | |
| void | setStartMsgType (MessageType startMsgType) throws JDOMException |
| Sets the type of the start message for all modules. | |
| void | setStartMsgType (Element messages, MessageType startMsgType) |
| Overwrites the type of the start messages. | |
Private Attributes | |
| final int | maxNbrVars = 5 |
| Maximum number of variables in the problem. | |
| final int | maxNbrEdges = 15 |
| Maximum number of binary constraints in the problem. | |
| final int | maxNbrAgents = 5 |
| Maximum number of agents. | |
| Queue | queue |
| The queue used to listen to the agents. | |
| Map< Object, QueueOutputPipeInterface > | pipes |
| For each agent, the output pipe to it. | |
| QueueIOPipe | pipe |
| The testers pipe. | |
| Map< String, AgentInterface< V > > | agents |
| All agents, indexed by their IDs. | |
| int | nbrAgents |
| Total number of agents. | |
| int | nbrMsgsReceived |
| Used to track the number of various types of messages received from the agents. | |
| int | nbrAgentsFinished |
| Number of agents finished. | |
| 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 | countNCCCs = false |
| Whether we should count Non-Concurrent Constraint Checks. | |
| SolutionCollector< V, U > | solCollector |
| The solution collector listening for the solution. | |
| Preprocessing< V, U > | preProcessingTester |
| Used to check the output of the preprocessing listener. | |
| MessageType | startMsgType |
| The type of the start message. | |
| Document | agentDesc |
| The description of the agent. | |
| boolean | useCentralMailer |
true if the algorithm must be tested with the central mailer | |
| DCOPProblemInterface< V, U > | problem |
| The random problem. | |
| boolean | useDelay |
true when the central mailer must be tested with delays | |
| CentralMailer | mailman |
| The CentralMailer. | |
| Class< V > | domClass |
| The class of variable values. | |
| Class< U > | utilClass |
| The class of utility values. | |
| boolean | useXCSP |
| Whether to use XCSP. | |
| boolean | useTCP |
| Whether to use TCP pipes. | |
| final boolean | maximize |
| Whether to test on maximization problem. | |
| final int | sign |
| The required sign for the costs/utilities. | |
JUnit test for ADOPTagent.
| <V> | the type used for variable values |
| <U> | the type used for utility values |
| frodo2.algorithms.adopt.test.ADOPTagentTest< V extends Addable< V >, U extends Addable< U > >.ADOPTagentTest | ( | boolean | useCentralMailer, |
| boolean | useDelay, | ||
| MessageType | startMsgType, | ||
| Class< V > | domClass, | ||
| Class< U > | utilClass, | ||
| boolean | useXCSP, | ||
| boolean | useTCP, | ||
| boolean | countNCCCs, | ||
| boolean | maximize, | ||
| int | sign ) |
Creates a JUnit test case.
| useCentralMailer | true when the central mailer should be tested |
| useDelay | true when the central mailer must be tested with delays |
| startMsgType | the type of the start message |
| domClass | the class of variable values |
| utilClass | the class of utility values |
| useXCSP | whether to use XCSP |
| useTCP | whether TCP pipes should be used for communication between agents |
| countNCCCs | whether we should tell the agent to count NCCCs |
| maximize | Whether to test on maximization problem |
| sign | The required sign for the costs/utilities |
References countNCCCs, domClass, maximize, sign, startMsgType, useCentralMailer, useDelay, useTCP, useXCSP, and utilClass.
Referenced by suite().
| Collection< MessageType > frodo2.algorithms.adopt.test.ADOPTagentTest< V extends Addable< V >, U extends Addable< U > >.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.adopt.test.ADOPTagentTest< V extends Addable< V >, U extends Addable< U > >.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.adopt.test.ADOPTagentTest< V extends Addable< V >, U extends Addable< U > >.setQueue | ( | Queue | queue | ) |
|
private |
Overwrites the type of the start messages.
| messages | messages element |
| startMsgType | the new type of the start messages |
References startMsgType.
|
private |
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 |
References agentDesc, setStartMsgType(), frodo2.algorithms.AgentInterface< V extends Addable< V > >.START_AGENT, and startMsgType.
Referenced by setStartMsgType(), and setUp().

| void frodo2.algorithms.adopt.test.ADOPTagentTest< V extends Addable< V >, U extends Addable< U > >.setUp | ( | ) | throws Exception |
References agentDesc, countNCCCs, frodo2.algorithms.test.AllTests.createRandProblem(), domClass, mailman, maxNbrAgents, maxNbrEdges, maxNbrVars, nbrAgentsFinished, nbrMsgsReceived, frodo2.algorithms.XCSPparser< V extends Addable< V >, U extends Addable< U > >.parse(), pipes, preProcessingTester, problem, queue, frodo2.algorithms.Problem< V extends Addable< V >, U extends Addable< U > >.reset(), frodo2.algorithms.Problem< V extends Addable< V >, U extends Addable< U > >.setDomClass(), frodo2.algorithms.XCSPparser< V extends Addable< V >, U extends Addable< U > >.setDomClass(), setStartMsgType(), frodo2.algorithms.AbstractProblem< V extends Addable< V >, U extends Addable< U > >.setUtilClass(), frodo2.algorithms.XCSPparser< V extends Addable< V >, U extends Addable< U > >.setUtilClass(), solCollector, frodo2.algorithms.AgentInterface< V extends Addable< V > >.STATS_MONITOR, and utilClass.

|
static |
References ADOPTagentTest(), and suite().
Referenced by suite(), and frodo2.algorithms.adopt.test.AllTestsADOPT.suite().

|
protected |
References agents, mailman, pipe, pipes, preProcessingTester, problem, queue, and solCollector.
| void frodo2.algorithms.adopt.test.ADOPTagentTest< V extends Addable< V >, U extends Addable< U > >.testRandom | ( | ) |
Tests the DPOPagent on a random problem.
References agentDesc, agents, frodo2.algorithms.AgentFactory< V extends Addable< V >, U extends Addable< U > >.createAgent(), frodo2.communication.mailer.CentralMailer.execute(), frodo2.solutionSpaces.ProblemInterface< V extends Addable< V >, U extends Addable< U > >.getAgent(), frodo2.algorithms.adopt.Preprocessing< Val extends Addable< Val >, U extends Addable< U > >.getReportedHeuristics(), mailman, nbrAgents, nbrAgentsFinished, pipe, problem, queue, solCollector, frodo2.algorithms.AbstractDCOPsolver< V extends Addable< V >, U extends Addable< U >, S extends Solution< V, U >.solve(), frodo2.timeout, useCentralMailer, and useTCP.

|
private |
The description of the agent.
Referenced by setStartMsgType(), setUp(), and testRandom().
|
private |
All agents, indexed by their IDs.
Referenced by tearDown(), and testRandom().
|
private |
Whether we should count Non-Concurrent Constraint Checks.
Referenced by ADOPTagentTest(), and setUp().
|
private |
The class of variable values.
Referenced by ADOPTagentTest(), and setUp().
|
private |
Used to wake up the test thread when all agents have finished.
|
private |
Used to make the test thread wait.
|
private |
The CentralMailer.
Referenced by setUp(), tearDown(), and testRandom().
|
private |
Whether to test on maximization problem.
Referenced by ADOPTagentTest().
|
private |
Maximum number of agents.
Referenced by setUp().
|
private |
Maximum number of binary constraints in the problem.
Referenced by setUp().
|
private |
|
private |
Total number of agents.
Referenced by notifyIn(), and testRandom().
|
private |
Number of agents finished.
Referenced by setUp(), and testRandom().
|
private |
Used to track the number of various types of messages received from the agents.
Referenced by setUp().
|
private |
The testers pipe.
Referenced by notifyIn(), tearDown(), and testRandom().
|
private |
For each agent, the output pipe to it.
Referenced by notifyIn(), setUp(), and tearDown().
|
private |
Used to check the output of the preprocessing listener.
Referenced by setUp(), and tearDown().
|
private |
The random problem.
Referenced by setUp(), tearDown(), and testRandom().
|
private |
The queue used to listen to the agents.
Referenced by setQueue(), setUp(), tearDown(), and testRandom().
|
private |
The required sign for the costs/utilities.
Referenced by ADOPTagentTest().
|
private |
The solution collector listening for the solution.
Referenced by setUp(), tearDown(), and testRandom().
|
private |
The type of the start message.
Referenced by ADOPTagentTest(), setStartMsgType(), and setStartMsgType().
|
private |
true if the algorithm must be tested with the central mailer
Referenced by ADOPTagentTest(), and testRandom().
|
private |
true when the central mailer must be tested with delays
Referenced by ADOPTagentTest().
|
private |
Whether to use TCP pipes.
Referenced by ADOPTagentTest(), and testRandom().
|
private |
Whether to use XCSP.
Referenced by ADOPTagentTest().
|
private |
The class of utility values.
Referenced by ADOPTagentTest(), and setUp().