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

Algorithm that generates samples for the random variables in the problem. More...

Inheritance diagram for frodo2.algorithms.dpop.stochastic.SamplingPhase< V extends Addable< V >, U extends Addable< U > >:

Classes

class  RandVarsProjMsg
 Message telling what random variables should be projected out at given decision variable. More...
enum  WhereToProject
 Where the random variables should be projected out. More...
class  AtLeaves
 The version of the SamplingPhase that samples at the leaves. More...
class  AtLCAs
 The version of the SamplingPhase that samples at the lcas. More...
class  AtRoots
 A version of the SamplingPhase in which the sampling for all random variables is performed at the roots. More...

Public Member Functions

 SamplingPhase (DCOPProblemInterface< V, U > problem, Element parameters)
 Constructor.
void reset ()
 SamplingPhase (Element parameters, DCOPProblemInterface< V, U > problem)
 Constructor in stats gatherer mode.
Collection< MessageTypegetMsgTypes ()
void notifyIn (Message msg)
void getStatsFromQueue (Queue queue)
void setSilent (boolean silent)
String dfsToString ()
Public Member Functions inherited from frodo2.algorithms.dpop.stochastic.LowestCommonAncestors
 LowestCommonAncestors (Map< String, Set< String > > flags, Map< String, String > owners)
 Constructor.
void setQueue (Queue queue)
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 String dfsToString (Map< String, ? extends DFSview<?, ?> > dfs, Map< String, Set< String > > randVars, Map< String, Set< String > > randVarsProj, final boolean projAtLeaves)
 Prints the input dfs in DOT format.

Static Public Attributes

static MessageType START_MSG_TYPE = AgentInterface.START_AGENT
 The type of the start message.
static final MessageType RAND_VARS_PROJ_MSG_TYPE = new MessageType ("E[DPOP]", "SamplingPhase", "Where to project random variables")
 The type of the messages telling what random variables should be projected out at given decision variable.
Static Public Attributes inherited from frodo2.algorithms.dpop.stochastic.LowestCommonAncestors
static MessageType DFS_MSG_TYPE = DFSgeneration.OUTPUT_MSG_TYPE
 The type of the message containing information about the DFS.
static final MessageType PHASE1_MSG_TYPE = new MessageType ("E[DPOP]", "LowestCommonAncestors", "LCAmsg1")
 The type of a phase 1 message.
static final MessageType PHASE2_MSG_TYPE = new MessageType ("E[DPOP]", "LowestCommonAncestors", "LCAmsg2")
 The type of a phase 2 message.
static final MessageType OUTPUT_MSG_TYPE = new MessageType ("E[DPOP]", "LowestCommonAncestors", "LCAoutput")
 The type of the output messages.

Protected Member Functions

 SamplingPhase ()
 Nullary constructor.
void init ()
 Parses the problem.
Protected Member Functions inherited from frodo2.algorithms.dpop.stochastic.LowestCommonAncestors
 LowestCommonAncestors ()
 Empty constructor with no specified flags.
void setFlags (Map< String, ? extends Set< String > > flags)
 Adds flags.
LCAmsg1 newPhase1msg (String node, NodeInfo nodeInfo)
 Creates a new Phase 1 message.
void terminatePhase2 (String node, NodeInfo nodeInfo, Set< String > pendingFlags)
 Sends messages to children and the output message.
void sendOutput (String node, NodeInfo nodeInfo)
 Sends the output message.

Protected Attributes

DCOPProblemInterface< V, U > problem
 The problem.
boolean started = false
 Whether the execution of the algorithm has started.
int nbrSamples
 The number of samples for each random variable.
HashMap< String, UtilitySolutionSpace< V, U > > probLaws = new HashMap< String, UtilitySolutionSpace<V, U> > ()
 For each random variable, its non-sampled probability law.
boolean reportStats = true
 Whether to report stats.
WhereToProject proj
 Where the random variables should be projected out.
Protected Attributes inherited from frodo2.algorithms.dpop.stochastic.LowestCommonAncestors
Queue queue
 The queue.
HashMap< String, NodeInfoinfos
 The known information about each node.
Map< String, String > owners = new HashMap<String, String> ()
 For each known node, the name of the agent that owns it.

Private Attributes

int nbrStatsMsgs
 The total number messages to expect in "statistics gatherer" mode.
HashMap< String, DFSview< V, ?> > relationships
 For every variable this agent owns, its view of the DFS.
String dotRendererClass
 Renderer to display DOT code.
HashMap< String, Set< String > > randVars
 For each variable, the random variables it is linked to (only used in stats gatherer mode).
HashMap< String, Set< String > > randVarsProj
 For each variable, the random variables it must project out (only used in stats gatherer mode).

Detailed Description

Algorithm that generates samples for the random variables in the problem.

The samples for a given random variable are chosen by the Lowest Common Ancestor of all decision variables responsible for enforcing a constraint involving that random variable.

Author
Thomas Leaute
Parameters
<V>the type used for random variable values
<U>the type used for probabilities
Todo
Improve garbage collection.

Constructor & Destructor Documentation

◆ SamplingPhase() [1/3]

frodo2.algorithms.dpop.stochastic.SamplingPhase< V extends Addable< V >, U extends Addable< U > >.SamplingPhase ( )
protected

Nullary constructor.

Referenced by notifyIn().

◆ SamplingPhase() [2/3]

◆ SamplingPhase() [3/3]

Member Function Documentation

◆ dfsToString() [1/2]

String frodo2.algorithms.dpop.stochastic.SamplingPhase< V extends Addable< V >, U extends Addable< U > >.dfsToString ( )

◆ dfsToString() [2/2]

String frodo2.algorithms.dpop.stochastic.SamplingPhase< V extends Addable< V >, U extends Addable< U > >.dfsToString ( Map< String, ? extends DFSview<?, ?> > dfs,
Map< String, Set< String > > randVars,
Map< String, Set< String > > randVarsProj,
final boolean projAtLeaves )
static

Prints the input dfs in DOT format.

Parameters
dfsfor each variable, a map associating a list of neighbors to each type of relationship
randVarsfor each variable, the set of random variables it is linked to
randVarsProjfor each variable, which random variables it must project out
projAtLeaveswhether projection of random variables is performed at the leaves
Returns
a DOT-formated representation of the DFS, including random variables

References randVars, randVarsProj, and relationships.

◆ getMsgTypes()

◆ getStatsFromQueue()

◆ init()

void frodo2.algorithms.dpop.stochastic.SamplingPhase< V extends Addable< V >, U extends Addable< U > >.init ( )
protected

Parses the problem.

References problem.

Referenced by notifyIn().

◆ notifyIn()

void frodo2.algorithms.dpop.stochastic.SamplingPhase< V extends Addable< V >, U extends Addable< U > >.notifyIn ( Message msg)
See also
LowestCommonAncestors.notifyIn(Message)

Reimplemented from frodo2.algorithms.dpop.stochastic.LowestCommonAncestors.

References frodo2.algorithms.AgentInterface< V extends Addable< V > >.AGENT_FINISHED, dfsToString(), dotRendererClass, frodo2.communication.MessageType.equals(), frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.DFSview< V extends Addable< V >, U extends Addable< U > >.getAllPseudoChildren(), frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.DFSview< V extends Addable< V >, U extends Addable< U > >.getChildren(), frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.MessageDFSoutput< V extends Addable< V >, U extends Addable< U > >.getNeighbors(), frodo2.algorithms.dpop.stochastic.SamplingPhase< V extends Addable< V >, U extends Addable< U > >.RandVarsProjMsg.getRandVars(), frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.DFSview< V extends Addable< V >, U extends Addable< U > >.getSpaces(), frodo2.communication.Message.getType(), frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.MessageDFSoutput< V extends Addable< V >, U extends Addable< U > >.getVar(), frodo2.algorithms.dpop.stochastic.SamplingPhase< V extends Addable< V >, U extends Addable< U > >.RandVarsProjMsg.getVariable(), init(), frodo2.solutionSpaces.DCOPProblemInterface< V extends Addable< V >, U extends Addable< U > >.isRandom(), frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.OUTPUT_MSG_TYPE, RAND_VARS_PROJ_MSG_TYPE, randVars, relationships, reset(), SamplingPhase(), and frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.STATS_MSG_TYPE.

Here is the call graph for this function:

◆ reset()

void frodo2.algorithms.dpop.stochastic.SamplingPhase< V extends Addable< V >, U extends Addable< U > >.reset ( )
See also
StatsReporter.reset()

Implements frodo2.algorithms.StatsReporter.

References probLaws, problem, and relationships.

Referenced by notifyIn().

◆ setSilent()

void frodo2.algorithms.dpop.stochastic.SamplingPhase< V extends Addable< V >, U extends Addable< U > >.setSilent ( boolean silent)

Member Data Documentation

◆ dotRendererClass

String frodo2.algorithms.dpop.stochastic.SamplingPhase< V extends Addable< V >, U extends Addable< U > >.dotRendererClass
private

Renderer to display DOT code.

Referenced by notifyIn().

◆ nbrSamples

int frodo2.algorithms.dpop.stochastic.SamplingPhase< V extends Addable< V >, U extends Addable< U > >.nbrSamples
protected

The number of samples for each random variable.

◆ nbrStatsMsgs

int frodo2.algorithms.dpop.stochastic.SamplingPhase< V extends Addable< V >, U extends Addable< U > >.nbrStatsMsgs
private

The total number messages to expect in "statistics gatherer" mode.

◆ probLaws

HashMap< String, UtilitySolutionSpace<V, U> > frodo2.algorithms.dpop.stochastic.SamplingPhase< V extends Addable< V >, U extends Addable< U > >.probLaws = new HashMap< String, UtilitySolutionSpace<V, U> > ()
protected

For each random variable, its non-sampled probability law.

Referenced by reset().

◆ problem

◆ proj

WhereToProject frodo2.algorithms.dpop.stochastic.SamplingPhase< V extends Addable< V >, U extends Addable< U > >.proj
protected

Where the random variables should be projected out.

◆ RAND_VARS_PROJ_MSG_TYPE

◆ randVars

HashMap< String, Set<String> > frodo2.algorithms.dpop.stochastic.SamplingPhase< V extends Addable< V >, U extends Addable< U > >.randVars
private

For each variable, the random variables it is linked to (only used in stats gatherer mode).

Referenced by dfsToString(), notifyIn(), and frodo2.algorithms.dpop.stochastic.SamplingPhase< V extends Addable< V >, U extends Addable< U > >.RandVarsProjMsg.RandVarsProjMsg().

◆ randVarsProj

HashMap< String, Set<String> > frodo2.algorithms.dpop.stochastic.SamplingPhase< V extends Addable< V >, U extends Addable< U > >.randVarsProj
private

For each variable, the random variables it must project out (only used in stats gatherer mode).

Referenced by dfsToString().

◆ relationships

HashMap< String, DFSview<V, ?> > frodo2.algorithms.dpop.stochastic.SamplingPhase< V extends Addable< V >, U extends Addable< U > >.relationships
private

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

Used only in stats gatherer mode.

Referenced by dfsToString(), notifyIn(), reset(), and SamplingPhase().

◆ reportStats

boolean frodo2.algorithms.dpop.stochastic.SamplingPhase< V extends Addable< V >, U extends Addable< U > >.reportStats = true
protected

Whether to report stats.

◆ START_MSG_TYPE

The type of the start message.

Referenced by getMsgTypes().

◆ started

boolean frodo2.algorithms.dpop.stochastic.SamplingPhase< V extends Addable< V >, U extends Addable< U > >.started = false
protected

Whether the execution of the algorithm has started.


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