4#include "CoinPackedVector.hpp"
18 std::vector<BuildOrder>
orders;
22 std::map<CommodityProducer*, Builder*>
p_to_b;
23 std::map<int, CommodityProducer*>
idx_to_p;
32 std::map<CommodityProducer*, Builder*>&
p_to_b,
33 std::map<int, CommodityProducer*>&
idx_to_p,
37 std::set<Builder*>::iterator
bit;
38 std::set<CommodityProducer*>::iterator
pit;
43 for (
bit = builders_.begin();
bit != builders_.end(); ++
bit) {
45 for (
pit = b->producers().begin();
pit != b->producers().end(); ++
pit) {
47 if (
p->Produces(commodity)) {
49 caps.insert(
idx,
p->Capacity(commodity));
60 ctx.
m.setDimensions(0, ctx.
col_ubs.size());
61 ctx.
m.appendRow(
caps);
65 ProgTranslatorContext& ctx,
66 std::map<CommodityProducer*, Builder*>&
p_to_b,
67 std::map<int, CommodityProducer*>&
idx_to_p,
68 std::vector<BuildOrder>&
orders) {
69 int nvar = ctx.col_ubs.size();
70 iface.setObjSense(1.0);
71 iface.loadProblem(ctx.m, &ctx.col_lbs[0], &ctx.col_ubs[0],
72 &ctx.obj_coeffs[0], &ctx.row_lbs[0], &ctx.row_ubs[0]);
73 for (
int i = 0; i !=
nvar; i++) {
77 iface.branchAndBound();
79 const double*
sol =
iface.getColSolution();
83 for (
int i = 0; i !=
nvar; i++) {
84 n =
static_cast<int>(
sol[i]);
88 orders.push_back(BuildOrder(n, b,
p));
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
double b(int nuc)
Computes the scattering length [cm] from the coherent and incoherent components.
struct to hold all problem instance state
std::vector< double > col_lbs
std::vector< double > col_ubs
std::vector< double > obj_coeffs
std::vector< double > row_ubs
std::vector< double > row_lbs