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

JUnit tests for the DSA agent. More...

Inheritance diagram for frodo2.algorithms.localSearch.dsa.tests.DSAagentTest< V extends Addable< V >, U extends Addable< U > >:

Public Member Functions

 DSAagentTest (boolean useXCSP, boolean useTCP, boolean countNCCCs, boolean useCentralMailer, MessageType startMsgType, String strategy, Class< V > domClass, Class< U > utilClass)
 Creates a JUnit test case corresponding to the input method.
void setUp () throws Exception
void testRandom ()
 Tests the DSAagent 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 setStartMsgType (MessageType startMsgType) throws JDOMException
 Sets the type of the start message for all modules.
void tearDown () throws Exception

Protected Attributes

final int maxNbrVars = 10
 Maximum number of variables in the problem.
final int maxNbrEdges = 15
 Maximum number of binary constraints in the problem.
final int maxNbrAgents = 10
 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 tester's 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 useTCP
 Whether TCP pipes should be used for communication between agents.
boolean countNCCCs = false
 Whether we should count Non-Concurrent Constraint Checks.
DSA< V, U > statsGatherer
 The DSA stats gatherer listening for the solution.
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
CentralMailer mailman
 The CentralMailer.
Class< V > domClass
 The class used for variable values.
Class< U > utilClass
 The class used for utility values.
String strategy
 The decision strategy used.

Private Attributes

boolean useXCSP
 Whether to use XCSP.
DCOPProblemInterface< V, U > problem
 The overall problem.

Detailed Description

JUnit tests for the DSA agent.

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

Constructor & Destructor Documentation

◆ DSAagentTest()

frodo2.algorithms.localSearch.dsa.tests.DSAagentTest< V extends Addable< V >, U extends Addable< U > >.DSAagentTest ( boolean useXCSP,
boolean useTCP,
boolean countNCCCs,
boolean useCentralMailer,
MessageType startMsgType,
String strategy,
Class< V > domClass,
Class< U > utilClass )

Creates a JUnit test case corresponding to the input method.

Parameters
useXCSPWhether to use XCSP
useTCPwhether TCP pipes should be used for communication between agents
countNCCCswhether we should tell the agent to count NCCCs
useCentralMailertrue when the central mailer should be used and tested
startMsgTypethe type of the start message
strategythe decision strategy used
domClassThe class used for variable values
utilClassthe class used for utility values

References countNCCCs, domClass, startMsgType, strategy, useCentralMailer, useTCP, useXCSP, and utilClass.

Referenced by suite().

Member Function Documentation

◆ getMsgTypes()

◆ notifyIn()

◆ setQueue()

◆ setStartMsgType()

void frodo2.algorithms.localSearch.dsa.tests.DSAagentTest< V extends Addable< V >, U extends Addable< U > >.setStartMsgType ( MessageType startMsgType) throws JDOMException
protected

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 frodo2.algorithms.AgentInterface< V extends Addable< V > >.START_AGENT, and startMsgType.

Referenced by setUp().

◆ setUp()

◆ suite()

TestSuite frodo2.algorithms.localSearch.dsa.tests.DSAagentTest< V extends Addable< V >, U extends Addable< U > >.suite ( )
static
Returns
the test suite

References DSAagentTest(), and suite().

Referenced by frodo2.algorithms.localSearch.dsa.tests.AllTestsDSA.suite(), and suite().

Here is the call graph for this function:

◆ tearDown()

void frodo2.algorithms.localSearch.dsa.tests.DSAagentTest< V extends Addable< V >, U extends Addable< U > >.tearDown ( ) throws Exception
protected
See also
junit.framework.TestCase#tearDown()

References agents, mailman, pipe, pipes, queue, and statsGatherer.

◆ testRandom()

Member Data Documentation

◆ agentDesc

Document frodo2.algorithms.localSearch.dsa.tests.DSAagentTest< V extends Addable< V >, U extends Addable< U > >.agentDesc
protected

The description of the agent.

Referenced by setUp(), and testRandom().

◆ agents

Map< String, AgentInterface<V> > frodo2.algorithms.localSearch.dsa.tests.DSAagentTest< V extends Addable< V >, U extends Addable< U > >.agents
protected

All agents, indexed by their IDs.

Referenced by tearDown(), and testRandom().

◆ countNCCCs

boolean frodo2.algorithms.localSearch.dsa.tests.DSAagentTest< V extends Addable< V >, U extends Addable< U > >.countNCCCs = false
protected

Whether we should count Non-Concurrent Constraint Checks.

Referenced by DSAagentTest(), and testRandom().

◆ domClass

Class<V> frodo2.algorithms.localSearch.dsa.tests.DSAagentTest< V extends Addable< V >, U extends Addable< U > >.domClass
protected

The class used for variable values.

Referenced by DSAagentTest(), and testRandom().

◆ finished

final Condition frodo2.algorithms.localSearch.dsa.tests.DSAagentTest< V extends Addable< V >, U extends Addable< U > >.finished = finished_lock.newCondition()
protected

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

◆ finished_lock

final ReentrantLock frodo2.algorithms.localSearch.dsa.tests.DSAagentTest< V extends Addable< V >, U extends Addable< U > >.finished_lock = new ReentrantLock ()
protected

Used to make the test thread wait.

◆ mailman

CentralMailer frodo2.algorithms.localSearch.dsa.tests.DSAagentTest< V extends Addable< V >, U extends Addable< U > >.mailman
protected

The CentralMailer.

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

◆ maxNbrAgents

final int frodo2.algorithms.localSearch.dsa.tests.DSAagentTest< V extends Addable< V >, U extends Addable< U > >.maxNbrAgents = 10
protected

Maximum number of agents.

Referenced by testRandom().

◆ maxNbrEdges

final int frodo2.algorithms.localSearch.dsa.tests.DSAagentTest< V extends Addable< V >, U extends Addable< U > >.maxNbrEdges = 15
protected

Maximum number of binary constraints in the problem.

Referenced by testRandom().

◆ maxNbrVars

final int frodo2.algorithms.localSearch.dsa.tests.DSAagentTest< V extends Addable< V >, U extends Addable< U > >.maxNbrVars = 10
protected

Maximum number of variables in the problem.

Note
Must be at least 2.

Referenced by testRandom().

◆ nbrAgents

int frodo2.algorithms.localSearch.dsa.tests.DSAagentTest< V extends Addable< V >, U extends Addable< U > >.nbrAgents
protected

Total number of agents.

Referenced by notifyIn(), and testRandom().

◆ nbrAgentsFinished

int frodo2.algorithms.localSearch.dsa.tests.DSAagentTest< V extends Addable< V >, U extends Addable< U > >.nbrAgentsFinished
protected

Number of agents finished.

Referenced by setUp(), and testRandom().

◆ nbrMsgsReceived

int frodo2.algorithms.localSearch.dsa.tests.DSAagentTest< V extends Addable< V >, U extends Addable< U > >.nbrMsgsReceived
protected

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

Referenced by setUp().

◆ pipe

QueueIOPipe frodo2.algorithms.localSearch.dsa.tests.DSAagentTest< V extends Addable< V >, U extends Addable< U > >.pipe
protected

The tester's pipe.

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

◆ pipes

Map<Object, QueueOutputPipeInterface> frodo2.algorithms.localSearch.dsa.tests.DSAagentTest< V extends Addable< V >, U extends Addable< U > >.pipes
protected

For each agent, the output pipe to it.

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

◆ problem

DCOPProblemInterface<V, U> frodo2.algorithms.localSearch.dsa.tests.DSAagentTest< V extends Addable< V >, U extends Addable< U > >.problem
private

The overall problem.

Referenced by testRandom().

◆ queue

Queue frodo2.algorithms.localSearch.dsa.tests.DSAagentTest< V extends Addable< V >, U extends Addable< U > >.queue
protected

The queue used to listen to the agents.

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

◆ startMsgType

MessageType frodo2.algorithms.localSearch.dsa.tests.DSAagentTest< V extends Addable< V >, U extends Addable< U > >.startMsgType
protected

The type of the start message.

Referenced by DSAagentTest(), and setStartMsgType().

◆ statsGatherer

DSA<V, U> frodo2.algorithms.localSearch.dsa.tests.DSAagentTest< V extends Addable< V >, U extends Addable< U > >.statsGatherer
protected

The DSA stats gatherer listening for the solution.

Referenced by tearDown(), and testRandom().

◆ strategy

String frodo2.algorithms.localSearch.dsa.tests.DSAagentTest< V extends Addable< V >, U extends Addable< U > >.strategy
protected

The decision strategy used.

Referenced by DSAagentTest(), and setUp().

◆ useCentralMailer

boolean frodo2.algorithms.localSearch.dsa.tests.DSAagentTest< V extends Addable< V >, U extends Addable< U > >.useCentralMailer
protected

true if the algorithm must be tested with the central mailer

Referenced by DSAagentTest(), and testRandom().

◆ useTCP

boolean frodo2.algorithms.localSearch.dsa.tests.DSAagentTest< V extends Addable< V >, U extends Addable< U > >.useTCP
protected

Whether TCP pipes should be used for communication between agents.

Referenced by DSAagentTest(), and testRandom().

◆ useXCSP

boolean frodo2.algorithms.localSearch.dsa.tests.DSAagentTest< V extends Addable< V >, U extends Addable< U > >.useXCSP
private

Whether to use XCSP.

Referenced by DSAagentTest().

◆ utilClass

Class<U> frodo2.algorithms.localSearch.dsa.tests.DSAagentTest< V extends Addable< V >, U extends Addable< U > >.utilClass
protected

The class used for utility values.

Referenced by DSAagentTest().


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