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

A JUnit test case for LowestCommonAncestors. More...

Inheritance diagram for frodo2.algorithms.dpop.stochastic.test.LowestCommonAncestorsTest:

Public Member Functions

 LowestCommonAncestorsTest (String method)
 Constructor that instantiates a test only for the input method.
void test () throws Exception
 Tests the output of the LowestCommonAncestors module.
Collection< MessageTypegetMsgTypes ()
void notifyIn (Message msg)
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 ()

Protected Member Functions

void setUp ()
void tearDown () throws Exception
void checkOutput ()
 Checks the output of the module.
void setModules () throws Exception
 Creates the modules.

Protected Attributes

final int maxNbrVars = 20
 Maximum number of variables in the random graph.
RandGraphFactory.Graph graph
 Random graph.
HashMap< String, HashSet< String > > allFlags
 For each node, its set of flags.
HashMap< String, HashSet< String > > lcas = new HashMap< String, HashSet<String> > ()
 For each node, the set of flags it is the lca of.
Map< String, Queuequeues
 List of queues, indexed by agent name.
Map< String, QueueOutputPipeInterfacepipes
 One output pipe used to send messages to each queue, indexed by the queue's agent name.
int remainingOutputs
 Current number of outputs yet to be received from the LowestCommonAncestors module.
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.
Map< String, ? extends DFSview<?, ?> > dfs
 The chosen DFS.

Private Member Functions

boolean subtreeHasFlag (String root, String flag)
 Checks whether a subtree contains a given flag.

Private Attributes

final int maxNbrEdges = 200
 Maximum number of edges in the random graph.
final int maxNbrAgents = 20
 Maximum number of agents.
final int nbrFlags = 20
 The number of flag types.
final double flagProb = 0.2
 For each flag type and each node, the probability that the node has that flag.

Detailed Description

A JUnit test case for LowestCommonAncestors.

Author
Thomas Leaute

Constructor & Destructor Documentation

◆ LowestCommonAncestorsTest()

frodo2.algorithms.dpop.stochastic.test.LowestCommonAncestorsTest.LowestCommonAncestorsTest ( String method)

Constructor that instantiates a test only for the input method.

Parameters
methodtest method

Referenced by suite().

Member Function Documentation

◆ checkOutput()

◆ getMsgTypes()

Collection< MessageType > frodo2.algorithms.dpop.stochastic.test.LowestCommonAncestorsTest.getMsgTypes ( )

◆ notifyIn()

◆ setModules()

void frodo2.algorithms.dpop.stochastic.test.LowestCommonAncestorsTest.setModules ( ) throws Exception
protected

Creates the modules.

Exceptions
Exceptionif an error occurs

Reimplemented in frodo2.algorithms.dpop.stochastic.test.SamplingPhaseTest.

References frodo2.communication.Queue.addIncomingMessagePolicy(), allFlags, graph, and queues.

Referenced by test().

Here is the call graph for this function:

◆ setQueue()

void frodo2.algorithms.dpop.stochastic.test.LowestCommonAncestorsTest.setQueue ( Queue queue)

Does nothing in this case.

Parameters
queuethe queue

Implements frodo2.communication.MessageListener< T >.

◆ setUp()

◆ subtreeHasFlag()

boolean frodo2.algorithms.dpop.stochastic.test.LowestCommonAncestorsTest.subtreeHasFlag ( String root,
String flag )
private

Checks whether a subtree contains a given flag.

Parameters
rootthe root of the subtree
flagthe flag
Returns
true iff the subtree contains the flag

References allFlags, dfs, and subtreeHasFlag().

Referenced by checkOutput(), and subtreeHasFlag().

Here is the call graph for this function:

◆ suite()

TestSuite frodo2.algorithms.dpop.stochastic.test.LowestCommonAncestorsTest.suite ( )
static
Returns
the test suite for this test

Reimplemented in frodo2.algorithms.dpop.stochastic.test.SamplingPhaseTest.

References LowestCommonAncestorsTest().

Referenced by frodo2.algorithms.dpop.stochastic.test.AllTestsStochDPOP.suite().

Here is the call graph for this function:

◆ tearDown()

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

Reimplemented in frodo2.algorithms.dpop.stochastic.test.SamplingPhaseTest.

References allFlags, dfs, graph, lcas, pipes, and queues.

◆ test()

void frodo2.algorithms.dpop.stochastic.test.LowestCommonAncestorsTest.test ( ) throws Exception

Member Data Documentation

◆ allFlags

HashMap< String, HashSet<String> > frodo2.algorithms.dpop.stochastic.test.LowestCommonAncestorsTest.allFlags
protected

◆ dfs

Map< String, ? extends DFSview<?, ?> > frodo2.algorithms.dpop.stochastic.test.LowestCommonAncestorsTest.dfs
protected

The chosen DFS.

For each variable, stores its relationships with neighboring variables

Referenced by checkOutput(), frodo2.algorithms.dpop.stochastic.test.SamplingPhaseTest.checkOutput(), setUp(), subtreeHasFlag(), and tearDown().

◆ finished

final Condition frodo2.algorithms.dpop.stochastic.test.LowestCommonAncestorsTest.finished = finished_lock.newCondition()
protected

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

Referenced by frodo2.algorithms.dpop.stochastic.test.SamplingPhaseTest.notifyIn().

◆ finished_lock

final ReentrantLock frodo2.algorithms.dpop.stochastic.test.LowestCommonAncestorsTest.finished_lock = new ReentrantLock ()
protected

Used to make the test thread wait.

Referenced by frodo2.algorithms.dpop.stochastic.test.SamplingPhaseTest.notifyIn().

◆ flagProb

final double frodo2.algorithms.dpop.stochastic.test.LowestCommonAncestorsTest.flagProb = 0.2
private

For each flag type and each node, the probability that the node has that flag.

Referenced by setUp().

◆ graph

RandGraphFactory.Graph frodo2.algorithms.dpop.stochastic.test.LowestCommonAncestorsTest.graph
protected

◆ lcas

HashMap< String, HashSet<String> > frodo2.algorithms.dpop.stochastic.test.LowestCommonAncestorsTest.lcas = new HashMap< String, HashSet<String> > ()
protected

◆ maxNbrAgents

final int frodo2.algorithms.dpop.stochastic.test.LowestCommonAncestorsTest.maxNbrAgents = 20
private

Maximum number of agents.

Referenced by setUp().

◆ maxNbrEdges

final int frodo2.algorithms.dpop.stochastic.test.LowestCommonAncestorsTest.maxNbrEdges = 200
private

Maximum number of edges in the random graph.

Referenced by setUp().

◆ maxNbrVars

final int frodo2.algorithms.dpop.stochastic.test.LowestCommonAncestorsTest.maxNbrVars = 20
protected

Maximum number of variables in the random graph.

Note
Must be at least 2.

Referenced by setUp().

◆ nbrFlags

final int frodo2.algorithms.dpop.stochastic.test.LowestCommonAncestorsTest.nbrFlags = 20
private

The number of flag types.

Referenced by setUp().

◆ pipes

Map<String, QueueOutputPipeInterface> frodo2.algorithms.dpop.stochastic.test.LowestCommonAncestorsTest.pipes
protected

One output pipe used to send messages to each queue, indexed by the queue's agent name.

Referenced by tearDown(), and test().

◆ queues

Map<String, Queue> frodo2.algorithms.dpop.stochastic.test.LowestCommonAncestorsTest.queues
protected

List of queues, indexed by agent name.

Referenced by setModules(), frodo2.algorithms.dpop.stochastic.test.SamplingPhaseTest.setModules(), tearDown(), and test().

◆ remainingOutputs

int frodo2.algorithms.dpop.stochastic.test.LowestCommonAncestorsTest.remainingOutputs
protected

Current number of outputs yet to be received from the LowestCommonAncestors module.

Referenced by frodo2.algorithms.dpop.stochastic.test.SamplingPhaseTest.notifyIn().


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