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

The MGM algorithm. More...

Inheritance diagram for frodo2.algorithms.localSearch.mgm.MGM< V extends Addable< V >, U extends Addable< U > >:

Classes

enum  StateValue
 The state of the current variable: More...
class  VariableInfo
 Convenience class that contains all necessary information on a single variable. More...

Public Member Functions

 MGM (Element parameters, DCOPProblemInterface< V, U > problem)
 Constructor for the stats reporter.
 MGM (DCOPProblemInterface< V, U > problem, Element parameters)
 Constructor.
void getStatsFromQueue (Queue queue)
void setSilent (boolean silent)
void reset ()
void notifyIn (Message msg)
void setQueue (Queue queue)
Collection< MessageTypegetMsgTypes ()
HashMap< String, ArrayList< frodo2.algorithms.StatsReporterWithConvergence.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 START message.
static final MessageType OK_MSG_TYPE = new MessageType ("MGM", "ok")
 Type used for the OK message.
static final MessageType IMPROVE_MSG_TYPE = new MessageType ("MGM", "improve")
 Type used for the IMPROVE message.
static final MessageType CONV_STATS_MSG_TYPE = new MessageType ("MGM", "ConvStats")
 The type of the message containing the assignment history.

Protected Member Functions

void init ()
 Called when the first message is received, initializes all the fields and variables that are needed.
void sendOK (VariableInfo< V, U > varInfo)
 Sending an OK message to all neighbors.
void sendIMPROVE (VariableInfo< V, U > varInfo)
 Send an improve message to all neighbors.
void log (String variableID, String message)
 Log function used to print the variables state during debugging.
VariableInfo< V, U > createVariableInfo (String variableID, DCOPProblemInterface< V, U > problem, List<? extends UtilitySolutionSpace< V, U > > spaces, boolean maximize)
 method used to create a VariableInfo object

Protected Attributes

Queue queue
 The queue to which this listener is registered.
final boolean LOG = false
 When true, every variable writes log information to a log file.
HashMap< String, BufferedWriter > loggers
 A list of buffered writers used to log information during debugging.
final boolean maximize
 true when solving a maximization problem, and false otherwise
Map< String, String > owners
 Maps variables to the agent that owns it.
int max_distance = 100
 The maximal number of rounds to be performed.
boolean started
 true when the START_AGENT message has been received, and false otherwise
HashMap< String, VariableInfo< V, U > > infos
 Contains, for each variable, an object containing all information needed by the algorithm.
DCOPProblemInterface< V, U > problem
 The local problem definition.
int variables_finished
 The number of variables that are finished.
final boolean convergence
 If true, the assignment history must be stored.
HashMap< String, ArrayList< CurrentAssignment< V > > > assignmentHistoriesMap
 For each variable its assignment history.

Private Attributes

boolean terminated
 true when this agent has sent the agent finished message

Detailed Description

The MGM algorithm.

Author
Brammert Ottens, 21 feb. 2011
Parameters
<V>type used for domain values
<U>type used for utility values

Constructor & Destructor Documentation

◆ MGM() [1/2]

frodo2.algorithms.localSearch.mgm.MGM< V extends Addable< V >, U extends Addable< U > >.MGM ( Element parameters,
DCOPProblemInterface< V, U > problem )

Constructor for the stats reporter.

Parameters
parametersparameters of the stats reporter
problemthe problem that is being solved

References assignmentHistoriesMap, and problem.

◆ MGM() [2/2]

frodo2.algorithms.localSearch.mgm.MGM< V extends Addable< V >, U extends Addable< U > >.MGM ( DCOPProblemInterface< V, U > problem,
Element parameters )

Constructor.

Parameters
problemthe local problem definition
parametersparameters of the listener

References problem.

Member Function Documentation

◆ createVariableInfo()

VariableInfo< V, U > frodo2.algorithms.localSearch.mgm.MGM< V extends Addable< V >, U extends Addable< U > >.createVariableInfo ( String variableID,
DCOPProblemInterface< V, U > problem,
List<? extends UtilitySolutionSpace< V, U > > spaces,
boolean maximize )
protected

method used to create a VariableInfo object

Author
Brammert Ottens, 16 feb. 2011
Parameters
variableIDthe ID of the variable
problemthe local problem definition
spaceslist of spaces owned by the agent
maximizetrue when dealing with a maximization problem, false otherwise
Returns
a VariablInfo object for variableID

References maximize, and problem.

Referenced by init().

◆ getAssignmentHistories()

◆ getCurrentSolution()

Map< String, V > frodo2.algorithms.localSearch.mgm.MGM< V extends Addable< V >, U extends Addable< U > >.getCurrentSolution ( )

◆ getMsgTypes()

◆ getStatsFromQueue()

◆ init()

◆ log()

void frodo2.algorithms.localSearch.mgm.MGM< V extends Addable< V >, U extends Addable< U > >.log ( String variableID,
String message )
protected

Log function used to print the variables state during debugging.

Parameters
variableIDThe ID of the variable that is logging
messageThe message that must be logged

References LOG, and loggers.

◆ notifyIn()

◆ reset()

◆ sendIMPROVE()

◆ sendOK()

void frodo2.algorithms.localSearch.mgm.MGM< V extends Addable< V >, U extends Addable< U > >.sendOK ( VariableInfo< V, U > varInfo)
protected

Sending an OK message to all neighbors.

Author
Brammert Ottens, 21 feb. 2011
Parameters
varInfothe variable that is sending the messages

References frodo2.algorithms.AgentInterface< V extends Addable< V > >.AGENT_FINISHED, frodo2.algorithms.localSearch.mgm.MGM< V extends Addable< V >, U extends Addable< U > >.VariableInfo< V extends Addable< V >, U extends Addable< U > >.agent_view, assignmentHistoriesMap, frodo2.algorithms.localSearch.mgm.MGM< V extends Addable< V >, U extends Addable< U > >.VariableInfo< V extends Addable< V >, U extends Addable< U > >.can_move, convergence, frodo2.algorithms.localSearch.mgm.MGM< V extends Addable< V >, U extends Addable< U > >.VariableInfo< V extends Addable< V >, U extends Addable< U > >.currentValue, frodo2.algorithms.localSearch.mgm.MGM< V extends Addable< V >, U extends Addable< U > >.VariableInfo< V extends Addable< V >, U extends Addable< U > >.domain, infos, max_distance, frodo2.algorithms.localSearch.mgm.MGM< V extends Addable< V >, U extends Addable< U > >.VariableInfo< V extends Addable< V >, U extends Addable< U > >.neighbors, frodo2.algorithms.localSearch.mgm.MGM< V extends Addable< V >, U extends Addable< U > >.VariableInfo< V extends Addable< V >, U extends Addable< U > >.newValue, owners, queue, frodo2.algorithms.AgentInterface< V extends Addable< V > >.STATS_MONITOR, frodo2.algorithms.localSearch.mgm.MGM< V extends Addable< V >, U extends Addable< U > >.VariableInfo< V extends Addable< V >, U extends Addable< U > >.termination_counter, frodo2.algorithms.localSearch.mgm.MGM< V extends Addable< V >, U extends Addable< U > >.VariableInfo< V extends Addable< V >, U extends Addable< U > >.variableID, and variables_finished.

◆ setQueue()

◆ setSilent()

void frodo2.algorithms.localSearch.mgm.MGM< V extends Addable< V >, U extends Addable< U > >.setSilent ( boolean silent)

Member Data Documentation

◆ assignmentHistoriesMap

HashMap<String, ArrayList<CurrentAssignment<V> > > frodo2.algorithms.localSearch.mgm.MGM< V extends Addable< V >, U extends Addable< U > >.assignmentHistoriesMap
protected

For each variable its assignment history.

Referenced by getAssignmentHistories(), init(), MGM(), reset(), and sendOK().

◆ CONV_STATS_MSG_TYPE

final MessageType frodo2.algorithms.localSearch.mgm.MGM< V extends Addable< V >, U extends Addable< U > >.CONV_STATS_MSG_TYPE = new MessageType ("MGM", "ConvStats")
static

The type of the message containing the assignment history.

Referenced by init(), and notifyIn().

◆ convergence

final boolean frodo2.algorithms.localSearch.mgm.MGM< V extends Addable< V >, U extends Addable< U > >.convergence
protected

If true, the assignment history must be stored.

Referenced by init(), and sendOK().

◆ IMPROVE_MSG_TYPE

◆ infos

HashMap<String, VariableInfo<V, U> > frodo2.algorithms.localSearch.mgm.MGM< V extends Addable< V >, U extends Addable< U > >.infos
protected

Contains, for each variable, an object containing all information needed by the algorithm.

Referenced by init(), and sendOK().

◆ LOG

final boolean frodo2.algorithms.localSearch.mgm.MGM< V extends Addable< V >, U extends Addable< U > >.LOG = false
protected

When true, every variable writes log information to a log file.

Referenced by log().

◆ loggers

HashMap<String, BufferedWriter> frodo2.algorithms.localSearch.mgm.MGM< V extends Addable< V >, U extends Addable< U > >.loggers
protected

A list of buffered writers used to log information during debugging.

Referenced by log().

◆ max_distance

int frodo2.algorithms.localSearch.mgm.MGM< V extends Addable< V >, U extends Addable< U > >.max_distance = 100
protected

The maximal number of rounds to be performed.

Referenced by sendOK().

◆ maximize

final boolean frodo2.algorithms.localSearch.mgm.MGM< V extends Addable< V >, U extends Addable< U > >.maximize
protected

true when solving a maximization problem, and false otherwise

Referenced by createVariableInfo(), and init().

◆ OK_MSG_TYPE

◆ owners

Map<String, String> frodo2.algorithms.localSearch.mgm.MGM< V extends Addable< V >, U extends Addable< U > >.owners
protected

Maps variables to the agent that owns it.

Referenced by init(), sendIMPROVE(), and sendOK().

◆ problem

◆ queue

Queue frodo2.algorithms.localSearch.mgm.MGM< V extends Addable< V >, U extends Addable< U > >.queue
protected

The queue to which this listener is registered.

Referenced by getStatsFromQueue(), init(), sendIMPROVE(), sendOK(), and setQueue().

◆ START_MSG_TYPE

MessageType frodo2.algorithms.localSearch.mgm.MGM< V extends Addable< V >, U extends Addable< U > >.START_MSG_TYPE = AgentInterface.START_AGENT
static

The type of the START message.

Referenced by getMsgTypes().

◆ started

boolean frodo2.algorithms.localSearch.mgm.MGM< V extends Addable< V >, U extends Addable< U > >.started
protected

true when the START_AGENT message has been received, and false otherwise

Referenced by init(), and notifyIn().

◆ terminated

boolean frodo2.algorithms.localSearch.mgm.MGM< V extends Addable< V >, U extends Addable< U > >.terminated
private

true when this agent has sent the agent finished message

Referenced by init().

◆ variables_finished

int frodo2.algorithms.localSearch.mgm.MGM< V extends Addable< V >, U extends Addable< U > >.variables_finished
protected

The number of variables that are finished.

Referenced by init(), and sendOK().


The documentation for this class was generated from the following file:
  • src/frodo2/algorithms/localSearch/mgm/MGM.java