|
FRODO Version 2.19.1
An open-source framework for Distributed Constraint Optimization (DCOP)
|
Protocol to elect a variable. More...

Public Member Functions | |
| VariableElection (DCOPProblemInterface<?, ?> problem, ScoringHeuristic< S > heuristic, int nbrSteps) | |
| Constructor. | |
| VariableElection (DCOPProblemInterface<?, ?> problem, Element parameters) throws Exception | |
| Constructor from XML descriptions. | |
| Collection< MessageType > | getMsgTypes () |
| Listens to messages of types LeaderElectionMaxID.START_MSG_TYPE and LeaderElectionMaxID.LE_MSG_TYPE. | |
| void | notifyIn (Message msg) |
| The actual algorithm. | |
| void | setQueue (Queue queue) |
| void | sendMessageToSelf (Message msg) |
| Method called by the LeaderElectionMaxID listeners to send their outputs. | |
| Public Member Functions inherited from frodo2.communication.Queue | |
| Queue (boolean measureMsgs) | |
| Constructor. | |
| Queue (boolean measureMsgs, boolean init) | |
| Constructor. | |
| void | toBeClosedUponKill (QueueInputPipeInterface input) |
| Reminds the queue to close the given pipe when it is killed. | |
| void | removeInputPipe (QueueInputPipeInterface input) |
| Removes the given input pipe from the list of input pipes. | |
| void | addOutputPipe (Object recipient, QueueOutputPipeInterface output) |
| Adds an output pipe to this queue. | |
| QueueOutputPipeInterface | getOutputPipe (Object recipient) |
| Returns the output pipe corresponding to the given recipient. | |
| void | removeOutputPipe (Object recipient) |
| Removes the output pipe corresponding to the given recipient. | |
| QueueIOPipe | addOutputQueue (Object recipient, Queue queue) |
| Adds a new output pipe to the provided queue. | |
| void | addIncomingMessagePolicy (IncomingMsgPolicyInterface< MessageType > policy) |
| Adds a listener to be notified of new incoming messages. | |
| void | addIncomingMessagePolicy (Collection< MessageType > msgTypes, IncomingMsgPolicyInterface< MessageType > policy) |
| Adds a listener to be notified of new incoming messages. | |
| void | addIncomingMessagePolicy (MessageType type, IncomingMsgPolicyInterface< MessageType > policy) |
| Adds a listener to be notified of new incoming messages of type type. | |
| void | addOutgoingMessagePolicy (OutgoingMsgPolicyInterface< MessageType > policy) |
| Adds a listener to be notified of new outgoing messages. | |
| void | addOutgoingMessagePolicy (Collection< MessageType > msgTypes, OutgoingMsgPolicyInterface< MessageType > policy) |
| Adds a listener to be notified of new outgoing messages. | |
| void | addOutgoingMessagePolicy (MessageType type, OutgoingMsgPolicyInterface< MessageType > policy) |
| Adds a listener to be notified of new outgoing messages of type type. | |
| void | addToInbox (MessageWrapper msg) |
| Adds the input message to this queue's inbox. | |
| void | sendMessage (Object to, Message msg) |
| Sends a message to a specified recipient. | |
| void | sendMessage (Object to, MessageWrapper msgWrap) |
| Send a message that has already been wrapped. | |
| void | end () |
| Kills the queue, making it unusable. | |
| void | run () |
| Continuously processes all messages in the inbox. | |
| void | deleteIncomingMessagePolicy (IncomingMsgPolicyInterface< MessageType > policy) |
| Completely removes the input policy from all lists of listeners. | |
| void | deleteStatsReporters () |
| Delete all StatsReporters. | |
| void | deleteOutgoingMessagePolicy (OutgoingMsgPolicyInterface< MessageType > policy) |
| Completely removes the outgoing message policy from all lists of listeners. | |
| void | cleanQueue () |
| Removes all messages from the inbox. | |
| void | setProblem (ProblemInterface<?, ?> problem) |
| Sets the problem that is queried for NCCCs. | |
| void | updateNCCCs (long msgNCCCs) |
| Updates the queue's NCCC counter to the input count if the input is greater. | |
| long | getCurrentTime () |
| int | getInboxSize () |
| MessageWrapper | getCurrentMessageWrapper () |
| HashMap< MessageType, Integer > | getMsgNbrs () |
| HashMap< Object, Integer > | getMsgNbrsSent () |
| HashMap< MessageType, Long > | getMsgSizes () |
| HashMap< Object, Long > | getMsgSizesSent () |
| HashMap< MessageType, Long > | getMaxMsgSizes () |
| void | resetStats () |
| Resets the metrics statistics. | |
| void | resetMsgSizeMonitor () |
| Closes the MsgSizeMonitor and creates a new one. | |
| 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 | FINISH_MSG_TYPE = AgentInterface.AGENT_FINISHED |
| The type of the message telling the agent finished. | |
Protected Member Functions | |
| VariableElection (DCOPProblemInterface<?, ?> problem) | |
| Incomplete constructor to be used by overriding classes. | |
| LeaderElectionMaxID< S > | newListener (String var, S score, Collection< String > neighbors) |
| Instantiates a new LeaderElectionMaxID. | |
| Protected Member Functions inherited from frodo2.communication.Queue | |
| Queue () | |
| Empty constructor that does absolutely nothing. | |
| void | notifyInListeners (Message msg, Object toAgent) |
| Notifies the incoming message listeners of a message. | |
| boolean | notifyOutListeners (Object fromAgent, Message msg, Collection<? extends Object > toAgents) |
| Notifies the outgoing message listeners of a message. | |
| void | recordStats (Object to, Message msg) |
| Records statistics about the input message. | |
Protected Attributes | |
| int | nbrSteps |
| The number of steps the protocol should run before it terminates. | |
| ScoringHeuristic< S > | heuristic |
| The heuristic. | |
| Protected Attributes inherited from frodo2.communication.Queue | |
| Set< QueueInputPipeInterface > | inputs |
| List of input pipes. | |
| HashMap< Object, QueueOutputPipeInterface > | outputs |
| Map associating an output pipe to each destination ID. | |
| MsgSizeMonitor | monitor |
| A monitor used to measure the sizes of the messages. | |
| HashMap< MessageType, ArrayList< IncomingMsgPolicyInterface< MessageType > > > | inPolicies |
| A list of listeners notified of incoming objects. | |
| HashMap< MessageType, ArrayList< OutgoingMsgPolicyInterface< MessageType > > > | outPolicies |
| A list of listeners notified of outgoing messages. | |
| ProblemInterface<?, ?> | problem |
| The problem used to obtain the current NCCC count. | |
| final boolean | measureMsgs |
| Whether to measure the number of messages and the total amount of information sent. | |
| HashMap< MessageType, Integer > | msgNbrs |
| For each message type, the number of messages sent of that type. | |
| HashMap< MessageType, Long > | msgSizes |
| For each message type, the total amount of information sent in messages of that type, in bytes. | |
| HashMap< MessageType, Long > | maxMsgSizes |
| For each message type, the size (in bytes) of the largest message of that type. | |
| MessageWrapper | msgWrap |
| The last wrapped message to have been received. | |
Package Functions | |
| public< R extends Object > void | sendMessageToMulti (Collection< R > recipients, Message msg) |
| Method called by the LeaderElectionMaxID listeners in order to send a message to specified variables. | |
| Package Functions inherited from frodo2.communication.Queue | |
| public< T extends Object > void | sendMessageToMulti (Collection< T > recipients, Message msg) |
| Sends a message to all specified recipients. | |
Private Member Functions | |
| void | init () |
| Parses the problem. | |
| void | reset () |
| Resets all problem-dependent fields (except the problem itself). | |
Private Attributes | |
| Queue | queue |
| The queue on which it should call sendMessage(). | |
| DCOPProblemInterface<?, ?> | problem |
| The problem. | |
| boolean | started = false |
| Whether the execution of the algorithm has started. | |
| Map< String, ArrayList< LeaderElectionMaxID< S > > > | neighborhoods |
| For each variable (internal or external), the list of internal variables connected to it. | |
| Map< String, String > | owners = new HashMap<String, String> () |
| For each known variable, the name of the agent that owns it. | |
| Collection< LeaderElectionMaxID< S > > | listeners |
| The LeaderElectionMaxID listeners corresponding to this agent's variables. | |
Additional Inherited Members | |
| Static Public Member Functions inherited from frodo2.communication.Queue | |
| static String | networkToDOT (Queue[] queues) |
| Generates a String representation in DOT format of a network of queues. | |
Protocol to elect a variable.
Contrary to LeaderElectionMaxID, this protocol elects a variable rather than an agent. The advantage is that it works when agents' subproblems have disconnected components. The implementation actually uses LeaderElectionMaxID, by treating each variable as an agent.
| <S> | the type used for the variables' scores |
| frodo2.algorithms.varOrdering.election.VariableElection< S extends Comparable< S > &Serializable >.VariableElection | ( | DCOPProblemInterface<?, ?> | problem, |
| ScoringHeuristic< S > | heuristic, | ||
| int | nbrSteps ) |
Constructor.
| problem | the problem |
| heuristic | the heuristic |
| nbrSteps | number of steps the protocol should run before it terminates |
References heuristic, nbrSteps, and problem.
Referenced by VariableElection().
| frodo2.algorithms.varOrdering.election.VariableElection< S extends Comparable< S > &Serializable >.VariableElection | ( | DCOPProblemInterface<?, ?> | problem, |
| Element | parameters ) throws Exception |
Constructor from XML descriptions.
| problem | description of the problem |
| parameters | description of the parameters of this protocol |
| Exception | if an error occurs |
References problem, and VariableElection().

|
protected |
Incomplete constructor to be used by overriding classes.
| problem | the agent's problem |
References problem.
| Collection< MessageType > frodo2.algorithms.varOrdering.election.VariableElection< S extends Comparable< S > &Serializable >.getMsgTypes | ( | ) |
Listens to messages of types LeaderElectionMaxID.START_MSG_TYPE and LeaderElectionMaxID.LE_MSG_TYPE.
Implements frodo2.communication.MessageListener< T >.
References FINISH_MSG_TYPE, frodo2.algorithms.varOrdering.election.LeaderElectionMaxID< T extends Comparable< T > &Serializable >.LE_MSG_TYPE, and START_MSG_TYPE.
|
private |
Parses the problem.
Reimplemented from frodo2.communication.Queue.
References heuristic, listeners, neighborhoods, newListener(), problem, and frodo2.algorithms.varOrdering.election.LeaderElectionMaxID< T extends Comparable< T > &Serializable >.setQueue().
Referenced by notifyIn().

|
protected |
Instantiates a new LeaderElectionMaxID.
| var | the variable |
| score | the score |
| neighbors | the variable's neighbors |
References nbrSteps.
Referenced by init().
| void frodo2.algorithms.varOrdering.election.VariableElection< S extends Comparable< S > &Serializable >.notifyIn | ( | Message | msg | ) |
The actual algorithm.
Listens to messages sent by LeaderElectionMaxID listeners, and notifies this agent's own LeaderElectionMaxID listeners.
| msg | the message that was just received |
Implements frodo2.communication.IncomingMsgPolicyInterface< T >.
References frodo2.communication.MessageType.equals(), FINISH_MSG_TYPE, init(), notifyIn(), and START_MSG_TYPE.
Referenced by notifyIn().

|
private |
Resets all problem-dependent fields (except the problem itself).
|
package |
Method called by the LeaderElectionMaxID listeners in order to send a message to specified variables.
If multiple variables are owned by the same agent, the message is only sent once to that agent.
| void frodo2.algorithms.varOrdering.election.VariableElection< S extends Comparable< S > &Serializable >.sendMessageToSelf | ( | Message | msg | ) |
Method called by the LeaderElectionMaxID listeners to send their outputs.
Reimplemented from frodo2.communication.Queue.
References queue.
| void frodo2.algorithms.varOrdering.election.VariableElection< S extends Comparable< S > &Serializable >.setQueue | ( | Queue | queue | ) |
Implements frodo2.communication.MessageListener< T >.
References frodo2.communication.Queue.Queue(), queue, and setQueue().
Referenced by setQueue().

|
static |
The type of the message telling the agent finished.
Referenced by getMsgTypes(), and notifyIn().
|
protected |
The heuristic.
Referenced by init(), and VariableElection().
|
private |
The LeaderElectionMaxID listeners corresponding to this agent's variables.
Referenced by init().
|
protected |
The number of steps the protocol should run before it terminates.
Referenced by newListener(), and VariableElection().
|
private |
For each variable (internal or external), the list of internal variables connected to it.
Referenced by init().
|
private |
For each known variable, the name of the agent that owns it.
Referenced by sendMessageToMulti().
|
private |
The problem.
Referenced by init(), VariableElection(), VariableElection(), and VariableElection().
|
private |
The queue on which it should call sendMessage().
Referenced by sendMessageToMulti(), sendMessageToSelf(), and setQueue().
|
static |
The type of the message telling the module to start.
Referenced by getMsgTypes(), and notifyIn().
|
private |
Whether the execution of the algorithm has started.