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

JUnit for DFSgeneration with Order. More...

Inheritance diagram for frodo2.algorithms.varOrdering.dfs.tests.DFSgenerationWithOrderTest:

Public Member Functions

 DFSgenerationWithOrderTest (boolean useTCP, Class< ? extends ScoringHeuristic<?> > heuristic, int minIncr)
 Constructor.
void testRandom () throws IllegalArgumentException, IOException, NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException
 Extends parent's method to include tests on correct order assignment.
Collection< MessageTypegetMsgTypes ()
 Listens to the output of the DFS generation protocol.
synchronized void notifyIn (Message msg)
Public Member Functions inherited from frodo2.algorithms.varOrdering.dfs.tests.DFSgenerationTest
 DFSgenerationTest (boolean useTCP, boolean useXML, Class< ? extends ScoringHeuristic<?> > heuristic)
 Constructor.
void setQueue (Queue queue)
 Does nothing in this case.
Public Member Functions inherited from frodo2.communication.IncomingMsgPolicyInterface< T >
default void notifyIn (Message msg, Object toAgent)
 Notifies the listener of an incoming message.

Static Public Member Functions

static TestSuite suite ()
Static Public Member Functions inherited from frodo2.algorithms.varOrdering.dfs.tests.DFSgenerationTest
static void checkDFS (Map< String, ? extends DFSview<?, ?> > dfs, Map< String, Set< String > > neighborhoods, LinkedList< String > path)
 Checks that the input is indeed a DFS tree.

Protected Member Functions

Element createDFSparams (Element heuristicParams)
MessageType getOutputMsgType ()
Class<?> getDFSclass ()
Protected Member Functions inherited from frodo2.algorithms.varOrdering.dfs.tests.DFSgenerationTest
void setUp ()
void tearDown () throws Exception
 Ends all queues.
void sendLEoutputs (String agent, Map< String, String > rootForVar)
 Sends the LEoutput messages.

Private Attributes

Map< String, Integer > totals
 For each variable, the total number of variables in its constraint graph component.
ArrayList< String > are_root
 List of all roots.
HashMap< String, Integer > node_order
 Stores order of the Variables in the DFS.
final int minIncr
 Each variable overstates by rand(minIncr, 2*minIncr) its visiting order in the constraint graph traversal, in order to keep its number of neighbors secret.

Additional Inherited Members

Protected Attributes inherited from frodo2.algorithms.varOrdering.dfs.tests.DFSgenerationTest
int nbrOutputMessagesPerVar = 2
 Number of output messages expected per variable.
int remainingOutputs
 Current number of variables that still need to send their output of the DFS generation protocol.
Map< String, DFSview< AddableInteger, AddableReal > > dfs = new HashMap< String, DFSview<AddableInteger, AddableReal> > (maxNbrVars)
 Output of the DFS generation protocol.
RandGraphFactory.Graph graph
 Random graph used to generate a constraint graph.

Detailed Description

JUnit for DFSgeneration with Order.

Author
Eric Zbinden, Thomas Leaute

Constructor & Destructor Documentation

◆ DFSgenerationWithOrderTest()

frodo2.algorithms.varOrdering.dfs.tests.DFSgenerationWithOrderTest.DFSgenerationWithOrderTest ( boolean useTCP,
Class< ? extends ScoringHeuristic<?> > heuristic,
int minIncr )

Constructor.

Parameters
useTCPwhether to use TCP pipes
heuristicthe class of the ScoringHeuristic used
minIncreach variable overstates by rand(minIncr, 2*minIncr) its visiting order in the constraint graph traversal, in order to keep its number of neighbors secret

References minIncr, and frodo2.algorithms.varOrdering.dfs.tests.DFSgenerationTest.useTCP.

Referenced by suite().

Member Function Documentation

◆ createDFSparams()

Element frodo2.algorithms.varOrdering.dfs.tests.DFSgenerationWithOrderTest.createDFSparams ( Element heuristicParams)
protected

◆ getDFSclass()

Class<?> frodo2.algorithms.varOrdering.dfs.tests.DFSgenerationWithOrderTest.getDFSclass ( )
protected
Returns
The DFSgeneration class under test

Reimplemented from frodo2.algorithms.varOrdering.dfs.tests.DFSgenerationTest.

◆ getMsgTypes()

◆ getOutputMsgType()

◆ notifyIn()

synchronized void frodo2.algorithms.varOrdering.dfs.tests.DFSgenerationWithOrderTest.notifyIn ( Message msg)
See also
IncomingMsgPolicyInterface.notifyIn(Message)
Todo
The module is tested against itself: we check that the order in the output message is the same as the order in the internal messages sent by the module. This is not enough: they could be equal, but both wrong. It is necessary to compute the orders independently outside of the module under test, and compare with the orders in the output messages.

Reimplemented from frodo2.algorithms.varOrdering.dfs.tests.DFSgenerationTest.

References are_root, frodo2.algorithms.varOrdering.dfs.DFSgenerationWithOrder< V extends Addable< V >, U extends Addable< U > >.CHILD_ORDER_MSG_TYPE, frodo2.communication.MessageType.equals(), frodo2.algorithms.varOrdering.dfs.CHILDmsg.getDest(), frodo2.algorithms.varOrdering.dfs.VarNbrMsg.getDest(), frodo2.algorithms.varOrdering.dfs.CHILDorderMsg.getOrder(), frodo2.algorithms.varOrdering.dfs.VarNbrMsg.getTotal(), frodo2.algorithms.varOrdering.dfs.DFSgenerationWithOrder< V extends Addable< V >, U extends Addable< U > >.DFSorderOutputMessage.getTrueOrder(), frodo2.communication.Message.getType(), frodo2.algorithms.varOrdering.dfs.DFSgenerationWithOrder< V extends Addable< V >, U extends Addable< U > >.DFSorderOutputMessage.getVar(), frodo2.algorithms.varOrdering.dfs.tests.DFSgenerationTest.graph, node_order, frodo2.algorithms.varOrdering.dfs.DFSgenerationWithOrder< V extends Addable< V >, U extends Addable< U > >.OUTPUT_ORDER_TYPE, frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.ROOT_VAR_MSG_TYPE, totals, and frodo2.algorithms.varOrdering.dfs.DFSgenerationWithOrder< V extends Addable< V >, U extends Addable< U > >.VARIABLE_COUNT_TYPE.

Here is the call graph for this function:

◆ suite()

TestSuite frodo2.algorithms.varOrdering.dfs.tests.DFSgenerationWithOrderTest.suite ( )
static
Returns
the test suite for this test

Reimplemented from frodo2.algorithms.varOrdering.dfs.tests.DFSgenerationTest.

References DFSgenerationWithOrderTest().

Referenced by frodo2.algorithms.varOrdering.dfs.tests.AllTestsDFS.suite().

Here is the call graph for this function:

◆ testRandom()

void frodo2.algorithms.varOrdering.dfs.tests.DFSgenerationWithOrderTest.testRandom ( ) throws IllegalArgumentException, IOException, NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException

Member Data Documentation

◆ are_root

ArrayList<String> frodo2.algorithms.varOrdering.dfs.tests.DFSgenerationWithOrderTest.are_root
private

List of all roots.

Referenced by notifyIn(), and testRandom().

◆ minIncr

final int frodo2.algorithms.varOrdering.dfs.tests.DFSgenerationWithOrderTest.minIncr
private

Each variable overstates by rand(minIncr, 2*minIncr) its visiting order in the constraint graph traversal, in order to keep its number of neighbors secret.

Referenced by DFSgenerationWithOrderTest().

◆ node_order

HashMap<String,Integer> frodo2.algorithms.varOrdering.dfs.tests.DFSgenerationWithOrderTest.node_order
private

Stores order of the Variables in the DFS.

Referenced by notifyIn(), and testRandom().

◆ totals

Map<String, Integer> frodo2.algorithms.varOrdering.dfs.tests.DFSgenerationWithOrderTest.totals
private

For each variable, the total number of variables in its constraint graph component.

Referenced by notifyIn(), and testRandom().


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