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

JUnit tests for the MGM agent. More...

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

Public Member Functions

 MGMagentTest (boolean useXCSP, boolean useTCP, boolean countNCCCs, boolean useCentralMailer, MessageType startMsgType, 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 tearDown () throws Exception

Protected Attributes

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.

Private Member Functions

void setStartMsgType (MessageType startMsgType) throws JDOMException
 Sets the type of the start message for all modules.

Private Attributes

final int maxNbrVars = 5
 Maximum number of variables in the problem.
final int maxNbrEdges = 10
 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 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.
boolean useXCSP
 Whether to use XCSP.
boolean useTCP
 Whether TCP pipes should be used for communication between agents.
boolean countNCCCs = false
 Whether we should count Non-Concurrent Constraint Checks.
MGM< V, U > statsGatherer
 The MGM 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
DCOPProblemInterface< V, U > problem
 The overall problem.
CentralMailer mailman
 The CentralMailer.
Class< V > domClass
 The class used for variable values.
Class< U > utilClass
 The class used for utility values.

Detailed Description

JUnit tests for the MGM agent.

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

Constructor & Destructor Documentation

◆ MGMagentTest()

frodo2.algorithms.localSearch.mgm.tests.MGMagentTest< V extends Addable< V >, U extends Addable< U > >.MGMagentTest ( boolean useXCSP,
boolean useTCP,
boolean countNCCCs,
boolean useCentralMailer,
MessageType startMsgType,
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
domClassThe class used for variable values
utilClassthe class used for utility values

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

Referenced by suite().

Member Function Documentation

◆ getMsgTypes()

◆ notifyIn()

◆ setQueue()

◆ setStartMsgType()

void frodo2.algorithms.localSearch.mgm.tests.MGMagentTest< 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 frodo2.algorithms.AgentInterface< V extends Addable< V > >.START_AGENT, and startMsgType.

Referenced by setUp().

◆ setUp()

◆ suite()

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

References MGMagentTest(), and suite().

Referenced by suite(), and frodo2.algorithms.test.AllTests.suite().

Here is the call graph for this function:

◆ tearDown()

void frodo2.algorithms.localSearch.mgm.tests.MGMagentTest< 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.mgm.tests.MGMagentTest< V extends Addable< V >, U extends Addable< U > >.agentDesc
private

The description of the agent.

Referenced by setUp(), and testRandom().

◆ agents

Map< String, AgentInterface<V> > frodo2.algorithms.localSearch.mgm.tests.MGMagentTest< 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.localSearch.mgm.tests.MGMagentTest< V extends Addable< V >, U extends Addable< U > >.countNCCCs = false
private

Whether we should count Non-Concurrent Constraint Checks.

Referenced by MGMagentTest(), and testRandom().

◆ domClass

Class<V> frodo2.algorithms.localSearch.mgm.tests.MGMagentTest< V extends Addable< V >, U extends Addable< U > >.domClass
private

The class used for variable values.

Referenced by MGMagentTest(), and testRandom().

◆ finished

final Condition frodo2.algorithms.localSearch.mgm.tests.MGMagentTest< 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.mgm.tests.MGMagentTest< 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.mgm.tests.MGMagentTest< V extends Addable< V >, U extends Addable< U > >.mailman
private

The CentralMailer.

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

◆ maxNbrAgents

final int frodo2.algorithms.localSearch.mgm.tests.MGMagentTest< V extends Addable< V >, U extends Addable< U > >.maxNbrAgents = 5
private

Maximum number of agents.

Referenced by testRandom().

◆ maxNbrEdges

final int frodo2.algorithms.localSearch.mgm.tests.MGMagentTest< V extends Addable< V >, U extends Addable< U > >.maxNbrEdges = 10
private

Maximum number of binary constraints in the problem.

Referenced by testRandom().

◆ maxNbrVars

final int frodo2.algorithms.localSearch.mgm.tests.MGMagentTest< 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 testRandom().

◆ nbrAgents

int frodo2.algorithms.localSearch.mgm.tests.MGMagentTest< V extends Addable< V >, U extends Addable< U > >.nbrAgents
private

Total number of agents.

Referenced by notifyIn(), and testRandom().

◆ nbrAgentsFinished

int frodo2.algorithms.localSearch.mgm.tests.MGMagentTest< V extends Addable< V >, U extends Addable< U > >.nbrAgentsFinished
private

Number of agents finished.

Referenced by setUp(), and testRandom().

◆ nbrMsgsReceived

int frodo2.algorithms.localSearch.mgm.tests.MGMagentTest< 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.localSearch.mgm.tests.MGMagentTest< V extends Addable< V >, U extends Addable< U > >.pipe
private

The tester's pipe.

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

◆ pipes

Map<Object, QueueOutputPipeInterface> frodo2.algorithms.localSearch.mgm.tests.MGMagentTest< V extends Addable< V >, U extends Addable< U > >.pipes
private

For each agent, the output pipe to it.

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

◆ problem

DCOPProblemInterface<V, U> frodo2.algorithms.localSearch.mgm.tests.MGMagentTest< V extends Addable< V >, U extends Addable< U > >.problem
private

The overall problem.

Referenced by testRandom().

◆ queue

Queue frodo2.algorithms.localSearch.mgm.tests.MGMagentTest< 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().

◆ startMsgType

MessageType frodo2.algorithms.localSearch.mgm.tests.MGMagentTest< V extends Addable< V >, U extends Addable< U > >.startMsgType
private

The type of the start message.

Referenced by MGMagentTest(), and setStartMsgType().

◆ statsGatherer

MGM<V, U> frodo2.algorithms.localSearch.mgm.tests.MGMagentTest< V extends Addable< V >, U extends Addable< U > >.statsGatherer
private

The MGM stats gatherer listening for the solution.

Referenced by tearDown(), and testRandom().

◆ useCentralMailer

boolean frodo2.algorithms.localSearch.mgm.tests.MGMagentTest< V extends Addable< V >, U extends Addable< U > >.useCentralMailer
private

true if the algorithm must be tested with the central mailer

Referenced by MGMagentTest(), and testRandom().

◆ useTCP

boolean frodo2.algorithms.localSearch.mgm.tests.MGMagentTest< V extends Addable< V >, U extends Addable< U > >.useTCP
private

Whether TCP pipes should be used for communication between agents.

Referenced by MGMagentTest(), and testRandom().

◆ useXCSP

boolean frodo2.algorithms.localSearch.mgm.tests.MGMagentTest< V extends Addable< V >, U extends Addable< U > >.useXCSP
private

Whether to use XCSP.

Referenced by MGMagentTest().

◆ utilClass

Class<U> frodo2.algorithms.localSearch.mgm.tests.MGMagentTest< V extends Addable< V >, U extends Addable< U > >.utilClass
private

The class used for utility values.

Referenced by MGMagentTest().


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