FRODO Version 2.19.1
An open-source framework for Distributed Constraint Optimization (DCOP)
Loading...
Searching...
No Matches
frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.VariableInfo< Val extends Addable< Val >, U extends Serializable &Addable< U > > Class Template Reference

Helper class that contains all the info belonging to a specific variable. More...

Public Member Functions

 VariableInfo (String variableID, Val[] domain, U zero)
 Constructor.
void storeConstraint (UtilitySolutionSpace< Val, U > space)
 Makes this variable responsible for this constraint.
void setDelta ()
 Given the current context, set the utilities for each value of this variable.
void setCurrentAssignmentSingleton ()
 This function is used to find the optimal decision of a singleton agent.
void setLowerBoundChild (String child, UtilitySolutionSpace< Val, U > bounds)
 Set the lower bound found by the Preprocessing module for child.
void setOwnLowerBound (UtilitySolutionSpace< Val, U > bounds)
 Set the lower bound on ones own values, as determined by the Preprocessing module.
void initializeBounds (U upperBound)
 Initializes the lower bounds to the value in lowerBounds, and set the upper bounds all to the same value upperBound.
void resetBounds (Val d, String child, U upperBound)
 Resets the bounds for a particular value / child combination.
void updateBounds (Val value, int child, U newLb, U newUb)
 Updates the bounds.
void computeLB (Val value)
 Computes the sum of all child lower bounds for domain value "value".
void computeUB (Val value)
 Computes the sum of all child upper bounds for domain value "value".
void resetChildThreshold (Val d, String child, U zero)
 Resets the threshold for a particular value / child combination.
void resetChildContext (Val d, int i)
 Resets the context for a particular value / child combination.
void setSeparator (String parent, List< String > pseudoParents)
 Sets the separator of this variable.
void setLowerNeighbours (List< String > children, List< String > pseudoChildren, U zero)
 Sets the lower neighbours of this variable.
getCurrentDelta ()
 Getter function.
boolean isSingleton ()
 Check to see if this variable has any neighbours.
boolean isReady ()
 A Variable is ready to start adopt when it has received all preprocessing messages.
boolean checkUpperBounds ()
 This functions checks, for each value, whether the bounds add up and are equal to the overall bound.
String toString ()

Public Attributes

boolean initialized = false
 false when the variable is not initialized yet and true otherwise
boolean terminate = false
 true when the variable received a terminate message from its parent
boolean execution_terminated = false
 true when execution has been terminated
boolean full_info = false
 True when the variable has received a VALUE message from all its higher priority neighbours.
int full_info_counter = 0
 Counts from how many agents it has received a VALUE message.
int nbrOfSeparators = 0
 The number of higher priority neighbours.
Message[] lastValueSent
 For each lower priority neighbour the last VALUE message that has been sent.
Message lastMessageReceived = null
 Remembers the last message that has been received.
String variableID
 This variable's ID.
String[] lowerNeighbours
 This variable's a list of lower neighbours.
HashMap< String, U > hChild
 The lower bounds for the children determined by the Preprocessing module.
UtilitySolutionSpace< Val, U > h
 The variables own lower bounds determined by the Preprocessing module.
int numberOfChildren
 This variable's number of children.
String[] separator
 The variable's parent and pseudo parents, separator[0] = parent, rest is pseudo parent.
HashMap< String, Integer > neighbours
 A list of my neighbours and their pointers in the separator and lowerNeighbours lists.
ArrayList< ArrayList< U > > lb
 For each variable/value v/d combination it contains a list of lower bounds for v's children.
U[] lbSUM
 Stores the sum of all the values in lb.
ArrayList< ArrayList< U > > ub
 For each variable/value v/d combination it contains a list of upper bounds for v's children.
U[] ubSUM
 Stores the sum of all the values in ub.
U[][] t
 For each variable/value v/d combination it contains the distribution of v's threshold over its children.
UB
 The current minimal upper bound.
ArrayList< U > UBperD
 For each value the upper bound.
LB
 The current minimal lower bound.
ArrayList< U > LBperD
 For each value the lower bound.
Val lbD
 The value that minimizes the lower bound.
Val ubD
 The value that minimizes the upper bound.
Val currentAssignment
 For each variable the current assignment.
ArrayList< U > delta
 Given the current context, this map contains the utilities for each value of this variable.
HashMap< Val, Integer > valuePointer
 For each value the position in the lb and ub arrays.
ArrayList< Val > domain
 The domain of this variable.
threshold
 The current threshold.
ArrayList< ArrayList< HashMap< String, Val > > > context
 For each value and child, its context.
HashMap< String, Val > currentContext
 For each variable, its current context.
BufferedWriter logFile
 This variables private log file.

Private Attributes

zero
 A zero utility.
UtilitySolutionSpace< Val, U > space
 The join of all constraints this variable is responsible for.

Detailed Description

Helper class that contains all the info belonging to a specific variable.

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

Constructor & Destructor Documentation

◆ VariableInfo()

frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.VariableInfo< Val extends Addable< Val >, U extends Serializable &Addable< U > >.VariableInfo ( String variableID,
Val[] domain,
U zero )

Constructor.

Parameters
variableIDthe name of the variable
domainthe variable's domain
zerothe zero utility

References context, currentAssignment, currentContext, delta, domain, hChild, LB, lb, LBperD, lbSUM, frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.LOG, logFile, neighbours, t, UB, ub, UBperD, ubSUM, valuePointer, variableID, VariableInfo(), and zero.

Referenced by VariableInfo().

Here is the call graph for this function:

Member Function Documentation

◆ checkUpperBounds()

boolean frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.VariableInfo< Val extends Addable< Val >, U extends Serializable &Addable< U > >.checkUpperBounds ( )

This functions checks, for each value, whether the bounds add up and are equal to the overall bound.

Returns
true when consistent and false otherwise

References delta, frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.infinity, ub, UBperD, valuePointer, and zero.

Referenced by frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.Original< Val extends Addable< Val >, U extends Addable< U > >.handleVALUEmessage().

◆ computeLB()

void frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.VariableInfo< Val extends Addable< Val >, U extends Serializable &Addable< U > >.computeLB ( Val value)

Computes the sum of all child lower bounds for domain value "value".

Parameters
valuethe domain value

References frodo2.solutionSpaces.AddableDelayed< T extends Addable< T > >.addDelayed(), computeLB(), delta, h, LB, lb, lbD, LBperD, lbSUM, frodo2.solutionSpaces.AddableDelayed< T extends Addable< T > >.resolve(), valuePointer, and zero.

Referenced by computeLB(), resetBounds(), and updateBounds().

Here is the call graph for this function:

◆ computeUB()

void frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.VariableInfo< Val extends Addable< Val >, U extends Serializable &Addable< U > >.computeUB ( Val value)

Computes the sum of all child upper bounds for domain value "value".

Parameters
valuethe domain value

References frodo2.solutionSpaces.AddableDelayed< T extends Addable< T > >.addDelayed(), delta, full_info, frodo2.solutionSpaces.AddableDelayed< T extends Addable< T > >.resolve(), UB, ub, ubD, UBperD, ubSUM, valuePointer, and zero.

Referenced by resetBounds(), and updateBounds().

Here is the call graph for this function:

◆ getCurrentDelta()

U frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.VariableInfo< Val extends Addable< Val >, U extends Serializable &Addable< U > >.getCurrentDelta ( )

◆ initializeBounds()

void frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.VariableInfo< Val extends Addable< Val >, U extends Serializable &Addable< U > >.initializeBounds ( U upperBound)

Initializes the lower bounds to the value in lowerBounds, and set the upper bounds all to the same value upperBound.

Parameters
upperBoundthe upper bound value

References hChild, initializeBounds(), lbSUM, ubSUM, and zero.

Referenced by frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.Original< Val extends Addable< Val >, U extends Addable< U > >.init(), and initializeBounds().

Here is the call graph for this function:

◆ isReady()

boolean frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.VariableInfo< Val extends Addable< Val >, U extends Serializable &Addable< U > >.isReady ( )

A Variable is ready to start adopt when it has received all preprocessing messages.

That is, 1 message from its own preprocessing phase, and 1 for each one of its children.

Author
Brammert Ottens, 29 mei 2009
Returns
true when ready to start, and false otherwise

References h, hChild, and numberOfChildren.

◆ isSingleton()

boolean frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.VariableInfo< Val extends Addable< Val >, U extends Serializable &Addable< U > >.isSingleton ( )

Check to see if this variable has any neighbours.

Returns
true when a singleton and false otherwise

References neighbours.

Referenced by frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.Original< Val extends Addable< Val >, U extends Addable< U > >.init().

◆ resetBounds()

void frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.VariableInfo< Val extends Addable< Val >, U extends Serializable &Addable< U > >.resetBounds ( Val d,
String child,
U upperBound )

Resets the bounds for a particular value / child combination.

Parameters
dthe value
childthe child
upperBoundthe upper bound

References computeLB(), computeUB(), lb, neighbours, ub, valuePointer, and zero.

Referenced by frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.Original< Val extends Addable< Val >, U extends Addable< U > >.reset().

Here is the call graph for this function:

◆ resetChildContext()

void frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.VariableInfo< Val extends Addable< Val >, U extends Serializable &Addable< U > >.resetChildContext ( Val d,
int i )

Resets the context for a particular value / child combination.

Parameters
dthe value
ithe index of the child

References context, and valuePointer.

Referenced by frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.Original< Val extends Addable< Val >, U extends Addable< U > >.reset().

◆ resetChildThreshold()

void frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.VariableInfo< Val extends Addable< Val >, U extends Serializable &Addable< U > >.resetChildThreshold ( Val d,
String child,
U zero )

Resets the threshold for a particular value / child combination.

Parameters
dthe value
childthe child
zerothe zero utility

References neighbours, t, valuePointer, and zero.

Referenced by frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.Original< Val extends Addable< Val >, U extends Addable< U > >.reset().

◆ setCurrentAssignmentSingleton()

void frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.VariableInfo< Val extends Addable< Val >, U extends Serializable &Addable< U > >.setCurrentAssignmentSingleton ( )

This function is used to find the optimal decision of a singleton agent.

References currentAssignment, delta, valuePointer, and zero.

Referenced by frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.decideSingleton().

◆ setDelta()

◆ setLowerBoundChild()

void frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.VariableInfo< Val extends Addable< Val >, U extends Serializable &Addable< U > >.setLowerBoundChild ( String child,
UtilitySolutionSpace< Val, U > bounds )

Set the lower bound found by the Preprocessing module for child.

Author
Brammert Ottens, 19 mei 2009
Parameters
childThe child to whom the bounds belong
boundsThe bounds themselves

References frodo2.solutionSpaces.UtilitySolutionSpace< V extends Addable< V >, U extends Addable< U > >.blindProjectAll(), and hChild.

Here is the call graph for this function:

◆ setLowerNeighbours()

void frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.VariableInfo< Val extends Addable< Val >, U extends Serializable &Addable< U > >.setLowerNeighbours ( List< String > children,
List< String > pseudoChildren,
U zero )

Sets the lower neighbours of this variable.

The first k are the children, the rest the pseudochildren

Parameters
childrenthe list of children
pseudoChildrenthe list of pseudo-children
zerothe zero utility

References lowerNeighbours, numberOfChildren, setLowerNeighbours(), valuePointer, and zero.

Referenced by setLowerNeighbours().

Here is the call graph for this function:

◆ setOwnLowerBound()

void frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.VariableInfo< Val extends Addable< Val >, U extends Serializable &Addable< U > >.setOwnLowerBound ( UtilitySolutionSpace< Val, U > bounds)

Set the lower bound on ones own values, as determined by the Preprocessing module.

Author
Brammert Ottens, 19 mei 2009
Parameters
boundsThe bounds

References h.

◆ setSeparator()

void frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.VariableInfo< Val extends Addable< Val >, U extends Serializable &Addable< U > >.setSeparator ( String parent,
List< String > pseudoParents )

Sets the separator of this variable.

Parameters
parentthe parent (or null if any)
pseudoParentsthe list of pseudo-parents

References nbrOfSeparators, neighbours, and separator.

◆ storeConstraint()

void frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.VariableInfo< Val extends Addable< Val >, U extends Serializable &Addable< U > >.storeConstraint ( UtilitySolutionSpace< Val, U > 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.

Here is the call graph for this function:

◆ toString()

String frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.VariableInfo< Val extends Addable< Val >, U extends Serializable &Addable< U > >.toString ( )
See also
java.lang.Object#toString()

References context, currentAssignment, currentContext, delta, LB, lb, lbD, LBperD, numberOfChildren, separator, t, threshold, UB, ub, ubD, UBperD, and variableID.

◆ updateBounds()

void frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.VariableInfo< Val extends Addable< Val >, U extends Serializable &Addable< U > >.updateBounds ( Val value,
int child,
U newLb,
U newUb )

Updates the bounds.

Parameters
valuethe value
childthe child
newUbthe new upper bound
newLbthe new lower bound

References computeLB(), computeUB(), lb, ub, and valuePointer.

Referenced by frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.Original< Val extends Addable< Val >, U extends Addable< U > >.handleCOSTmessage().

Here is the call graph for this function:

Member Data Documentation

◆ context

◆ currentAssignment

◆ currentContext

◆ delta

ArrayList<U> frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.VariableInfo< Val extends Addable< Val >, U extends Serializable &Addable< U > >.delta

Given the current context, this map contains the utilities for each value of this variable.

Referenced by checkUpperBounds(), computeLB(), computeUB(), getCurrentDelta(), setCurrentAssignmentSingleton(), setDelta(), toString(), and VariableInfo().

◆ domain

◆ execution_terminated

boolean frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.VariableInfo< Val extends Addable< Val >, U extends Serializable &Addable< U > >.execution_terminated = false

◆ full_info

boolean frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.VariableInfo< Val extends Addable< Val >, U extends Serializable &Addable< U > >.full_info = false

True when the variable has received a VALUE message from all its higher priority neighbours.

Referenced by computeUB(), and setDelta().

◆ full_info_counter

◆ h

UtilitySolutionSpace<Val, U> frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.VariableInfo< Val extends Addable< Val >, U extends Serializable &Addable< U > >.h

The variables own lower bounds determined by the Preprocessing module.

Referenced by computeLB(), isReady(), and setOwnLowerBound().

◆ hChild

HashMap<String, U> frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.VariableInfo< Val extends Addable< Val >, U extends Serializable &Addable< U > >.hChild

The lower bounds for the children determined by the Preprocessing module.

Referenced by initializeBounds(), isReady(), setLowerBoundChild(), and VariableInfo().

◆ initialized

boolean frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.VariableInfo< Val extends Addable< Val >, U extends Serializable &Addable< U > >.initialized = false

◆ lastMessageReceived

Message frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.VariableInfo< Val extends Addable< Val >, U extends Serializable &Addable< U > >.lastMessageReceived = null

Remembers the last message that has been received.

When the same message is received multiple times in a row, only the first message is processed. The other messages do not contain any new information and only generate more messages

◆ lastValueSent

Message [] frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.VariableInfo< Val extends Addable< Val >, U extends Serializable &Addable< U > >.lastValueSent

For each lower priority neighbour the last VALUE message that has been sent.

◆ LB

◆ lb

◆ lbD

Val frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.VariableInfo< Val extends Addable< Val >, U extends Serializable &Addable< U > >.lbD

The value that minimizes the lower bound.

Referenced by computeLB(), setDelta(), and toString().

◆ LBperD

ArrayList<U> frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.VariableInfo< Val extends Addable< Val >, U extends Serializable &Addable< U > >.LBperD

For each value the lower bound.

Referenced by computeLB(), setDelta(), toString(), and VariableInfo().

◆ lbSUM

U [] frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.VariableInfo< Val extends Addable< Val >, U extends Serializable &Addable< U > >.lbSUM

Stores the sum of all the values in lb.

Uses some more memory in order to prevent having to check the delta each time

Referenced by computeLB(), initializeBounds(), setDelta(), and VariableInfo().

◆ logFile

BufferedWriter frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.VariableInfo< Val extends Addable< Val >, U extends Serializable &Addable< U > >.logFile

◆ lowerNeighbours

◆ nbrOfSeparators

◆ neighbours

◆ numberOfChildren

◆ separator

◆ space

UtilitySolutionSpace<Val, U> frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.VariableInfo< Val extends Addable< Val >, U extends Serializable &Addable< U > >.space
private

The join of all constraints this variable is responsible for.

Referenced by storeConstraint().

◆ t

◆ terminate

◆ threshold

◆ UB

◆ ub

◆ ubD

Val frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.VariableInfo< Val extends Addable< Val >, U extends Serializable &Addable< U > >.ubD

The value that minimizes the upper bound.

Referenced by computeUB(), setDelta(), and toString().

◆ UBperD

ArrayList<U> frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.VariableInfo< Val extends Addable< Val >, U extends Serializable &Addable< U > >.UBperD

For each value the upper bound.

Referenced by checkUpperBounds(), computeUB(), setDelta(), toString(), and VariableInfo().

◆ ubSUM

U [] frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.VariableInfo< Val extends Addable< Val >, U extends Serializable &Addable< U > >.ubSUM

Stores the sum of all the values in ub.

Uses some more memory in order to prevent having to check the delta each time

Referenced by computeUB(), initializeBounds(), setDelta(), and VariableInfo().

◆ valuePointer

◆ variableID

◆ zero


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