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

JUnit test for ADOPTagent. More...

Inheritance diagram for frodo2.algorithms.adopt.test.ADOPTagentTest< V extends Addable< V >, U extends Addable< U > >:

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< MessageTypegetMsgTypes ()
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, QueueOutputPipeInterfacepipes
 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.

Detailed Description

JUnit test for ADOPTagent.

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

Constructor & Destructor Documentation

◆ ADOPTagentTest()

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.

Parameters
useCentralMailertrue when the central mailer should be tested
useDelaytrue when the central mailer must be tested with delays
startMsgTypethe type of the start message
domClassthe class of variable values
utilClassthe class of utility values
useXCSPwhether to use XCSP
useTCPwhether TCP pipes should be used for communication between agents
countNCCCswhether we should tell the agent to count NCCCs
maximizeWhether to test on maximization problem
signThe required sign for the costs/utilities

References countNCCCs, domClass, maximize, sign, startMsgType, useCentralMailer, useDelay, useTCP, useXCSP, and utilClass.

Referenced by suite().

Member Function Documentation

◆ getMsgTypes()

◆ notifyIn()

◆ setQueue()

void frodo2.algorithms.adopt.test.ADOPTagentTest< V extends Addable< V >, U extends Addable< U > >.setQueue ( Queue queue)

◆ setStartMsgType() [1/2]

void frodo2.algorithms.adopt.test.ADOPTagentTest< V extends Addable< V >, U extends Addable< U > >.setStartMsgType ( Element messages,
MessageType startMsgType )
private

Overwrites the type of the start messages.

Parameters
messagesmessages element
startMsgTypethe new type of the start messages

References startMsgType.

◆ setStartMsgType() [2/2]

void frodo2.algorithms.adopt.test.ADOPTagentTest< V extends Addable< V >, U extends Addable< U > >.setStartMsgType ( MessageType startMsgType) throws JDOMException
private

Sets the type of the start message for all modules.

Parameters
startMsgTypethe new type for the start message
Exceptions
JDOMExceptionif 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().

Here is the call graph for this function:

◆ setUp()

◆ suite()

TestSuite frodo2.algorithms.adopt.test.ADOPTagentTest< V extends Addable< V >, U extends Addable< U > >.suite ( )
static
Returns
the test suite
Bug
ADOPT does not seem to handle message delays.
Bug
The first test fails

References ADOPTagentTest(), and suite().

Referenced by suite(), and frodo2.algorithms.adopt.test.AllTestsADOPT.suite().

Here is the call graph for this function:

◆ tearDown()

void frodo2.algorithms.adopt.test.ADOPTagentTest< V extends Addable< V >, U extends Addable< U > >.tearDown ( ) throws Exception
protected
See also
junit.framework.TestCase#tearDown()

References agents, mailman, pipe, pipes, preProcessingTester, problem, queue, and solCollector.

◆ testRandom()

Member Data Documentation

◆ agentDesc

Document frodo2.algorithms.adopt.test.ADOPTagentTest< V extends Addable< V >, U extends Addable< U > >.agentDesc
private

The description of the agent.

Referenced by setStartMsgType(), setUp(), and testRandom().

◆ agents

Map< String, AgentInterface<V> > frodo2.algorithms.adopt.test.ADOPTagentTest< V extends Addable< V >, U extends Addable< U > >.agents
private

All agents, indexed by their IDs.

Referenced by tearDown(), and testRandom().

◆ countNCCCs

boolean frodo2.algorithms.adopt.test.ADOPTagentTest< V extends Addable< V >, U extends Addable< U > >.countNCCCs = false
private

Whether we should count Non-Concurrent Constraint Checks.

Referenced by ADOPTagentTest(), and setUp().

◆ domClass

Class<V> frodo2.algorithms.adopt.test.ADOPTagentTest< V extends Addable< V >, U extends Addable< U > >.domClass
private

The class of variable values.

Referenced by ADOPTagentTest(), and setUp().

◆ finished

final Condition frodo2.algorithms.adopt.test.ADOPTagentTest< V extends Addable< V >, U extends Addable< U > >.finished = finished_lock.newCondition()
private

Used to wake up the test thread when all agents have finished.

◆ finished_lock

final ReentrantLock frodo2.algorithms.adopt.test.ADOPTagentTest< V extends Addable< V >, U extends Addable< U > >.finished_lock = new ReentrantLock ()
private

Used to make the test thread wait.

◆ mailman

CentralMailer frodo2.algorithms.adopt.test.ADOPTagentTest< V extends Addable< V >, U extends Addable< U > >.mailman
private

The CentralMailer.

Referenced by setUp(), tearDown(), and testRandom().

◆ maximize

final boolean frodo2.algorithms.adopt.test.ADOPTagentTest< V extends Addable< V >, U extends Addable< U > >.maximize
private

Whether to test on maximization problem.

Referenced by ADOPTagentTest().

◆ maxNbrAgents

final int frodo2.algorithms.adopt.test.ADOPTagentTest< V extends Addable< V >, U extends Addable< U > >.maxNbrAgents = 5
private

Maximum number of agents.

Referenced by setUp().

◆ maxNbrEdges

final int frodo2.algorithms.adopt.test.ADOPTagentTest< V extends Addable< V >, U extends Addable< U > >.maxNbrEdges = 15
private

Maximum number of binary constraints in the problem.

Referenced by setUp().

◆ maxNbrVars

final int frodo2.algorithms.adopt.test.ADOPTagentTest< V extends Addable< V >, U extends Addable< U > >.maxNbrVars = 5
private

Maximum number of variables in the problem.

Note
Must be at least 2.

Referenced by setUp().

◆ nbrAgents

int frodo2.algorithms.adopt.test.ADOPTagentTest< V extends Addable< V >, U extends Addable< U > >.nbrAgents
private

Total number of agents.

Referenced by notifyIn(), and testRandom().

◆ nbrAgentsFinished

int frodo2.algorithms.adopt.test.ADOPTagentTest< V extends Addable< V >, U extends Addable< U > >.nbrAgentsFinished
private

Number of agents finished.

Referenced by setUp(), and testRandom().

◆ nbrMsgsReceived

int frodo2.algorithms.adopt.test.ADOPTagentTest< V extends Addable< V >, U extends Addable< U > >.nbrMsgsReceived
private

Used to track the number of various types of messages received from the agents.

Referenced by setUp().

◆ pipe

QueueIOPipe frodo2.algorithms.adopt.test.ADOPTagentTest< V extends Addable< V >, U extends Addable< U > >.pipe
private

The testers pipe.

Referenced by notifyIn(), tearDown(), and testRandom().

◆ pipes

Map<Object, QueueOutputPipeInterface> frodo2.algorithms.adopt.test.ADOPTagentTest< V extends Addable< V >, U extends Addable< U > >.pipes
private

For each agent, the output pipe to it.

Referenced by notifyIn(), setUp(), and tearDown().

◆ preProcessingTester

Preprocessing<V, U> frodo2.algorithms.adopt.test.ADOPTagentTest< V extends Addable< V >, U extends Addable< U > >.preProcessingTester
private

Used to check the output of the preprocessing listener.

Referenced by setUp(), and tearDown().

◆ problem

DCOPProblemInterface<V, U> frodo2.algorithms.adopt.test.ADOPTagentTest< V extends Addable< V >, U extends Addable< U > >.problem
private

The random problem.

Referenced by setUp(), tearDown(), and testRandom().

◆ queue

Queue frodo2.algorithms.adopt.test.ADOPTagentTest< V extends Addable< V >, U extends Addable< U > >.queue
private

The queue used to listen to the agents.

Referenced by setQueue(), setUp(), tearDown(), and testRandom().

◆ sign

final int frodo2.algorithms.adopt.test.ADOPTagentTest< V extends Addable< V >, U extends Addable< U > >.sign
private

The required sign for the costs/utilities.

Referenced by ADOPTagentTest().

◆ solCollector

SolutionCollector<V, U> frodo2.algorithms.adopt.test.ADOPTagentTest< V extends Addable< V >, U extends Addable< U > >.solCollector
private

The solution collector listening for the solution.

Referenced by setUp(), tearDown(), and testRandom().

◆ startMsgType

MessageType frodo2.algorithms.adopt.test.ADOPTagentTest< V extends Addable< V >, U extends Addable< U > >.startMsgType
private

The type of the start message.

Referenced by ADOPTagentTest(), setStartMsgType(), and setStartMsgType().

◆ useCentralMailer

boolean frodo2.algorithms.adopt.test.ADOPTagentTest< V extends Addable< V >, U extends Addable< U > >.useCentralMailer
private

true if the algorithm must be tested with the central mailer

Referenced by ADOPTagentTest(), and testRandom().

◆ useDelay

boolean frodo2.algorithms.adopt.test.ADOPTagentTest< V extends Addable< V >, U extends Addable< U > >.useDelay
private

true when the central mailer must be tested with delays

Referenced by ADOPTagentTest().

◆ useTCP

boolean frodo2.algorithms.adopt.test.ADOPTagentTest< V extends Addable< V >, U extends Addable< U > >.useTCP
private

Whether to use TCP pipes.

Referenced by ADOPTagentTest(), and testRandom().

◆ useXCSP

boolean frodo2.algorithms.adopt.test.ADOPTagentTest< V extends Addable< V >, U extends Addable< U > >.useXCSP
private

Whether to use XCSP.

Referenced by ADOPTagentTest().

◆ utilClass

Class<U> frodo2.algorithms.adopt.test.ADOPTagentTest< V extends Addable< V >, U extends Addable< U > >.utilClass
private

The class of utility values.

Referenced by ADOPTagentTest(), and setUp().


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