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

The SynchBB algorithm for DCOPs. More...

Inheritance diagram for frodo2.algorithms.synchbb.SynchBB< V extends Addable< V >, U extends Addable< U > >:

Classes

class  ConvergenceMessage
 A message reporting the convergence for a given component. More...
class  ClusterInfo
 Information about a cluster of variables owned by this agent. More...
class  ComponentInfo
 The information about a particular component of the constraint graph. More...

Public Member Functions

 SynchBB (Element parameters, DCOPProblemInterface< V, U > problem)
 The constructor called in "statistics gatherer" mode.
 SynchBB (DCOPProblemInterface< V, U > problem, Element parameters)
 Constructor.
void reset ()
Collection< MessageTypegetMsgTypes ()
void getStatsFromQueue (Queue queue)
void setSilent (boolean silent)
void setQueue (Queue queue)
void notifyIn (Message msg)
HashMap< String, ArrayList< CurrentAssignment< V > > > getAssignmentHistories ()
Map< String, V > getCurrentSolution ()
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 Attributes

static MessageType START_MSG_TYPE = AgentInterface.START_AGENT
 The type of the message telling the module to start.
static MessageType ORDER_MSG_TYPE = OrderMsg.ORDER_MSG_TYPE
 The types of the messages containing the chosen linear order of (clusters of) variables.
static MessageType ORDER_STATS_MSG_TYPE = OrderMsg.STATS_MSG_TYPE
 The types of the messages containing the chosen linear order of (clusters of) variables sent to the stats gatherer.
static final MessageType BACKTRACK_MSG_TYPE = new MessageType ("SynchBB", "Backtrack")
 The type of the backtrack messages.
static final MessageType PATH_MSG_TYPE = new MessageType ("SynchBB", "Path")
 The type of the messages containing the current partial assignment.
static final MessageType OUTPUT_MSG_TYPE = new MessageType ("SynchBB", "Solution")
 The type of the message containing the optimal solution found.
static final MessageType UB_MSG_TYPE = new MessageType ("SynchBB", "UB")
 The type of the messages broadcast by the last variable containing the current upper bound.

Private Member Functions

void start ()
 Parses the problem.
boolean checkAllCostsNonNeg ()
void initiate (Comparable<?> compID, ComponentInfo compInfo)
 Chooses a first value for the first cluster of variables and starts the algorithm.
void terminate (Comparable<?> compID, ComponentInfo compInfo)
 Sends output and termination messages.
void received_from_prev (PathMsg< V, U > msg)
 Reacts to the reception of a path message from the previous cluster in the ordering.
void received_from_next (BTmsg msg)
 Reacts to the reception of a backtrack message.
void send_token (Comparable<?> compID, ComponentInfo compInfo, final int clusterIndex, ClusterInfo info, V[] next)
 Sends the next message.
V[] get_next (ComponentInfo compInfo, final int clusterIndex, ClusterInfo info)
 Chooses the next assignment for the current cluster of variables.

Private Attributes

final boolean convergence
 true when the convergence history is to be stored
HashMap< String, ArrayList< CurrentAssignment< V > > > assignmentHistoriesMap
 For each variable, its assignment history.
HashMap< Comparable<?>, ComponentInfocompInfos
 The information about each component in the constraint graph.
HashMap< String, Comparable<?> > compOfCluster
 For each cluster, its component ID.
Queue queue
 This module's queue.
DCOPProblemInterface< V, U > problem
 The problem.
boolean started = false
 Whether the module has already started the algorithm.
zero
 The 0 cost.
HashMap< String, V > solution
 The solution.
Class< V > valClass
 The class of V.
Class< V[]> valArrayClass
 The class of V[].
LinkedList< SolutionMsg< V, U > > pendingSolMsgs
 Used to store solution messages received by the stats gatherer before their corresponding linear order.
LinkedList< ConvergenceMessage< V > > pendingConvMsgs
 Used to store convergence messages received by the stats gatherer before their corresponding linear order.
HashMap< String, PathMsg< V, U > > pendingPathMsgs
 For some clusters, a PathMsg that was received before the var order message.

Static Private Attributes

static final MessageType CONV_STATS_MSG_TYPE = new MessageType ("SynchBB", "Convergence")
 The type of the message reporting the convergence for a given component.
static final boolean DEBUG = false
 Whether the algorithm should print out debugging information.

Detailed Description

The SynchBB algorithm for DCOPs.

This is the original SynchBB algorithm by Hirayama & Yokoo (CP'97), adapted to solve DCOPs as proposed by Meisels (Springer Verlag, 2008), with two additional performance improvements:

  • BACKTRACK messages do not include the path
  • PATH messages strip the first part of the path that has not changed
Author
Thomas Leaute
Parameters
<V>the type used for variable values
<U>the type used for utility values

Constructor & Destructor Documentation

◆ SynchBB() [1/2]

frodo2.algorithms.synchbb.SynchBB< V extends Addable< V >, U extends Addable< U > >.SynchBB ( Element parameters,
DCOPProblemInterface< V, U > problem )

The constructor called in "statistics gatherer" mode.

Parameters
problemthe overall problem
parametersthe description of what statistics should be reported (currently unused)

References problem.

◆ SynchBB() [2/2]

frodo2.algorithms.synchbb.SynchBB< V extends Addable< V >, U extends Addable< U > >.SynchBB ( DCOPProblemInterface< V, U > problem,
Element parameters )

Constructor.

Parameters
problemthis agent's problem
parametersthe parameters for SynchBB

References problem.

Member Function Documentation

◆ checkAllCostsNonNeg()

boolean frodo2.algorithms.synchbb.SynchBB< V extends Addable< V >, U extends Addable< U > >.checkAllCostsNonNeg ( )
private
Returns
true if all utilities in all spaces are non-negative, false otherwise

References frodo2.solutionSpaces.DCOPProblemInterface< V extends Addable< V >, U extends Addable< U > >.getSolutionSpaces(), frodo2.solutionSpaces.SolutionSpace< V extends Addable< V > >.Iterator< V >.hasNext(), and zero.

Referenced by start().

Here is the call graph for this function:

◆ get_next()

V[] frodo2.algorithms.synchbb.SynchBB< V extends Addable< V >, U extends Addable< U > >.get_next ( ComponentInfo compInfo,
final int clusterIndex,
ClusterInfo info )
private

Chooses the next assignment for the current cluster of variables.

Parameters
compInfothe information about the component in the constraint graph
clusterIndexindex of the current cluster in the cluster ordering
infoinformation about the current cluster
Returns
the next assignment for the current cluster, or null if the domain is exhausted
Todo
can we move a part of this computation at the creation of the clusterInfo object to avoid searching for these variables that are fixed in the order too many times? Yes, we can!(R)

References get_next(), and valArrayClass.

Referenced by get_next(), received_from_next(), and send_token().

Here is the call graph for this function:

◆ getAssignmentHistories()

◆ getCurrentSolution()

Map< String, V > frodo2.algorithms.synchbb.SynchBB< V extends Addable< V >, U extends Addable< U > >.getCurrentSolution ( )

◆ getMsgTypes()

◆ getStatsFromQueue()

◆ initiate()

void frodo2.algorithms.synchbb.SynchBB< V extends Addable< V >, U extends Addable< U > >.initiate ( Comparable<?> compID,
ComponentInfo compInfo )
private

Chooses a first value for the first cluster of variables and starts the algorithm.

Parameters
compIDthe ID of the component in the constraint graph
compInfothe information about the component in the constraint graph

References initiate(), frodo2.algorithms.synchbb.SynchBB< V extends Addable< V >, U extends Addable< U > >.ClusterInfo.nextAgent, terminate(), valArrayClass, and valClass.

Referenced by initiate().

Here is the call graph for this function:

◆ notifyIn()

void frodo2.algorithms.synchbb.SynchBB< V extends Addable< V >, U extends Addable< U > >.notifyIn ( Message msg)

◆ received_from_next()

void frodo2.algorithms.synchbb.SynchBB< V extends Addable< V >, U extends Addable< U > >.received_from_next ( BTmsg msg)
private

◆ received_from_prev()

void frodo2.algorithms.synchbb.SynchBB< V extends Addable< V >, U extends Addable< U > >.received_from_prev ( PathMsg< V, U > msg)
private

Reacts to the reception of a path message from the previous cluster in the ordering.

Parameters
msgthe received path message

References frodo2.algorithms.synchbb.SynchBB< V extends Addable< V >, U extends Addable< U > >.ComponentInfo.clusterIndexes, and received_from_prev().

Referenced by received_from_prev().

Here is the call graph for this function:

◆ reset()

◆ send_token()

void frodo2.algorithms.synchbb.SynchBB< V extends Addable< V >, U extends Addable< U > >.send_token ( Comparable<?> compID,
ComponentInfo compInfo,
final int clusterIndex,
ClusterInfo info,
V[] next )
private

Sends the next message.

Parameters
compIDthe ID of the component in the constraint graph
compInfothe information about the component in the constraint graph
clusterIndexindex of the current cluster in the cluster ordering
infoinformation on the current cluster
nextnext assignment chosen for the current cluster

References convergence, DEBUG, get_next(), frodo2.solutionSpaces.ProblemInterface< V extends Addable< V >, U extends Addable< U > >.getAgent(), frodo2.communication.Queue.getCurrentTime(), send_token(), frodo2.communication.Queue.sendMessage(), frodo2.communication.Queue.sendMessageToMulti(), terminate(), UB_MSG_TYPE, and valArrayClass.

Referenced by received_from_next(), and send_token().

Here is the call graph for this function:

◆ setQueue()

void frodo2.algorithms.synchbb.SynchBB< V extends Addable< V >, U extends Addable< U > >.setQueue ( Queue queue)

◆ setSilent()

◆ start()

◆ terminate()

Member Data Documentation

◆ assignmentHistoriesMap

HashMap< String, ArrayList< CurrentAssignment<V> > > frodo2.algorithms.synchbb.SynchBB< V extends Addable< V >, U extends Addable< U > >.assignmentHistoriesMap
private

For each variable, its assignment history.

◆ BACKTRACK_MSG_TYPE

final MessageType frodo2.algorithms.synchbb.SynchBB< V extends Addable< V >, U extends Addable< U > >.BACKTRACK_MSG_TYPE = new MessageType ("SynchBB", "Backtrack")
static

The type of the backtrack messages.

Referenced by frodo2.algorithms.synchbb.BTmsg.BTmsg(), frodo2.algorithms.synchbb.BTmsg.BTmsg(), and getMsgTypes().

◆ compInfos

HashMap<Comparable<?>, ComponentInfo> frodo2.algorithms.synchbb.SynchBB< V extends Addable< V >, U extends Addable< U > >.compInfos
private

The information about each component in the constraint graph.

◆ compOfCluster

HashMap< String, Comparable<?> > frodo2.algorithms.synchbb.SynchBB< V extends Addable< V >, U extends Addable< U > >.compOfCluster
private

For each cluster, its component ID.

◆ CONV_STATS_MSG_TYPE

◆ convergence

◆ DEBUG

final boolean frodo2.algorithms.synchbb.SynchBB< V extends Addable< V >, U extends Addable< U > >.DEBUG = false
staticprivate

Whether the algorithm should print out debugging information.

Referenced by send_token().

◆ ORDER_MSG_TYPE

MessageType frodo2.algorithms.synchbb.SynchBB< V extends Addable< V >, U extends Addable< U > >.ORDER_MSG_TYPE = OrderMsg.ORDER_MSG_TYPE
static

The types of the messages containing the chosen linear order of (clusters of) variables.

Referenced by getMsgTypes().

◆ ORDER_STATS_MSG_TYPE

MessageType frodo2.algorithms.synchbb.SynchBB< V extends Addable< V >, U extends Addable< U > >.ORDER_STATS_MSG_TYPE = OrderMsg.STATS_MSG_TYPE
static

The types of the messages containing the chosen linear order of (clusters of) variables sent to the stats gatherer.

Referenced by getStatsFromQueue(), and notifyIn().

◆ OUTPUT_MSG_TYPE

final MessageType frodo2.algorithms.synchbb.SynchBB< V extends Addable< V >, U extends Addable< U > >.OUTPUT_MSG_TYPE = new MessageType ("SynchBB", "Solution")
static

The type of the message containing the optimal solution found.

Referenced by getMsgTypes(), and terminate().

◆ PATH_MSG_TYPE

final MessageType frodo2.algorithms.synchbb.SynchBB< V extends Addable< V >, U extends Addable< U > >.PATH_MSG_TYPE = new MessageType ("SynchBB", "Path")
static

◆ pendingConvMsgs

LinkedList< ConvergenceMessage<V> > frodo2.algorithms.synchbb.SynchBB< V extends Addable< V >, U extends Addable< U > >.pendingConvMsgs
private

Used to store convergence messages received by the stats gatherer before their corresponding linear order.

◆ pendingPathMsgs

HashMap< String, PathMsg<V, U> > frodo2.algorithms.synchbb.SynchBB< V extends Addable< V >, U extends Addable< U > >.pendingPathMsgs
private

For some clusters, a PathMsg that was received before the var order message.

◆ pendingSolMsgs

LinkedList< SolutionMsg<V, U> > frodo2.algorithms.synchbb.SynchBB< V extends Addable< V >, U extends Addable< U > >.pendingSolMsgs
private

Used to store solution messages received by the stats gatherer before their corresponding linear order.

◆ problem

DCOPProblemInterface<V, U> frodo2.algorithms.synchbb.SynchBB< V extends Addable< V >, U extends Addable< U > >.problem
private

The problem.

Referenced by SynchBB(), and SynchBB().

◆ queue

Queue frodo2.algorithms.synchbb.SynchBB< V extends Addable< V >, U extends Addable< U > >.queue
private

This module's queue.

Referenced by getStatsFromQueue(), and setQueue().

◆ solution

HashMap<String, V> frodo2.algorithms.synchbb.SynchBB< V extends Addable< V >, U extends Addable< U > >.solution
private

The solution.

◆ START_MSG_TYPE

MessageType frodo2.algorithms.synchbb.SynchBB< V extends Addable< V >, U extends Addable< U > >.START_MSG_TYPE = AgentInterface.START_AGENT
static

The type of the message telling the module to start.

Referenced by getMsgTypes().

◆ started

boolean frodo2.algorithms.synchbb.SynchBB< V extends Addable< V >, U extends Addable< U > >.started = false
private

Whether the module has already started the algorithm.

◆ UB_MSG_TYPE

final MessageType frodo2.algorithms.synchbb.SynchBB< V extends Addable< V >, U extends Addable< U > >.UB_MSG_TYPE = new MessageType ("SynchBB", "UB")
static

The type of the messages broadcast by the last variable containing the current upper bound.

Referenced by getMsgTypes(), and send_token().

◆ valArrayClass

Class<V[]> frodo2.algorithms.synchbb.SynchBB< V extends Addable< V >, U extends Addable< U > >.valArrayClass
private

The class of V[].

Referenced by get_next(), initiate(), and send_token().

◆ valClass

Class<V> frodo2.algorithms.synchbb.SynchBB< V extends Addable< V >, U extends Addable< U > >.valClass
private

The class of V.

Referenced by initiate().

◆ zero

U frodo2.algorithms.synchbb.SynchBB< V extends Addable< V >, U extends Addable< U > >.zero
private

The 0 cost.

Referenced by checkAllCostsNonNeg().


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