FRODO Version 2.19.1
An open-source framework for Distributed Constraint Optimization (DCOP)
Loading...
Searching...
No Matches
frodo2.algorithms.dpop.test.UTILpropagationTest< U extends Addable< U > >.Listener Class Reference

The listener that checks the messages sent by the UTILpropagation listeners. More...

Inheritance diagram for frodo2.algorithms.dpop.test.UTILpropagationTest< U extends Addable< U > >.Listener:

Public Member Functions

 Listener (boolean useTCP, boolean useXML, Element parameters, Class< ? extends StatsReporter > listenerClass, boolean withAnonymVars) throws IOException, NoSuchMethodException, IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException, ClassNotFoundException
 Constructor that tests the UTIL propagation protocol on a random DFS.
void waitForOutputs ()
 Waits for the outputs of the module and checks their validity.
Collection< MessageTypegetMsgTypes ()
 Listens to the outputs of the UTIL propagation protocol.
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.

Protected Member Functions

void setUpPrelimModules (Queue queue, DCOPProblemInterface< AddableInteger, U > subProblem)
 Sets up modules that are necessary for the module under test to work.
void checkOutput ()
 Checks that the output of the module is correct.
Hypercube< AddableInteger, U > simulateUTIL (String var)
 Simulates UTIL propagation on the subtree rooted at the input variable, while checking separators.

Protected Attributes

Integer nbrMsgsRemaining
 The number of output messages remaining to be received from the UTIL propagation protocol.
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, UtilitySolutionSpace< AddableInteger, U > > hypercubes
 For each variable, the constraint it is responsible for enforcing.
UTILpropagation< AddableInteger, U > statsGatherer
 The stats gatherer.
XCSPparser< AddableInteger, U > parser
 The parser for the problem.

Private Attributes

optTotalUtil
 Optimal, total utility across all connected components.
Object optTotalUtil_lock = new Object ()
 Used to synchronize access to optTotalUtil, which can be null.
Map< String, QueueOutputPipeInterfacepipes
 The pipes of the queue network, indexed by agent name.
Queue myQueue
 The Listener's own queue.
List< ? extends UtilitySolutionSpace< AddableInteger, U > > spaces
 The constraints in the problem.

Detailed Description

The listener that checks the messages sent by the UTILpropagation listeners.

Constructor & Destructor Documentation

◆ Listener()

frodo2.algorithms.dpop.test.UTILpropagationTest< U extends Addable< U > >.Listener.Listener ( boolean useTCP,
boolean useXML,
Element parameters,
Class< ? extends StatsReporter > listenerClass,
boolean withAnonymVars ) throws IOException, NoSuchMethodException, IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException, ClassNotFoundException

Constructor that tests the UTIL propagation protocol on a random DFS.

Parameters
useTCPtrue whether TCP pipes should be used instead of QueueIOPipes
useXMLwhether we should use the constructor that takes in XML elements or the manual constructor
parametersthe parameters for the module under test
listenerClassthe class of the listener under test
withAnonymVarstrue if anonymous variables should be taken into account when parsing the problem
Exceptions
IOExceptionif the method fails to create pipes
NoSuchMethodExceptionif the UTILpropagation class does not have a public constructor that takes in a ProblemInterface and a JDOM Element
InvocationTargetExceptionif the UTILpropagation constructor throws an exception
IllegalAccessExceptionif the UTILpropagation class does not have a public constructor that takes in a ProblemInterface and a JDOM Element
InstantiationExceptionif the instantiation of UTILpropagation failed
IllegalArgumentExceptionif an error occurs in passing arguments to the constructor of UTILpropagation
ClassNotFoundExceptionif the utility class is unknown

References frodo2.communication.Queue.addIncomingMessagePolicy(), frodo2.algorithms.dpop.test.UTILpropagationTest< U extends Addable< U > >.computeDFS(), frodo2.algorithms.test.AllTests.createQueueNetwork(), frodo2.algorithms.dpop.test.UTILpropagationTest< U extends Addable< U > >.dfs, frodo2.algorithms.test.AllTests.generateProblem(), frodo2.solutionSpaces.ProblemInterface< V extends Addable< V >, U extends Addable< U > >.getAgents(), frodo2.solutionSpaces.DCOPProblemInterface< V extends Addable< V >, U extends Addable< U > >.getAllVars(), 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.solutionSpaces.DCOPProblemInterface< V extends Addable< V >, U extends Addable< U > >.getSolutionSpaces(), 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.solutionSpaces.DCOPProblemInterface< V extends Addable< V >, U extends Addable< U > >.getVarScopes(), frodo2.algorithms.dpop.test.UTILpropagationTest< U extends Addable< U > >.graph, frodo2.algorithms.dpop.test.UTILpropagationTest< U extends Addable< U > >.maximize, myQueue, nbrMsgsRemaining, frodo2.algorithms.dpop.UTILpropagation< Val extends Addable< Val >, U extends Addable< U > >.OPT_UTIL_MSG_TYPE, frodo2.algorithms.dpop.test.UTILpropagationTest< U extends Addable< U > >.parameters, parser, pipes, frodo2.algorithms.dpop.test.UTILpropagationTest< U extends Addable< U > >.queues, frodo2.algorithms.dpop.test.UTILpropagationTest< U extends Addable< U > >.separators, frodo2.communication.Queue.setProblem(), setUpPrelimModules(), frodo2.algorithms.AbstractProblem< V extends Addable< V >, U extends Addable< U > >.setUtilClass(), frodo2.algorithms.dpop.test.UTILpropagationTest< U extends Addable< U > >.sign, spaces, frodo2.algorithms.AgentInterface< V extends Addable< V > >.STATS_MONITOR, statsGatherer, frodo2.algorithms.dpop.test.UTILpropagationTest< U extends Addable< U > >.useTCP, frodo2.algorithms.dpop.test.UTILpropagationTest< U extends Addable< U > >.useXML, and frodo2.algorithms.dpop.test.UTILpropagationTest< U extends Addable< U > >.utilClass.

Here is the call graph for this function:

Member Function Documentation

◆ checkOutput()

◆ getMsgTypes()

◆ notifyIn()

◆ setQueue()

◆ setUpPrelimModules()

void frodo2.algorithms.dpop.test.UTILpropagationTest< U extends Addable< U > >.Listener.setUpPrelimModules ( Queue queue,
DCOPProblemInterface< AddableInteger, U > subProblem )
protected

Sets up modules that are necessary for the module under test to work.

Parameters
queuethe queue to which the modules should be added
subProblemthe corresponding agent's subproblem

Referenced by Listener().

◆ simulateUTIL()

◆ waitForOutputs()

Member Data Documentation

◆ finished

final Condition frodo2.algorithms.dpop.test.UTILpropagationTest< U extends Addable< U > >.Listener.finished = finished_lock.newCondition()
protected

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

◆ finished_lock

final ReentrantLock frodo2.algorithms.dpop.test.UTILpropagationTest< U extends Addable< U > >.Listener.finished_lock = new ReentrantLock ()
protected

Used to make the test thread wait.

◆ hypercubes

Map< String, UtilitySolutionSpace<AddableInteger, U> > frodo2.algorithms.dpop.test.UTILpropagationTest< U extends Addable< U > >.Listener.hypercubes
protected

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

Referenced by simulateUTIL(), and waitForOutputs().

◆ myQueue

Queue frodo2.algorithms.dpop.test.UTILpropagationTest< U extends Addable< U > >.Listener.myQueue
private

The Listener's own queue.

Referenced by Listener(), and waitForOutputs().

◆ nbrMsgsRemaining

Integer frodo2.algorithms.dpop.test.UTILpropagationTest< U extends Addable< U > >.Listener.nbrMsgsRemaining
protected

The number of output messages remaining to be received from the UTIL propagation protocol.

Referenced by Listener(), and waitForOutputs().

◆ optTotalUtil

U frodo2.algorithms.dpop.test.UTILpropagationTest< U extends Addable< U > >.Listener.optTotalUtil
private

Optimal, total utility across all connected components.

Referenced by checkOutput().

◆ optTotalUtil_lock

Object frodo2.algorithms.dpop.test.UTILpropagationTest< U extends Addable< U > >.Listener.optTotalUtil_lock = new Object ()
private

Used to synchronize access to optTotalUtil, which can be null.

◆ parser

XCSPparser<AddableInteger, U> frodo2.algorithms.dpop.test.UTILpropagationTest< U extends Addable< U > >.Listener.parser
protected

The parser for the problem.

Referenced by Listener(), and simulateUTIL().

◆ pipes

Map<String, QueueOutputPipeInterface> frodo2.algorithms.dpop.test.UTILpropagationTest< U extends Addable< U > >.Listener.pipes
private

The pipes of the queue network, indexed by agent name.

Referenced by Listener(), and waitForOutputs().

◆ spaces

List< ? extends UtilitySolutionSpace<AddableInteger, U> > frodo2.algorithms.dpop.test.UTILpropagationTest< U extends Addable< U > >.Listener.spaces
private

The constraints in the problem.

Referenced by Listener(), and waitForOutputs().

◆ statsGatherer

UTILpropagation<AddableInteger, U> frodo2.algorithms.dpop.test.UTILpropagationTest< U extends Addable< U > >.Listener.statsGatherer
protected

The stats gatherer.

Referenced by Listener().


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