FRODO Version 2.19.1
An open-source framework for Distributed Constraint Optimization (DCOP)
Loading...
Searching...
No Matches
frodo2.algorithms.odpop.goodsTree.leafNodeTree.LeafNodeTree< Val extends Addable< Val >, U extends Addable< U >, L extends frodo2.algorithms.odpop.goodsTree.InnerNodeTreeFullDomain.Node< U > > Class Template Reference
Inheritance diagram for frodo2.algorithms.odpop.goodsTree.leafNodeTree.LeafNodeTree< Val extends Addable< Val >, U extends Addable< U >, L extends frodo2.algorithms.odpop.goodsTree.InnerNodeTreeFullDomain.Node< U > >:

Public Member Functions

 LeafNodeTree (String ownVariable, Val[] ownVariableDomain, UtilitySolutionSpace< Val, U > space, U zero, U infeasible, boolean maximize, boolean collectStats)
 A constructor.
 LeafNodeTree (String ownVariable, Val[] ownVariableDomain, List< UtilitySolutionSpace< Val, U > > spaces, U zero, U infeasible, boolean maximize, boolean collectStats)
 A constructor.
Good< Val, U > getAmax ()
void getBestAssignmentForOwnVariable (HashMap< String, Val > context)
int[] getFinalDomainSize ()
Val[][] getDomains ()
boolean hasFullInfo ()
boolean hasMore ()
boolean isValuationSufficient ()
boolean knowsVariable (String variable)
boolean notEnoughInfo ()
boolean pathExists (Val[] values)
void removeAMax ()
 This function is not used in this class.
void setFinalDomainSize (String[] variables, int[] domainSize)
 This function is not used in this class.
boolean stillToSend ()
String[] getChildSeparatorReportingOrder (int child)
void setChildrenSeparator (int child, String[] variables)
boolean add (Good< Val, U > g, int sender, HashMap< String, Val[]> domains)
boolean setChildDone (int child)
HashMap< String, Val > getChildValues (HashMap< String, Val > parentContext, int child)
Public Member Functions inherited from frodo2.algorithms.odpop.goodsTree.GoodsTree< Val extends Addable< Val >, U extends Addable< U >, L extends Node< U > >
 GoodsTree (String ownVariable, Val[] ownVariableDomain, UtilitySolutionSpace< Val, U > space, U zero, int numberOfChildren, U infeasibleUtil, boolean maximize, boolean collectStats)
 A constructor.
 GoodsTree (String ownVariable, Val[] ownVariableDomain, List< UtilitySolutionSpace< Val, U > > spaces, U zero, int numberOfChildren, U infeasibleUtil, boolean maximize, boolean collectStats)
 A constructor.
double getTreeFillPercentage ()
long getNumberOfDummies ()
double getDummiesFillPercentage ()
boolean greaterThanOrEqual (U u1, U u2)
 Compares two values.
boolean greaterThan (U u1, U u2)
 Compares two values.
getMaximalCut ()
long getNumberOfGoodsSent ()
long getSizeOfSpace ()

Protected Member Functions

void addToTree (Val[] assignment, int depth, Node currentNode)
 Adds a reported value to the goods tree.
void getOwnAssignment (HashMap< String, Val > assignment, Node currentNode, int depth)
 Given an assignment to all the variables in the variables separator, this method finds and returns the optimal value of the tree's own variable.
boolean pathExists (Val[] values, int finalDepth)
 Checks whether a path exists up until a certain depth.
Protected Member Functions inherited from frodo2.algorithms.odpop.goodsTree.GoodsTree< Val extends Addable< Val >, U extends Addable< U >, L extends Node< U > >
void solveLocalProblem ()
 Method used to solve the local problem and create an ordered list of all feasible assignments.
void countLeafNode ()
 Method used to count the number of leaf nodes created (includes the dummy nodes).
void countLeafNode (boolean real)
 Method used to count the number of leaf nodes created (includes the dummy nodes).
void countGoodsProduced ()
 Count rhe number of goods produced.

Protected Attributes

Node root
 The root of the tree.
boolean hasMore
 true when orderedAssignments is not empty, and false otherwise
String[] separatorVariables
 The variables in ownVariable's separator.
int[] domainSize
 For each variable the size of its domain.
HashMap< String, HashMap< Val, Integer > > valuePointers
 for each variables, the child index of their values
Val[] localAssignment
 The currently optimal assignment to the local problem.
boolean singleton
 true when the variable that owns this tree is a singleton, i.e.
Protected Attributes inherited from frodo2.algorithms.odpop.goodsTree.GoodsTree< Val extends Addable< Val >, U extends Addable< U >, L extends Node< U > >
UtilitySolutionSpace< Val, U > localProblem
 The list of spaces this variable is responsible for.
int numberOfLocalVariables
 The number of local variables in the local problem.
IteratorBestFirst< Val, U > localProblemIterator
 Iterator that returns solutions to the local problem in a best first order.
final U infeasibleUtil
 The -infinite utility.
final U zero
 The zero utility.
int numberOfSpaces
 The number of spaces that together comprise the local problem.
Class<?> domainElementClass
 domain element used for reflection
int numberOfVariables
 The number of variables in the local problem.
String[] depthToVariable
 Links a level in the tree with its corresponding variable.
String ownVariable
 The variable that controls this LeafNodeTree.
int depthFinalVariable
 The depth of the last variable in the tree.
Val[] ownVarDomain
 The domain of ownVariable.
String[] outsideVariables
 The variables as they should be communicated with the outside world.
int[] valuesToBeRemoved
 Contains the indices of the values that need to be removed from the assigment before being send upwards.
int depthOfFirstToBeRemovedVariables
 All variables below this depth must be removed when sending a good.
HashMap< String, Integer > outsideVariablesMapping
 A mapping from outside variables to inside variables.
final boolean maximize
 true when we are maximizing, and false otherwise
long totalSeparatorSpaceSize = 1
 The size of the separator space.

Private Member Functions

void init (U zero)
 Method to initialize all the variables.

Private Attributes

HashMap< String, Integer > variableToDepth
 The index of every variable in variables.
boolean stillToSend
 true when the final domain size information has not yet been requested, and false otherwise

Static Private Attributes

static final long serialVersionUID = -4372313666234992912L
 Used for serialisation.

Additional Inherited Members

Public Attributes inherited from frodo2.algorithms.odpop.goodsTree.GoodsTree< Val extends Addable< Val >, U extends Addable< U >, L extends Node< U > >
final boolean COLLECT_STATISTICS
 true when statistics should be collected, and false otherwise

Detailed Description

Author
Brammert Ottens, 9 nov 2009
Parameters
<Val>type used for variable values
<U>type used for utility values
<L>type used for the leaf node
Todo
write tests for this class

Constructor & Destructor Documentation

◆ LeafNodeTree() [1/2]

frodo2.algorithms.odpop.goodsTree.leafNodeTree.LeafNodeTree< Val extends Addable< Val >, U extends Addable< U >, L extends frodo2.algorithms.odpop.goodsTree.InnerNodeTreeFullDomain.Node< U > >.LeafNodeTree ( String ownVariable,
Val[] ownVariableDomain,
UtilitySolutionSpace< Val, U > space,
U zero,
U infeasible,
boolean maximize,
boolean collectStats )

A constructor.

Warning
we assume that the agent's own variable is put in the end of variables_order
Parameters
ownVariableThe variable ID
ownVariableDomainThe domain of ownVariable
spaceThe hypercube representing the local problem
zeroThe zero utility
infeasibleThe infeasible utility
maximizewhen true we are maximizing, when false we are minimizing
collectStatstrue when statistics should be collected, and false otherwise

References init(), frodo2.algorithms.odpop.goodsTree.GoodsTree< Val extends Addable< Val >, U extends Addable< U >, L extends Node< U > >.maximize, frodo2.algorithms.odpop.goodsTree.GoodsTree< Val extends Addable< Val >, U extends Addable< U >, L extends Node< U > >.numberOfSpaces, frodo2.algorithms.odpop.goodsTree.GoodsTree< Val extends Addable< Val >, U extends Addable< U >, L extends Node< U > >.ownVariable, frodo2.algorithms.odpop.goodsTree.GoodsTree< Val extends Addable< Val >, U extends Addable< U >, L extends Node< U > >.solveLocalProblem(), and frodo2.algorithms.odpop.goodsTree.GoodsTree< Val extends Addable< Val >, U extends Addable< U >, L extends Node< U > >.zero.

Here is the call graph for this function:

◆ LeafNodeTree() [2/2]

frodo2.algorithms.odpop.goodsTree.leafNodeTree.LeafNodeTree< Val extends Addable< Val >, U extends Addable< U >, L extends frodo2.algorithms.odpop.goodsTree.InnerNodeTreeFullDomain.Node< U > >.LeafNodeTree ( String ownVariable,
Val[] ownVariableDomain,
List< UtilitySolutionSpace< Val, U > > spaces,
U zero,
U infeasible,
boolean maximize,
boolean collectStats )

A constructor.

Warning
we assume that the agents own variable is put in the end of variables_order
Parameters
ownVariableThe variable ID
ownVariableDomainThe domain of ownVariable
spacesThe hypercubes representing the local problem
zeroThe zero utility
infeasibleThe infeasible utility
maximizewhen true we are maximizing, when false we are minimizing
collectStatstrue when statistics should be collected, and false otherwise

References init(), frodo2.algorithms.odpop.goodsTree.GoodsTree< Val extends Addable< Val >, U extends Addable< U >, L extends Node< U > >.maximize, frodo2.algorithms.odpop.goodsTree.GoodsTree< Val extends Addable< Val >, U extends Addable< U >, L extends Node< U > >.numberOfSpaces, frodo2.algorithms.odpop.goodsTree.GoodsTree< Val extends Addable< Val >, U extends Addable< U >, L extends Node< U > >.ownVariable, frodo2.algorithms.odpop.goodsTree.GoodsTree< Val extends Addable< Val >, U extends Addable< U >, L extends Node< U > >.solveLocalProblem(), and frodo2.algorithms.odpop.goodsTree.GoodsTree< Val extends Addable< Val >, U extends Addable< U >, L extends Node< U > >.zero.

Here is the call graph for this function:

Member Function Documentation

◆ add()

◆ addToTree()

◆ getAmax()

◆ getBestAssignmentForOwnVariable()

void frodo2.algorithms.odpop.goodsTree.leafNodeTree.LeafNodeTree< Val extends Addable< Val >, U extends Addable< U >, L extends frodo2.algorithms.odpop.goodsTree.InnerNodeTreeFullDomain.Node< U > >.getBestAssignmentForOwnVariable ( HashMap< String, Val > context)

◆ getChildSeparatorReportingOrder()

◆ getChildValues()

◆ getDomains()

◆ getFinalDomainSize()

◆ getOwnAssignment()

◆ hasFullInfo()

◆ hasMore()

◆ init()

◆ isValuationSufficient()

◆ knowsVariable()

◆ notEnoughInfo()

◆ pathExists() [1/2]

◆ pathExists() [2/2]

boolean frodo2.algorithms.odpop.goodsTree.leafNodeTree.LeafNodeTree< Val extends Addable< Val >, U extends Addable< U >, L extends frodo2.algorithms.odpop.goodsTree.InnerNodeTreeFullDomain.Node< U > >.pathExists ( Val[] values,
int finalDepth )
protected

Checks whether a path exists up until a certain depth.

Author
Brammert Ottens, 10 nov 2009
Parameters
valuesthe path to be checked
finalDepththe maximal depth
Returns
true when the path exists, and false otherwise

References frodo2.algorithms.odpop.goodsTree.GoodsTree< Val extends Addable< Val >, U extends Addable< U >, L extends Node< U > >.depthToVariable, frodo2.algorithms.odpop.goodsTree.leafNodeTree.Node.getChild(), root, and valuePointers.

Here is the call graph for this function:

◆ removeAMax()

◆ setChildDone()

◆ setChildrenSeparator()

◆ setFinalDomainSize()

void frodo2.algorithms.odpop.goodsTree.leafNodeTree.LeafNodeTree< Val extends Addable< Val >, U extends Addable< U >, L extends frodo2.algorithms.odpop.goodsTree.InnerNodeTreeFullDomain.Node< U > >.setFinalDomainSize ( String[] variables,
int[] domainSize )

◆ stillToSend()

Member Data Documentation

◆ domainSize

For each variable the size of its domain.

Referenced by addToTree(), getFinalDomainSize(), init(), and setFinalDomainSize().

◆ hasMore

true when orderedAssignments is not empty, and false otherwise

Referenced by hasFullInfo(), hasMore(), and init().

◆ localAssignment

Val [] frodo2.algorithms.odpop.goodsTree.leafNodeTree.LeafNodeTree< Val extends Addable< Val >, U extends Addable< U >, L extends frodo2.algorithms.odpop.goodsTree.InnerNodeTreeFullDomain.Node< U > >.localAssignment
protected

The currently optimal assignment to the local problem.

Referenced by getOwnAssignment().

◆ root

◆ separatorVariables

String [] frodo2.algorithms.odpop.goodsTree.leafNodeTree.LeafNodeTree< Val extends Addable< Val >, U extends Addable< U >, L extends frodo2.algorithms.odpop.goodsTree.InnerNodeTreeFullDomain.Node< U > >.separatorVariables
protected

The variables in ownVariable's separator.

Referenced by init().

◆ serialVersionUID

final long frodo2.algorithms.odpop.goodsTree.leafNodeTree.LeafNodeTree< Val extends Addable< Val >, U extends Addable< U >, L extends frodo2.algorithms.odpop.goodsTree.InnerNodeTreeFullDomain.Node< U > >.serialVersionUID = -4372313666234992912L
staticprivate

Used for serialisation.

◆ singleton

true when the variable that owns this tree is a singleton, i.e.

has no parents or children

Referenced by init().

◆ stillToSend

true when the final domain size information has not yet been requested, and false otherwise

Referenced by getFinalDomainSize(), init(), and stillToSend().

◆ valuePointers

HashMap<String, HashMap<Val, Integer> > frodo2.algorithms.odpop.goodsTree.leafNodeTree.LeafNodeTree< Val extends Addable< Val >, U extends Addable< U >, L extends frodo2.algorithms.odpop.goodsTree.InnerNodeTreeFullDomain.Node< U > >.valuePointers
protected

for each variables, the child index of their values

Referenced by addToTree(), getOwnAssignment(), init(), knowsVariable(), pathExists(), and pathExists().

◆ variableToDepth

HashMap<String, Integer> frodo2.algorithms.odpop.goodsTree.leafNodeTree.LeafNodeTree< Val extends Addable< Val >, U extends Addable< U >, L extends frodo2.algorithms.odpop.goodsTree.InnerNodeTreeFullDomain.Node< U > >.variableToDepth
private

The index of every variable in variables.

Referenced by init().


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