|
FRODO Version 2.19.1
An open-source framework for Distributed Constraint Optimization (DCOP)
|
Centralized mail man that enforces that only one agent is awake at a time, which is useful to measure distributed runtime. More...

Classes | |
| class | FakeQueue |
| The queue associated with a specific agent. More... | |
| class | TimestampComparator |
| A comparator used in the PriorityQueue to order messages according to their timestamps. More... | |
| class | DelayGenerator |
| Abstract class that defines the functions needed in a delay generator. More... | |
| class | NegativeExponentialDistribution |
| This class is used to generate message delay according to the negative exponential distribution. More... | |
Public Member Functions | |
| CentralMailer (boolean measureMsgs, boolean useDelayGenerator, Element parameters) | |
| Constructor. | |
| CentralMailer (ProblemInterface<?, ?> problem, Element agentConfig) | |
| Constructor. | |
| void | start () |
| boolean | execute () |
| Executes the algorithm. | |
| boolean | execute (long timeout) |
| Executes the algorithm. | |
| void | run () |
| Waits for a message to be available and then delivers it. | |
| void | end () |
| Kills the CentralMailer. | |
| Queue | newQueue (String agent) |
| Creates a new queue for the given agent. | |
| Queue | newQueue (String agent, boolean updateTime) |
| Creates a new queue for the given agent. | |
Static Public Attributes | |
| static final MessageType | ERROR_MSG = MessageType.SYSTEM.newChild("CentralMailer", "CentralMailerError") |
| Type of messages sent when an exception occurs. | |
| static final MessageType | OutOfMemMsg = MessageType.SYSTEM.newChild("CentralMailer", "OutOfMem") |
| Type of out of memory message. | |
Protected Member Functions | |
| boolean | checkTimestamp (long time) |
| Checks that the input time is higher than the last timestamp. | |
Protected Attributes | |
| HashMap< String, FakeQueue > | queues |
| Each agent's queue. | |
| PriorityQueue< MessageWrapper > | orderedQueue |
| The ordered repository of messages. | |
| long | lastTimeStamp = Long.MIN_VALUE |
| The time stamp of the last message that has been released. | |
| LinkedList< MessageWrapper > | outbox = new LinkedList<MessageWrapper> () |
| Buffer of messages waiting to be put into the priority queue. | |
| final DelayGenerator | delayGenerator |
| Used to generate random delays. | |
| final boolean | measuringMsgs |
| Whether to measure the number of messages and the total amount of information sent. | |
| ReentrantLock | lock = new ReentrantLock() |
| The lock used for synchronization. | |
| Condition | msgReady = this.lock.newCondition() |
| The condition on which the timed thread awaits to deliver a message. | |
| Condition | msgDone = this.lock.newCondition() |
| The condition on which execute() awaits to proceed to the next message. | |
| FakeQueue | currentQueue |
| The currently active queue. | |
| volatile MessageWrapper | currentMsg |
| The message delivered to the currently active Queue. | |
| boolean | stop = true |
| Flag used to tell the CentralMailer that it should terminate. | |
| boolean | idleMsgsSent = false |
| Whether the agents have already been notified that they are all idle. | |
Private Attributes | |
| HashMap< MessageType, Collection< IncomingMsgPolicyInterface< MessageType > > > | eavesdroppersIn |
| The eavesdroppers for incoming messages, per message type. | |
| HashMap< MessageType, Collection< OutgoingMsgPolicyInterface< MessageType > > > | eavesdroppersOut |
| The eavesdroppers for outgoing messages. | |
Centralized mail man that enforces that only one agent is awake at a time, which is useful to measure distributed runtime.
| frodo2.communication.mailer.CentralMailer.CentralMailer | ( | boolean | measureMsgs, |
| boolean | useDelayGenerator, | ||
| Element | parameters ) |
Constructor.
| measureMsgs | whether to measure the number and sizes of messages |
| useDelayGenerator | true when the DelayGenerator is to be used |
| parameters | parameters of the CentralMailer (not used in this implementation) |
References delayGenerator, orderedQueue, and frodo2.communication.MessageType.ROOT.
| frodo2.communication.mailer.CentralMailer.CentralMailer | ( | ProblemInterface<?, ?> | problem, |
| Element | agentConfig ) |
Constructor.
| problem | the problem instance |
| agentConfig | the agent configuration |
References frodo2.algorithms.Eavesdroppable< T >.getEavesdropper(), frodo2.communication.MessageListener< T >.getMsgTypes(), and frodo2.communication.MessageType.ROOT.

|
protected |
Checks that the input time is higher than the last timestamp.
| time | input time |
true iff the test passed Referenced by run().
| void frodo2.communication.mailer.CentralMailer.end | ( | ) |
Kills the CentralMailer.
| boolean frodo2.communication.mailer.CentralMailer.execute | ( | ) |
Executes the algorithm.
References frodo2.algorithms.AgentFactory< V extends Addable< V >, U extends Addable< U > >.DEFAULT_TIMEOUT, and execute().
Referenced by execute(), frodo2.communication.mailer.tests.testCentralMailer.testNext(), frodo2.algorithms.adopt.test.ADOPTagentTest< V extends Addable< V >, U extends Addable< U > >.testRandom(), frodo2.algorithms.asodpop.tests.ASODPOPagentTest< V extends Addable< V >, U extends Addable< U > >.testRandom(), frodo2.algorithms.asodpop.tests.ASODPOPBinaryAgentTest< V extends Addable< V >, U extends Addable< U > >.testRandom(), frodo2.algorithms.dpop.test.DPOPagentTest< V extends Addable< V >, U extends Addable< U > >.testRandom(), frodo2.algorithms.duct.tests.DUCTagentTest.testRandom(), frodo2.algorithms.localSearch.dsa.tests.DSAagentTest< V extends Addable< V >, U extends Addable< U > >.testRandom(), frodo2.algorithms.localSearch.mgm.mgm2.tests.MGM2agentTest< V extends Addable< V >, U extends Addable< U > >.testRandom(), frodo2.algorithms.localSearch.mgm.tests.MGMagentTest< V extends Addable< V >, U extends Addable< U > >.testRandom(), frodo2.algorithms.odpop.tests.ODPOPagentTest< V extends Addable< V >, U extends Addable< U > >.testRandom(), frodo2.algorithms.odpop.tests.ODPOPagentTestBinaryDomains< V extends Addable< V >, U extends Addable< U > >.testRandom(), frodo2.algorithms.odpop.tests.ODPOPagentTestFullDomain< V extends Addable< V >, U extends Addable< U > >.testRandom(), and frodo2.algorithms.AgentFactory< V extends Addable< V >, U extends Addable< U > >.waitForEnd().

| boolean frodo2.communication.mailer.CentralMailer.execute | ( | long | timeout | ) |
Executes the algorithm.
| timeout | the timeout in milliseconds |
References frodo2.communication.MessageWrapper.addDelay(), frodo2.communication.mailer.CentralMailer.FakeQueue.agent, frodo2.algorithms.AgentInterface< V extends Addable< V > >.AGENT_FINISHED, frodo2.algorithms.AgentInterface< V extends Addable< V > >.ALL_AGENTS_IDLE, frodo2.controller.Controller.CONTROLLER, frodo2.daemon.Daemon.DAEMON, frodo2.communication.MessageType.equals(), ERROR_MSG, frodo2.communication.mailer.CentralMailer.DelayGenerator.generateDelay(), frodo2.communication.mailer.CentralMailer.FakeQueue.getCurrentTime(), frodo2.communication.MessageWrapper.getDestinations(), frodo2.communication.MessageWrapper.getMessage(), frodo2.communication.MessageType.getParent(), frodo2.communication.MessageWrapper.getTime(), frodo2.communication.Message.getType(), lastTimeStamp, frodo2.communication.mailer.CentralMailer.FakeQueue.notifyInListeners(), OutOfMemMsg, frodo2.communication.mailer.CentralMailer.FakeQueue.recordStats(), frodo2.communication.mailer.CentralMailer.FakeQueue.setCurrentMsgWrapper(), start(), frodo2.algorithms.AgentInterface< V extends Addable< V > >.STATS_MONITOR, stop, and frodo2.timeout.

| Queue frodo2.communication.mailer.CentralMailer.newQueue | ( | String | agent | ) |
Creates a new queue for the given agent.
| agent | agent name |
References newQueue().
Referenced by newQueue().

| Queue frodo2.communication.mailer.CentralMailer.newQueue | ( | String | agent, |
| boolean | updateTime ) |
Creates a new queue for the given agent.
| agent | agent name |
| updateTime | If false, this queue's time will always remain frozen at its initial value |
References frodo2.controller.Controller.CONTROLLER, frodo2.daemon.Daemon.DAEMON, and frodo2.algorithms.AgentInterface< V extends Addable< V > >.STATS_MONITOR.
| void frodo2.communication.mailer.CentralMailer.run | ( | ) |
Waits for a message to be available and then delivers it.
References frodo2.communication.mailer.CentralMailer.FakeQueue.agent, checkTimestamp(), frodo2.daemon.Daemon.DAEMON, ERROR_MSG, frodo2.communication.mailer.CentralMailer.FakeQueue.freezeTime(), frodo2.communication.MessageWrapper.getMessage(), frodo2.communication.MessageWrapper.getNCCCs(), frodo2.communication.MessageType.getParent(), frodo2.communication.MessageWrapper.getTime(), frodo2.communication.Message.getType(), lock, frodo2.communication.mailer.CentralMailer.FakeQueue.notifyInListeners(), OutOfMemMsg, frodo2.communication.Queue.updateNCCCs(), and frodo2.communication.mailer.CentralMailer.FakeQueue.updateTime.

| void frodo2.communication.mailer.CentralMailer.start | ( | ) |
Referenced by execute().
|
protected |
The message delivered to the currently active Queue.
|
protected |
The currently active queue.
|
protected |
Used to generate random delays.
Referenced by CentralMailer().
|
private |
The eavesdroppers for incoming messages, per message type.
|
private |
The eavesdroppers for outgoing messages.
|
static |
Type of messages sent when an exception occurs.
Referenced by execute(), frodo2.algorithms.AgentFactory< V extends Addable< V >, U extends Addable< U > >.getMsgTypes(), and run().
|
protected |
Whether the agents have already been notified that they are all idle.
|
protected |
The time stamp of the last message that has been released.
Referenced by execute().
|
protected |
|
protected |
Whether to measure the number of messages and the total amount of information sent.
Referenced by frodo2.communication.mailer.CentralMailer.FakeQueue.FakeQueue().
|
protected |
The condition on which execute() awaits to proceed to the next message.
|
protected |
The condition on which the timed thread awaits to deliver a message.
|
protected |
The ordered repository of messages.
Referenced by CentralMailer(), frodo2.communication.mailer.CentralMailer.FakeQueue.cleanQueue(), and frodo2.communication.mailer.CentralMailer.FakeQueue.getInboxSize().
|
protected |
Buffer of messages waiting to be put into the priority queue.
Referenced by frodo2.communication.mailer.CentralMailer.FakeQueue.addToInbox(), and frodo2.communication.mailer.CentralMailer.FakeQueue.sendMessageToMulti().
|
static |
Type of out of memory message.
Referenced by execute(), frodo2.algorithms.AgentFactory< V extends Addable< V >, U extends Addable< U > >.getMsgTypes(), and run().
|
protected |
Each agent's queue.
Referenced by frodo2.communication.mailer.CentralMailer.FakeQueue.sendMessage().
|
protected |
Flag used to tell the CentralMailer that it should terminate.