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

Classical UTIL propagation protocol. More...

Inheritance diagram for frodo2.algorithms.dpop.count.CountSolutionsUTIL< Val extends Addable< Val >, U extends Addable< U > >:

Classes

class  SolutionMessage
 A message holding the optimal assignments to a variable, conditioned on the assignments to the variables in its separator. More...
class  SeparatorMessage
 A message holding the separator of a given child variable. More...
class  OptUtilMessage
 Message sent by roots containing the optimal utility value of their DFS tree. More...
class  StatsMessage
 Message containing statistics. More...
class  VariableInfo
 A convenience class used to store information about a variable. More...

Public Member Functions

 CountSolutionsUTIL (DCOPProblemInterface< Val, U > problem)
 Constructor.
 CountSolutionsUTIL (DCOPProblemInterface< Val, U > problem, Element parameters) throws ClassNotFoundException
 Constructor from XML descriptions.
void reset ()
 CountSolutionsUTIL (Element parameters, DCOPProblemInterface< Val, U > problem)
 The constructor called in "statistics gatherer" mode.
Collection< MessageTypegetMsgTypes ()
void notifyIn (Message msg)
 The algorithm.
void setQueue (Queue queue)
void getStatsFromQueue (Queue queue)
void setSilent (boolean silent)
Integer getMaxMsgDim ()
getOptUtil ()
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 DFS_MSG_TYPE = DFSgeneration.OUTPUT_MSG_TYPE
 The type of the messages containing information about the DFS.
static final MessageType UTIL_MSG_TYPE = UTILpropagation.UTIL_MSG_TYPE
 The type of the messages containing utilities.
static final MessageType OUTPUT_MSG_TYPE = new MessageType ("Count-DPOP", "UTIL", "UTILoutput")
 The type of the messages containing conditional optimal assignments.
static final MessageType SEPARATOR_MSG_TYPE = new MessageType ("Count-DPOP", "UTIL", "Separator")
 The type of the messages containing separators.
static final MessageType OPT_UTIL_MSG_TYPE = new MessageType ("Count-DPOP", "UTIL", "OptUtil")
 The type of the messages containing optimal utility values sent by roots.
static final MessageType UTIL_STATS_MSG_TYPE = new MessageType ("Count-DPOP", "UTIL", "UTILstats")
 The type of messages sent to the statistics monitor.

Protected Member Functions

void init ()
 Parses the problem.
void sendSeparator (String sender, String dest, String[] separator)
 Sends a message to the VALUEpropagation module containing the separator of a variable.
ProjOutput< Val, U > project (UtilitySolutionSpace< Val, U > space, String var)
 Projects the input variable from the input space.
void sendToParent (String var, String parent, UtilitySolutionSpace< Val, U > space)
 Sends a UTIL message.
void sendOutput (UtilitySolutionSpace< Val, U > space, String root)
 Sends the output optimal utility to itself (i.e.

Protected Attributes

boolean withAnonymVars = false
 Whether the parser should consider variables with no specified owner.
DCOPProblemInterface< Val, U > problem
 The problem.
boolean started = false
 Whether the execution of the algorithm has been started.
boolean maximize = true
 true if we want to maximize utility, false if we want to minimize cost
Queue queue
 The queue on which it should call sendMessage().
Map< String, VariableInfoinfos = new HashMap<String, VariableInfo> ()
 For each variable this agent owns, its relevant information.
Map< String, String > owners = new HashMap<String, String> ()
 For each known variable, the name of the agent that owns it.
optUtil
 The optimal utility found to the problem.

Private Member Functions

void record (UtilitySolutionSpace< Val, U > space, VariableInfo info)
 Records the input space until spaces from all children have been received.
void projectAndSend (VariableInfo info)
 Projects out a variable and sends the result to its parent (if any) or to itself (to initiate VALUE propagation).

Private Attributes

boolean reportStats = true
 Whether to report stats.
Integer maxMsgDim = 0
 In stats gatherer mode, the maximum number of variables in a UTIL message.

Detailed Description

Classical UTIL propagation protocol.

Author
Thomas Leaute, Brammert Ottens
Parameters
<Val>type used for variable values
<U>type used for utility values
Todo
Extremely high code redundancy with UTILpropagation; we should be inheriting this class.

Constructor & Destructor Documentation

◆ CountSolutionsUTIL() [1/3]

Constructor.

Parameters
problemthe problem description

References problem.

◆ CountSolutionsUTIL() [2/3]

frodo2.algorithms.dpop.count.CountSolutionsUTIL< Val extends Addable< Val >, U extends Addable< U > >.CountSolutionsUTIL ( DCOPProblemInterface< Val, U > problem,
Element parameters ) throws ClassNotFoundException

Constructor from XML descriptions.

Parameters
problemdescription of the problem
parametersdescription of the parameters of UTILpropagation
Exceptions
ClassNotFoundExceptionif the module parameters specify an unknown class for utility values

References problem.

◆ CountSolutionsUTIL() [3/3]

frodo2.algorithms.dpop.count.CountSolutionsUTIL< Val extends Addable< Val >, U extends Addable< U > >.CountSolutionsUTIL ( Element parameters,
DCOPProblemInterface< Val, 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.

Member Function Documentation

◆ getMaxMsgDim()

Integer frodo2.algorithms.dpop.count.CountSolutionsUTIL< Val extends Addable< Val >, U extends Addable< U > >.getMaxMsgDim ( )
Returns
the maximum number of variables in a UTIL message (in stats gatherer mode only)

◆ getMsgTypes()

◆ getOptUtil()

U frodo2.algorithms.dpop.count.CountSolutionsUTIL< Val extends Addable< Val >, U extends Addable< U > >.getOptUtil ( )
Returns
the optimal utility found to the problem
Warning
Only works if the module is instantiated in stats gatherer mode.

Referenced by frodo2.algorithms.dpop.count.SolutionCounter< V extends Addable< V >, U extends Addable< U > >.count().

◆ getStatsFromQueue()

void frodo2.algorithms.dpop.count.CountSolutionsUTIL< Val extends Addable< Val >, U extends Addable< U > >.getStatsFromQueue ( Queue queue)

◆ init()

void frodo2.algorithms.dpop.count.CountSolutionsUTIL< Val extends Addable< Val >, U extends Addable< U > >.init ( )
protected

Parses the problem.

References problem.

◆ notifyIn()

void frodo2.algorithms.dpop.count.CountSolutionsUTIL< Val extends Addable< Val >, U extends Addable< U > >.notifyIn ( Message msg)

The algorithm.

For each variable that it owns, the agent waits for the reception of all UTIL messages from all child variables, plus one corresponding to a private constraint sent by the DPOP agent.

Parameters
msgthe message received

Implements frodo2.communication.IncomingMsgPolicyInterface< T >.

References frodo2.communication.MessageType.equals(), notifyIn(), and OPT_UTIL_MSG_TYPE.

Referenced by notifyIn().

Here is the call graph for this function:

◆ project()

ProjOutput< Val, U > frodo2.algorithms.dpop.count.CountSolutionsUTIL< Val extends Addable< Val >, U extends Addable< U > >.project ( UtilitySolutionSpace< Val, U > space,
String var )
protected

Projects the input variable from the input space.

Parameters
spacethe space
varthe variable to project out
Returns
the result of the projection

References maximize, and frodo2.solutionSpaces.UtilitySolutionSpace< V extends Addable< V >, U extends Addable< U > >.project().

Here is the call graph for this function:

◆ projectAndSend()

void frodo2.algorithms.dpop.count.CountSolutionsUTIL< Val extends Addable< Val >, U extends Addable< U > >.projectAndSend ( VariableInfo info)
private

Projects out a variable and sends the result to its parent (if any) or to itself (to initiate VALUE propagation).

Parameters
infoinformation about the variable to be projected out

References projectAndSend(), queue, and sendOutput().

Referenced by projectAndSend().

Here is the call graph for this function:

◆ record()

void frodo2.algorithms.dpop.count.CountSolutionsUTIL< Val extends Addable< Val >, U extends Addable< U > >.record ( UtilitySolutionSpace< Val, U > space,
VariableInfo info )
private

Records the input space until spaces from all children have been received.

Parameters
spacethe space to be recorded
infothe variable info

References frodo2.algorithms.dpop.count.CountSolutionsUTIL< Val extends Addable< Val >, U extends Addable< U > >.VariableInfo.space.

◆ reset()

void frodo2.algorithms.dpop.count.CountSolutionsUTIL< Val extends Addable< Val >, U extends Addable< U > >.reset ( )

◆ sendOutput()

void frodo2.algorithms.dpop.count.CountSolutionsUTIL< Val extends Addable< Val >, U extends Addable< U > >.sendOutput ( UtilitySolutionSpace< Val, U > space,
String root )
protected

Sends the output optimal utility to itself (i.e.

the VALUEpropagation listener) and to the statistics monitor

Parameters
spacethe final frontier
rootthe root of the DFS

References infos, frodo2.output, queue, and frodo2.algorithms.AgentInterface< V extends Addable< V > >.STATS_MONITOR.

Referenced by projectAndSend().

◆ sendSeparator()

void frodo2.algorithms.dpop.count.CountSolutionsUTIL< Val extends Addable< Val >, U extends Addable< U > >.sendSeparator ( String sender,
String dest,
String[] separator )
protected

Sends a message to the VALUEpropagation module containing the separator of a variable.

Parameters
sendersender variable
destdestination variable
separatorthe separator of the destination variable

References queue.

◆ sendToParent()

void frodo2.algorithms.dpop.count.CountSolutionsUTIL< Val extends Addable< Val >, U extends Addable< U > >.sendToParent ( String var,
String parent,
UtilitySolutionSpace< Val, U > space )
protected

Sends a UTIL message.

Parameters
varthe sender of the message
parentthe destination of the message
spacethe content of the message

References infos, owners, queue, and frodo2.algorithms.AgentInterface< V extends Addable< V > >.STATS_MONITOR.

◆ setQueue()

◆ setSilent()

Member Data Documentation

◆ DFS_MSG_TYPE

The type of the messages containing information about the DFS.

Referenced by getMsgTypes().

◆ infos

Map<String, VariableInfo> frodo2.algorithms.dpop.count.CountSolutionsUTIL< Val extends Addable< Val >, U extends Addable< U > >.infos = new HashMap<String, VariableInfo> ()
protected

For each variable this agent owns, its relevant information.

Referenced by sendOutput(), and sendToParent().

◆ maximize

boolean frodo2.algorithms.dpop.count.CountSolutionsUTIL< Val extends Addable< Val >, U extends Addable< U > >.maximize = true
protected

true if we want to maximize utility, false if we want to minimize cost

Referenced by project().

◆ maxMsgDim

Integer frodo2.algorithms.dpop.count.CountSolutionsUTIL< Val extends Addable< Val >, U extends Addable< U > >.maxMsgDim = 0
private

In stats gatherer mode, the maximum number of variables in a UTIL message.

◆ OPT_UTIL_MSG_TYPE

final MessageType frodo2.algorithms.dpop.count.CountSolutionsUTIL< Val extends Addable< Val >, U extends Addable< U > >.OPT_UTIL_MSG_TYPE = new MessageType ("Count-DPOP", "UTIL", "OptUtil")
static

◆ optUtil

U frodo2.algorithms.dpop.count.CountSolutionsUTIL< Val extends Addable< Val >, U extends Addable< U > >.optUtil
protected

The optimal utility found to the problem.

◆ OUTPUT_MSG_TYPE

final MessageType frodo2.algorithms.dpop.count.CountSolutionsUTIL< Val extends Addable< Val >, U extends Addable< U > >.OUTPUT_MSG_TYPE = new MessageType ("Count-DPOP", "UTIL", "UTILoutput")
static

◆ owners

Map<String, String> frodo2.algorithms.dpop.count.CountSolutionsUTIL< Val extends Addable< Val >, U extends Addable< U > >.owners = new HashMap<String, String> ()
protected

For each known variable, the name of the agent that owns it.

Referenced by sendToParent().

◆ problem

DCOPProblemInterface<Val, U> frodo2.algorithms.dpop.count.CountSolutionsUTIL< Val extends Addable< Val >, U extends Addable< U > >.problem
protected

◆ queue

Queue frodo2.algorithms.dpop.count.CountSolutionsUTIL< Val extends Addable< Val >, U extends Addable< U > >.queue
protected

The queue on which it should call sendMessage().

Referenced by getStatsFromQueue(), projectAndSend(), sendOutput(), sendSeparator(), sendToParent(), and setQueue().

◆ reportStats

boolean frodo2.algorithms.dpop.count.CountSolutionsUTIL< Val extends Addable< Val >, U extends Addable< U > >.reportStats = true
private

Whether to report stats.

◆ SEPARATOR_MSG_TYPE

final MessageType frodo2.algorithms.dpop.count.CountSolutionsUTIL< Val extends Addable< Val >, U extends Addable< U > >.SEPARATOR_MSG_TYPE = new MessageType ("Count-DPOP", "UTIL", "Separator")
static

◆ START_MSG_TYPE

MessageType frodo2.algorithms.dpop.count.CountSolutionsUTIL< Val extends Addable< Val >, 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.dpop.count.CountSolutionsUTIL< Val extends Addable< Val >, U extends Addable< U > >.started = false
protected

Whether the execution of the algorithm has been started.

◆ UTIL_MSG_TYPE

final MessageType frodo2.algorithms.dpop.count.CountSolutionsUTIL< Val extends Addable< Val >, U extends Addable< U > >.UTIL_MSG_TYPE = UTILpropagation.UTIL_MSG_TYPE
static

The type of the messages containing utilities.

Referenced by getMsgTypes().

◆ UTIL_STATS_MSG_TYPE

final MessageType frodo2.algorithms.dpop.count.CountSolutionsUTIL< Val extends Addable< Val >, U extends Addable< U > >.UTIL_STATS_MSG_TYPE = new MessageType ("Count-DPOP", "UTIL", "UTILstats")
static

◆ withAnonymVars

boolean frodo2.algorithms.dpop.count.CountSolutionsUTIL< Val extends Addable< Val >, U extends Addable< U > >.withAnonymVars = false
protected

Whether the parser should consider variables with no specified owner.


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