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 > > Class Template Reference

JUnit test for the class UTILpropagation. More...

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

Classes

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

Public Member Functions

 UTILpropagationTest (String method)
 Constructor that instantiates a test only for the input method.
 UTILpropagationTest (boolean useTCP, boolean useXML, Class< U > utilClass, boolean minNCCCs)
 Constructor.
void testComputeDFS ()
 A test method that tests the test helper method computeDFS().
void test () throws Exception
 Tests the UTIL propagation protocol on a random graph.

Static Public Member Functions

static TestSuite suite ()
static< V extends Addable< V > U extends Addable< U > Map< String, DFSview< V, U > > computeDFS (Graph graph, DCOPProblemInterface< V, U > problem)
static< V extends Addable< V > U extends Addable< U > Map< String, DFSview< V, U > > computeDFS (Graph graph, DCOPProblemInterface< V, U > problem, boolean withSharedVars)
static< U extends Addable< U > Map< String, UtilitySolutionSpace< AddableInteger, U > > startUTIL (RandGraphFactory.Graph graph, Map< String, DFSview< AddableInteger, U > > dfs, Map< String, Queue > queues, List< ? extends UtilitySolutionSpace< AddableInteger, U > > constraints)
 Sends messages to the queues to initiate the UTIL propagation.

Protected Member Functions

void setUp ()
void tearDown () throws Exception
 Ends all queues.
Listener newListenerInstance (boolean useTCP, boolean useXML, Element parameters) throws Exception
 Creates a new Listener.

Protected Attributes

final int maxNbrVars = 10
 Maximum number of variables in the random graph.
final int maxNbrEdges = 40
 Maximum number of edges in the random graph.
final int maxNbrAgents = 10
 Maximum number of agents.
RandGraphFactory.Graph graph
 Random graph used to generate a constraint graph.
Map< String, DFSview< AddableInteger, U > > dfs
 The DFS corresponding to the random graph.
Element parameters
 The parameters for the module under test.
boolean maximize
 Whether we should maximize or minimize.
int sign = 0
 The desired sign for the utilities (if 0, utilities can be either sign).

Private Attributes

Map< String, Queuequeues
 List of queues, indexed by agent name.
Map< String, String[] > separators
 For each variable, the list of variables in its separator.
boolean useTCP
 Whether to use TCP pipes or shared memory pipes.
boolean useXML
 Whether to use the XML-based constructor.
Class< U > utilClass
 The class to use for utility values.
boolean minNCCCs
 Whether to optimize runtime or constraint checks.

Detailed Description

JUnit test for the class UTILpropagation.

Author
Thomas Leaute
Parameters
<U>the type used for utility values

Constructor & Destructor Documentation

◆ UTILpropagationTest() [1/2]

Constructor that instantiates a test only for the input method.

Parameters
methodtest method

Referenced by suite().

◆ UTILpropagationTest() [2/2]

frodo2.algorithms.dpop.test.UTILpropagationTest< U extends Addable< U > >.UTILpropagationTest ( boolean useTCP,
boolean useXML,
Class< U > utilClass,
boolean minNCCCs )

Constructor.

Parameters
useTCPwhether to use TCP pipes or shared memory pipes
useXMLwhether to use the XML-based constructor
utilClassthe class to use for utility values
minNCCCswhether to optimize runtime or constraint checks

References maximize, minNCCCs, useTCP, useXML, and utilClass.

Member Function Documentation

◆ computeDFS() [1/2]

◆ computeDFS() [2/2]

static< V extends Addable< V > U extends Addable< U > Map< String, DFSview< V, U > > frodo2.algorithms.dpop.test.UTILpropagationTest< U extends Addable< U > >.computeDFS ( Graph graph,
DCOPProblemInterface< V, U > problem,
boolean withSharedVars )
static
Bug
the spaces must come for the agent's subproblem to correctly count NCCCs

References frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.DFSview< V extends Addable< V >, U extends Addable< U > >.addChild(), frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.DFSview< V extends Addable< V >, U extends Addable< U > >.addPseudoChild(), frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.DFSview< V extends Addable< V >, U extends Addable< U > >.addPseudoParent(), 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(), frodo2.solutionSpaces.DCOPProblemInterface< V extends Addable< V >, U extends Addable< U > >.getOwner(), frodo2.solutionSpaces.DCOPProblemInterface< V extends Addable< V >, U extends Addable< U > >.getSolutionSpaces(), graph, frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.DFSview< V extends Addable< V >, U extends Addable< U > >.setParent(), and frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.DFSview< V extends Addable< V >, U extends Addable< U > >.setSpaces().

Here is the call graph for this function:

◆ newListenerInstance()

Listener frodo2.algorithms.dpop.test.UTILpropagationTest< U extends Addable< U > >.newListenerInstance ( boolean useTCP,
boolean useXML,
Element parameters ) throws Exception
protected

Creates a new Listener.

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
Returns
the new listener
Exceptions
Exceptionif an error occurs

Reimplemented in frodo2.algorithms.dpop.param.test.ParamUTILtest< U extends Addable< U > >, and frodo2.algorithms.dpop.stochastic.test.ExpectedUTILtest.

References parameters, useTCP, and useXML.

Referenced by test().

◆ setUp()

◆ startUTIL()

static< U extends Addable< U > Map< String, UtilitySolutionSpace< AddableInteger, U > > frodo2.algorithms.dpop.test.UTILpropagationTest< U extends Addable< U > >.startUTIL ( RandGraphFactory.Graph graph,
Map< String, DFSview< AddableInteger, U > > dfs,
Map< String, Queue > queues,
List< ? extends UtilitySolutionSpace< AddableInteger, U > > constraints )
static

Sends messages to the queues to initiate the UTIL propagation.

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
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, frodo2.solutionSpaces.UtilitySolutionSpace< V extends Addable< V >, U extends Addable< U > >.join(), queues, frodo2.communication.Queue.sendMessageToSelf(), and frodo2.algorithms.AgentInterface< V extends Addable< V > >.START_AGENT.

Referenced by frodo2.algorithms.dpop.test.UTILpropagationTest< U extends Addable< U > >.Listener.waitForOutputs(), and frodo2.algorithms.dpop.test.VALUEpropagationTest< U extends Addable< U > >.Listener.waitForOutputs().

Here is the call graph for this function:

◆ suite()

TestSuite frodo2.algorithms.dpop.test.UTILpropagationTest< U extends Addable< U > >.suite ( )
static
Returns
the test suite for this test

Reimplemented in frodo2.algorithms.dpop.param.test.ParamUTILtest< U extends Addable< U > >, and frodo2.algorithms.dpop.stochastic.test.ExpectedUTILtest.

References UTILpropagationTest().

Referenced by frodo2.algorithms.dpop.test.AllTestsDPOP.suite().

Here is the call graph for this function:

◆ tearDown()

void frodo2.algorithms.dpop.test.UTILpropagationTest< U extends Addable< U > >.tearDown ( ) throws Exception
protected

Ends all queues.

See also
junit.framework.TestCase#tearDown()

References dfs, graph, parameters, queues, and separators.

◆ test()

void frodo2.algorithms.dpop.test.UTILpropagationTest< U extends Addable< U > >.test ( ) throws Exception

Tests the UTIL propagation protocol on a random graph.

Exceptions
Exceptionif an error occurs

References newListenerInstance(), useTCP, useXML, and frodo2.algorithms.dpop.test.UTILpropagationTest< U extends Addable< U > >.Listener.waitForOutputs().

Here is the call graph for this function:

◆ testComputeDFS()

Member Data Documentation

◆ dfs

◆ graph

◆ maximize

◆ maxNbrAgents

final int frodo2.algorithms.dpop.test.UTILpropagationTest< U extends Addable< U > >.maxNbrAgents = 10
protected

Maximum number of agents.

Referenced by setUp().

◆ maxNbrEdges

final int frodo2.algorithms.dpop.test.UTILpropagationTest< U extends Addable< U > >.maxNbrEdges = 40
protected

Maximum number of edges in the random graph.

Referenced by setUp().

◆ maxNbrVars

final int frodo2.algorithms.dpop.test.UTILpropagationTest< U extends Addable< U > >.maxNbrVars = 10
protected

Maximum number of variables in the random graph.

Note
Must be at least 2.

Referenced by setUp().

◆ minNCCCs

boolean frodo2.algorithms.dpop.test.UTILpropagationTest< U extends Addable< U > >.minNCCCs
private

Whether to optimize runtime or constraint checks.

Referenced by setUp(), and UTILpropagationTest().

◆ parameters

◆ queues

◆ separators

◆ sign

int frodo2.algorithms.dpop.test.UTILpropagationTest< U extends Addable< U > >.sign = 0
protected

The desired sign for the utilities (if 0, utilities can be either sign).

Referenced by frodo2.algorithms.dpop.test.UTILpropagationTest< U extends Addable< U > >.Listener.Listener(), and testComputeDFS().

◆ useTCP

◆ useXML

◆ utilClass


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