GAMS  1.2.2
AuctionBase.h
Go to the documentation of this file.
1 
54 #ifndef _GAMS_AUCTIONS_AUCTION_BASE_H_
55 #define _GAMS_AUCTIONS_AUCTION_BASE_H_
56 
57 #include <vector>
58 #include <string>
59 #include <map>
60 
61 #include "madara/knowledge/KnowledgeBase.h"
62 #include "madara/knowledge/containers/Map.h"
63 
64 #include "AuctionTypesEnum.h"
65 #include "gams/groups/GroupBase.h"
67 #include "gams/GamsExport.h"
68 
70 
71 namespace gams
72 {
73  namespace auctions
74  {
79  {
80  public:
87  AuctionBase (const std::string & auction_prefix = "",
88  const std::string & agent_prefix = "",
89  madara::knowledge::KnowledgeBase * knowledge = 0);
90 
94  virtual ~AuctionBase ();
95 
100  virtual void add_group (groups::GroupBase * group);
101 
105  virtual void clear_group (void);
106 
112  virtual bool is_member (const std::string & agent_prefix) const;
113 
122  virtual madara::knowledge::KnowledgeRecord get_bid (
123  const std::string & id);
124 
129  virtual void set_agent_prefix (const std::string & prefix);
130 
135  virtual void set_auction_prefix (const std::string & prefix);
136 
141  virtual void set_knowledge_base (
142  madara::knowledge::KnowledgeBase * knowledge);
143 
147  virtual void sync (void);
148 
153  const std::string & get_agent_prefix (void) const;
154 
159  const std::string & get_auction_prefix (void) const;
160 
165  virtual double get_participation (void) const;
166 
177  void bid (const madara::knowledge::KnowledgeRecord & amount);
178 
189  virtual void bid (const std::string & agent,
190  const madara::knowledge::KnowledgeRecord & amount);
191 
196  virtual std::string get_leader (void) = 0;
197 
204  virtual void get_bids (AuctionBids & bids,
205  bool strip_prefix = true,
206  bool include_all_members = false) const;
207 
212  virtual void advance_round (void);
213 
218  int get_round (void) const;
219 
223  virtual void reset_round (void);
224 
230  void set_round (int round);
231 
237  std::string get_auction_round_prefix (void) const;
238 
239  protected:
240 
245  void reset_bids_pointer (void);
246 
250  mutable madara::knowledge::KnowledgeBase * knowledge_;
251 
255  std::string auction_prefix_;
256 
260  std::string agent_prefix_;
261 
265  int round_;
266 
270  madara::knowledge::containers::Map bids_;
271 
276  };
277  }
278 }
279 
280 #include "AuctionBase.inl"
281 
282 #endif // _GAMS_AUCTIONS_AUCTION_BASE_H_
A fixed list of agent members.
Copyright (c) 2016 Carnegie Mellon University.
std::string auction_prefix_
the prefix for the auction
Definition: AuctionBase.h:255
Base class for an auction.
Definition: AuctionBase.h:78
int round_
the auction round in a multi-round auction
Definition: AuctionBase.h:265
madara::knowledge::containers::Map bids_
convenience class for bids
Definition: AuctionBase.h:270
Copyright (c) 2016 Carnegie Mellon University.
Contains all GAMS-related tools, classes and code.
Base class for a group of agents.
Definition: GroupBase.h:90
groups::GroupFixedList group_
the expected participant group
Definition: AuctionBase.h:275
#define GAMS_EXPORT
Definition: GamsExport.h:20
madara::knowledge::KnowledgeBase * knowledge_
The knowledge base to use as a data plane.
Definition: AuctionBase.h:250
Copyright (c) 2016 Carnegie Mellon University.
std::vector< AuctionBid > AuctionBids
convenience typedef for vector fo AuctionBid
Definition: AuctionBid.h:126
Copyright (c) 2016 Carnegie Mellon University.
std::string agent_prefix_
self prefix of the agent
Definition: AuctionBase.h:260