GAMS  1.4.0
gams::auctions::AuctionMinimumDistance Class Reference

An auction where the winner is the closest agent to a location. More...

#include <AuctionMinimumDistance.h>

Inheritance diagram for gams::auctions::AuctionMinimumDistance:
gams::auctions::AuctionBase

Public Member Functions

 AuctionMinimumDistance (const std::string &auction_prefix="", const std::string &agent_prefix="", madara::knowledge::KnowledgeBase *knowledge=0, platforms::BasePlatform *platform=0)
 Constructor. More...
 
virtual ~AuctionMinimumDistance ()
 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...
 
void calculate_bids (void)
 Calculate bids using current agent locations. 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)
 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_platform (platforms::BasePlatform *platform)
 Sets the platform whose frame we are referencing. More...
 
void set_round (int round)
 Explicitly sets the round number. More...
 
void set_target (pose::Position target)
 Sets the target of the distance calculations. More...
 
void set_target (utility::GPSPosition target)
 Sets the target of the distance calculations. 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...
 
platforms::BasePlatformplatform_
 The platform is necessary to construct poses(we need frame) More...
 
int round_
 the auction round in a multi-round auction More...
 
pose::Position target_
 The location that distance will be calculated to. More...
 

Detailed Description

An auction where the winner is the closest agent to a location.

Definition at line 77 of file AuctionMinimumDistance.h.

Constructor & Destructor Documentation

◆ AuctionMinimumDistance()

gams::auctions::AuctionMinimumDistance::AuctionMinimumDistance ( const std::string &  auction_prefix = "",
const std::string &  agent_prefix = "",
madara::knowledge::KnowledgeBase *  knowledge = 0,
platforms::BasePlatform platform = 0 
)

Constructor.

Parameters
auction_prefixthe name of the auction(e.g. auction.position)
agent_prefixthe name of this bidder(e.g. agent.0)
knowledgethe knowledge base to use for syncing
platformthe platform that contains a frame of reference

◆ ~AuctionMinimumDistance()

virtual gams::auctions::AuctionMinimumDistance::~AuctionMinimumDistance ( )
virtual

Constructor.

Member Function Documentation

◆ add_group()

virtual void gams::auctions::AuctionBase::add_group ( groups::GroupBase group)
virtualinherited

Adds a group of auction participants.

Parameters
groupa group of bidders joining the auction

◆ advance_round()

virtual void gams::auctions::AuctionBase::advance_round ( void  )
virtualinherited

Proceeds to the next auction round in a multi-round auction.

◆ bid() [1/2]

void gams::auctions::AuctionBase::bid ( const madara::knowledge::KnowledgeRecord &  amount)
inherited

Bids in the auction.

Uses the agent prefix that has been set in this Auction as the bidder id.

Parameters
amountbidded 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.

◆ bid() [2/2]

virtual void gams::auctions::AuctionBase::bid ( const std::string &  agent,
const madara::knowledge::KnowledgeRecord &  amount 
)
virtualinherited

Bids in the auction.

Parameters
agentthe agent prefix who is bidding
amountbidded 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.

◆ calculate_bids()

void gams::auctions::AuctionMinimumDistance::calculate_bids ( void  )

Calculate bids using current agent locations.

◆ clear_group()

virtual void gams::auctions::AuctionBase::clear_group ( void  )
virtualinherited

Clears the underlying auction participants group.

◆ get_agent_prefix()

const std::string& gams::auctions::AuctionBase::get_agent_prefix ( void  ) const
inherited

Gets the prefix for the current agent.

Returns
the name of this bidding agent(e.g. agent.0)

◆ get_auction_prefix()

const std::string& gams::auctions::AuctionBase::get_auction_prefix ( void  ) const
inherited

Gets the prefix for the auction in the knowledge base.

Returns
the name of the auction(e.g. auction.protectors)

◆ get_auction_round_prefix()

std::string gams::auctions::AuctionBase::get_auction_round_prefix ( void  ) const
inherited

Returns the full auction prefix string, including round.

Returns
the actual prefix in the knowledge base corresponding to the current round of this auction

◆ get_bid()

virtual madara::knowledge::KnowledgeRecord gams::auctions::AuctionBase::get_bid ( const std::string &  id)
virtualinherited

Checks if the agent is a member of the action participants.

Parameters
idthe agent id(e.g. agent.0 or agent.leader). If null, uses the current agent's id
Returns
the bid of the agent. KnowledgeRecord is false/invalid if no bid has been made or if the agent is not actually an auction participant.

◆ get_bids()

virtual void gams::auctions::AuctionBase::get_bids ( AuctionBids bids,
bool  strip_prefix = true,
bool  include_all_members = false 
) const
virtualinherited

Returns the list of bids in this round.

Parameters
bidsthe map of bidders to bid amount
strip_prefixif true, strips auction prefix from bidder
include_all_membersif true, includes empty bids from

◆ get_leader()

virtual std::string gams::auctions::AuctionMinimumDistance::get_leader ( void  )
virtual

Returns the leader of the bidding process.

Returns
the agent prefix of the leader of the auction

Implements gams::auctions::AuctionBase.

◆ get_participation()

virtual double gams::auctions::AuctionBase::get_participation ( void  ) const
virtualinherited

Gets participation rate in the group for this round.

Returns
the percentage of participation(0.0-1.0)

◆ get_round()

int gams::auctions::AuctionBase::get_round ( void  ) const
inherited

Retrieves the round number, usually in a multi-round auction.

Returns
the agent prefix of the leader of the auction

◆ is_member()

virtual bool gams::auctions::AuctionBase::is_member ( const std::string &  agent_prefix) const
virtualinherited

Checks if the agent is a member of the action participants.

Parameters
agent_prefixthe participating agent's prefix(e.g. agent.0)
Returns
true if the agent is a member of the auction

◆ reset_bids_pointer()

void gams::auctions::AuctionBase::reset_bids_pointer ( void  )
protectedinherited

calls a reset on the bids_ location in the knowledge base using auction_prefix_ + "." + round_.

◆ reset_round()

virtual void gams::auctions::AuctionBase::reset_round ( void  )
virtualinherited

Resets the round.

◆ set_agent_prefix()

virtual void gams::auctions::AuctionBase::set_agent_prefix ( const std::string &  prefix)
virtualinherited

Sets the prefix for the current bidding agent.

Parameters
prefixthe name of the agent(e.g. agent.0)

◆ set_auction_prefix()

virtual void gams::auctions::AuctionBase::set_auction_prefix ( const std::string &  prefix)
virtualinherited

Sets the prefix for the auction in the knowledge base.

Parameters
prefixthe name of the auction(e.g. auction.protectors)

◆ set_knowledge_base()

virtual void gams::auctions::AuctionBase::set_knowledge_base ( madara::knowledge::KnowledgeBase *  knowledge)
virtualinherited

Sets the knowledge base.

Parameters
knowledgethe knowledge base to use for syncing

◆ set_platform()

void gams::auctions::AuctionMinimumDistance::set_platform ( platforms::BasePlatform platform)

Sets the platform whose frame we are referencing.

Parameters
platformthe hardware platform with the positioning frame

◆ set_round()

void gams::auctions::AuctionBase::set_round ( int  round)
inherited

Explicitly sets the round number.

Should only be used by advanced users

Parameters
roundthe round number for the auction

◆ set_target() [1/2]

void gams::auctions::AuctionMinimumDistance::set_target ( pose::Position  target)

Sets the target of the distance calculations.

Parameters
targetthe location that distance references are made to

◆ set_target() [2/2]

void gams::auctions::AuctionMinimumDistance::set_target ( utility::GPSPosition  target)

Sets the target of the distance calculations.

Parameters
targetthe GPSPosition that distance references are made to

◆ sync()

virtual void gams::auctions::AuctionBase::sync ( void  )
virtualinherited

Syncs the auction information from the knowledge base.

Member Data Documentation

◆ agent_prefix_

std::string gams::auctions::AuctionBase::agent_prefix_
protectedinherited

self prefix of the agent

Definition at line 260 of file AuctionBase.h.

◆ auction_prefix_

std::string gams::auctions::AuctionBase::auction_prefix_
protectedinherited

the prefix for the auction

Definition at line 255 of file AuctionBase.h.

◆ bids_

madara::knowledge::containers::Map gams::auctions::AuctionBase::bids_
protectedinherited

convenience class for bids

Definition at line 270 of file AuctionBase.h.

◆ group_

groups::GroupFixedList gams::auctions::AuctionBase::group_
protectedinherited

the expected participant group

Definition at line 275 of file AuctionBase.h.

◆ knowledge_

madara::knowledge::KnowledgeBase* gams::auctions::AuctionBase::knowledge_
mutableprotectedinherited

The knowledge base to use as a data plane.

Definition at line 250 of file AuctionBase.h.

◆ platform_

platforms::BasePlatform* gams::auctions::AuctionMinimumDistance::platform_
protected

The platform is necessary to construct poses(we need frame)

Definition at line 136 of file AuctionMinimumDistance.h.

◆ round_

int gams::auctions::AuctionBase::round_
protectedinherited

the auction round in a multi-round auction

Definition at line 265 of file AuctionBase.h.

◆ target_

pose::Position gams::auctions::AuctionMinimumDistance::target_
protected

The location that distance will be calculated to.

Definition at line 131 of file AuctionMinimumDistance.h.


The documentation for this class was generated from the following file: