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 > >.AtLCAs< V extends Addable< V >, U extends Addable< U > > Class Template Reference

The version of the SamplingPhase that samples at the lcas. More...

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

Public Member Functions

 AtLCAs ()
 Nullary constructor.
 AtLCAs (Element parameters, DCOPProblemInterface< V, U > problem)
 Constructor in statistics gatherer mode.
 AtLCAs (DCOPProblemInterface< V, U > problem, Element parameters)
 Constructor.
void notifyIn (Message msg)
Public Member Functions inherited from frodo2.algorithms.dpop.stochastic.SamplingPhase< V, U >
void reset ()
Collection< MessageTypegetMsgTypes ()
void notifyIn (Message msg)
void getStatsFromQueue (Queue queue)
void setSilent (boolean silent)
String dfsToString ()

Protected Member Functions

 AtLCAs (Element parameters, DCOPProblemInterface< V, U > problem, boolean parseProj)
 Constructor in statistics gatherer mode.
void init ()
Map< V, Double > combineSamples (Map< V, Double > samples1, Map< V, Double > samples2)
 Merges two sample sets and then reduces the result.
LCAmsg1 newPhase1msg (String node, NodeInfo nodeInfo)
void proposeSamples (String var, NodeInfo nodeInfo)
 Sample all random variables linked to the current variable, and add them to the proposed samples for this variable.
void terminatePhase2 (String node, NodeInfo nodeInfo, Set< String > pendingFlags)
void terminatePhase2 (String node, NodeInfo nodeInfo, Set< String > pendingFlags, HashMap< String, Map< V, Double > > samplesFromParent)
 Sends messages to children and the output message.
void sendOutput (String node, NodeInfo nodeInfo)
Protected Member Functions inherited from frodo2.algorithms.dpop.stochastic.SamplingPhase< V, U >
 SamplingPhase ()
 Nullary constructor.
void init ()
 Parses the problem.

Protected Attributes

Collection< String > allRandVars
 The random variables in the problem.
WhereToProject whereToProject = WhereToProject.LCAS
 Where random variables are being projected out.
HashMap< String, HashMap< String, Map< V, Double > > > samples = new HashMap< String, HashMap< String, Map<V, Double> > > ()
 For each decision variable, for each random variable, a set of proposed sample values.
HashMap< String, Map< V, Double > > finalSamples = new HashMap< String, Map<V, Double> > ()
 For each random variable, the final set of samples chosen.
Protected Attributes inherited from frodo2.algorithms.dpop.stochastic.SamplingPhase< V, U >
DCOPProblemInterface< V, U > problem
 The problem.
boolean started
 Whether the execution of the algorithm has started.
int nbrSamples
 The number of samples for each random variable.
HashMap< String, UtilitySolutionSpace< V, U > > probLaws
 For each random variable, its non-sampled probability law.
boolean reportStats
 Whether to report stats.
WhereToProject proj
 Where the random variables should be projected out.

Private Member Functions

void chooseSamples (String var, NodeInfo nodeInfo)
 Combines the proposed samples for each random variable for which the input variable is the lca.
Map< V, Double > downSample (Map< V, Double > samples)
 Down-samples the input sample set to make it have the proper size.

Additional Inherited Members

Static Public Attributes inherited from frodo2.algorithms.dpop.stochastic.SamplingPhase< V, U >
static MessageType START_MSG_TYPE
 The type of the start message.
static final MessageType RAND_VARS_PROJ_MSG_TYPE
 The type of the messages telling what random variables should be projected out at given decision variable.

Detailed Description

The version of the SamplingPhase that samples at the lcas.

Parameters
<V>the type used for variable values
<U>the type used for utility values

Constructor & Destructor Documentation

◆ AtLCAs() [1/4]

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

Nullary constructor.

◆ AtLCAs() [2/4]

frodo2.algorithms.dpop.stochastic.SamplingPhase< V extends Addable< V >, U extends Addable< U > >.AtLCAs< V extends Addable< V >, U extends Addable< U > >.AtLCAs ( Element parameters,
DCOPProblemInterface< V, U > problem )

Constructor in statistics gatherer mode.

Parameters
problemthe overall problem
parametersthe parameters

References frodo2.algorithms.dpop.stochastic.SamplingPhase< V, U >.problem.

◆ AtLCAs() [3/4]

frodo2.algorithms.dpop.stochastic.SamplingPhase< V extends Addable< V >, U extends Addable< U > >.AtLCAs< V extends Addable< V >, U extends Addable< U > >.AtLCAs ( Element parameters,
DCOPProblemInterface< V, U > problem,
boolean parseProj )
protected

Constructor in statistics gatherer mode.

Parameters
problemthe overall problem
parametersthe parameters
parseProjwhether to parse where random variables should be projected out

References frodo2.algorithms.dpop.stochastic.SamplingPhase< V, U >.problem, and frodo2.algorithms.dpop.stochastic.SamplingPhase< V extends Addable< V >, U extends Addable< U > >.WhereToProject.ROOTS.

◆ AtLCAs() [4/4]

frodo2.algorithms.dpop.stochastic.SamplingPhase< V extends Addable< V >, U extends Addable< U > >.AtLCAs< V extends Addable< V >, U extends Addable< U > >.AtLCAs ( DCOPProblemInterface< V, U > problem,
Element parameters )

Member Function Documentation

◆ chooseSamples()

void frodo2.algorithms.dpop.stochastic.SamplingPhase< V extends Addable< V >, U extends Addable< U > >.AtLCAs< V extends Addable< V >, U extends Addable< U > >.chooseSamples ( String var,
NodeInfo nodeInfo )
private

Combines the proposed samples for each random variable for which the input variable is the lca.

Parameters
varthe current variable
nodeInfoinformation about the current variable

References downSample(), finalSamples, and frodo2.algorithms.dpop.stochastic.LowestCommonAncestors.NodeInfo.lcas.

Referenced by sendOutput(), and terminatePhase2().

Here is the call graph for this function:

◆ combineSamples()

Map< V, Double > frodo2.algorithms.dpop.stochastic.SamplingPhase< V extends Addable< V >, U extends Addable< U > >.AtLCAs< V extends Addable< V >, U extends Addable< U > >.combineSamples ( Map< V, Double > samples1,
Map< V, Double > samples2 )
protected

Merges two sample sets and then reduces the result.

Parameters
samples1first sample set
samples2second sample set
Returns
the reduced combination of the two input sample sets

Referenced by proposeSamples().

◆ downSample()

Map< V, Double > frodo2.algorithms.dpop.stochastic.SamplingPhase< V extends Addable< V >, U extends Addable< U > >.AtLCAs< V extends Addable< V >, U extends Addable< U > >.downSample ( Map< V, Double > samples)
private

Down-samples the input sample set to make it have the proper size.

Parameters
samplesproposed samples
Returns
new sample set of the appropriate size
Todo
Test this method separately?

References samples.

Referenced by chooseSamples().

◆ init()

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

◆ newPhase1msg()

LCAmsg1 frodo2.algorithms.dpop.stochastic.SamplingPhase< V extends Addable< V >, U extends Addable< U > >.AtLCAs< V extends Addable< V >, U extends Addable< U > >.newPhase1msg ( String node,
NodeInfo nodeInfo )
protected

◆ notifyIn()

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

◆ proposeSamples()

void frodo2.algorithms.dpop.stochastic.SamplingPhase< V extends Addable< V >, U extends Addable< U > >.AtLCAs< V extends Addable< V >, U extends Addable< U > >.proposeSamples ( String var,
NodeInfo nodeInfo )
protected

Sample all random variables linked to the current variable, and add them to the proposed samples for this variable.

Parameters
varthe current variable
nodeInfoinformation about the current variable

References combineSamples(), frodo2.algorithms.dpop.stochastic.LowestCommonAncestors.NodeInfo.myFlags, and frodo2.solutionSpaces.UtilitySolutionSpace< V extends Addable< V >, U extends Addable< U > >.sample().

Referenced by newPhase1msg(), sendOutput(), and terminatePhase2().

Here is the call graph for this function:

◆ sendOutput()

◆ terminatePhase2() [1/2]

void frodo2.algorithms.dpop.stochastic.SamplingPhase< V extends Addable< V >, U extends Addable< U > >.AtLCAs< V extends Addable< V >, U extends Addable< U > >.terminatePhase2 ( String node,
NodeInfo nodeInfo,
Set< String > pendingFlags )
protected
See also
LowestCommonAncestors.terminatePhase2(java.lang.String, LowestCommonAncestors.NodeInfo, java.util.Set)

References terminatePhase2().

Referenced by terminatePhase2(), and terminatePhase2().

Here is the call graph for this function:

◆ terminatePhase2() [2/2]

void frodo2.algorithms.dpop.stochastic.SamplingPhase< V extends Addable< V >, U extends Addable< U > >.AtLCAs< V extends Addable< V >, U extends Addable< U > >.terminatePhase2 ( String node,
NodeInfo nodeInfo,
Set< String > pendingFlags,
HashMap< String, Map< V, Double > > samplesFromParent )
protected

Sends messages to children and the output message.

Parameters
nodethe current node
nodeInfoinformation about the current node
pendingFlagsa set of flags whose lca has not yet been computed
samplesFromParentthe samples received from the parent

References chooseSamples(), finalSamples, frodo2.algorithms.dpop.stochastic.SamplingPhase< V extends Addable< V >, U extends Addable< U > >.WhereToProject.LEAVES, frodo2.algorithms.dpop.stochastic.LowestCommonAncestors.owners, frodo2.algorithms.dpop.stochastic.SamplingPhase< V, U >.problem, proposeSamples(), frodo2.algorithms.dpop.stochastic.LowestCommonAncestors.queue, samples, frodo2.algorithms.AgentInterface< V extends Addable< V > >.STATS_MONITOR, and terminatePhase2().

Here is the call graph for this function:

Member Data Documentation

◆ allRandVars

Collection<String> frodo2.algorithms.dpop.stochastic.SamplingPhase< V extends Addable< V >, U extends Addable< U > >.AtLCAs< V extends Addable< V >, U extends Addable< U > >.allRandVars
protected

The random variables in the problem.

◆ finalSamples

HashMap< String, Map<V, Double> > frodo2.algorithms.dpop.stochastic.SamplingPhase< V extends Addable< V >, U extends Addable< U > >.AtLCAs< V extends Addable< V >, U extends Addable< U > >.finalSamples = new HashMap< String, Map<V, Double> > ()
protected

For each random variable, the final set of samples chosen.

Referenced by chooseSamples(), sendOutput(), and terminatePhase2().

◆ samples

HashMap< String, HashMap< String, Map<V, Double> > > frodo2.algorithms.dpop.stochastic.SamplingPhase< V extends Addable< V >, U extends Addable< U > >.AtLCAs< V extends Addable< V >, U extends Addable< U > >.samples = new HashMap< String, HashMap< String, Map<V, Double> > > ()
protected

For each decision variable, for each random variable, a set of proposed sample values.

Referenced by downSample(), and terminatePhase2().

◆ whereToProject

WhereToProject frodo2.algorithms.dpop.stochastic.SamplingPhase< V extends Addable< V >, U extends Addable< U > >.AtLCAs< V extends Addable< V >, U extends Addable< U > >.whereToProject = WhereToProject.LCAS
protected

Where random variables are being projected out.


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