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 > > Class Template Reference

This class implements the ADOPT algorithm as described in: More...

Inheritance diagram for frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >:

Classes

interface  Version
 The different versions of adopt handle some things differently. More...
class  Original
 The original adopt version. More...
class  VariableInfo
 Helper class that contains all the info belonging to a specific variable. More...

Public Member Functions

 ADOPT (Element parameters, DCOPProblemInterface< Val, U > problem)
 Constructor for the stats gatherer mode.
 ADOPT (DCOPProblemInterface< Val, U > problem, Element parameters) throws Exception
 A constructor that takes in the description of the problem and the parameters of adopt.
 ADOPT (DCOPProblemInterface< Val, U > problem, String versionName, boolean convergence) throws Exception
 Constructor.
void reset ()
Collection< MessageTypegetMsgTypes ()
void notifyIn (Message msg)
void setQueue (Queue queue)
void getStatsFromQueue (Queue queue)
HashMap< String, ArrayList< CurrentAssignment< Val > > > getAssignmentHistories ()
boolean compatible (HashMap< String, Val > context1, HashMap< String, Val > context2)
 Two contexts are compatible if they agree on the shared variables.
void sendMessageToVariable (String variable, Message msg)
 Sends a message to the owner of the variable.
void setSilent (boolean silent)
Map< String, Val > 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 Member Functions

static< Val extends Addable< Val > U extends Addable< U > void log (VariableInfo< Val, U > variable, String message)

Static Public Attributes

static MessageType START_MSG_TYPE = AgentInterface.START_AGENT
 The type of the message telling the module to start.
static final MessageType CONV_STATS_MSG_TYPE = new MessageType ("ADOPT", "ConvStats")
 The type of the message containing the assignment history.

Private Member Functions

void init ()
 Parses the problem.
boolean checkAllCostsNonNeg ()
void setVersion (String versionName) throws ClassNotFoundException, NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException
 Helper function to set the heuristic used for preprocessing.
void decideSingleton (VariableInfo< Val, U > variable)
 When this variable is isolated, immediately calculate its decision and terminate.

Private Attributes

Queue queue
 The message queue.
infinity
 Infinite utility.
HashMap< String, VariableInfo< Val, U > > infos
 For each variable all the info needed to run the algorithm.
Map< String, String > owners = new HashMap<String, String>()
 For each known variable, the name of the agent that owns it.
Version< Val, U > adoptVersion
 Object with version specific methods.
HashMap< String, Boolean > variableReady = new HashMap<String, Boolean>()
 Variable used in order to determine whether the algorithm can be initiated or not for a particular variable.
int variableReadyCounter = 0
 Variable that counts the number of variables that have terminated.
DCOPProblemInterface< Val, U > problem
 The agent's problem.
boolean started = false
 Whether the algorithm has been started.
final boolean convergence
 true when the convergence history is to be stored
HashMap< String, ArrayList< CurrentAssignment< Val > > > assignmentHistoriesMap
 For each variable its assignment history.

Static Private Attributes

static final boolean LOG = false
 To log or not to log.

Detailed Description

This class implements the ADOPT algorithm as described in:

"An Asynchronous Complete Method for Distributed Constraint Optimization" P.J. Modi et al AAMAS03

Author
Brammert Ottens, Thomas Leaute
Parameters
<Val>the type used for variable values
<U>the type used for utility values
Warning
ADOPT only works for minimization problems, in which all costs are non-negative.

Constructor & Destructor Documentation

◆ ADOPT() [1/3]

◆ ADOPT() [2/3]

frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.ADOPT ( DCOPProblemInterface< Val, U > problem,
Element parameters ) throws Exception

A constructor that takes in the description of the problem and the parameters of adopt.

Parameters
problemProblem description
parametersadopt's parameters
Exceptions
Exceptionif an error occurs

References infinity, problem, and setVersion().

Here is the call graph for this function:

◆ ADOPT() [3/3]

frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.ADOPT ( DCOPProblemInterface< Val, U > problem,
String versionName,
boolean convergence ) throws Exception

Constructor.

Parameters
problemthe problem
versionNamethe name of the version of ADOPT
convergencetrue when the assignment history should be stored
Exceptions
Exceptionif an error occurs

References convergence, infinity, problem, and setVersion().

Here is the call graph for this function:

Member Function Documentation

◆ checkAllCostsNonNeg()

boolean frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.checkAllCostsNonNeg ( )
private
Returns
true if all utilities in all spaces are non-negative, false otherwise
Author
Thomas Leaute

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

Referenced by init().

Here is the call graph for this function:

◆ compatible()

boolean frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.compatible ( HashMap< String, Val > context1,
HashMap< String, Val > context2 )

Two contexts are compatible if they agree on the shared variables.

Parameters
context1the first context
context2the second context
Returns
true if the contexts are compatible and false otherwise

◆ decideSingleton()

◆ getAssignmentHistories()

HashMap< String, ArrayList< CurrentAssignment< Val > > > frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.getAssignmentHistories ( )

◆ getCurrentSolution()

Map< String, Val > frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.getCurrentSolution ( )

◆ getMsgTypes()

◆ getStatsFromQueue()

void frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.getStatsFromQueue ( Queue queue)

◆ init()

void frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.init ( )
private

Parses the problem.

References assignmentHistoriesMap, checkAllCostsNonNeg(), infinity, infos, problem, and variableReady.

Referenced by notifyIn().

Here is the call graph for this function:

◆ log()

static< Val extends Addable< Val > U extends Addable< U > void frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.log ( VariableInfo< Val, U > variable,
String message )
static

◆ notifyIn()

◆ reset()

void frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.reset ( )
See also
StatsReporter.reset()
Todo
Auto-generated method stub

Implements frodo2.algorithms.StatsReporter.

◆ sendMessageToVariable()

void frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.sendMessageToVariable ( String variable,
Message msg )

Sends a message to the owner of the variable.

Parameters
variablethe name of the destination variable
msgthe message

References owners, and queue.

◆ setQueue()

void frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.setQueue ( Queue queue)

◆ setSilent()

void frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.setSilent ( boolean silent)

◆ setVersion()

void frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.setVersion ( String versionName) throws ClassNotFoundException, NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException
private

Helper function to set the heuristic used for preprocessing.

Parameters
versionNamethe name of the version class
Exceptions
ClassNotFoundExceptionif the version is not found
NoSuchMethodExceptionif the version class does not have a constructor taking a single argument of class ADOPT
InstantiationExceptionif calling the constructor for the version failed
IllegalAccessExceptionif calling the constructor for the version failed
InvocationTargetExceptionif calling the constructor for the version failed

References ADOPT(), and setVersion().

Referenced by ADOPT(), ADOPT(), and setVersion().

Here is the call graph for this function:

Member Data Documentation

◆ adoptVersion

Version<Val, U> frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.adoptVersion
private

Object with version specific methods.

Referenced by getMsgTypes().

◆ assignmentHistoriesMap

HashMap<String, ArrayList<CurrentAssignment<Val> > > frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.assignmentHistoriesMap
private

For each variable its assignment history.

Referenced by ADOPT(), decideSingleton(), getAssignmentHistories(), and init().

◆ CONV_STATS_MSG_TYPE

final MessageType frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.CONV_STATS_MSG_TYPE = new MessageType ("ADOPT", "ConvStats")
static

The type of the message containing the assignment history.

Referenced by getStatsFromQueue().

◆ convergence

final boolean frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.convergence
private

true when the convergence history is to be stored

Referenced by ADOPT(), and decideSingleton().

◆ infinity

◆ infos

HashMap<String, VariableInfo<Val, U> > frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.infos
private

For each variable all the info needed to run the algorithm.

Referenced by decideSingleton(), and init().

◆ LOG

◆ owners

Map<String, String> frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.owners = new HashMap<String, String>()
private

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

Referenced by sendMessageToVariable().

◆ problem

DCOPProblemInterface<Val, U> frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.problem
private

The agent's problem.

Referenced by ADOPT(), ADOPT(), ADOPT(), and init().

◆ queue

Queue frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.queue
private

The message queue.

Referenced by decideSingleton(), getStatsFromQueue(), sendMessageToVariable(), and setQueue().

◆ START_MSG_TYPE

MessageType frodo2.algorithms.adopt.ADOPT< 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.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.started = false
private

Whether the algorithm has been started.

◆ variableReady

HashMap<String, Boolean> frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.variableReady = new HashMap<String, Boolean>()
private

Variable used in order to determine whether the algorithm can be initiated or not for a particular variable.

Referenced by init().

◆ variableReadyCounter

int frodo2.algorithms.adopt.ADOPT< Val extends Addable< Val >, U extends Addable< U > >.variableReadyCounter = 0
private

Variable that counts the number of variables that have terminated.

Referenced by decideSingleton().


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