FRODO Version 2.19.1
An open-source framework for Distributed Constraint Optimization (DCOP)
Loading...
Searching...
No Matches
frodo2.algorithms.localSearch.dsa.DSA< Val extends Addable< Val >, U extends Addable< U > > Class Template Reference
Inheritance diagram for frodo2.algorithms.localSearch.dsa.DSA< Val extends Addable< Val >, U extends Addable< U > >:

Classes

class  VariableInfo
 Container class for information needed for each variable. More...
interface  DetermineAssignment
 Interface used to implement the different decision strategies of DSA. More...
class  A
class  C
class  E
class  VarAssignment
 Container for a value assignment and its utility. More...

Public Member Functions

 DSA (Element parameters, DCOPProblemInterface< Val, U > problem)
 Constructor for the stats gatherer mode.
 DSA (DCOPProblemInterface< Val, U > problem, Element parameters) throws ClassNotFoundException
 Constructor.
 DSA (DCOPProblemInterface< Val, U > problem, Element parameters, int nbrCycles)
 Constructor.
void reset ()
HashMap< String, ArrayList< CurrentAssignment< Val > > > getAssignmentHistories ()
void getStatsFromQueue (Queue queue)
Val getCurrentValue (String variable)
 Getter method.
getCurrentUtility (String variable)
 Getter method.
void setSilent (boolean silent)
Collection< MessageTypegetMsgTypes ()
void notifyIn (Message msg)
void setQueue (Queue queue)
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 Attributes

static MessageType START_MSG_TYPE = AgentInterface.START_AGENT
 The type of the message telling the module to start.
static MessageType VALUE_MSG_TYPE = new MessageType ("DSA", "VALUE")
 The type of the message used to report a value to neighboring variables.
static final MessageType CONV_STATS_MSG_TYPE = new MessageType ("DSA", "ConvStats")
 The type of the message containing the assignment history.

Protected Member Functions

void setDecisionStrategy (String decisionStrategy)
 Method used to set the decision strategy.
void init ()
 Initializes the agent's variables.
VariableInfo< Val, U > createVariableInfo (String variableID, Val[] domain, String[] neighbours, DCOPProblemInterface< Val, U > problem)
 method used to create a VariableInfo object
void log (String variableID, String message)
 Log function used to print the variables state during debugging.

Protected Attributes

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 convergence
 Whether the listener should record the assignment history or not.
HashMap< String, ArrayList< CurrentAssignment< Val > > > assignmentHistoriesMap
 For each variable its assignment history.
DCOPProblemInterface< Val, U > problem
 The agent's problem.
double p
 The probability with which a new value is chosen.
int numberOfVariables
 The number of variables owned by this agent.
Queue queue
 The message queue.
HashMap< String, VariableInfo< Val, U > > infos
 For each variable a container with information.
DetermineAssignment< Val, U > decisionStrategy
 Strategy used to determine a new assignment.
boolean started
 true when the module has been initialized, and false otherwise
Map< String, String > owners
 For each variable the agent that owns it.
int nbrCycles
 The number of synchronous cycles before termination (except for isolated variables).
int variableFinishedCounter
 Counts the number of variables that have hit the desired cycle count.
boolean terminated
 true when this agent has sent the agent finished message during initialization

Detailed Description

Author
Brammert Ottens, 10 aug 2009

This class implements the Distributed Local Search algorithm DSA as described in "Distributed stochastic search and distributed breakout: properties, comparison and applications to constraint optimization problems in sensor networks" by Zhang et al, 2005.

DSA is a very simple algorithm, where each variable decides whether to changes its value based on the values of its neighbouring variables and some local decision procedure. If the variable value changes this is reported to its neighbours via a message. The decision procedures implemented here are as follows, where delta is the difference between the current local utility and the optimal local utility obtainable when changing one's value, in terms of number of conflicts if either one is infeasible, or in terms of utility if both are feasible. v is the value that gives this optimal utility and 0 <= p <= 1 a probability

                            delta @iliteral > @endiliteral  0               conflict, delta == 0            no conflict, delta == 0 

DSA-A : v with p - - DSA-B : v with p v with p - DSA-C : v with p v with p v with p DSA-D : v v with p - DSA-E : v v with p v with p

Parameters
<Val>type used for variable values
<U>type used for utility values
Todo
Implement strategies B and D.

Constructor & Destructor Documentation

◆ DSA() [1/3]

◆ DSA() [2/3]

frodo2.algorithms.localSearch.dsa.DSA< Val extends Addable< Val >, U extends Addable< U > >.DSA ( DCOPProblemInterface< Val, U > problem,
Element parameters ) throws ClassNotFoundException

Constructor.

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

References decisionStrategy, DSA(), nbrCycles, p, problem, and setDecisionStrategy().

Here is the call graph for this function:

◆ DSA() [3/3]

frodo2.algorithms.localSearch.dsa.DSA< Val extends Addable< Val >, U extends Addable< U > >.DSA ( DCOPProblemInterface< Val, U > problem,
Element parameters,
int nbrCycles )

Constructor.

Parameters
problemdescription of the local problem
parametersparameters of the module
nbrCyclesthe number of cycles that the algorithm should run

References decisionStrategy, DSA(), nbrCycles, p, problem, and setDecisionStrategy().

Here is the call graph for this function:

Member Function Documentation

◆ createVariableInfo()

VariableInfo< Val, U > frodo2.algorithms.localSearch.dsa.DSA< Val extends Addable< Val >, U extends Addable< U > >.createVariableInfo ( String variableID,
Val[] domain,
String[] neighbours,
DCOPProblemInterface< Val, U > problem )
protected

method used to create a VariableInfo object

Author
Brammert Ottens, 16 feb. 2011
Parameters
variableIDthe ID of the variable
domainthe domain of the variable
neighboursthe neighbors of the variable
problemthe local problem definition
Returns
a VariableInfo object for variableID

References problem.

Referenced by init().

◆ getAssignmentHistories()

◆ getCurrentSolution()

Map< String, Val > frodo2.algorithms.localSearch.dsa.DSA< Val extends Addable< Val >, U extends Addable< U > >.getCurrentSolution ( )

◆ getCurrentUtility()

U frodo2.algorithms.localSearch.dsa.DSA< Val extends Addable< Val >, U extends Addable< U > >.getCurrentUtility ( String variable)

Getter method.

Author
Brammert Ottens, 12 aug 2009
Parameters
variablethe variable for which the utility is requested
Returns
the current utility

References infos.

◆ getCurrentValue()

Val frodo2.algorithms.localSearch.dsa.DSA< Val extends Addable< Val >, U extends Addable< U > >.getCurrentValue ( String variable)

Getter method.

Author
Brammert Ottens, 12 aug 2009
Parameters
variablethe variable for which the value is requested
Returns
the value of the variable

References infos.

◆ getMsgTypes()

◆ getStatsFromQueue()

◆ init()

◆ log()

void frodo2.algorithms.localSearch.dsa.DSA< Val extends Addable< Val >, 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()

void frodo2.algorithms.localSearch.dsa.DSA< Val extends Addable< Val >, U extends Addable< U > >.reset ( )
See also
StatsReporterWithConvergence.reset()
Todo
Auto-generated method stub

Implements frodo2.algorithms.StatsReporter.

◆ setDecisionStrategy()

void frodo2.algorithms.localSearch.dsa.DSA< Val extends Addable< Val >, U extends Addable< U > >.setDecisionStrategy ( String decisionStrategy)
protected

Method used to set the decision strategy.

Author
Brammert Ottens, 23 mrt. 2011
Parameters
decisionStrategythe decision strategy to be used

References decisionStrategy, DSA(), and setDecisionStrategy().

Referenced by DSA(), DSA(), and setDecisionStrategy().

Here is the call graph for this function:

◆ setQueue()

◆ setSilent()

void frodo2.algorithms.localSearch.dsa.DSA< Val extends Addable< Val >, U extends Addable< U > >.setSilent ( boolean silent)

Member Data Documentation

◆ assignmentHistoriesMap

HashMap<String, ArrayList<CurrentAssignment<Val> > > frodo2.algorithms.localSearch.dsa.DSA< Val extends Addable< Val >, U extends Addable< U > >.assignmentHistoriesMap
protected

For each variable its assignment history.

Referenced by DSA(), getAssignmentHistories(), and init().

◆ CONV_STATS_MSG_TYPE

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

The type of the message containing the assignment history.

Referenced by getStatsFromQueue(), init(), and notifyIn().

◆ convergence

final boolean frodo2.algorithms.localSearch.dsa.DSA< Val extends Addable< Val >, U extends Addable< U > >.convergence
protected

Whether the listener should record the assignment history or not.

Referenced by DSA(), and init().

◆ decisionStrategy

DetermineAssignment<Val, U> frodo2.algorithms.localSearch.dsa.DSA< Val extends Addable< Val >, U extends Addable< U > >.decisionStrategy
protected

Strategy used to determine a new assignment.

Referenced by DSA(), DSA(), and setDecisionStrategy().

◆ infos

HashMap<String, VariableInfo<Val, U> > frodo2.algorithms.localSearch.dsa.DSA< Val extends Addable< Val >, U extends Addable< U > >.infos
protected

For each variable a container with information.

Referenced by getCurrentUtility(), getCurrentValue(), and init().

◆ LOG

final boolean frodo2.algorithms.localSearch.dsa.DSA< Val extends Addable< Val >, 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.dsa.DSA< Val extends Addable< Val >, U extends Addable< U > >.loggers
protected

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

Referenced by log().

◆ nbrCycles

int frodo2.algorithms.localSearch.dsa.DSA< Val extends Addable< Val >, U extends Addable< U > >.nbrCycles
protected

The number of synchronous cycles before termination (except for isolated variables).

Referenced by DSA(), and DSA().

◆ numberOfVariables

int frodo2.algorithms.localSearch.dsa.DSA< Val extends Addable< Val >, U extends Addable< U > >.numberOfVariables
protected

The number of variables owned by this agent.

Referenced by DSA(), and init().

◆ owners

Map<String, String> frodo2.algorithms.localSearch.dsa.DSA< Val extends Addable< Val >, U extends Addable< U > >.owners
protected

For each variable the agent that owns it.

Referenced by init().

◆ p

double frodo2.algorithms.localSearch.dsa.DSA< Val extends Addable< Val >, U extends Addable< U > >.p
protected

The probability with which a new value is chosen.

Referenced by DSA(), and DSA().

◆ problem

◆ queue

Queue frodo2.algorithms.localSearch.dsa.DSA< Val extends Addable< Val >, U extends Addable< U > >.queue
protected

The message queue.

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

◆ START_MSG_TYPE

MessageType frodo2.algorithms.localSearch.dsa.DSA< 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.localSearch.dsa.DSA< Val extends Addable< Val >, U extends Addable< U > >.started
protected

true when the module has been initialized, and false otherwise

Referenced by init().

◆ terminated

boolean frodo2.algorithms.localSearch.dsa.DSA< Val extends Addable< Val >, U extends Addable< U > >.terminated
protected

true when this agent has sent the agent finished message during initialization

Referenced by init().

◆ VALUE_MSG_TYPE

MessageType frodo2.algorithms.localSearch.dsa.DSA< Val extends Addable< Val >, U extends Addable< U > >.VALUE_MSG_TYPE = new MessageType ("DSA", "VALUE")
static

◆ variableFinishedCounter

int frodo2.algorithms.localSearch.dsa.DSA< Val extends Addable< Val >, U extends Addable< U > >.variableFinishedCounter
protected

Counts the number of variables that have hit the desired cycle count.

Referenced by init().


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