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

Distributed DFS generation protocol. More...

Inheritance diagram for frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >:

Classes

class  DFSview
 The view of the DFS from one variable. More...
class  MessageDFSoutput
 Message class used for the output of the protocol. More...
interface  NextChildChoiceHeuristic
 Interface for heuristics used to choose a variable's next child from its list of open neighbors. More...
class  BlindScoringHeuristic
 A DFS heuristic based on a ScoringHeuristic that does not require message exchange between agents. More...
class  ScoreBroadcastingHeuristic
 Selects the next child as the one that has the highest score. More...

Public Member Functions

 DFSgeneration ()
 Default constructor.
 DFSgeneration (DCOPProblemInterface< V, U > problem, NextChildChoiceHeuristic heuristic)
 Constructor.
 DFSgeneration (DCOPProblemInterface< V, U > problem, Element parameters) throws ClassNotFoundException
 Constructor.
 DFSgeneration (Element parameters, DCOPProblemInterface< V, U > problem)
 The constructor called in "statistics gatherer" mode.
 DFSgeneration (DCOPProblemInterface< V, U > problem)
 Manual constructor for the "statistics gatherer" mode.
HashMap< String, DFSview< V, U > > getDFS ()
Collection< MessageTypegetMsgTypes ()
void notifyIn (Message msg)
 The algorithm.
void setQueue (Queue queue)
void getStatsFromQueue (Queue queue)
void setSilent (boolean silent)
String dfsToString ()
void reset ()
long getFinalTime ()
 Returns the time at which the DFS phase has finished, determined by looking at the timestamp of the stat messages.
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< V extends Addable< V > U extends Addable< U > String dfsToString (Map< String, DFSview< V, U > > dfs)

Static Public Attributes

static MessageType FINISH_MSG_TYPE = AgentInterface.AGENT_FINISHED
 The type of the message telling the agent finished.
static MessageType START_MSG_TYPE = AgentInterface.START_AGENT
 The type of the message telling the module to start.
static MessageType ROOT_VAR_MSG_TYPE = LeaderElectionMaxID.OUTPUT_MSG_TYPE
 The type of the messages telling whether a given variable is a root.
static final MessageType CHILD_MSG_TYPE = new MessageType ("VarOrdering", "DFSgeneration", "Child")
 The type of the message used to tell the recipient that it is a child of the sender.
static MessageType PSEUDO_MSG_TYPE = new MessageType ("VarOrdering", "DFSgeneration", "Pseudo")
 The type of the message used to tell the recipient that it is a pseudo-child of the sender.
static MessageType OUTPUT_MSG_TYPE = new MessageType ("VarOrdering", "DFSgeneration", "Output")
 The type of the output messages.
static final MessageType STATS_MSG_TYPE = new MessageType ("VarOrdering", "DFSgeneration", "Stats")
 The type of the messages containing statistics.

Protected Member Functions

MessageType getRootVarMsgType ()
MessageType getChildMsgType ()
MessageType getPseudoMsgType ()
MessageType getOutputMsgType ()
 DFSgeneration (boolean withSharedVars)
 Empty constructor.
void init ()
 Parses the problem.
void init (String var)
 Parses the problem for only one variable.
void processAdditionalMsgInformation (Message msg, String var, DFSview< V, U > dfsView)
 allows to process information included in messages which extend CHILDmsg
CHILDmsg makeChildToken (Serializable rootID, String var, String dest, Collection< String > openNeighbors)
 makes the ChildToken Message with all the information required by the module
void sendAdditionalDFSoutput (Serializable rootID, String myVar)
 Use this method to send additional output from DFS generation.
boolean sendDownCHILDtoken (Serializable rootID, String var, Collection< String > openList, DFSview< V, U > myDFSview, Message msg)
 Attempts to choose the next child and sends it a CHILD token.

Protected Attributes

Queue queue
 The queue on which it should call sendMessage().
boolean started = false
 Whether the execution of the algorithm has started.
Map< String, Collection< String > > openNeighbors
 For each variable that this agent owns, a collection of open neighbor variables.
HashMap< String, DFSview< V, U > > dfsViews
 For every variable this agent owns, its view of the DFS.
Map< String, String > owners
 For each known variable, the name of the agent that owns it.
int totalNbrVars
 The total number of variables in the problem (used only in "statistics gatherer" mode).
NextChildChoiceHeuristic heuristic
 The heuristic used to choose a variable's next child from its list of open neighbors.
DCOPProblemInterface< V, U > problem
 The problem.
HashMap< Serializable, LinkedList< String > > partialPaths = new HashMap< Serializable, LinkedList<String> > ()
 For each component, the current partial constraint graph traversal path.

Private Member Functions

NextChildChoiceHeuristic createHeuristic (Class<? extends NextChildChoiceHeuristic > heuristicClass, Element heuristicParams)
 Instantiates a heuristic using reflection, based on the class name and the XCSP problem description.
void parseSpaces (String myVar, DFSview< V, U > myDFSview)
 Parses and records the spaces for the input variable.
void resetComponent (String var)
 Resets all entries in this.dfsViews corresponding to variables in the component of the input variable.

Private Attributes

HashSet< String > sentOutputs = new HashSet<String> ()
 The variables for which a DFSoutput has already been sent.
boolean silent = false
 Whether the stats reporter should print its stats.
String dotRendererClass = null
 Renderer to display DOT code.
long finalTime = Long.MIN_VALUE
 The time at which the DFS procedure has finished.
final boolean withSharedVars
 When parsing the constraints, whether to take into account variables with no specified owners.

Detailed Description

Distributed DFS generation protocol.

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

Constructor & Destructor Documentation

◆ DFSgeneration() [1/6]

Default constructor.

Referenced by DFSgeneration().

◆ DFSgeneration() [2/6]

Constructor.

Parameters
problemthe problem
heuristicthe heuristic

References heuristic, and problem.

◆ DFSgeneration() [3/6]

frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.DFSgeneration ( DCOPProblemInterface< V, U > problem,
Element parameters ) throws ClassNotFoundException

Constructor.

Parameters
problemthis agent's problem
parametersthe parameters for DFSgeneration
Exceptions
ClassNotFoundExceptionif the heuristic class is unknown

References createHeuristic(), DFSgeneration(), and problem.

Here is the call graph for this function:

◆ DFSgeneration() [4/6]

frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.DFSgeneration ( Element parameters,
DCOPProblemInterface< V, U > problem )

The constructor called in "statistics gatherer" mode.

Parameters
problemthe overall problem
parametersthe description of what statistics should be reported (currently unused)

References dfsViews, dotRendererClass, and problem.

◆ DFSgeneration() [5/6]

Manual constructor for the "statistics gatherer" mode.

Parameters
problemthe overall problem

References dfsViews, and problem.

◆ DFSgeneration() [6/6]

frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.DFSgeneration ( boolean withSharedVars)
protected

Empty constructor.

Parameters
withSharedVarsWhen parsing the constraints, whether to take into account variables with no specified owners

References withSharedVars.

Member Function Documentation

◆ createHeuristic()

NextChildChoiceHeuristic frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.createHeuristic ( Class<? extends NextChildChoiceHeuristic > heuristicClass,
Element heuristicParams )
private

Instantiates a heuristic using reflection, based on the class name and the XCSP problem description.

Parameters
heuristicClassthe class of the heuristic
heuristicParamsthe XML description of the heuristic
Returns
a new instance of the corresponding heuristic

References problem.

Referenced by DFSgeneration().

◆ dfsToString() [1/2]

String frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.dfsToString ( )
Returns
a DOT-formated representation of the dfs

References dfsToString().

Referenced by dfsToString().

Here is the call graph for this function:

◆ dfsToString() [2/2]

◆ getChildMsgType()

MessageType frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.getChildMsgType ( )
protected
Returns
The type of the message used to tell the recipient that it is a child of the sender

References CHILD_MSG_TYPE.

Referenced by getMsgTypes().

◆ getDFS()

HashMap< String, DFSview< V, U > > frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.getDFS ( )

◆ getFinalTime()

long frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.getFinalTime ( )

Returns the time at which the DFS phase has finished, determined by looking at the timestamp of the stat messages.

Author
Brammert Ottens, 22 feb 2010
Returns
the time at which the DFS phase has finished

References finalTime.

◆ getMsgTypes()

Collection< MessageType > frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.getMsgTypes ( )

◆ getOutputMsgType()

MessageType frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.getOutputMsgType ( )
protected
Returns
The type of the output messages

References OUTPUT_MSG_TYPE.

Referenced by init().

◆ getPseudoMsgType()

MessageType frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.getPseudoMsgType ( )
protected
Returns
The type of the message used to tell the recipient that it is a pseudo-child of the sender

References PSEUDO_MSG_TYPE.

Referenced by getMsgTypes().

◆ getRootVarMsgType()

MessageType frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.getRootVarMsgType ( )
protected
Returns
the types of the messages telling whether a given variable is a root

References ROOT_VAR_MSG_TYPE.

Referenced by getMsgTypes().

◆ getStatsFromQueue()

◆ init() [1/2]

void frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.init ( )
protected

Parses the problem.

References dfsViews, init(), openNeighbors, and problem.

Referenced by init().

Here is the call graph for this function:

◆ init() [2/2]

void frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.init ( String var)
protected

Parses the problem for only one variable.

Parameters
varthe specified variable

References dfsViews, getOutputMsgType(), problem, and frodo2.communication.Queue.sendMessageToSelf().

Here is the call graph for this function:

◆ makeChildToken()

CHILDmsg frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.makeChildToken ( Serializable rootID,
String var,
String dest,
Collection< String > openNeighbors )
protected

makes the ChildToken Message with all the information required by the module

Parameters
rootIDThe ID of the root
varThe variable concerned
destThe destination variable
openNeighborsThe list of open neighbors of the current variable
Returns
The CHILDmsg to be sent

References openNeighbors.

Referenced by sendDownCHILDtoken().

◆ notifyIn()

void frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.notifyIn ( Message msg)

The algorithm.

The algorithm is triggered by the receipt of a messages of type LeaderElectionMaxID.OUTPUT_MSG_TYPE, telling the agent whether each variable is a root. The actual implementation corresponds to the one described in the P-DPOP paper published in WI-IAT 2008.

Parameters
msgthe message received

Implements frodo2.communication.IncomingMsgPolicyInterface< T >.

References frodo2.communication.MessageType.equals(), notifyIn(), and STATS_MSG_TYPE.

Referenced by notifyIn().

Here is the call graph for this function:

◆ parseSpaces()

◆ processAdditionalMsgInformation()

void frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.processAdditionalMsgInformation ( Message msg,
String var,
DFSview< V, U > dfsView )
protected

allows to process information included in messages which extend CHILDmsg

Parameters
msgThe message received
varThe variable concerned
dfsViewThe dfsView of myVar

◆ reset()

◆ resetComponent()

void frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.resetComponent ( String var)
private

Resets all entries in this.dfsViews corresponding to variables in the component of the input variable.

Parameters
vara variable in the component to be reset

◆ sendAdditionalDFSoutput()

void frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.sendAdditionalDFSoutput ( Serializable rootID,
String myVar )
protected

Use this method to send additional output from DFS generation.

Parameters
rootIDThe ID of the root
myVarVariable name

◆ sendDownCHILDtoken()

boolean frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.sendDownCHILDtoken ( Serializable rootID,
String var,
Collection< String > openList,
DFSview< V, U > myDFSview,
Message msg )
protected

Attempts to choose the next child and sends it a CHILD token.

Parameters
rootIDthe ID of the root
varthe variable whose next child must be chosen
openListthe list of open neighbors
myDFSviewthe known dfsView for the input variable
msgthe message just received
Returns
false if and only if no CHILD token was sent because the open list is empty; true otherwise

References frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.DFSview< V extends Addable< V >, U extends Addable< U > >.addChild(), makeChildToken(), frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.NextChildChoiceHeuristic.popNextChild(), and queue.

Here is the call graph for this function:

◆ setQueue()

void frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.setQueue ( Queue queue)
See also
IncomingMsgPolicyInterface.setQueue(Queue)

Implements frodo2.communication.MessageListener< T >.

References queue, and setQueue().

Referenced by setQueue().

Here is the call graph for this function:

◆ setSilent()

Member Data Documentation

◆ CHILD_MSG_TYPE

final MessageType frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.CHILD_MSG_TYPE = new MessageType ("VarOrdering", "DFSgeneration", "Child")
static

◆ dfsViews

HashMap< String, DFSview<V, U> > frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.dfsViews
protected

For every variable this agent owns, its view of the DFS.

Referenced by DFSgeneration(), DFSgeneration(), getDFS(), init(), and init().

◆ dotRendererClass

String frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.dotRendererClass = null
private

Renderer to display DOT code.

Referenced by DFSgeneration().

◆ finalTime

long frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.finalTime = Long.MIN_VALUE
private

The time at which the DFS procedure has finished.

Referenced by getFinalTime().

◆ FINISH_MSG_TYPE

◆ heuristic

NextChildChoiceHeuristic frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.heuristic
protected

The heuristic used to choose a variable's next child from its list of open neighbors.

Referenced by DFSgeneration().

◆ openNeighbors

◆ OUTPUT_MSG_TYPE

MessageType frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.OUTPUT_MSG_TYPE = new MessageType ("VarOrdering", "DFSgeneration", "Output")
static

The type of the output messages.

Referenced by frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.getMsgTypes(), frodo2.algorithms.adopt.Preprocessing< Val extends Addable< Val >, U extends Addable< U > >.getMsgTypes(), frodo2.algorithms.asodpop.ASODPOP< Val extends Addable< Val >, U extends Addable< U > >.getMsgTypes(), frodo2.algorithms.asodpop.ASODPOPBinaryDomains< Val extends Addable< Val >, U extends Addable< U > >.getMsgTypes(), frodo2.algorithms.dpop.memory.LabelingPhase< V extends Addable< V > >.getMsgTypes(), frodo2.algorithms.dpop.param.ParamVALUE< Val extends Addable< Val > >.getMsgTypes(), frodo2.algorithms.dpop.privacy.EncryptedUTIL< V extends Addable< V >, U extends Addable< U >, E extends AddableLimited< U, E >.getMsgTypes(), frodo2.algorithms.dpop.privacy.RerootRequester< V extends Addable< V >, U extends Addable< U > >.getMsgTypes(), frodo2.algorithms.dpop.privacy.test.SecureRerootingTest.getMsgTypes(), frodo2.algorithms.dpop.privacy.VariableObfuscation< V extends Addable< V >, U extends Addable< U > >.getMsgTypes(), frodo2.algorithms.duct.Normalize< V extends Addable< V > >.getMsgTypes(), frodo2.algorithms.duct.Sampling< V extends Addable< V > >.getMsgTypes(), frodo2.algorithms.odpop.UTILpropagationFullDomain< Val extends Addable< Val >, U extends Addable< U >, L extends LeafNode< U > >.getMsgTypes(), frodo2.algorithms.odpop.VALUEpropagation< Val extends Addable< Val >, U extends Addable< U > >.getMsgTypes(), getOutputMsgType(), frodo2.algorithms.varOrdering.dfs.tests.DFSgenerationTest.getOutputMsgType(), frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.MessageDFSoutput< V extends Addable< V >, U extends Addable< U > >.MessageDFSoutput(), frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.MessageDFSoutput< V extends Addable< V >, U extends Addable< U > >.MessageDFSoutput(), frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.notifyIn(), frodo2.algorithms.adopt.Preprocessing< Val extends Addable< Val >, U extends Addable< U > >.notifyIn(), frodo2.algorithms.dpop.memory.LabelingPhase< V extends Addable< V > >.notifyIn(), frodo2.algorithms.dpop.privacy.test.SecureRerootingTest.notifyIn(), frodo2.algorithms.dpop.stochastic.ExpectedUTIL< Val extends Addable< Val >, U extends Addable< U > >.notifyIn(), frodo2.algorithms.dpop.stochastic.SamplingPhase< V extends Addable< V >, U extends Addable< U > >.notifyIn(), frodo2.algorithms.duct.Normalize< V extends Addable< V > >.notifyIn(), frodo2.algorithms.duct.NormalizeInf< V extends Addable< V > >.notifyIn(), frodo2.algorithms.duct.Sampling< V extends Addable< V > >.notifyIn(), frodo2.algorithms.duct.SamplingChild< V extends Addable< V > >.notifyIn(), frodo2.algorithms.duct.SamplingChildSearch< V extends Addable< V > >.notifyIn(), frodo2.algorithms.duct.SamplingPruning< V extends Addable< V > >.notifyIn(), frodo2.algorithms.duct.SamplingPruningSearch< V extends Addable< V > >.notifyIn(), frodo2.algorithms.odpop.VALUEpropagation< Val extends Addable< Val >, U extends Addable< U > >.notifyIn(), frodo2.algorithms.varOrdering.dfs.DFSgenerationParallel< S extends Comparable< S > &Serializable >.FakeQueue.notifyInListeners(), frodo2.algorithms.dpop.privacy.VariableObfuscation< V extends Addable< V >, U extends Addable< U > >.notifyOut(), frodo2.algorithms.varOrdering.dfs.DFSgenerationParallel< S extends Comparable< S > &Serializable >.FakeQueue.sendMessageToSelf(), and frodo2.algorithms.dpop.privacy.test.SecureCircularRoutingTest.setUp().

◆ owners

Map<String, String> frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.owners
protected

For each known variable, the name of the agent that owns it.

◆ partialPaths

HashMap< Serializable, LinkedList<String> > frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.partialPaths = new HashMap< Serializable, LinkedList<String> > ()
protected

For each component, the current partial constraint graph traversal path.

◆ problem

◆ PSEUDO_MSG_TYPE

MessageType frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.PSEUDO_MSG_TYPE = new MessageType ("VarOrdering", "DFSgeneration", "Pseudo")
static

The type of the message used to tell the recipient that it is a pseudo-child of the sender.

Referenced by getPseudoMsgType().

◆ queue

Queue frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.queue
protected

The queue on which it should call sendMessage().

Referenced by getStatsFromQueue(), sendDownCHILDtoken(), and setQueue().

◆ ROOT_VAR_MSG_TYPE

◆ sentOutputs

HashSet<String> frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.sentOutputs = new HashSet<String> ()
private

The variables for which a DFSoutput has already been sent.

◆ silent

boolean frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.silent = false
private

Whether the stats reporter should print its stats.

Referenced by setSilent().

◆ START_MSG_TYPE

◆ started

boolean frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.started = false
protected

Whether the execution of the algorithm has started.

◆ STATS_MSG_TYPE

◆ totalNbrVars

int frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.totalNbrVars
protected

The total number of variables in the problem (used only in "statistics gatherer" mode).

◆ withSharedVars

final boolean frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.withSharedVars
private

When parsing the constraints, whether to take into account variables with no specified owners.

Referenced by DFSgeneration().


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