1 #ifndef CYCLUS_SRC_REQUEST_H_ 2 #define CYCLUS_SRC_REQUEST_H_ 8 #include <boost/shared_ptr.hpp> 9 #include <boost/weak_ptr.hpp> 97 inline boost::shared_ptr<T>
target()
const {
return target_; }
110 return portfolio_.lock();
124 requester_(requester),
125 commodity_(commodity),
126 preference_(preference),
127 exclusive_(exclusive),
128 cost_function_(cost_function) {}
132 std::string commodity =
"",
double preference = kDefaultPref,
133 bool exclusive =
false)
135 requester_(requester),
136 commodity_(commodity),
137 preference_(preference),
138 exclusive_(exclusive),
139 cost_function_(NULL) {}
145 requester_(requester),
146 commodity_(commodity),
147 preference_(preference),
148 portfolio_(portfolio),
149 exclusive_(exclusive),
150 cost_function_(cost_function) {}
154 std::string commodity =
"",
double preference = kDefaultPref,
155 bool exclusive =
false)
157 requester_(requester),
158 commodity_(commodity),
159 preference_(preference),
160 portfolio_(portfolio),
161 exclusive_(exclusive),
162 cost_function_(NULL) {}
164 boost::shared_ptr<T> target_;
168 boost::weak_ptr<RequestPortfolio<T>> portfolio_;
175 #endif // CYCLUS_SRC_REQUEST_H_ std::string commodity() const
static const double kDefaultPref
Default preference values are unity.
boost::shared_ptr< T > target() const
boost::shared_ptr< RequestPortfolio< T > > Ptr
std::function< double(boost::shared_ptr< T >)> cost_function_t
static Request< T > * Create(boost::shared_ptr< T > target, Trader *requester, typename RequestPortfolio< T >::Ptr portfolio, std::string commodity, double preference, bool exclusive, cost_function_t cost_function)
a factory method for a request
A simple API for agents that wish to exchange resources in the simulation.
cost_function_t cost_function() const
static Request< T > * Create(boost::shared_ptr< T > target, Trader *requester, typename RequestPortfolio< T >::Ptr portfolio, std::string commodity="", double preference=kDefaultPref, bool exclusive=false)
a factory method for a request
static Request< T > * Create(boost::shared_ptr< T > target, Trader *requester, std::string commodity="", double preference=kDefaultPref, bool exclusive=false)
a factory method for a bid for a bid without a portfolio
double preference() const
Trader * requester() const
static Request< T > * Create(boost::shared_ptr< T > target, Trader *requester, std::string commodity, double preference, bool exclusive, cost_function_t cost_function)
a factory method for a bid for a bid without a portfolio
RequestPortfolio< T >::Ptr portfolio() const
taken directly from OsiSolverInterface.cpp on 2/17/14 from https://projects.coin-or.org/Osi/browser/trunk.
A Request encapsulates all the information required to communicate the needs of an agent in the Dynam...
A RequestPortfolio is a group of (possibly constrainted) requests for resources.