1 #ifndef CYCLUS_SRC_EXCHANGE_CONTEXT_H_ 2 #define CYCLUS_SRC_EXCHANGE_CONTEXT_H_ 26 typedef std::map<Request<T>*, std::map<Bid<T>*,
double> >
type;
33 typedef std::map<std::string, std::vector<Request<T>*> >
type;
54 requests.push_back(port);
55 const std::vector<Request<T>*>& vr = port->
requests();
56 typename std::vector<Request<T>*>::const_iterator it;
58 for (it = vr.begin(); it != vr.end(); ++it) {
68 commod_requests[pr->
commodity()].push_back(pr);
74 const std::set<Bid<T>*>& vr = port->
bids();
75 typename std::set<Bid<T>*>::const_iterator it;
77 for (it = vr.begin(); it != vr.end(); ++it) {
87 assert(pb->
bidder() != NULL);
88 bidders.insert(pb->
bidder());
90 bids_by_request[pb->
request()].push_back(pb);
94 std::make_pair(pb,
std::isnan(bid_pref) ? pb->
request()->preference() : bid_pref));
98 std::vector<typename RequestPortfolio<T>::Ptr>
requests;
101 std::vector<typename BidPortfolio<T>::Ptr>
bids;
113 std::map< Request<T>*, std::vector<Bid<T>*> >
122 #endif // CYCLUS_SRC_EXCHANGE_CONTEXT_H_ std::map< Trader *, typename PrefMap< T >::type > trader_prefs
maps commodity name to requests for that commodity
std::map< std::string, std::vector< Request< T > * > > type
boost::shared_ptr< BidPortfolio< T > > Ptr
std::string commodity() const
Request< T > * request_ptr
std::vector< typename RequestPortfolio< T >::Ptr > requests
a reference to an exchange's set of requests
boost::shared_ptr< RequestPortfolio< T > > Ptr
The ExchangeContext is designed to provide an ease-of-use interface for querying and reaggregating in...
CommodMap< T >::type commod_requests
maps commodity name to requests for that commodity
const std::vector< Request< T > * > & requests() const
void AddRequest(Request< T > *pr)
Adds an individual request.
std::map< Request< T > *, std::map< Bid< T > *, double > > type
void AddRequest(ExchangeTranslationContext< T > &translation_ctx, Request< T > *r, ExchangeNode::Ptr n)
Adds a request-node mapping.
std::vector< typename BidPortfolio< T >::Ptr > bids
a reference to an exchange's set of bids
A Bid encapsulates all the information required to communicate a bid response to a request for a reso...
std::set< Trader * > bidders
known bidders
Request< T > * request_ptr
void AddBid(ExchangeTranslationContext< T > &translation_ctx, Bid< T > *b, ExchangeNode::Ptr n)
Adds a bid-node mapping.
Trader * requester() const
std::set< Trader * > requesters
known requesters
void AddRequestPortfolio(const typename RequestPortfolio< T >::Ptr port)
adds a request to the context
const std::set< Bid< T > * > & bids() const
taken directly from OsiSolverInterface.cpp on 2/17/14 from https://projects.coin-or.org/Osi/browser/trunk.
void AddBid(Bid< T > *pb)
adds a bid to the appropriate containers, default trade preference between request and bid is set ...
Request< T > * request() const
std::map< Request< T > *, std::vector< Bid< T > * > > bids_by_request
maps request to all bids for request
double preference() const
void AddBidPortfolio(const typename BidPortfolio< T >::Ptr port)
adds a bid to the context
A Request encapsulates all the information required to communicate the needs of an agent in the Dynam...