1#ifndef CYCLUS_SRC_TOOLKIT_MATL_BUY_POLICY_H_
2#define CYCLUS_SRC_TOOLKIT_MATL_BUY_POLICY_H_
5#include <boost/shared_ptr.hpp>
173 return std::min({throughput_,
174 fill_to_ - buf_->quantity(),
176 buf_tracker_->space()});
180 inline bool MakeReq()
const {
return buf_tracker_->quantity() <= req_at_; }
183 inline bool Excl()
const {
return quantize_ > 0; }
188 return Excl() ? quantize_ : amt;
192 inline int NReq(
double amt)
const {
193 return Excl() ?
static_cast<int>(amt / quantize_) : 1;
200 return rsrc_commods_;
204 return (next_dormant_end_ < 0 || next_active_end_ < 0);
208 return (time >= next_active_end_ && time < next_dormant_end_);
226 struct CommodDetail {
231 void set_manager(
Agent* m);
233 void set_inv_policy(std::string
p,
double x,
234 double y = std::numeric_limits<double>::max());
236 void set_fill_to(
double x);
238 void set_req_at(
double x);
239 void set_cumulative_cap(
double x);
240 void set_quantize(
double x);
241 void set_throughput(
double x);
242 void init_active_dormant();
246 std::string name_, inv_policy;
247 double fill_to_, req_at_, quantize_, throughput_, cumulative_cap_,
250 int next_active_end_= 0;
251 int next_dormant_end_= 0;
257 std::map<Material::Ptr, std::string> rsrc_commods_;
258 std::map<std::string, CommodDetail> commod_details_;
The abstract base class used by all types of agents that live and interact in a simulation.
boost::shared_ptr< Composition > Ptr
boost::shared_ptr< DoubleDistribution > Ptr
boost::shared_ptr< IntDistribution > Ptr
boost::shared_ptr< Material > Ptr
A simple API for agents that wish to exchange resources in the simulation.
virtual Agent * manager()
taken directly from OsiSolverInterface.cpp on 2/17/14 from https://projects.coin-or....
T OptionalQuery(InfileTree *tree, std::string query, T default_val)
a query method for optional parameters
A Trade is a simple container that associates a request for a resource with a bid for that resource.