1#ifndef CYCLUS_SRC_BID_PORTFOLIO_H_
2#define CYCLUS_SRC_BID_PORTFOLIO_H_
8#include <boost/shared_ptr.hpp>
32class BidPortfolio :
public boost::enable_shared_from_this<BidPortfolio<T>> {
34 typedef boost::shared_ptr<BidPortfolio<T>>
Ptr;
41 typename std::set<Bid<T>*>::iterator
it;
42 for (
it = bids_.begin();
it != bids_.end(); ++
it) {
59 exclusive, preference);
61 if (offer->quantity() > 0)
66 <<
" is offering a bid quantity <= 0, Q = " << offer->quantity();
82 std::numeric_limits<double>::quiet_NaN());
88 constraints_.insert(
c);
99 inline const std::set<Bid<T>*>&
bids()
const {
return bids_; }
102 inline const std::set<CapacityConstraint<T>>&
constraints()
const {
110 bidder_ =
rhs.bidder_;
112 constraints_ =
rhs.constraints_;
113 typename std::set<Bid<T>*>::iterator
it;
114 for (
it = bids_.begin();
it != bids_.end(); ++
it) {
124 void VerifyResponder_(
Bid<T>* b) {
125 if (bidder_ ==
NULL) {
126 bidder_ =
b->bidder();
127 }
else if (bidder_ !=
b->bidder()) {
128 std::string msg =
"Insertion error: bidders do not match.";
134 void VerifyCommodity_(
const Bid<T>*
r) {}
138 std::set<Bid<T>*> bids_;
141 std::set<CapacityConstraint<T>> constraints_;
A BidPortfolio is a collection of bids as responses to requests for resources and associated constrai...
const std::set< CapacityConstraint< T > > & constraints() const
std::string commodity() const
void AddConstraint(const CapacityConstraint< T > &c)
add a capacity constraint associated with the portfolio
~BidPortfolio()
deletes all bids associated with it
Bid< T > * AddBid(Request< T > *request, boost::shared_ptr< T > offer, Trader *bidder, bool exclusive=false)
add a bid to the portfolio
Bid< T > * AddBid(Request< T > *request, boost::shared_ptr< T > offer, Trader *bidder, bool exclusive, double preference)
add a bid to the portfolio
const std::set< Bid< T > * > & bids() const
boost::shared_ptr< BidPortfolio< T > > Ptr
BidPortfolio()
default constructor
A Bid encapsulates all the information required to communicate a bid response to a request for a reso...
static Bid< T > * Create(Request< T > *request, boost::shared_ptr< T > offer, Trader *bidder, typename BidPortfolio< T >::Ptr portfolio, bool exclusive, double preference)
a factory method for a bid
A CapacityConstraint provides an ability to determine an agent's constraints on resource allocation g...
A Request encapsulates all the information required to communicate the needs of an agent in the Dynam...
A simple API for agents that wish to exchange resources in the simulation.
For values that are too big, too small, etc.
taken directly from OsiSolverInterface.cpp on 2/17/14 from https://projects.coin-or....
std::string GetTraderSpec(Trader *bidder)
T OptionalQuery(InfileTree *tree, std::string query, T default_val)
a query method for optional parameters
std::string GetTraderPrototype(Trader *bidder)
double b(int nuc)
Computes the scattering length [cm] from the coherent and incoherent components.