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

An agent that uses a single queue. More...

Inheritance diagram for frodo2.algorithms.SingleQueueAgent< Val extends Addable< Val > >:

Public Member Functions

 SingleQueueAgent (ProblemInterface< Val, ?> probDesc, Document agentDesc, CentralMailer mailman) throws JDOMException, ClassNotFoundException, NoSuchMethodException, IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException
 Constructor.
void addOutputPipe (String agent, QueueOutputPipeInterface outputPipe)
void connect ()
String getID ()
void kill ()
void start ()
 Does nothing.
void setup (QueueOutputPipeInterface toDaemonPipe, QueueOutputPipeInterface toControllerPipe, boolean statsToController, int port)
void report ()
Collection< MessageTypegetMsgTypes ()
void notifyIn (Message msg)
void setQueue (Queue queue)
 Does nothing.
Map< String, Val > getCurrentSolution ()
Public Member Functions inherited from frodo2.algorithms.AgentInterface< Val >
void report ()
 Tells the agent to report to the local white pages.
void connect ()
 Tells the agent to start requesting connections to other agents from the white pages.
void start ()
 Starts the algorithm.
void kill ()
 Stops the algorithm.
String getID ()
Map< String, V > getCurrentSolution ()
 Returns the solution found by the algorithm upon termination.
void addOutputPipe (String agent, QueueOutputPipeInterface outputPipe)
 Adds an output pipe to the agent.
void setup (QueueOutputPipeInterface toDaemonPipe, QueueOutputPipeInterface toControllerPipe, boolean statsToController, int port)
 Sets up the agent to communicate with a daemon, a controller, and its neighbors.
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 void setMsgType (Class< ? extends MessageListener< MessageType > > moduleClass, String msgType, MessageType newType) throws NoSuchFieldException
 Changes the type of a message in a module.

Protected Member Functions

void oneMoreNeighbor ()
 Increments the number of neighbors connected, and notifies the controller when they are all connected.
void finished ()
 Sends a message to the controller saying that the agent has finished.

Protected Attributes

String agentID
 The agent's ID.
final Queue queue
 The agent's queue.
Set< String > neighbours
 This agent's neighbor IDs.
QueueIOPipe localInputPipe
 Pipe used to send messages to this agent.

Private Attributes

Collection< MessageTypemsgTypes = new ArrayList<MessageType> ()
 The message types this agent listens to.
int neighboursConnected
 The number of neighbours connected to the agent.
int port
 The incoming port number.
final boolean measureMsgs
 Whether to measure the number of messages and the total amount of information sent.
ProblemInterface< Val, ?> problem
 The problem to solve.
StatsReporterWithConvergence< Val > solutionMonitor
 The module that monitors on the values of the variables this agent owns.

Static Private Attributes

static QueueOutputPipeInterface blackHole
 Output pipe that ignores anything sent to it.

Additional Inherited Members

Static Public Attributes inherited from frodo2.algorithms.AgentInterface< Val >
static final String STATS_MONITOR
 Recipient ID to which statistics about algorithm execution should be sent.
static final MessageType AGENT_CONNECTED
 Message to be sent if an agent has a connection with all its neighbours.
static final MessageType AGENT_FINISHED
 The message sent when an agent has terminated.
static final MessageType ALL_AGENTS_IDLE
 The message sent when it has been detected that all agents are waiting for messages, but there are no more messages on the way.
static final MessageType LOCAL_AGENT_ADDRESS_REQUEST
 The message an agent uses to ask the white pages for an address.
static final MessageType LOCAL_AGENT_REPORTING
 an agent reports to its local white pages
static final MessageType START_AGENT
 Message used to tell an agent to start its algorithm.
static final MessageType STOP_AGENT
 Message used to tell an agent to stop.

Detailed Description

An agent that uses a single queue.

Author
Thomas Leaute
Brammert Ottens
Parameters
<Val>the type used for domain values

Constructor & Destructor Documentation

◆ SingleQueueAgent()

frodo2.algorithms.SingleQueueAgent< Val extends Addable< Val > >.SingleQueueAgent ( ProblemInterface< Val, ?> probDesc,
Document agentDesc,
CentralMailer mailman ) throws JDOMException, ClassNotFoundException, NoSuchMethodException, IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException

Constructor.

Parameters
probDescthe description of the problem
agentDescJDOM document containing the description of the problem
mailmanthe CentralMailer; ignored if not measuring Simulated Time
Exceptions
JDOMExceptionthrown if reading a description document failed
ClassNotFoundExceptionif a module class mentioned in the description is unknown
NoSuchMethodExceptionif a module class used does not contain a constructor that takes in a ProblemInterface and a JDOM Element
InvocationTargetExceptionif a module constructor throws an exception
IllegalAccessExceptionif the constructor for an IncomingMsgPolicyInterface is not accessible
InstantiationExceptionif a module class provided in the description is an abstract class
IllegalArgumentExceptionif the constructor of an IncomingMsgPolicyInterface does not take the proper arguments

References measureMsgs, problem, and SingleQueueAgent().

Referenced by SingleQueueAgent().

Here is the call graph for this function:

Member Function Documentation

◆ addOutputPipe()

void frodo2.algorithms.SingleQueueAgent< Val extends Addable< Val > >.addOutputPipe ( String agent,
QueueOutputPipeInterface outputPipe )
See also
AgentInterface.addOutputPipe(String, QueueOutputPipeInterface)

References oneMoreNeighbor(), and queue.

Here is the call graph for this function:

◆ connect()

◆ finished()

void frodo2.algorithms.SingleQueueAgent< Val extends Addable< Val > >.finished ( )
protected

◆ getCurrentSolution()

Map< String, Val > frodo2.algorithms.SingleQueueAgent< Val extends Addable< Val > >.getCurrentSolution ( )

◆ getID()

String frodo2.algorithms.SingleQueueAgent< Val extends Addable< Val > >.getID ( )
See also
AgentInterface.getID()

References agentID.

◆ getMsgTypes()

◆ kill()

void frodo2.algorithms.SingleQueueAgent< Val extends Addable< Val > >.kill ( )
See also
AgentInterface.kill()

References queue.

Referenced by notifyIn().

◆ notifyIn()

◆ oneMoreNeighbor()

void frodo2.algorithms.SingleQueueAgent< Val extends Addable< Val > >.oneMoreNeighbor ( )
protected

Increments the number of neighbors connected, and notifies the controller when they are all connected.

References frodo2.algorithms.AgentInterface< V extends Addable< V > >.AGENT_CONNECTED, frodo2.controller.Controller.CONTROLLER, neighbours, neighboursConnected, and queue.

Referenced by addOutputPipe(), and connect().

◆ report()

void frodo2.algorithms.SingleQueueAgent< Val extends Addable< Val > >.report ( )
See also
AgentInterface.report()

References agentID, frodo2.daemon.Daemon.DAEMON, localInputPipe, port, and frodo2.communication.Queue.sendMessage().

Referenced by setup().

Here is the call graph for this function:

◆ setMsgType()

void frodo2.algorithms.SingleQueueAgent< Val extends Addable< Val > >.setMsgType ( Class< ? extends MessageListener< MessageType > > moduleClass,
String msgType,
MessageType newType ) throws NoSuchFieldException
static

Changes the type of a message in a module.

Parameters
moduleClassthe class of the module
msgTypethe message type whose value is to be changed
newTypenew value for the message type
Exceptions
NoSuchFieldExceptionif msgType is not a field of module

Referenced by frodo2.algorithms.varOrdering.dfs.DFSgenerationParallel< S extends Comparable< S > &Serializable >.DFSgenerationParallel(), frodo2.algorithms.AbstractDCOPsolver< V extends Addable< V >, U extends Addable< U >, S extends Solution< V, U >.overrideMsgTypes(), and frodo2.algorithms.afb.test.AFBagentTest< V extends Addable< V >, U extends Addable< U > >.setUp().

◆ setQueue()

void frodo2.algorithms.SingleQueueAgent< Val extends Addable< Val > >.setQueue ( Queue queue)

◆ setup()

◆ start()

void frodo2.algorithms.SingleQueueAgent< Val extends Addable< Val > >.start ( )

Member Data Documentation

◆ agentID

String frodo2.algorithms.SingleQueueAgent< Val extends Addable< Val > >.agentID
protected

◆ blackHole

QueueOutputPipeInterface frodo2.algorithms.SingleQueueAgent< Val extends Addable< Val > >.blackHole
staticprivate
Initial value:
public void close() { }
public void pushMessage(MessageWrapper msg) { }
public String toDOT() { return "black_hole"; }
}
Message wrapper, used to store information on.
Definition MessageWrapper.java:36
Interface for classes used as an output of a Queue object.
Definition QueueOutputPipeInterface.java:30

Output pipe that ignores anything sent to it.

◆ localInputPipe

QueueIOPipe frodo2.algorithms.SingleQueueAgent< Val extends Addable< Val > >.localInputPipe
protected

Pipe used to send messages to this agent.

Referenced by report().

◆ measureMsgs

final boolean frodo2.algorithms.SingleQueueAgent< Val extends Addable< Val > >.measureMsgs
private

Whether to measure the number of messages and the total amount of information sent.

Referenced by SingleQueueAgent().

◆ msgTypes

Collection<MessageType> frodo2.algorithms.SingleQueueAgent< Val extends Addable< Val > >.msgTypes = new ArrayList<MessageType> ()
private

The message types this agent listens to.

Referenced by getMsgTypes().

◆ neighbours

Set<String> frodo2.algorithms.SingleQueueAgent< Val extends Addable< Val > >.neighbours
protected

◆ neighboursConnected

int frodo2.algorithms.SingleQueueAgent< Val extends Addable< Val > >.neighboursConnected
private

The number of neighbours connected to the agent.

Referenced by oneMoreNeighbor().

◆ port

int frodo2.algorithms.SingleQueueAgent< Val extends Addable< Val > >.port
private

The incoming port number.

Referenced by report(), and setup().

◆ problem

ProblemInterface<Val, ?> frodo2.algorithms.SingleQueueAgent< Val extends Addable< Val > >.problem
private

The problem to solve.

Referenced by SingleQueueAgent().

◆ queue

◆ solutionMonitor

StatsReporterWithConvergence<Val> frodo2.algorithms.SingleQueueAgent< Val extends Addable< Val > >.solutionMonitor
private

The module that monitors on the values of the variables this agent owns.

Referenced by getCurrentSolution().


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