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

JUnit test for the class VALUEpropagation. More...

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

Classes

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

Public Member Functions

 VALUEpropagationTest (boolean useTCP, boolean useXML, Class< U > utilClass)
 Constructor.
void test () throws Exception
 Tests the UTIL and VALUE propagation protocols on a random graph.

Static Public Member Functions

static TestSuite suite ()

Protected Member Functions

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

Protected Attributes

Map< String, Queuequeues = new HashMap<String, Queue> ()
 List of queues, indexed by agent name.
RandGraphFactory.Graph graph
 Random graph used to generate a constraint graph.
Map< String, DFSview< AddableInteger, U > > dfs
 The DFS corresponding to the random graph.
boolean maximize
 Whether we should maximize or minimize.
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.

Private 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.
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.
Map< String, AddableIntegeroptAssignments
 The optimal assignment to each variable.

Detailed Description

JUnit test for the class VALUEpropagation.

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

Constructor & Destructor Documentation

◆ VALUEpropagationTest()

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

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

References maximize, useTCP, useXML, and utilClass.

Referenced by suite().

Member Function Documentation

◆ newListenerInstance()

Listener frodo2.algorithms.dpop.test.VALUEpropagationTest< U extends Addable< U > >.newListenerInstance ( boolean useTCP,
boolean useXML ) 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
Returns
the new listener
Exceptions
Exceptionif an error occurs

Reimplemented in frodo2.algorithms.dpop.param.test.ParamVALUEtest< U extends Addable< U > >.

References newListenerInstance(), useTCP, and useXML.

Referenced by newListenerInstance(), and test().

Here is the call graph for this function:

◆ setUp()

void frodo2.algorithms.dpop.test.VALUEpropagationTest< U extends Addable< U > >.setUp ( )
protected
See also
junit.framework.TestCase#setUp()

Reimplemented in frodo2.algorithms.dpop.param.test.ParamVALUEtest< U extends Addable< U > >.

References frodo2.algorithms.RandGraphFactory.getRandGraph(), graph, maximize, maxNbrAgents, maxNbrEdges, maxNbrVars, and optAssignments.

Here is the call graph for this function:

◆ suite()

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

Reimplemented in frodo2.algorithms.dpop.param.test.ParamVALUEtest< U extends Addable< U > >.

References VALUEpropagationTest().

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

Here is the call graph for this function:

◆ tearDown()

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

Ends all queues.

See also
junit.framework.TestCase#tearDown()

Reimplemented in frodo2.algorithms.dpop.param.test.ParamVALUEtest< U extends Addable< U > >.

References dfs, graph, optAssignments, and queues.

◆ test()

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

Tests the UTIL and VALUE propagation protocols on a random graph.

Exceptions
Exceptionif an error occurs

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

Here is the call graph for this function:

Member Data Documentation

◆ dfs

◆ finished

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

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

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

◆ finished_lock

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

◆ graph

◆ maximize

◆ maxNbrAgents

final int frodo2.algorithms.dpop.test.VALUEpropagationTest< U extends Addable< U > >.maxNbrAgents = 10
private

Maximum number of agents.

Referenced by setUp().

◆ maxNbrEdges

final int frodo2.algorithms.dpop.test.VALUEpropagationTest< U extends Addable< U > >.maxNbrEdges = 40
private

Maximum number of edges in the random graph.

Referenced by setUp().

◆ maxNbrVars

final int frodo2.algorithms.dpop.test.VALUEpropagationTest< U extends Addable< U > >.maxNbrVars = 10
private

Maximum number of variables in the random graph.

Note
Must be at least 2.

Referenced by setUp().

◆ nbrMsgsRemaining

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

◆ optAssignments

◆ queues

◆ useTCP

◆ useXML

◆ utilClass


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