54 #ifndef _GAMS_AUCTIONS_AUCTION_BASE_H_
55 #define _GAMS_AUCTIONS_AUCTION_BASE_H_
61 #include "madara/knowledge/KnowledgeBase.h"
62 #include "madara/knowledge/containers/Map.h"
88 const std::string & agent_prefix =
"",
89 madara::knowledge::KnowledgeBase * knowledge = 0);
112 virtual bool is_member(
const std::string & agent_prefix)
const;
122 virtual madara::knowledge::KnowledgeRecord
get_bid(
123 const std::string &
id);
142 madara::knowledge::KnowledgeBase * knowledge);
177 void bid(
const madara::knowledge::KnowledgeRecord & amount);
189 virtual void bid(
const std::string & agent,
190 const madara::knowledge::KnowledgeRecord & amount);
205 bool strip_prefix =
true,
206 bool include_all_members =
false)
const;
270 madara::knowledge::containers::Map
bids_;
280 #include "AuctionBase.inl"
Copyright(c) 2016 Carnegie Mellon University.
Copyright (c) 2016 Carnegie Mellon University.
Copyright(c) 2016 Carnegie Mellon University.
Copyright(c) 2016 Carnegie Mellon University.
Base class for an auction.
void set_round(int round)
Explicitly sets the round number.
virtual madara::knowledge::KnowledgeRecord get_bid(const std::string &id)
Checks if the agent is a member of the action participants.
virtual void bid(const std::string &agent, const madara::knowledge::KnowledgeRecord &amount)
Bids in the auction.
int round_
the auction round in a multi-round auction
virtual void set_agent_prefix(const std::string &prefix)
Sets the prefix for the current bidding agent.
virtual void reset_round(void)
Resets the round.
groups::GroupFixedList group_
the expected participant group
std::string agent_prefix_
self prefix of the agent
void bid(const madara::knowledge::KnowledgeRecord &amount)
Bids in the auction.
virtual double get_participation(void) const
Gets participation rate in the group for this round.
madara::knowledge::KnowledgeBase * knowledge_
The knowledge base to use as a data plane.
const std::string & get_agent_prefix(void) const
Gets the prefix for the current agent.
madara::knowledge::containers::Map bids_
convenience class for bids
virtual void set_auction_prefix(const std::string &prefix)
Sets the prefix for the auction in the knowledge base.
virtual ~AuctionBase()
Constructor.
virtual std::string get_leader(void)=0
Returns the leader of the bidding process.
virtual bool is_member(const std::string &agent_prefix) const
Checks if the agent is a member of the action participants.
int get_round(void) const
Retrieves the round number, usually in a multi-round auction.
const std::string & get_auction_prefix(void) const
Gets the prefix for the auction in the knowledge base.
virtual void advance_round(void)
Proceeds to the next auction round in a multi-round auction.
virtual void clear_group(void)
Clears the underlying auction participants group.
virtual void sync(void)
Syncs the auction information from the knowledge base.
std::string get_auction_round_prefix(void) const
Returns the full auction prefix string, including round.
std::string auction_prefix_
the prefix for the auction
virtual void add_group(groups::GroupBase *group)
Adds a group of auction participants.
AuctionBase(const std::string &auction_prefix="", const std::string &agent_prefix="", madara::knowledge::KnowledgeBase *knowledge=0)
Constructor.
virtual void set_knowledge_base(madara::knowledge::KnowledgeBase *knowledge)
Sets the knowledge base.
virtual void get_bids(AuctionBids &bids, bool strip_prefix=true, bool include_all_members=false) const
Returns the list of bids in this round.
void reset_bids_pointer(void)
calls a reset on the bids_ location in the knowledge base using auction_prefix_ + "....
Base class for a group of agents.
A fixed list of agent members.
std::vector< AuctionBid > AuctionBids
convenience typedef for vector fo AuctionBid
Contains all GAMS-related tools, classes and code.