12 ss << std::setprecision(17) <<
"new capacity " << cap
13 <<
" lower than existing quantity " <<
quantity();
22 ss << std::setprecision(17) <<
"removal quantity " << qty
23 <<
" larger than buff quantity " <<
quantity();
31 while (left > 0 &&
count() > 0) {
37 tmp = r->ExtractRes(left);
41 mats_present_.erase(r);
44 manifest.push_back(r);
56 ss << std::setprecision(17) <<
"removal quantity " << qty
57 <<
" larger than buff quantity " <<
quantity();
67 void ResourceBuff::UpdateQty() {
68 std::list<Resource::Ptr>::iterator it;
69 std::vector<double> qtys;
70 for (it = mats_.begin(); it != mats_.end(); ++it) {
71 qtys.push_back((*it)->quantity());
77 if (
count() < num || num < 0) {
79 ss <<
"remove count " << num <<
" larger than buff count " <<
count();
84 for (
int i = 0; i < num; i++) {
87 manifest.push_back(r);
88 mats_present_.erase(r);
96 if (mats_.size() < 1) {
97 throw ValueError(
"cannot pop resource from an empty buff");
109 mats_present_.erase(r);
116 std::stringstream ss;
117 ss <<
"resource pushing breaks capacity limit: space=" <<
space()
118 <<
", rsrc->quantity()=" << r->quantity();
120 }
else if (mats_present_.count(r) == 1) {
121 throw KeyError(
"duplicate resource push attempted");
125 mats_present_.insert(r);
For values that are too big, too small, etc.
double eps_rsrc()
an epsilon value to be used by resources
static double KahanSum(std::vector< double > input)
sums the materials in the vector in an intelligent way, to avoid floating point issues.
boost::shared_ptr< Resource > Ptr
taken directly from OsiSolverInterface.cpp on 2/17/14 from https://projects.coin-or.org/Osi/browser/trunk.
Declares the CycArithmetic class, which holds arithmetic algorithms.
For failed retrieval/insertion of key-based data into/from data structures.
double eps()
a generic epsilon value