An election that implements plurality voting (NOT IMPLEMENTED)
More...
#include <ElectionPlurality.h>
|
| void | reset_votes_pointer (void) |
| | calls a reset on the votes_ location in the knowledge base using election_prefix_ + "." + round_. More...
|
| |
An election that implements plurality voting (NOT IMPLEMENTED)
Definition at line 73 of file ElectionPlurality.h.
| gams::elections::ElectionPlurality::ElectionPlurality |
( |
const std::string & |
election_prefix = "", |
|
|
const std::string & |
agent_prefix = "", |
|
|
madara::knowledge::KnowledgeBase * |
knowledge = 0 |
|
) |
| |
Constructor.
- Parameters
-
| election_prefix | the name of the election (e.g. election.leader) |
| agent_prefix | the name of this bidder (e.g. agent.0) |
| knowledge | the knowledge base to use for syncing |
| virtual gams::elections::ElectionPlurality::~ElectionPlurality |
( |
| ) |
|
|
virtual |
| virtual void gams::elections::ElectionBase::advance_round |
( |
void |
| ) |
|
|
virtualinherited |
Proceeds to the next election round in a multi-round election.
| const std::string& gams::elections::ElectionBase::get_agent_prefix |
( |
void |
| ) |
const |
|
inherited |
Gets the prefix for the current agent.
- Returns
- the name of this bidding agent (e.g. agent.0)
| const std::string& gams::elections::ElectionBase::get_election_prefix |
( |
void |
| ) |
const |
|
inherited |
Gets the prefix for the election in the knowledge base.
- Returns
- the name of the election (e.g. election.protectors)
| std::string gams::elections::ElectionPlurality::get_leader |
( |
void |
| ) |
|
Returns the leader of the voting.
| virtual CandidateList gams::elections::ElectionPlurality::get_leaders |
( |
int |
num_leaders = 1 | ) |
|
|
virtual |
Returns the leaders of the election in order of popularity or whatever conditions constitute winning the election.
- Parameters
-
| num_leaders | maximum leaders to return |
- Returns
- the leaders of the election up to num_leaders
Implements gams::elections::ElectionBase.
| int gams::elections::ElectionBase::get_round |
( |
void |
| ) |
const |
|
inherited |
Retrieves the round number, usually in a multi-round election.
- Returns
- the agent prefix of the leader of the election
| virtual void gams::elections::ElectionBase::get_votes |
( |
CandidateVotes & |
results | ) |
|
|
virtualinherited |
Gets the votes cast in the election.
- Parameters
-
| results | the results of the vote |
Gets the votes cast in the election by a specific group of agents.
- Parameters
-
| group | the group that is of interest |
| results | the results of the vote |
| virtual bool gams::elections::ElectionBase::has_voted |
( |
const std::string & |
agent_prefix | ) |
|
|
virtualinherited |
Checks if the agent has voted in this round.
- Parameters
-
| agent_prefix | the participating agent's prefix (e.g. agent.0) |
- Returns
- true if the agent is a member of the election
| virtual void gams::elections::ElectionBase::reset_round |
( |
void |
| ) |
|
|
virtualinherited |
Resets the round.
- Returns
- the agent prefix of the leader of the election
| void gams::elections::ElectionBase::reset_votes_pointer |
( |
void |
| ) |
|
|
protectedinherited |
calls a reset on the votes_ location in the knowledge base using election_prefix_ + "." + round_.
| virtual void gams::elections::ElectionBase::set_agent_prefix |
( |
const std::string & |
prefix | ) |
|
|
virtualinherited |
Sets the prefix for the current bidding agent.
- Parameters
-
| prefix | the name of the agent (e.g. agent.0) |
| virtual void gams::elections::ElectionBase::set_election_prefix |
( |
const std::string & |
prefix | ) |
|
|
virtualinherited |
Sets the prefix for the election in the knowledge base.
- Parameters
-
| prefix | the name of the election (e.g. election.protectors) |
| virtual void gams::elections::ElectionBase::set_knowledge_base |
( |
madara::knowledge::KnowledgeBase * |
knowledge | ) |
|
|
virtualinherited |
Sets the knowledge base.
- Parameters
-
| knowledge | the knowledge base to use for syncing |
| virtual void gams::elections::ElectionBase::sync |
( |
void |
| ) |
|
|
virtualinherited |
Syncs the election information from the knowledge base.
| void gams::elections::ElectionBase::vote |
( |
const std::string & |
candidate, |
|
|
int |
votes = 1 |
|
) |
| |
|
inherited |
Votes in the election.
Uses the agent prefix that has been set in this Election as the voter id.
- Parameters
-
| candidate | the candidate receiving votes |
| votes | the number of votes cast |
| virtual void gams::elections::ElectionBase::vote |
( |
const std::string & |
agent, |
|
|
const std::string & |
candidate, |
|
|
int |
votes = 1 |
|
) |
| |
|
virtualinherited |
Bids in the election.
- Parameters
-
| agent | the agent prefix who is bidding |
| candidate | the candidate receiving votes |
| votes | the number of votes cast |
| std::string gams::elections::ElectionBase::agent_prefix_ |
|
protectedinherited |
| std::string gams::elections::ElectionBase::election_prefix_ |
|
protectedinherited |
| madara::knowledge::KnowledgeBase* gams::elections::ElectionBase::knowledge_ |
|
mutableprotectedinherited |
The knowledge base to use as a data plane.
Definition at line 211 of file ElectionBase.h.
| int gams::elections::ElectionBase::round_ |
|
protectedinherited |
the election round in a multi-round election
Definition at line 226 of file ElectionBase.h.
| madara::knowledge::containers::Map gams::elections::ElectionBase::votes_ |
|
protectedinherited |
The documentation for this class was generated from the following file: