|
FRODO Version 2.19.1
An open-source framework for Distributed Constraint Optimization (DCOP)
|
This distributed leader election protocol chooses a leader agent as the one with highest unique ID. More...

Classes | |
| class | MessageLEoutput |
| Message class used for the output of the protocol. More... | |
Public Member Functions | |
| Collection< MessageType > | getMsgTypes () |
| void | setQueue (Queue queue) |
| LeaderElectionMaxID (String comID, T myID, Collection< String > neighbors, int nbrSteps) | |
| Constructor. | |
| LeaderElectionMaxID (DCOPProblemInterface<?, ?> problem, Element params) | |
| Constructor. | |
| void | notifyIn (Message msg) |
| The actual algorithm. | |
| 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 = new MessageType ("VarOrdering", "LeaderElectionMaxID", "Start") |
| The type of the message used to tell the protocol to start. | |
| static final MessageType | LE_MSG_TYPE = new MessageType ("VarOrdering", "LeaderElectionMaxID", "ELECT") |
| The type of the messages used to carry agent IDs. | |
| static final MessageType | OUTPUT_MSG_TYPE = new MessageType ("VarOrdering", "LeaderElectionMaxID", "Output") |
| The type of the output message. | |
Protected Member Functions | |
| T | getMaxID () |
Protected Attributes | |
| T | myID |
| This agent's ID. | |
| T | maxID |
| Current computed maximum ID. | |
| int | stepCountdown = 0 |
| Index of the current step in the protocol, decremented until it reaches 0. | |
Private Attributes | |
| MaxIDmsg< T > | lastSentMsg |
| The last MaxIDmsg sent. | |
| final int | nbrNeighbors |
| The number of neighbors of the agent. | |
| HashSet< String > | thisStepSenders |
| IDs of the agents from which we have received messages since the beginning of the current step. | |
| HashMap< String, T > | nextStepIDs = new HashMap<String, T> () |
| Messages belonging to the next step that have already been received. | |
| Queue | queue |
| The queue on which it should call sendMessage(). | |
| final String | comID |
| Communication ID. | |
| Collection< String > | neighbors |
| The neighbors of this agent. | |
| boolean | started = false |
| Whether this agent has already received the message that tells it to start the protocol. | |
| final AgentScoringHeuristic< T > | heuristic |
| The heuristic. | |
This distributed leader election protocol chooses a leader agent as the one with highest unique ID.
| <T> | the type used for agent IDs |
| frodo2.algorithms.varOrdering.election.LeaderElectionMaxID< T extends Comparable< T > &Serializable >.LeaderElectionMaxID | ( | String | comID, |
| T | myID, | ||
| Collection< String > | neighbors, | ||
| int | nbrSteps ) |
Constructor.
| comID | communication ID used to identify this agent as the sender of messages |
| myID | ID that uniquely identifies this agent |
| neighbors | the neighbors of this agent |
| nbrSteps | Number of steps the protocol should run before it terminates |
References comID, myID, nbrNeighbors, neighbors, and thisStepSenders.
Referenced by LeaderElectionMaxID().
| frodo2.algorithms.varOrdering.election.LeaderElectionMaxID< T extends Comparable< T > &Serializable >.LeaderElectionMaxID | ( | DCOPProblemInterface<?, ?> | problem, |
| Element | params ) |
Constructor.
| problem | the agent's subproblem |
| params | this module's parameters |
References LeaderElectionMaxID(), and nbrNeighbors.

|
protected |
References maxID.
| Collection< MessageType > frodo2.algorithms.varOrdering.election.LeaderElectionMaxID< T extends Comparable< T > &Serializable >.getMsgTypes | ( | ) |
Implements frodo2.communication.MessageListener< T >.
References LE_MSG_TYPE, and START_MSG_TYPE.
| void frodo2.algorithms.varOrdering.election.LeaderElectionMaxID< T extends Comparable< T > &Serializable >.notifyIn | ( | Message | msg | ) |
The actual algorithm.
The algorithm is triggered by the reception of a message of type either this.startMsgType or this.LEmsgType. At each step, the protocol computes the max of its ID and of the IDs in all received messages, and forwards it. After a specified number of steps, the algorithm terminates, and returns a message of type this.outputMsgType if its ID matches the last computed max ID (it is then the leader).
| msg | the message that was just received |
Implements frodo2.communication.IncomingMsgPolicyInterface< T >.
References frodo2.communication.MessageType.equals(), frodo2.algorithms.heuristics.AgentScoringHeuristic< S extends Comparable< S > &Serializable >.getScore(), notifyIn(), and START_MSG_TYPE.
Referenced by notifyIn().

| void frodo2.algorithms.varOrdering.election.LeaderElectionMaxID< T extends Comparable< T > &Serializable >.setQueue | ( | Queue | queue | ) |
|
private |
Communication ID.
This is used to identify the agent as the sender of messages. It can be different from myID.
Referenced by LeaderElectionMaxID().
|
private |
The heuristic.
|
private |
The last MaxIDmsg sent.
|
static |
The type of the messages used to carry agent IDs.
Referenced by getMsgTypes(), frodo2.algorithms.varOrdering.election.tests.LeaderElectionMaxIDTest< S extends Comparable< S > >.getMsgTypes(), frodo2.algorithms.varOrdering.election.tests.VarElectionMessengerTest.IdIncreasingVerifyer.getMsgTypes(), frodo2.algorithms.varOrdering.election.VariableElection< S extends Comparable< S > &Serializable >.getMsgTypes(), frodo2.algorithms.varOrdering.election.MaxIDmsg< T extends Comparable< T > &Serializable >.MaxIDmsg(), frodo2.algorithms.varOrdering.election.tests.VarElectionMessengerTest.IdIncreasingVerifyer.notifyIn(), frodo2.algorithms.varOrdering.election.MaxIDmsg< T extends Comparable< T > &Serializable >.readExternal(), and frodo2.algorithms.varOrdering.election.MaxIDmsg< T extends Comparable< T > &Serializable >.toString().
|
protected |
Current computed maximum ID.
Referenced by getMaxID().
|
protected |
This agent's ID.
Referenced by LeaderElectionMaxID().
|
private |
The number of neighbors of the agent.
Referenced by LeaderElectionMaxID(), and LeaderElectionMaxID().
|
private |
The neighbors of this agent.
Referenced by LeaderElectionMaxID().
|
private |
Messages belonging to the next step that have already been received.
Maps a sender ID to the maxID value it sent.
|
static |
The type of the output message.
Referenced by frodo2.algorithms.dpop.privacy.P2_DPOPsolver< V extends Addable< V >, U extends Addable< U > >.clear(), frodo2.algorithms.dpop.privacy.P3halves_DPOPsolver< V extends Addable< V > >.clear(), frodo2.algorithms.varOrdering.election.tests.LeaderElectionMaxIDTest< S extends Comparable< S > >.getMsgTypes(), frodo2.algorithms.varOrdering.election.tests.VariableElectionTest< S extends Comparable< S > &Serializable >.getMsgTypes(), frodo2.algorithms.varOrdering.linear.LinearOrdering< V extends Addable< V >, U extends Addable< U > >.getMsgTypes(), frodo2.algorithms.varOrdering.election.LeaderElectionMaxID< T extends Comparable< T > &Serializable >.MessageLEoutput< T extends Comparable< T > &Serializable >.MessageLEoutput(), frodo2.algorithms.varOrdering.election.tests.LeaderElectionMaxIDTest< S extends Comparable< S > >.notifyIn(), frodo2.algorithms.varOrdering.election.tests.VariableElectionTest< S extends Comparable< S > &Serializable >.notifyIn(), and frodo2.algorithms.varOrdering.linear.LinearOrdering< V extends Addable< V >, U extends Addable< U > >.notifyIn().
|
private |
The queue on which it should call sendMessage().
Referenced by setQueue().
|
static |
The type of the message used to tell the protocol to start.
Referenced by getMsgTypes(), notifyIn(), and frodo2.algorithms.varOrdering.election.tests.LeaderElectionMaxIDTest< S extends Comparable< S > >.testRandom().
|
private |
Whether this agent has already received the message that tells it to start the protocol.
|
protected |
Index of the current step in the protocol, decremented until it reaches 0.
|
private |
IDs of the agents from which we have received messages since the beginning of the current step.
Referenced by LeaderElectionMaxID().