FRODO Version 2.19.1
An open-source framework for Distributed Constraint Optimization (DCOP)
Loading...
Searching...
No Matches
frodo2.algorithms.duct.Sampling< V extends Addable< V > >.VariableInfo Class Reference

Convenience class to hold variable information. More...

Public Member Functions

 VariableInfo (String variableID, V[] domain, String parent, List< String > children, Class< SamplingProcedure< V > > samplingClass, Class< TerminationCondition< V > > terminationClass)
 Constructor.
boolean storeCOSTmsg (COSTmsg msg)
void setSize (long size)
void setSeparator (Set< String > separator)
solveSingleton (boolean maximize)
 Solve the local problem of a singleton variable.
boolean finishedSampling (double error, double delta)
boolean sample ()
 Method used to sample the values of the variable.
boolean setContext (String sender, String[] variables, V[] values)
 Method used to update the context after a VALUE message has been received.
AddableReal solveLeaf ()
 Solve the local problem of a leaf, given the context.
VALUEmsg< V > getNewValueMessage (String child, boolean finished)
Message getCostMessage ()
String getParent ()
void storeConstraint (UtilitySolutionSpace< V, AddableReal > space)
 Makes this variable responsible for this constraint.
List< String > getChildren ()
SolutionCollector.AssignmentMessage< V > getAssignmentMessage (V value)
SolutionCollector.AssignmentMessage< V > getAssignmentMessage (String var, V value)
AddableReal getFinalBound ()
String toString ()

Protected Member Functions

SearchNode< V > createNode (int domainSize, boolean maximize, boolean IGNORE_INF)
 Method to create search node.

Protected Attributes

String variableID
 The name of the variable.
V[] domain
 The domain of the variable.
int domainSize
 The size of the domain.
String parent
 The parent of the variable.
final boolean leaf
 true when the variable is a leaf node, and false otherwise
boolean parentFinished
 true when the parent finished sampling
int nbrChildren
 The number of children of this variable.
long size
 The maximal number of nodes below any node of this variable.
int contextSize
 The size of the context.
V[] context
 The current value assignment of all agents in the separator.
HashMap< String, Integer > contextPointer
 For each context variable, the position in the context array.
String[] contextVariables
 The context variables.
currentValue
 The currently sampled value.
int currentValueIndex
 The index of the current value.
UtilitySolutionSpace< V, AddableRealspace
 The local problem of the variable.
SamplingProcedure< V > sampler
 The sampler used.
SearchNode< V > node
 The distribution corresponding to the current context.
HashMap< State< V >, SearchNode< V > > distributions
 For each possible context value seen, the collected information.
AddableReal reportedSample
 sum of all samples reported by the children for the current context
Message nextCostMsg
 The next cost message to be sent.
int costMessagesReceived
 The number of COST messages received as a reply on the last VALUE message.
ArrayList< VALUEmsg< V > > toBeProcessed
 List of to be processed value messages.
AddableReal penalty
 penalty used to replace an infeasible solution
boolean receivedNormalize
 true when normalization is finished for this variable, and false otherwise

Private Attributes

List< String > children
 The list of children.
TerminationCondition< V > termination
 The termination condition used.
Bound< V > bound
 The bound used for sampling.

Detailed Description

Convenience class to hold variable information.

Author
Brammert Ottens, 7 jul. 2011

Constructor & Destructor Documentation

◆ VariableInfo()

frodo2.algorithms.duct.Sampling< V extends Addable< V > >.VariableInfo.VariableInfo ( String variableID,
V[] domain,
String parent,
List< String > children,
Class< SamplingProcedure< V > > samplingClass,
Class< TerminationCondition< V > > terminationClass )

Constructor.

Parameters
variableIDthe name of the variable
domainthe domain of the variable
parentthe parent of the variable
childrenlist of the children of the variable
samplingClassthe class of the sampling method
terminationClassthe class of the termination condition

References children, domain, nbrChildren, parent, frodo2.algorithms.duct.Sampling< V extends Addable< V > >.samplingClass, frodo2.algorithms.duct.Sampling< V extends Addable< V > >.terminationClass, and variableID.

Member Function Documentation

◆ createNode()

SearchNode< V > frodo2.algorithms.duct.Sampling< V extends Addable< V > >.VariableInfo.createNode ( int domainSize,
boolean maximize,
boolean IGNORE_INF )
protected

Method to create search node.

Author
Brammert Ottens, 4 nov. 2011
Parameters
domainSizethe size of the domain
maximizetrue when maximizing, and false otherwise
IGNORE_INFtrue when infeasible utilities are to be ignored, and false otherwise
Returns
a new search node

References domainSize, frodo2.algorithms.duct.Sampling< V extends Addable< V > >.IGNORE_INF, and frodo2.algorithms.duct.Sampling< V extends Addable< V > >.maximize.

Referenced by setContext().

◆ finishedSampling()

boolean frodo2.algorithms.duct.Sampling< V extends Addable< V > >.VariableInfo.finishedSampling ( double error,
double delta )
Author
Brammert Ottens, 7 jul. 2011
Parameters
errorthe intended error
deltathe delta that determines the probability
Returns
true when enough samples have been received, false otherwise

References frodo2.algorithms.duct.Sampling< V extends Addable< V > >.delta, domain, frodo2.algorithms.duct.Sampling< V extends Addable< V > >.error, frodo2.algorithms.duct.Sampling< V extends Addable< V > >.maximize, node, and termination.

Referenced by frodo2.algorithms.duct.Sampling< V extends Addable< V > >.notifyIn().

◆ getAssignmentMessage() [1/2]

SolutionCollector.AssignmentMessage< V > frodo2.algorithms.duct.Sampling< V extends Addable< V > >.VariableInfo.getAssignmentMessage ( String var,
V value )
Author
Brammert Ottens, 18 okt. 2011
Parameters
varthe variable for which the assignment is reported
valuethe value of the assignment
Returns
an assignment message to report value value

◆ getAssignmentMessage() [2/2]

SolutionCollector.AssignmentMessage< V > frodo2.algorithms.duct.Sampling< V extends Addable< V > >.VariableInfo.getAssignmentMessage ( V value)
Author
Brammert Ottens, 18 okt. 2011
Parameters
valuethe value of the assignment
Returns
an assignment message to report value value

References variableID.

Referenced by frodo2.algorithms.duct.Sampling< V extends Addable< V > >.notifyIn().

◆ getChildren()

List< String > frodo2.algorithms.duct.Sampling< V extends Addable< V > >.VariableInfo.getChildren ( )
Author
Brammert Ottens, 7 jul. 2011
Returns
a list containing the children of this variable

References children.

Referenced by frodo2.algorithms.duct.Sampling< V extends Addable< V > >.reportValue().

◆ getCostMessage()

Message frodo2.algorithms.duct.Sampling< V extends Addable< V > >.VariableInfo.getCostMessage ( )
Author
Brammert Ottens, 7 jul. 2011
Returns
a COST message to be reported to the parent

Referenced by frodo2.algorithms.duct.Sampling< V extends Addable< V > >.notifyIn().

◆ getFinalBound()

◆ getNewValueMessage()

VALUEmsg< V > frodo2.algorithms.duct.Sampling< V extends Addable< V > >.VariableInfo.getNewValueMessage ( String child,
boolean finished )
Author
Brammert Ottens, 7 jul. 2011
Parameters
childthe child for which the VALUE message is meant
finishedtrue when the variable is ready with sampling, and false otherwise
Returns
a value message containing the newly chosen value;

References frodo2.algorithms.duct.Sampling< V extends Addable< V > >.VALUE_FIN_MSG_TYPE, frodo2.algorithms.duct.Sampling< V extends Addable< V > >.VALUE_MSG_TYPE, and variableID.

Referenced by frodo2.algorithms.duct.Sampling< V extends Addable< V > >.reportValue().

◆ getParent()

String frodo2.algorithms.duct.Sampling< V extends Addable< V > >.VariableInfo.getParent ( )
Author
Brammert Ottens, 7 jul. 2011
Returns
the parent of this variable

Referenced by frodo2.algorithms.duct.Sampling< V extends Addable< V > >.notifyIn().

◆ sample()

boolean frodo2.algorithms.duct.Sampling< V extends Addable< V > >.VariableInfo.sample ( )

Method used to sample the values of the variable.

Based on the context, and a give probability distribution this method chooses a value for variablID and stores it in context

Author
Brammert Ottens, 7 jul. 2011
Returns
true when the current local problem is feasible, false otherwise

References bound, context, contextVariables, currentValue, currentValueIndex, domain, frodo2.algorithms.duct.Sampling< V extends Addable< V > >.infeasibleUtility, node, sampler, and space.

Referenced by frodo2.algorithms.duct.Sampling< V extends Addable< V > >.notifyIn().

◆ setContext()

boolean frodo2.algorithms.duct.Sampling< V extends Addable< V > >.VariableInfo.setContext ( String sender,
String[] variables,
V[] values )

◆ setSeparator()

void frodo2.algorithms.duct.Sampling< V extends Addable< V > >.VariableInfo.setSeparator ( Set< String > separator)
Author
Brammert Ottens, 25 aug. 2011
Parameters
separatorthe separator of the variable

References contextPointer, contextSize, contextVariables, domain, setSeparator(), and variableID.

Referenced by frodo2.algorithms.duct.Sampling< V extends Addable< V > >.notifyIn(), and setSeparator().

Here is the call graph for this function:

◆ setSize()

◆ solveLeaf()

AddableReal frodo2.algorithms.duct.Sampling< V extends Addable< V > >.VariableInfo.solveLeaf ( )

Solve the local problem of a leaf, given the context.

Author
Brammert Ottens, 29 aug. 2011
Returns
the maximal utility obtainable given the context

References frodo2.solutionSpaces.AddableReal.compareTo(), context, contextSize, contextVariables, currentValue, domain, domainSize, frodo2.algorithms.duct.Sampling< V extends Addable< V > >.infeasibleUtility, leaf, frodo2.algorithms.duct.Sampling< V extends Addable< V > >.maximize, penalty, and space.

Referenced by frodo2.algorithms.duct.Sampling< V extends Addable< V > >.notifyIn().

Here is the call graph for this function:

◆ solveSingleton()

V frodo2.algorithms.duct.Sampling< V extends Addable< V > >.VariableInfo.solveSingleton ( boolean maximize)

◆ storeConstraint()

void frodo2.algorithms.duct.Sampling< V extends Addable< V > >.VariableInfo.storeConstraint ( UtilitySolutionSpace< V, AddableReal > space)

Makes this variable responsible for this constraint.

Parameters
spacethe constraint

References frodo2.solutionSpaces.UtilitySolutionSpace< V extends Addable< V >, U extends Addable< U > >.join(), and space.

Referenced by frodo2.algorithms.duct.Sampling< V extends Addable< V > >.notifyIn().

Here is the call graph for this function:

◆ storeCOSTmsg()

boolean frodo2.algorithms.duct.Sampling< V extends Addable< V > >.VariableInfo.storeCOSTmsg ( COSTmsg msg)
Author
Brammert Ottens, 7 jul. 2011
Parameters
msgthe message to be stored
Returns
true when enough cost messages have been received, false otherwise

References frodo2.algorithms.duct.COSTmsg.getCost(), frodo2.algorithms.duct.Sampling< V extends Addable< V > >.infeasibleUtility, frodo2.algorithms.duct.Sampling< V extends Addable< V > >.maximize, nbrChildren, nextCostMsg, node, parent, penalty, reportedSample, and sampler.

Referenced by frodo2.algorithms.duct.Sampling< V extends Addable< V > >.notifyIn().

Here is the call graph for this function:

◆ toString()

String frodo2.algorithms.duct.Sampling< V extends Addable< V > >.VariableInfo.toString ( )
See also
java.lang.Object#toString()

References contextSize, frodo2.algorithms.duct.Sampling< V extends Addable< V > >.delta, node, and variableID.

Member Data Documentation

◆ bound

Bound<V> frodo2.algorithms.duct.Sampling< V extends Addable< V > >.VariableInfo.bound
private

The bound used for sampling.

Referenced by sample().

◆ children

List<String> frodo2.algorithms.duct.Sampling< V extends Addable< V > >.VariableInfo.children
private

The list of children.

Referenced by getChildren(), solveSingleton(), and VariableInfo().

◆ context

V [] frodo2.algorithms.duct.Sampling< V extends Addable< V > >.VariableInfo.context
protected

The current value assignment of all agents in the separator.

Referenced by sample(), setContext(), and solveLeaf().

◆ contextPointer

HashMap<String, Integer> frodo2.algorithms.duct.Sampling< V extends Addable< V > >.VariableInfo.contextPointer
protected

For each context variable, the position in the context array.

Referenced by setContext(), and setSeparator().

◆ contextSize

int frodo2.algorithms.duct.Sampling< V extends Addable< V > >.VariableInfo.contextSize
protected

The size of the context.

Referenced by setSeparator(), solveLeaf(), and toString().

◆ contextVariables

String [] frodo2.algorithms.duct.Sampling< V extends Addable< V > >.VariableInfo.contextVariables
protected

The context variables.

Referenced by sample(), setContext(), setSeparator(), and solveLeaf().

◆ costMessagesReceived

int frodo2.algorithms.duct.Sampling< V extends Addable< V > >.VariableInfo.costMessagesReceived
protected

The number of COST messages received as a reply on the last VALUE message.

◆ currentValue

V frodo2.algorithms.duct.Sampling< V extends Addable< V > >.VariableInfo.currentValue
protected

◆ currentValueIndex

int frodo2.algorithms.duct.Sampling< V extends Addable< V > >.VariableInfo.currentValueIndex
protected

The index of the current value.

Referenced by sample().

◆ distributions

HashMap<State<V>, SearchNode<V> > frodo2.algorithms.duct.Sampling< V extends Addable< V > >.VariableInfo.distributions
protected

For each possible context value seen, the collected information.

Referenced by setContext().

◆ domain

V [] frodo2.algorithms.duct.Sampling< V extends Addable< V > >.VariableInfo.domain
protected

The domain of the variable.

Referenced by finishedSampling(), sample(), setContext(), setSeparator(), solveLeaf(), and VariableInfo().

◆ domainSize

int frodo2.algorithms.duct.Sampling< V extends Addable< V > >.VariableInfo.domainSize
protected

The size of the domain.

Referenced by createNode(), setContext(), and solveLeaf().

◆ leaf

final boolean frodo2.algorithms.duct.Sampling< V extends Addable< V > >.VariableInfo.leaf
protected

true when the variable is a leaf node, and false otherwise

Referenced by frodo2.algorithms.duct.Sampling< V extends Addable< V > >.notifyIn(), setContext(), and solveLeaf().

◆ nbrChildren

int frodo2.algorithms.duct.Sampling< V extends Addable< V > >.VariableInfo.nbrChildren
protected

The number of children of this variable.

Referenced by storeCOSTmsg(), and VariableInfo().

◆ nextCostMsg

Message frodo2.algorithms.duct.Sampling< V extends Addable< V > >.VariableInfo.nextCostMsg
protected

The next cost message to be sent.

Referenced by storeCOSTmsg().

◆ node

SearchNode<V> frodo2.algorithms.duct.Sampling< V extends Addable< V > >.VariableInfo.node
protected

The distribution corresponding to the current context.

Referenced by finishedSampling(), getFinalBound(), sample(), setContext(), storeCOSTmsg(), and toString().

◆ parent

String frodo2.algorithms.duct.Sampling< V extends Addable< V > >.VariableInfo.parent
protected

◆ parentFinished

boolean frodo2.algorithms.duct.Sampling< V extends Addable< V > >.VariableInfo.parentFinished
protected

true when the parent finished sampling

Referenced by frodo2.algorithms.duct.Sampling< V extends Addable< V > >.notifyIn().

◆ penalty

AddableReal frodo2.algorithms.duct.Sampling< V extends Addable< V > >.VariableInfo.penalty
protected

penalty used to replace an infeasible solution

Referenced by frodo2.algorithms.duct.Sampling< V extends Addable< V > >.notifyIn(), solveLeaf(), and storeCOSTmsg().

◆ receivedNormalize

boolean frodo2.algorithms.duct.Sampling< V extends Addable< V > >.VariableInfo.receivedNormalize
protected

true when normalization is finished for this variable, and false otherwise

Referenced by frodo2.algorithms.duct.Sampling< V extends Addable< V > >.notifyIn().

◆ reportedSample

AddableReal frodo2.algorithms.duct.Sampling< V extends Addable< V > >.VariableInfo.reportedSample
protected

sum of all samples reported by the children for the current context

Referenced by storeCOSTmsg().

◆ sampler

SamplingProcedure<V> frodo2.algorithms.duct.Sampling< V extends Addable< V > >.VariableInfo.sampler
protected

The sampler used.

Referenced by sample(), and storeCOSTmsg().

◆ size

long frodo2.algorithms.duct.Sampling< V extends Addable< V > >.VariableInfo.size
protected

The maximal number of nodes below any node of this variable.

Referenced by setSize().

◆ space

UtilitySolutionSpace<V, AddableReal> frodo2.algorithms.duct.Sampling< V extends Addable< V > >.VariableInfo.space
protected

The local problem of the variable.

Referenced by sample(), setContext(), solveLeaf(), solveSingleton(), and storeConstraint().

◆ termination

TerminationCondition<V> frodo2.algorithms.duct.Sampling< V extends Addable< V > >.VariableInfo.termination
private

The termination condition used.

Referenced by finishedSampling().

◆ toBeProcessed

ArrayList<VALUEmsg<V> > frodo2.algorithms.duct.Sampling< V extends Addable< V > >.VariableInfo.toBeProcessed
protected

List of to be processed value messages.

Referenced by frodo2.algorithms.duct.Sampling< V extends Addable< V > >.notifyIn().

◆ variableID


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