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

JUnit tests for the DSA algorithm. More...

Inheritance diagram for frodo2.algorithms.localSearch.dsa.tests.TestDSA< U extends Addable< U > >:

Public Member Functions

 TestDSA (String name, String strategy, boolean maximize, Class< U > utilClass)
void testStrategyA ()
 Test the strategy A.
void testStrategyC ()
 Test the strategy C.
void testStrategyE ()
 Test the strategy E.

Static Public Member Functions

static TestSuite suite ()

Protected Member Functions

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

Private Attributes

final int maxNbrVars = 40
 Maximum number of variables in the problem.
final int maxNbrEdges = 800
 Maximum number of binary constraints in the problem.
final int maxNbrAgents = 10
 Maximum number of agents.
XCSPparser< AddableInteger, U > problem
 A random problem used to test.
String agent
 The agent for which the decision strategy is to be tested.
String variable
 The variable for which the decision strategy is to be tested.
AddableInteger[] ownDomain
 The domain of variable.
int domainSize
 The size of ownDomain.
String[] neighbours
 The neighboring variables of variable.
int numberOfNeighbours
 The number of neighbours.
AddableInteger initialValue
 The initial value of variable.
AddableInteger[] context
 Array for storing the context values.
String[] contextVariables
 Array for storing the context variables.
List< ? extends UtilitySolutionSpace< AddableInteger, U > > spaces
 A list of spaces known by agent.
XCSPparser< AddableInteger, U > subProblem
 The subproblem belonging to the agent.
boolean maximize
 true when the problem is a maximization problem, and false otherwise
optimal
 The utility of the optimal assignment.
originalUtil
 The utility of the original assignment.
AddableInteger optimalValue
 The optimal value assignment given the context.
AddableInteger value
 The final value of the variable.
Queue q
 The queue used to send messages.
Queue q2
 Dummy queue to be used as a sink.
Element parameters
 The modules parameters.
DSA< AddableInteger, U > module
 Instance of the module to be tested.
String strategy
 Decision strategy to be tested.
int comparison
 The difference between the optimal utility and the current utility.
Class< U > utilClass
 The class used for utility values.

Detailed Description

JUnit tests for the DSA algorithm.

Since DSA it is not complete, the only things that can be tested are the different decision strategies.

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

Constructor & Destructor Documentation

◆ TestDSA()

frodo2.algorithms.localSearch.dsa.tests.TestDSA< U extends Addable< U > >.TestDSA ( String name,
String strategy,
boolean maximize,
Class< U > utilClass )
Parameters
namethe name of the test to be performed
strategythe strategy to be tested
maximizewhether to maximize or minimize
utilClassthe type used for utility values

References maximize, strategy, and utilClass.

Referenced by suite().

Member Function Documentation

◆ setUp()

◆ suite()

TestSuite frodo2.algorithms.localSearch.dsa.tests.TestDSA< U extends Addable< U > >.suite ( )
static
Returns
the test suite

References suite(), and TestDSA().

Referenced by frodo2.algorithms.localSearch.dsa.tests.AllTestsDSA.suite(), and suite().

Here is the call graph for this function:

◆ tearDown()

void frodo2.algorithms.localSearch.dsa.tests.TestDSA< U extends Addable< U > >.tearDown ( ) throws Exception
protected
See also
junit.framework.TestCase#tearDown()

References q, and q2.

◆ testStrategyA()

void frodo2.algorithms.localSearch.dsa.tests.TestDSA< U extends Addable< U > >.testStrategyA ( )

Test the strategy A.

Author
Brammert Ottens, 11 aug 2009

References comparison, initialValue, optimalValue, and value.

◆ testStrategyC()

void frodo2.algorithms.localSearch.dsa.tests.TestDSA< U extends Addable< U > >.testStrategyC ( )

Test the strategy C.

Author
Brammert Ottens, 11 aug 2009

References comparison, initialValue, optimalValue, and value.

◆ testStrategyE()

void frodo2.algorithms.localSearch.dsa.tests.TestDSA< U extends Addable< U > >.testStrategyE ( )

Test the strategy E.

Author
Brammert Ottens, 11 aug 2009

References comparison, initialValue, module, optimal, value, and variable.

Member Data Documentation

◆ agent

String frodo2.algorithms.localSearch.dsa.tests.TestDSA< U extends Addable< U > >.agent
private

The agent for which the decision strategy is to be tested.

Referenced by setUp().

◆ comparison

int frodo2.algorithms.localSearch.dsa.tests.TestDSA< U extends Addable< U > >.comparison
private

The difference between the optimal utility and the current utility.

Referenced by setUp(), testStrategyA(), testStrategyC(), and testStrategyE().

◆ context

Array for storing the context values.

Referenced by setUp().

◆ contextVariables

String [] frodo2.algorithms.localSearch.dsa.tests.TestDSA< U extends Addable< U > >.contextVariables
private

Array for storing the context variables.

Referenced by setUp().

◆ domainSize

int frodo2.algorithms.localSearch.dsa.tests.TestDSA< U extends Addable< U > >.domainSize
private

The size of ownDomain.

Referenced by setUp().

◆ initialValue

The initial value of variable.

Referenced by setUp(), testStrategyA(), testStrategyC(), and testStrategyE().

◆ maximize

boolean frodo2.algorithms.localSearch.dsa.tests.TestDSA< U extends Addable< U > >.maximize
private

true when the problem is a maximization problem, and false otherwise

Referenced by setUp(), and TestDSA().

◆ maxNbrAgents

final int frodo2.algorithms.localSearch.dsa.tests.TestDSA< U extends Addable< U > >.maxNbrAgents = 10
private

Maximum number of agents.

Referenced by setUp().

◆ maxNbrEdges

final int frodo2.algorithms.localSearch.dsa.tests.TestDSA< U extends Addable< U > >.maxNbrEdges = 800
private

Maximum number of binary constraints in the problem.

Referenced by setUp().

◆ maxNbrVars

final int frodo2.algorithms.localSearch.dsa.tests.TestDSA< U extends Addable< U > >.maxNbrVars = 40
private

Maximum number of variables in the problem.

Note
Must be at least 2.

Referenced by setUp().

◆ module

Instance of the module to be tested.

Referenced by setUp(), and testStrategyE().

◆ neighbours

String [] frodo2.algorithms.localSearch.dsa.tests.TestDSA< U extends Addable< U > >.neighbours
private

The neighboring variables of variable.

Referenced by setUp().

◆ numberOfNeighbours

int frodo2.algorithms.localSearch.dsa.tests.TestDSA< U extends Addable< U > >.numberOfNeighbours
private

The number of neighbours.

Referenced by setUp().

◆ optimal

U frodo2.algorithms.localSearch.dsa.tests.TestDSA< U extends Addable< U > >.optimal
private

The utility of the optimal assignment.

Referenced by setUp(), and testStrategyE().

◆ optimalValue

The optimal value assignment given the context.

Referenced by setUp(), testStrategyA(), and testStrategyC().

◆ originalUtil

U frodo2.algorithms.localSearch.dsa.tests.TestDSA< U extends Addable< U > >.originalUtil
private

The utility of the original assignment.

Referenced by setUp().

◆ ownDomain

The domain of variable.

Referenced by setUp().

◆ parameters

Element frodo2.algorithms.localSearch.dsa.tests.TestDSA< U extends Addable< U > >.parameters
private

The modules parameters.

Referenced by setUp().

◆ problem

A random problem used to test.

Referenced by setUp().

◆ q

The queue used to send messages.

Referenced by setUp(), and tearDown().

◆ q2

Dummy queue to be used as a sink.

Referenced by setUp(), and tearDown().

◆ spaces

List< ? extends UtilitySolutionSpace<AddableInteger, U> > frodo2.algorithms.localSearch.dsa.tests.TestDSA< U extends Addable< U > >.spaces
private

A list of spaces known by agent.

Referenced by setUp().

◆ strategy

String frodo2.algorithms.localSearch.dsa.tests.TestDSA< U extends Addable< U > >.strategy
private

Decision strategy to be tested.

Referenced by setUp(), and TestDSA().

◆ subProblem

The subproblem belonging to the agent.

Referenced by setUp().

◆ utilClass

Class<U> frodo2.algorithms.localSearch.dsa.tests.TestDSA< U extends Addable< U > >.utilClass
private

The class used for utility values.

Referenced by setUp(), and TestDSA().

◆ value

The final value of the variable.

Referenced by setUp(), testStrategyA(), testStrategyC(), and testStrategyE().

◆ variable

String frodo2.algorithms.localSearch.dsa.tests.TestDSA< U extends Addable< U > >.variable
private

The variable for which the decision strategy is to be tested.

Referenced by setUp(), and testStrategyE().


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