FRODO Version 2.19.1
An open-source framework for Distributed Constraint Optimization (DCOP)
Loading...
Searching...
No Matches
frodo2.algorithms.adopt.test.testADOPT Class Reference

This class is used to test the workings of the ADOPT listener. More...

Inheritance diagram for frodo2.algorithms.adopt.test.testADOPT:

Public Member Functions

 testADOPT (Class< ? extends Addable<?> > utilClass, String version, boolean useTCP, boolean useXML)
 Constructor that instantiates a test only for the input method.
void test () throws Exception
 Runs a random test.
Collection< MessageTypegetMsgTypes ()
void notifyIn (Message msg)
void setQueue (Queue queue)
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 ()
static< U extends Addable< U > Map< String, UtilitySolutionSpace< AddableInteger, U > > startADOPT (RandGraphFactory.Graph graph, Map< String, DFSview< AddableInteger, U > > dfs, Map< String, Queue > queues, List< ? extends UtilitySolutionSpace< AddableInteger, U > > constraints, XCSPparser< AddableInteger, U > parser)
 Sends messages to the queues to initiate ADOPT.

Protected Member Functions

void setUp () throws Exception
void tearDown () throws Exception

Package Attributes

Queue myQueue
 The queue to which this class is registered as a listener.

Private Member Functions

Hypercube< AddableInteger, AddableIntegersimulateUTIL (String var)
 Simulates UTIL propagation on the subtree rooted at the input variable, while checking separators.

Private Attributes

final int maxNbrVars = 7
 Maximum number of variables in the random graph.
final int maxNbrEdges = 25
 Maximum number of edges in the random graph.
final int maxNbrAgents = 7
 Maximum number of agents.
int nbrMsgsRemaining
 The number of output messages remaining to be received.
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.
Map< String, Queuequeues
 List of queues, indexed by agent name.
Element parameters
 The parameters for adopt.
RandGraphFactory.Graph graph
 Random graph used to generate a constraint graph.
Map< String, DFSview< AddableInteger, AddableInteger > > dfs
 The DFS corresponding to the random graph.
Map< String, UtilitySolutionSpace< AddableInteger, AddableInteger > > hypercubes
 For each variable, the constraint it is responsible for enforcing.
XCSPparser< AddableInteger, AddableIntegerparser
 The parser.
Class<? extends Addable<?> > utilClass
 The class of utility values.
String version
 The version of ADOPT.
boolean useTCP
 Whether to use TCP pipes or shared memory pipes.
boolean useXML
 Whether to use the XML-based constructor.

Detailed Description

This class is used to test the workings of the ADOPT listener.

Author
Brammert Ottens, Thomas Leaute

Constructor & Destructor Documentation

◆ testADOPT()

frodo2.algorithms.adopt.test.testADOPT.testADOPT ( Class< ? extends Addable<?> > utilClass,
String version,
boolean useTCP,
boolean useXML )

Constructor that instantiates a test only for the input method.

Parameters
utilClassthe class of utility values
versionthe version of ADOPT
useTCPwhether to use TCP pipes or shared memory pipes
useXMLwhether to use the XML-based constructor

References useTCP, useXML, utilClass, and version.

Referenced by suite().

Member Function Documentation

◆ getMsgTypes()

◆ notifyIn()

void frodo2.algorithms.adopt.test.testADOPT.notifyIn ( Message msg)

◆ setQueue()

void frodo2.algorithms.adopt.test.testADOPT.setQueue ( Queue queue)

◆ setUp()

◆ simulateUTIL()

Hypercube< AddableInteger, AddableInteger > frodo2.algorithms.adopt.test.testADOPT.simulateUTIL ( String var)
private

Simulates UTIL propagation on the subtree rooted at the input variable, while checking separators.

Parameters
varroot variable
Returns
the UTIL message that the input variable sends to its parent (if any)

References frodo2.solutionSpaces.UtilitySolutionSpace< V extends Addable< V >, U extends Addable< U > >.blindProject(), frodo2.solutionSpaces.hypercube.Hypercube< V extends Addable< V >, U extends Addable< U > >.clone(), dfs, hypercubes, frodo2.solutionSpaces.UtilitySolutionSpace< V extends Addable< V >, U extends Addable< U > >.join(), frodo2.solutionSpaces.AddableInteger.PlusInfinity.PLUS_INF, and simulateUTIL().

Referenced by simulateUTIL(), and test().

Here is the call graph for this function:

◆ startADOPT()

static< U extends Addable< U > Map< String, UtilitySolutionSpace< AddableInteger, U > > frodo2.algorithms.adopt.test.testADOPT.startADOPT ( RandGraphFactory.Graph graph,
Map< String, DFSview< AddableInteger, U > > dfs,
Map< String, Queue > queues,
List< ? extends UtilitySolutionSpace< AddableInteger, U > > constraints,
XCSPparser< AddableInteger, U > parser )
static

Sends messages to the queues to initiate ADOPT.

Parameters
<U>the type used for utility values
graphthe constraint graph
dfsthe corresponding DFS (for each node in the graph, the relationships of this node)
queuesthe array of queues, indexed by the names of the clusters in the graph
constraintsthe hypercubes in the problem definition
parserthe parser for the random problem
Returns
for each variable, the constraint it is responsible for enforcing

References dfs, frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.DFSview< V extends Addable< V >, U extends Addable< U > >.getAllPseudoChildren(), frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.DFSview< V extends Addable< V >, U extends Addable< U > >.getChildren(), graph, hypercubes, frodo2.solutionSpaces.UtilitySolutionSpace< V extends Addable< V >, U extends Addable< U > >.join(), parser, queues, frodo2.communication.Queue.sendMessageToSelf(), frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.DFSview< V extends Addable< V >, U extends Addable< U > >.setSpaces(), and frodo2.algorithms.AgentInterface< V extends Addable< V > >.START_AGENT.

Referenced by test().

Here is the call graph for this function:

◆ suite()

TestSuite frodo2.algorithms.adopt.test.testADOPT.suite ( )
static
Returns
the test suite for this test

References testADOPT().

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

Here is the call graph for this function:

◆ tearDown()

void frodo2.algorithms.adopt.test.testADOPT.tearDown ( ) throws Exception
protected
See also
junit.framework.TestCase#tearDown()

References dfs, graph, and queues.

◆ test()

void frodo2.algorithms.adopt.test.testADOPT.test ( ) throws Exception

Runs a random test.

Exceptions
Exceptionif an error occurs

References frodo2.solutionSpaces.AddableInteger.add(), frodo2.communication.Queue.addIncomingMessagePolicy(), frodo2.algorithms.test.AllTests.createQueueNetwork(), dfs, frodo2.solutionSpaces.ProblemInterface< V extends Addable< V >, U extends Addable< U > >.getAgents(), frodo2.solutionSpaces.DCOPProblemInterface< V extends Addable< V >, U extends Addable< U > >.getDomain(), frodo2.solutionSpaces.ProblemInterface< V extends Addable< V >, U extends Addable< U > >.getDomClass(), frodo2.solutionSpaces.DCOPProblemInterface< V extends Addable< V >, U extends Addable< U > >.getOwners(), frodo2.solutionSpaces.DCOPProblemInterface< V extends Addable< V >, U extends Addable< U > >.getProbabilitySpacePerRandVar(), frodo2.solutionSpaces.DCOPProblemInterface< V extends Addable< V >, U extends Addable< U > >.getRandVars(), frodo2.algorithms.SolutionCollector< V extends Addable< V >, U extends Addable< U > >.getSolution(), frodo2.solutionSpaces.DCOPProblemInterface< V extends Addable< V >, U extends Addable< U > >.getSolutionSpaces(), frodo2.algorithms.SolutionCollector< V extends Addable< V >, U extends Addable< U > >.getStatsFromQueue(), frodo2.solutionSpaces.DCOPProblemInterface< V extends Addable< V >, U extends Addable< U > >.getSubProblem(), frodo2.solutionSpaces.ProblemInterface< V extends Addable< V >, U extends Addable< U > >.getUtilClass(), frodo2.algorithms.SolutionCollector< V extends Addable< V >, U extends Addable< U > >.getUtility(), frodo2.solutionSpaces.hypercube.Hypercube< V extends Addable< V >, U extends Addable< U > >.getUtility(), frodo2.solutionSpaces.DCOPProblemInterface< V extends Addable< V >, U extends Addable< U > >.getVariables(), frodo2.solutionSpaces.DCOPProblemInterface< V extends Addable< V >, U extends Addable< U > >.getVarScopes(), graph, hypercubes, myQueue, nbrMsgsRemaining, parameters, frodo2.algorithms.XCSPparser< V extends Addable< V >, U extends Addable< U > >.parse(), parser, queues, frodo2.communication.Queue.setProblem(), frodo2.algorithms.SolutionCollector< V extends Addable< V >, U extends Addable< U > >.setSilent(), simulateUTIL(), startADOPT(), frodo2.algorithms.AgentInterface< V extends Addable< V > >.STATS_MONITOR, test(), useTCP, useXML, and version.

Referenced by test().

Here is the call graph for this function:

Member Data Documentation

◆ dfs

Map< String, DFSview<AddableInteger, AddableInteger> > frodo2.algorithms.adopt.test.testADOPT.dfs
private

The DFS corresponding to the random graph.

Referenced by setUp(), simulateUTIL(), startADOPT(), tearDown(), and test().

◆ finished

final Condition frodo2.algorithms.adopt.test.testADOPT.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.testADOPT.finished_lock = new ReentrantLock ()
private

Used to make the test thread wait.

◆ graph

RandGraphFactory.Graph frodo2.algorithms.adopt.test.testADOPT.graph
private

Random graph used to generate a constraint graph.

Referenced by setUp(), startADOPT(), tearDown(), and test().

◆ hypercubes

Map< String, UtilitySolutionSpace<AddableInteger, AddableInteger> > frodo2.algorithms.adopt.test.testADOPT.hypercubes
private

For each variable, the constraint it is responsible for enforcing.

Referenced by simulateUTIL(), startADOPT(), and test().

◆ maxNbrAgents

final int frodo2.algorithms.adopt.test.testADOPT.maxNbrAgents = 7
private

Maximum number of agents.

Referenced by setUp().

◆ maxNbrEdges

final int frodo2.algorithms.adopt.test.testADOPT.maxNbrEdges = 25
private

Maximum number of edges in the random graph.

Referenced by setUp().

◆ maxNbrVars

final int frodo2.algorithms.adopt.test.testADOPT.maxNbrVars = 7
private

Maximum number of variables in the random graph.

Note
Must be at least 2.

Referenced by setUp().

◆ myQueue

Queue frodo2.algorithms.adopt.test.testADOPT.myQueue
package

The queue to which this class is registered as a listener.

Referenced by test().

◆ nbrMsgsRemaining

int frodo2.algorithms.adopt.test.testADOPT.nbrMsgsRemaining
private

The number of output messages remaining to be received.

Referenced by notifyIn(), and test().

◆ parameters

Element frodo2.algorithms.adopt.test.testADOPT.parameters
private

The parameters for adopt.

Referenced by setUp(), and test().

◆ parser

XCSPparser<AddableInteger, AddableInteger> frodo2.algorithms.adopt.test.testADOPT.parser
private

The parser.

Referenced by setUp(), startADOPT(), and test().

◆ queues

Map<String, Queue> frodo2.algorithms.adopt.test.testADOPT.queues
private

List of queues, indexed by agent name.

Referenced by startADOPT(), tearDown(), and test().

◆ useTCP

boolean frodo2.algorithms.adopt.test.testADOPT.useTCP
private

Whether to use TCP pipes or shared memory pipes.

Referenced by test(), and testADOPT().

◆ useXML

boolean frodo2.algorithms.adopt.test.testADOPT.useXML
private

Whether to use the XML-based constructor.

Referenced by test(), and testADOPT().

◆ utilClass

Class<? extends Addable<?> > frodo2.algorithms.adopt.test.testADOPT.utilClass
private

The class of utility values.

Referenced by testADOPT().

◆ version

String frodo2.algorithms.adopt.test.testADOPT.version
private

The version of ADOPT.

Referenced by test(), and testADOPT().


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