GAMS
1.4.0
|
Base class for an auction. More...
#include <AuctionBase.h>
Public Member Functions | |
AuctionBase (const std::string &auction_prefix="", const std::string &agent_prefix="", madara::knowledge::KnowledgeBase *knowledge=0) | |
Constructor. More... | |
virtual | ~AuctionBase () |
Constructor. More... | |
virtual void | add_group (groups::GroupBase *group) |
Adds a group of auction participants. More... | |
virtual void | advance_round (void) |
Proceeds to the next auction round in a multi-round auction. More... | |
void | bid (const madara::knowledge::KnowledgeRecord &amount) |
Bids in the auction. More... | |
virtual void | bid (const std::string &agent, const madara::knowledge::KnowledgeRecord &amount) |
Bids in the auction. More... | |
virtual void | clear_group (void) |
Clears the underlying auction participants group. More... | |
const std::string & | get_agent_prefix (void) const |
Gets the prefix for the current agent. More... | |
const std::string & | get_auction_prefix (void) const |
Gets the prefix for the auction in the knowledge base. More... | |
std::string | get_auction_round_prefix (void) const |
Returns the full auction prefix string, including round. More... | |
virtual madara::knowledge::KnowledgeRecord | get_bid (const std::string &id) |
Checks if the agent is a member of the action participants. More... | |
virtual void | get_bids (AuctionBids &bids, bool strip_prefix=true, bool include_all_members=false) const |
Returns the list of bids in this round. More... | |
virtual std::string | get_leader (void)=0 |
Returns the leader of the bidding process. More... | |
virtual double | get_participation (void) const |
Gets participation rate in the group for this round. More... | |
int | get_round (void) const |
Retrieves the round number, usually in a multi-round auction. More... | |
virtual bool | is_member (const std::string &agent_prefix) const |
Checks if the agent is a member of the action participants. More... | |
virtual void | reset_round (void) |
Resets the round. More... | |
virtual void | set_agent_prefix (const std::string &prefix) |
Sets the prefix for the current bidding agent. More... | |
virtual void | set_auction_prefix (const std::string &prefix) |
Sets the prefix for the auction in the knowledge base. More... | |
virtual void | set_knowledge_base (madara::knowledge::KnowledgeBase *knowledge) |
Sets the knowledge base. More... | |
void | set_round (int round) |
Explicitly sets the round number. More... | |
virtual void | sync (void) |
Syncs the auction information from the knowledge base. More... | |
Protected Member Functions | |
void | reset_bids_pointer (void) |
calls a reset on the bids_ location in the knowledge base using auction_prefix_ + "." + round_. More... | |
Protected Attributes | |
std::string | agent_prefix_ |
self prefix of the agent More... | |
std::string | auction_prefix_ |
the prefix for the auction More... | |
madara::knowledge::containers::Map | bids_ |
convenience class for bids More... | |
groups::GroupFixedList | group_ |
the expected participant group More... | |
madara::knowledge::KnowledgeBase * | knowledge_ |
The knowledge base to use as a data plane. More... | |
int | round_ |
the auction round in a multi-round auction More... | |
Base class for an auction.
Definition at line 78 of file AuctionBase.h.
gams::auctions::AuctionBase::AuctionBase | ( | const std::string & | auction_prefix = "" , |
const std::string & | agent_prefix = "" , |
||
madara::knowledge::KnowledgeBase * | knowledge = 0 |
||
) |
Constructor.
auction_prefix | the name of the auction(e.g. auction.position) |
agent_prefix | the name of this bidder(e.g. agent.0) |
knowledge | the knowledge base to use for syncing |
|
virtual |
Constructor.
|
virtual |
Adds a group of auction participants.
group | a group of bidders joining the auction |
|
virtual |
Proceeds to the next auction round in a multi-round auction.
void gams::auctions::AuctionBase::bid | ( | const madara::knowledge::KnowledgeRecord & | amount | ) |
Bids in the auction.
Uses the agent prefix that has been set in this Auction as the bidder id.
amount | bidded amount. This is a very flexible amount that allows for almost any type of MADARA data type. Most auctions will probably use doubles and ints though. This does allow for exotic auctions such as parseable strings though that might be a constraint or a structured bid. |
|
virtual |
Bids in the auction.
agent | the agent prefix who is bidding |
amount | bidded amount. This is a very flexible amount that allows for almost any type of MADARA data type. Most auctions will probably use doubles and ints though. This does allow for exotic auctions such as parseable strings though that might be a constraint or a structured bid. |
|
virtual |
Clears the underlying auction participants group.
const std::string& gams::auctions::AuctionBase::get_agent_prefix | ( | void | ) | const |
Gets the prefix for the current agent.
const std::string& gams::auctions::AuctionBase::get_auction_prefix | ( | void | ) | const |
Gets the prefix for the auction in the knowledge base.
std::string gams::auctions::AuctionBase::get_auction_round_prefix | ( | void | ) | const |
Returns the full auction prefix string, including round.
|
virtual |
Checks if the agent is a member of the action participants.
id | the agent id(e.g. agent.0 or agent.leader). If null, uses the current agent's id |
|
virtual |
Returns the list of bids in this round.
bids | the map of bidders to bid amount |
strip_prefix | if true, strips auction prefix from bidder |
include_all_members | if true, includes empty bids from |
|
pure virtual |
Returns the leader of the bidding process.
Implemented in gams::auctions::AuctionMinimumDistance, gams::auctions::AuctionMinimumBid, and gams::auctions::AuctionMaximumBid.
|
virtual |
Gets participation rate in the group for this round.
int gams::auctions::AuctionBase::get_round | ( | void | ) | const |
Retrieves the round number, usually in a multi-round auction.
|
virtual |
Checks if the agent is a member of the action participants.
agent_prefix | the participating agent's prefix(e.g. agent.0) |
|
protected |
calls a reset on the bids_ location in the knowledge base using auction_prefix_ + "." + round_.
|
virtual |
Resets the round.
|
virtual |
Sets the prefix for the current bidding agent.
prefix | the name of the agent(e.g. agent.0) |
|
virtual |
Sets the prefix for the auction in the knowledge base.
prefix | the name of the auction(e.g. auction.protectors) |
|
virtual |
Sets the knowledge base.
knowledge | the knowledge base to use for syncing |
void gams::auctions::AuctionBase::set_round | ( | int | round | ) |
Explicitly sets the round number.
Should only be used by advanced users
round | the round number for the auction |
|
virtual |
Syncs the auction information from the knowledge base.
|
protected |
self prefix of the agent
Definition at line 260 of file AuctionBase.h.
|
protected |
the prefix for the auction
Definition at line 255 of file AuctionBase.h.
|
protected |
convenience class for bids
Definition at line 270 of file AuctionBase.h.
|
protected |
the expected participant group
Definition at line 275 of file AuctionBase.h.
|
mutableprotected |
The knowledge base to use as a data plane.
Definition at line 250 of file AuctionBase.h.
|
protected |
the auction round in a multi-round auction
Definition at line 265 of file AuctionBase.h.