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

JUnit tests for Util reuse in S-DPOP. More...

Inheritance diagram for frodo2.algorithms.dpop.restart.test.TestSDPOP< V extends Addable< V >, U extends Addable< U > >:

Public Member Functions

 TestSDPOP (String method, Class< V > domClass, Class< U > utilClass)
 Constructor.
void testCorrectness ()
 running the test by comparing Solution of S-DPOP to solution of DPOP
Solution< V, U > testGeneric (int changeType)
 provides a generic test method which takes the test type as argument
void testAddDisconnected ()
 Add a disconnected variable to the problem, no UTIL message should be sent.
void testAddOneToRoot ()
 adds a single variable to the root, only 1 util-msg should be sent
void testChangeLeafVariableName ()
 change the name of a leaf variable with no backedges, only 1 util-msg should be sent
void testReuse ()
 Checks that no UTIL message is sent when the problem doesn't change.

Static Public Member Functions

static TestSuite suite ()
static Document modifyProblemRandomly (Document problem, double nodeRatio)

Static Public Attributes

static int maxNbrVars = 10
 Maximum number of variables.
static int maxNbrEdges = 40
 Maximum number of edges in the primal constraint graph.
static int maxNbrAgents = 10
 Maximum number of agents.
static final int TEST_RANDOM_CHANGE = 1
 test type
static final int TEST_CHANGE_LEAF_NAME = 2
 test type
static final int TEST_ADD_ROOT_NEIGHBOR = 3
 test type
static final int TEST_ADD_DISCONNECTED = 4
 test type
static double changeRatio = 0.5
 Probability of changing any given relation when randomly modifying problem.

Protected Member Functions

void setUp () throws Exception
void tearDown ()

Private Member Functions

Document changeLeafName (Document problem2)
 changes name of one leaf variable with no back-edges
Document addDisconnected (Document problem2)
 adds one disconnected variable to the problem
Document addRootNeighbor (Document problem2)
 adds a neighbor to the root of the problem

Private Attributes

Document SDPOPagent = null
 S-DPOP agent.
Document DPOPagent = null
 DPOP agent.
DPOPsolver< V, U > DPOPsolver = null
 DPOP solver.
DPOPsolver< V, U > SDPOPsolver = null
 S-DPOP solver.
Document problem = null
 The problem.
Class< V > domClass
 The class used for variable values.
Class< U > utilClass
 The class used for utility values.

Detailed Description

JUnit tests for Util reuse in S-DPOP.

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

Constructor & Destructor Documentation

◆ TestSDPOP()

frodo2.algorithms.dpop.restart.test.TestSDPOP< V extends Addable< V >, U extends Addable< U > >.TestSDPOP ( String method,
Class< V > domClass,
Class< U > utilClass )

Constructor.

Parameters
methodthe name of the test method
domClassThe class used for variable values
utilClassThe class used for utility values

References domClass, and utilClass.

Referenced by suite().

Member Function Documentation

◆ addDisconnected()

Document frodo2.algorithms.dpop.restart.test.TestSDPOP< V extends Addable< V >, U extends Addable< U > >.addDisconnected ( Document problem2)
private

adds one disconnected variable to the problem

Parameters
problem2original problem
Returns
modified problem

Referenced by testGeneric().

◆ addRootNeighbor()

Document frodo2.algorithms.dpop.restart.test.TestSDPOP< V extends Addable< V >, U extends Addable< U > >.addRootNeighbor ( Document problem2)
private

adds a neighbor to the root of the problem

Parameters
problem2original problem
Returns
modified problem
Todo
for this I will need to know the (or a) root of the problem

Referenced by testGeneric().

◆ changeLeafName()

Document frodo2.algorithms.dpop.restart.test.TestSDPOP< V extends Addable< V >, U extends Addable< U > >.changeLeafName ( Document problem2)
private

changes name of one leaf variable with no back-edges

Parameters
problem2original problem
Returns
modified problem
Todo
: for this I will need to identify leafs without roots, which is a bit tricky...

Referenced by testGeneric().

◆ modifyProblemRandomly()

Document frodo2.algorithms.dpop.restart.test.TestSDPOP< V extends Addable< V >, U extends Addable< U > >.modifyProblemRandomly ( Document problem,
double nodeRatio )
static
Parameters
problemthe initial problem
nodeRatioprobability of changing any given relation
Returns
the modified problem

References problem.

Referenced by testGeneric().

◆ setUp()

void frodo2.algorithms.dpop.restart.test.TestSDPOP< V extends Addable< V >, U extends Addable< U > >.setUp ( ) throws Exception
protected

◆ suite()

TestSuite frodo2.algorithms.dpop.restart.test.TestSDPOP< V extends Addable< V >, U extends Addable< U > >.suite ( )
static
Returns
the test suite
Todo
: implement and add the rest of the tests

References suite(), and TestSDPOP().

Referenced by frodo2.algorithms.dpop.restart.test.AllTestsS_DPOP.suite(), and suite().

Here is the call graph for this function:

◆ tearDown()

void frodo2.algorithms.dpop.restart.test.TestSDPOP< V extends Addable< V >, U extends Addable< U > >.tearDown ( )
protected
See also
junit.framework.TestCase#tearDown()

◆ testAddDisconnected()

void frodo2.algorithms.dpop.restart.test.TestSDPOP< V extends Addable< V >, U extends Addable< U > >.testAddDisconnected ( )

Add a disconnected variable to the problem, no UTIL message should be sent.

References frodo2.algorithms.Solution< V, U >.getMsgNbrs(), TEST_ADD_DISCONNECTED, testGeneric(), and frodo2.algorithms.dpop.UTILpropagation< Val extends Addable< Val >, U extends Addable< U > >.UTIL_MSG_TYPE.

Here is the call graph for this function:

◆ testAddOneToRoot()

void frodo2.algorithms.dpop.restart.test.TestSDPOP< V extends Addable< V >, U extends Addable< U > >.testAddOneToRoot ( )

adds a single variable to the root, only 1 util-msg should be sent

Todo
assertions

References TEST_ADD_ROOT_NEIGHBOR, and testGeneric().

Here is the call graph for this function:

◆ testChangeLeafVariableName()

void frodo2.algorithms.dpop.restart.test.TestSDPOP< V extends Addable< V >, U extends Addable< U > >.testChangeLeafVariableName ( )

change the name of a leaf variable with no backedges, only 1 util-msg should be sent

Todo
assertions

References TEST_CHANGE_LEAF_NAME, and testGeneric().

Here is the call graph for this function:

◆ testCorrectness()

void frodo2.algorithms.dpop.restart.test.TestSDPOP< V extends Addable< V >, U extends Addable< U > >.testCorrectness ( )

running the test by comparing Solution of S-DPOP to solution of DPOP

References TEST_RANDOM_CHANGE, and testGeneric().

Here is the call graph for this function:

◆ testGeneric()

◆ testReuse()

Member Data Documentation

◆ changeRatio

double frodo2.algorithms.dpop.restart.test.TestSDPOP< V extends Addable< V >, U extends Addable< U > >.changeRatio = 0.5
static

Probability of changing any given relation when randomly modifying problem.

Referenced by testGeneric().

◆ domClass

Class<V> frodo2.algorithms.dpop.restart.test.TestSDPOP< V extends Addable< V >, U extends Addable< U > >.domClass
private

The class used for variable values.

Referenced by TestSDPOP().

◆ DPOPagent

Document frodo2.algorithms.dpop.restart.test.TestSDPOP< V extends Addable< V >, U extends Addable< U > >.DPOPagent = null
private

DPOP agent.

Referenced by setUp().

◆ DPOPsolver

DPOPsolver<V, U> frodo2.algorithms.dpop.restart.test.TestSDPOP< V extends Addable< V >, U extends Addable< U > >.DPOPsolver = null
private

DPOP solver.

Referenced by setUp(), testGeneric(), and testReuse().

◆ maxNbrAgents

int frodo2.algorithms.dpop.restart.test.TestSDPOP< V extends Addable< V >, U extends Addable< U > >.maxNbrAgents = 10
static

Maximum number of agents.

Referenced by setUp().

◆ maxNbrEdges

int frodo2.algorithms.dpop.restart.test.TestSDPOP< V extends Addable< V >, U extends Addable< U > >.maxNbrEdges = 40
static

Maximum number of edges in the primal constraint graph.

Referenced by setUp().

◆ maxNbrVars

int frodo2.algorithms.dpop.restart.test.TestSDPOP< V extends Addable< V >, U extends Addable< U > >.maxNbrVars = 10
static

Maximum number of variables.

Referenced by setUp().

◆ problem

Document frodo2.algorithms.dpop.restart.test.TestSDPOP< V extends Addable< V >, U extends Addable< U > >.problem = null
private

The problem.

Referenced by modifyProblemRandomly(), testGeneric(), and testReuse().

◆ SDPOPagent

Document frodo2.algorithms.dpop.restart.test.TestSDPOP< V extends Addable< V >, U extends Addable< U > >.SDPOPagent = null
private

S-DPOP agent.

Referenced by testGeneric(), and testReuse().

◆ SDPOPsolver

DPOPsolver<V, U> frodo2.algorithms.dpop.restart.test.TestSDPOP< V extends Addable< V >, U extends Addable< U > >.SDPOPsolver = null
private

S-DPOP solver.

Referenced by testGeneric(), and testReuse().

◆ TEST_ADD_DISCONNECTED

final int frodo2.algorithms.dpop.restart.test.TestSDPOP< V extends Addable< V >, U extends Addable< U > >.TEST_ADD_DISCONNECTED = 4
static

test type

Referenced by testAddDisconnected(), and testGeneric().

◆ TEST_ADD_ROOT_NEIGHBOR

final int frodo2.algorithms.dpop.restart.test.TestSDPOP< V extends Addable< V >, U extends Addable< U > >.TEST_ADD_ROOT_NEIGHBOR = 3
static

test type

Referenced by testAddOneToRoot(), and testGeneric().

◆ TEST_CHANGE_LEAF_NAME

final int frodo2.algorithms.dpop.restart.test.TestSDPOP< V extends Addable< V >, U extends Addable< U > >.TEST_CHANGE_LEAF_NAME = 2
static

test type

Referenced by testChangeLeafVariableName(), and testGeneric().

◆ TEST_RANDOM_CHANGE

final int frodo2.algorithms.dpop.restart.test.TestSDPOP< V extends Addable< V >, U extends Addable< U > >.TEST_RANDOM_CHANGE = 1
static

test type

Todo
Use an enum instead

Referenced by testCorrectness(), and testGeneric().

◆ utilClass

Class<U> frodo2.algorithms.dpop.restart.test.TestSDPOP< V extends Addable< V >, U extends Addable< U > >.utilClass
private

The class used for utility values.

Referenced by TestSDPOP().


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