FRODO Version 2.19.1
An open-source framework for Distributed Constraint Optimization (DCOP)
Loading...
Searching...
No Matches
frodo2.algorithms.test.XCSPparserTest Class Reference

Test suite for XCSPparser. More...

Inheritance diagram for frodo2.algorithms.test.XCSPparserTest:

Public Member Functions

 XCSPparserTest (String name)
 Generates a test using the specified method.
 XCSPparserTest (String name, boolean maximize)
 Generates a test using the specified method.
 XCSPparserTest (String name, boolean extendedRandNeighborhoods, boolean publicAgents)
 Generates a test using the specified method.
void testGetZeroUtility ()
 Test method for getZeroUtility().
void testGetPlusInfUtility ()
 Test method for getPlusInfUtility().
void testGetMinInfUtility ()
 Test method for getMinInfUtility().
void testGetAgents ()
 Test method for XCSPparser.getAgents().
void testGetOwner ()
 Test method for XCSPparser.getOwner(java.lang.String).
void testGetOwners ()
 Test method for XCSPparser.getOwners().
void testGetNbrVars ()
 Test method for XCSPparser.getNbrVars().
void testGetNbrVarsString ()
 Test method for XCSPparser.getNbrVars(java.lang.String).
void testGetVariables ()
 Test method for XCSPparser.getVariables().
void testGetVariablesString ()
 Test method for XCSPparser.getVariables(java.lang.String).
void testGetExtVars ()
 Test method for XCSPparser.getExtVars().
void testGetNeighborVars ()
 Test method for XCSPparser.getNeighborVars(java.lang.String).
void testGetNeighborVarsWithAnonymVars ()
 Test method for XCSPparser.getNeighborVars(java.lang.String, boolean).
void testGetNeighborVars (boolean withAnonymVars)
 Test for getNeighborVars.
void testGetNbrNeighbors ()
 Test method for XCSPparser.getNbrNeighbors(java.lang.String).
void testGetNeighborhoods ()
 Test method for XCSPparser.getNeighborhoods(java.lang.String).
void testGetAnonymNeighborhoods ()
 Test method for XCSPparser.getAnonymNeighborhoods(java.lang.String).
void testGetNeighborhoodSizes ()
 Test method for XCSPparser.getNeighborhoodSizes(java.lang.String).
void testGetAgentNeighborhoods ()
 Test method for XCSPparser.getAgentNeighborhoods(java.lang.String).
void testGetDomainSize ()
 Test method for XCSPparser.getDomainSize(java.lang.String).
void testGetDomain () throws JDOMException
 Test method for frodo2.algorithms.XCSPparser.getDomain(java.lang.String).
void testSetDomain ()
 Tests the setDomain() method.
void testGetSubProblem ()
 Test method for XCSPparser.getSubProblem(String).
void testIsRandom () throws JDOMException
 Test method for frodo2.algorithms.XCSPparser.isRandom(java.lang.String).
void testGetSolutionSpacesWithRandVars ()
 Test method for getSolutionSpaces() with random variables.
void testGetSolutionSpaces ()
 Test method for getSolutionSpaces() ignoring random variables.
void testGetProbabilitySpaces ()
 Test method for getProbabilitySpaces().
void testGetSolutionSpacesForVarWithRandVars ()
 Test method for getSolutionSpaces(String) with random variables.
void testGetSolutionSpacesForVar ()
 Test method for getSolutionSpaces(String) ignoring random variables.
void testGetProbabilitySpacesForVar ()
 Test method for getProbabilitySpaces(String).
void testGetUtility ()
 Test for the method getUtility() on complete assignments.
void testMaximize ()
 Test for the method maximize().

Static Public Member Functions

static TestSuite suite ()

Protected Member Functions

void setUp ()
void tearDown () throws Exception
Map< String, ? extends Collection< String > > getNeighborhoods (final boolean withAnonymVars)
 Computes the correct neighborhoods.
void testGetSolutionSpaces (DCOPProblemInterface< AddableInteger, AddableReal > problem, List< ? extends UtilitySolutionSpace< AddableInteger, AddableReal > > refSpaces, String var, final boolean withRandVars)
 Test method for getSolutionSpaces(String, boolean).

Protected Attributes

RandGraphFactory.Graph graph
 Random graph used to generate a constraint graph.
Document probDoc
 Random XCSP problem.
XCSPparser< AddableInteger, AddableRealparser
 The parser.
DCOPProblemInterface< AddableInteger, AddableRealprob
 The parsed problem instance.
ArrayList< Hypercube< AddableInteger, AddableReal > > solutionSpaces = new ArrayList< Hypercube<AddableInteger, AddableReal> > ()
 The list of solution spaces in the problem.
ArrayList< Hypercube< AddableInteger, AddableReal > > probSpaces = new ArrayList< Hypercube<AddableInteger, AddableReal> > ()
 The list of probability spaces in the problem.

Private Member Functions

HashSet< String > getExtendedRandNeighbors (String var)
 Builds the set of all random variables reachable from var by paths involving only random variables.
void testGetNeighborhoods (final boolean onlyAnonymVars)
 Test for XCSPparser.getNeighborhoods(java.lang.String) and XCSPparser.getAnonymNeighborhoods(java.lang.String).
void testGetSolutionSpacesForVar (final boolean withRandVars)
 Test method for getSolutionSpaces(String, boolean).

Private Attributes

final boolean maximize
 Whether to test on maximization problems.
final int maxNbrVars = 15
 Maximum number of variables in the random graph.
final int maxNbrEdges = 100
 Maximum number of edges in the random graph.
final int maxNbrAgents = 5
 Maximum number of agents.
boolean extendedRandNeighborhoods
 Whether we want extended random neighborhoods.
boolean publicAgents = false
 Whether each agent knows the identities of all agents.

Detailed Description

Test suite for XCSPparser.

Author
Thomas Leaute
Todo
Fully test extendedRandNeighborhoods

Constructor & Destructor Documentation

◆ XCSPparserTest() [1/3]

frodo2.algorithms.test.XCSPparserTest.XCSPparserTest ( String name)

Generates a test using the specified method.

Parameters
namename of the method

Referenced by suite().

◆ XCSPparserTest() [2/3]

frodo2.algorithms.test.XCSPparserTest.XCSPparserTest ( String name,
boolean maximize )

Generates a test using the specified method.

Parameters
namename of the method
maximizewhether to test on maximization problems

References maximize.

◆ XCSPparserTest() [3/3]

frodo2.algorithms.test.XCSPparserTest.XCSPparserTest ( String name,
boolean extendedRandNeighborhoods,
boolean publicAgents )

Generates a test using the specified method.

Parameters
namename of the method
extendedRandNeighborhoodswhether we want extended random neighborhoods
publicAgentsWhether each agent knows the identities of all agents

References extendedRandNeighborhoods, and publicAgents.

Member Function Documentation

◆ getExtendedRandNeighbors()

HashSet< String > frodo2.algorithms.test.XCSPparserTest.getExtendedRandNeighbors ( String var)
private

Builds the set of all random variables reachable from var by paths involving only random variables.

Parameters
varthe input variable
Returns
the extended random neighbors of var

References frodo2.solutionSpaces.DCOPProblemInterface< V extends Addable< V >, U extends Addable< U > >.isRandom().

Referenced by getNeighborhoods(), and testGetSubProblem().

Here is the call graph for this function:

◆ getNeighborhoods()

Map< String, ? extends Collection< String > > frodo2.algorithms.test.XCSPparserTest.getNeighborhoods ( final boolean withAnonymVars)
protected

◆ setUp()

void frodo2.algorithms.test.XCSPparserTest.setUp ( )
protected

◆ suite()

TestSuite frodo2.algorithms.test.XCSPparserTest.suite ( )
static
Returns
the test suite for this test

References suite(), and XCSPparserTest().

Referenced by frodo2.algorithms.test.AllTests.suite(), and suite().

Here is the call graph for this function:

◆ tearDown()

void frodo2.algorithms.test.XCSPparserTest.tearDown ( ) throws Exception
protected
See also
junit.framework.TestCase#tearDown()

References graph, parser, and probDoc.

◆ testGetAgentNeighborhoods()

void frodo2.algorithms.test.XCSPparserTest.testGetAgentNeighborhoods ( )

◆ testGetAgents()

void frodo2.algorithms.test.XCSPparserTest.testGetAgents ( )

Test method for XCSPparser.getAgents().

References graph, and prob.

◆ testGetAnonymNeighborhoods()

void frodo2.algorithms.test.XCSPparserTest.testGetAnonymNeighborhoods ( )

Test method for XCSPparser.getAnonymNeighborhoods(java.lang.String).

References testGetNeighborhoods().

Here is the call graph for this function:

◆ testGetDomain()

void frodo2.algorithms.test.XCSPparserTest.testGetDomain ( ) throws JDOMException

◆ testGetDomainSize()

◆ testGetExtVars()

◆ testGetMinInfUtility()

void frodo2.algorithms.test.XCSPparserTest.testGetMinInfUtility ( )

Test method for getMinInfUtility().

References frodo2.solutionSpaces.AddableReal.add(), frodo2.solutionSpaces.AddableReal.equals(), and prob.

Here is the call graph for this function:

◆ testGetNbrNeighbors()

void frodo2.algorithms.test.XCSPparserTest.testGetNbrNeighbors ( )

◆ testGetNbrVars()

void frodo2.algorithms.test.XCSPparserTest.testGetNbrVars ( )

Test method for XCSPparser.getNbrVars().

References graph, and prob.

◆ testGetNbrVarsString()

void frodo2.algorithms.test.XCSPparserTest.testGetNbrVarsString ( )

Test method for XCSPparser.getNbrVars(java.lang.String).

References graph, and prob.

◆ testGetNeighborhoods() [1/2]

void frodo2.algorithms.test.XCSPparserTest.testGetNeighborhoods ( )

Test method for XCSPparser.getNeighborhoods(java.lang.String).

References testGetNeighborhoods().

Referenced by testGetAnonymNeighborhoods(), and testGetNeighborhoods().

Here is the call graph for this function:

◆ testGetNeighborhoods() [2/2]

void frodo2.algorithms.test.XCSPparserTest.testGetNeighborhoods ( final boolean onlyAnonymVars)
private

Test for XCSPparser.getNeighborhoods(java.lang.String) and XCSPparser.getAnonymNeighborhoods(java.lang.String).

Parameters
onlyAnonymVarswhether we are only interested in random neighbors

References getNeighborhoods(), graph, frodo2.solutionSpaces.DCOPProblemInterface< V extends Addable< V >, U extends Addable< U > >.isRandom(), and prob.

Here is the call graph for this function:

◆ testGetNeighborhoodSizes()

void frodo2.algorithms.test.XCSPparserTest.testGetNeighborhoodSizes ( )

◆ testGetNeighborVars() [1/2]

void frodo2.algorithms.test.XCSPparserTest.testGetNeighborVars ( )

Test method for XCSPparser.getNeighborVars(java.lang.String).

References testGetNeighborVars().

Referenced by testGetNeighborVars(), and testGetNeighborVarsWithAnonymVars().

Here is the call graph for this function:

◆ testGetNeighborVars() [2/2]

void frodo2.algorithms.test.XCSPparserTest.testGetNeighborVars ( boolean withAnonymVars)

Test for getNeighborVars.

Parameters
withAnonymVarsif false, ignores variables with no specified owner

References getNeighborhoods(), frodo2.solutionSpaces.DCOPProblemInterface< V extends Addable< V >, U extends Addable< U > >.isRandom(), and prob.

Here is the call graph for this function:

◆ testGetNeighborVarsWithAnonymVars()

void frodo2.algorithms.test.XCSPparserTest.testGetNeighborVarsWithAnonymVars ( )

Test method for XCSPparser.getNeighborVars(java.lang.String, boolean).

References testGetNeighborVars().

Here is the call graph for this function:

◆ testGetOwner()

void frodo2.algorithms.test.XCSPparserTest.testGetOwner ( )

Test method for XCSPparser.getOwner(java.lang.String).

References graph, and prob.

◆ testGetOwners()

void frodo2.algorithms.test.XCSPparserTest.testGetOwners ( )

◆ testGetPlusInfUtility()

void frodo2.algorithms.test.XCSPparserTest.testGetPlusInfUtility ( )

Test method for getPlusInfUtility().

References frodo2.solutionSpaces.AddableReal.add(), frodo2.solutionSpaces.AddableReal.equals(), and prob.

Here is the call graph for this function:

◆ testGetProbabilitySpaces()

void frodo2.algorithms.test.XCSPparserTest.testGetProbabilitySpaces ( )

Test method for getProbabilitySpaces().

References prob, and probSpaces.

◆ testGetProbabilitySpacesForVar()

void frodo2.algorithms.test.XCSPparserTest.testGetProbabilitySpacesForVar ( )

◆ testGetSolutionSpaces() [1/2]

void frodo2.algorithms.test.XCSPparserTest.testGetSolutionSpaces ( )

Test method for getSolutionSpaces() ignoring random variables.

References frodo2.solutionSpaces.hypercube.Hypercube< V extends Addable< V >, U extends Addable< U > >.iterator(), frodo2.java, prob, and testGetSolutionSpaces().

Referenced by testGetSolutionSpaces(), testGetSolutionSpacesForVar(), and testGetSolutionSpacesWithRandVars().

Here is the call graph for this function:

◆ testGetSolutionSpaces() [2/2]

void frodo2.algorithms.test.XCSPparserTest.testGetSolutionSpaces ( DCOPProblemInterface< AddableInteger, AddableReal > problem,
List< ? extends UtilitySolutionSpace< AddableInteger, AddableReal > > refSpaces,
String var,
final boolean withRandVars )
protected

Test method for getSolutionSpaces(String, boolean).

Parameters
problemthe problem
refSpacesthe reference spaces
varthe variable
withRandVarsif true, also considers random variables
Todo
Test with default cost

References frodo2.solutionSpaces.DCOPProblemInterface< V extends Addable< V >, U extends Addable< U > >.getSolutionSpaces().

Here is the call graph for this function:

◆ testGetSolutionSpacesForVar() [1/2]

void frodo2.algorithms.test.XCSPparserTest.testGetSolutionSpacesForVar ( )

Test method for getSolutionSpaces(String) ignoring random variables.

References frodo2.solutionSpaces.hypercube.Hypercube< V extends Addable< V >, U extends Addable< U > >.iterator(), frodo2.java, prob, and testGetSolutionSpacesForVar().

Referenced by testGetSolutionSpacesForVar(), and testGetSolutionSpacesForVarWithRandVars().

Here is the call graph for this function:

◆ testGetSolutionSpacesForVar() [2/2]

void frodo2.algorithms.test.XCSPparserTest.testGetSolutionSpacesForVar ( final boolean withRandVars)
private

Test method for getSolutionSpaces(String, boolean).

Parameters
withRandVarsif true, considers random variables
Todo

Test with default cost

Test with and without forbidden vars

References frodo2.solutionSpaces.DCOPProblemInterface< V extends Addable< V >, U extends Addable< U > >.getVariables(), graph, prob, and testGetSolutionSpaces().

Here is the call graph for this function:

◆ testGetSolutionSpacesForVarWithRandVars()

void frodo2.algorithms.test.XCSPparserTest.testGetSolutionSpacesForVarWithRandVars ( )

Test method for getSolutionSpaces(String) with random variables.

References testGetSolutionSpacesForVar().

Here is the call graph for this function:

◆ testGetSolutionSpacesWithRandVars()

void frodo2.algorithms.test.XCSPparserTest.testGetSolutionSpacesWithRandVars ( )

Test method for getSolutionSpaces() with random variables.

References testGetSolutionSpaces().

Here is the call graph for this function:

◆ testGetSubProblem()

◆ testGetUtility()

void frodo2.algorithms.test.XCSPparserTest.testGetUtility ( )

Test for the method getUtility() on complete assignments.

References frodo2.solutionSpaces.AddableReal.add(), graph, and prob.

Here is the call graph for this function:

◆ testGetVariables()

void frodo2.algorithms.test.XCSPparserTest.testGetVariables ( )

Test method for XCSPparser.getVariables().

References graph, and prob.

◆ testGetVariablesString()

void frodo2.algorithms.test.XCSPparserTest.testGetVariablesString ( )

Test method for XCSPparser.getVariables(java.lang.String).

References graph, and prob.

◆ testGetZeroUtility()

void frodo2.algorithms.test.XCSPparserTest.testGetZeroUtility ( )

Test method for getZeroUtility().

References frodo2.solutionSpaces.AddableReal.add(), frodo2.solutionSpaces.AddableReal.equals(), and prob.

Here is the call graph for this function:

◆ testIsRandom()

void frodo2.algorithms.test.XCSPparserTest.testIsRandom ( ) throws JDOMException

Test method for frodo2.algorithms.XCSPparser.isRandom(java.lang.String).

Exceptions
JDOMExceptionif an error occurred when reading the problem description

References prob, and probDoc.

◆ testMaximize()

◆ testSetDomain()

Member Data Documentation

◆ extendedRandNeighborhoods

boolean frodo2.algorithms.test.XCSPparserTest.extendedRandNeighborhoods
private

Whether we want extended random neighborhoods.

Referenced by XCSPparserTest().

◆ graph

◆ maximize

final boolean frodo2.algorithms.test.XCSPparserTest.maximize
private

Whether to test on maximization problems.

Referenced by XCSPparserTest().

◆ maxNbrAgents

final int frodo2.algorithms.test.XCSPparserTest.maxNbrAgents = 5
private

Maximum number of agents.

Referenced by setUp().

◆ maxNbrEdges

final int frodo2.algorithms.test.XCSPparserTest.maxNbrEdges = 100
private

Maximum number of edges in the random graph.

Referenced by setUp().

◆ maxNbrVars

final int frodo2.algorithms.test.XCSPparserTest.maxNbrVars = 15
private

Maximum number of variables in the random graph.

Note
Must be at least 2.

Referenced by setUp().

◆ parser

XCSPparser< AddableInteger, AddableReal > frodo2.algorithms.test.XCSPparserTest.parser
protected

The parser.

Referenced by setUp(), and tearDown().

◆ prob

◆ probDoc

Document frodo2.algorithms.test.XCSPparserTest.probDoc
protected

Random XCSP problem.

Referenced by setUp(), tearDown(), testGetDomain(), and testIsRandom().

◆ probSpaces

ArrayList< Hypercube<AddableInteger, AddableReal> > frodo2.algorithms.test.XCSPparserTest.probSpaces = new ArrayList< Hypercube<AddableInteger, AddableReal> > ()
protected

The list of probability spaces in the problem.

Referenced by setUp(), and testGetProbabilitySpaces().

◆ publicAgents

boolean frodo2.algorithms.test.XCSPparserTest.publicAgents = false
private

Whether each agent knows the identities of all agents.

Referenced by XCSPparserTest().

◆ solutionSpaces

ArrayList< Hypercube<AddableInteger, AddableReal> > frodo2.algorithms.test.XCSPparserTest.solutionSpaces = new ArrayList< Hypercube<AddableInteger, AddableReal> > ()
protected

The list of solution spaces in the problem.

Referenced by setUp().


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