1#ifndef CYCLUS_SRC_TOOLKIT_MATL_BUY_POLICY_H_
2#define CYCLUS_SRC_TOOLKIT_MATL_BUY_POLICY_H_
5#include <boost/shared_ptr.hpp>
122 TotalInvTracker* buf_tracker);
124 TotalInvTracker* buf_tracker,
double throughput,
129 TotalInvTracker* buf_tracker,
double throughput,
132 TotalInvTracker* buf_tracker,
133 double throughput, std::string inv_policy,
134 double fill_behav,
double req_at);
136 TotalInvTracker* buf_tracker, std::string inv_policy,
137 double fill_behav,
double req_at);
139 TotalInvTracker* buf_tracker,
double throughput,
140 double cumulative_cap,
183 return std::min({throughput_,
184 fill_to_ - buf_->quantity(),
186 buf_tracker_->space()});
190 inline bool MakeReq()
const {
return buf_tracker_->quantity() <= req_at_; }
193 inline bool Excl()
const {
return quantize_ > 0; }
198 return Excl() ? quantize_ : amt;
202 inline int NReq(
double amt)
const {
203 return Excl() ?
static_cast<int>(amt / quantize_) : 1;
210 return rsrc_commods_;
214 return (next_dormant_end_ < 0 || next_active_end_ < 0);
218 return (time >= next_active_end_ && time < next_dormant_end_);
237 struct CommodDetail {
242 void set_manager(
Agent* m);
243 void set_total_inv_tracker(TotalInvTracker* t = NULL);
244 void set_inv_policy(std::string p,
double x,
245 double y = std::numeric_limits<double>::max());
247 void set_fill_to(
double x);
249 void set_req_at(
double x);
250 void set_cumulative_cap(
double x);
251 void set_quantize(
double x);
252 void set_throughput(
double x);
253 void init_active_dormant();
255 ResBuf<Material>* buf_;
256 TotalInvTracker* buf_tracker_;
257 std::string name_, inv_policy;
258 double fill_to_, req_at_, quantize_, throughput_, cumulative_cap_,
261 int next_active_end_= 0;
262 int next_dormant_end_= 0;
268 std::map<Material::Ptr, std::string> rsrc_commods_;
269 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....
A Trade is a simple container that associates a request for a resource with a bid for that resource.