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;
24 SetUp_(iface, ctx, p_to_b, idx_to_p, commodity, demand);
25 Solve_(iface, ctx, p_to_b, idx_to_p, orders);
32 std::map<CommodityProducer*, Builder*>& p_to_b,
33 std::map<int, CommodityProducer*>& idx_to_p,
36 CoinPackedVector caps;
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) {
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();
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++) {
83 for (
int i = 0; i != nvar; i++) {
84 n =
static_cast<int>(sol[i]);
88 orders.push_back(BuildOrder(n, b, p));
virtual void setInteger(int index)
Set the index-th variable to be an integer variable.
virtual void initialSolve()
Solve initial LP relaxation.
virtual void loadProblem(const CoinPackedMatrix &matrix, const double *collb, const double *colub, const double *obj, const double *rowlb, const double *rowub)
Load in an problem by copying the arguments (the constraints on the rows are given by lower and upper...
virtual void branchAndBound()
Invoke solver's built-in enumeration algorithm.
virtual void setObjSense(double s)
Set objective function sense (1 for min (default), -1 for max,)
virtual const double * getColSolution() const
Get pointer to array[getNumCols()] of primal solution vector.
virtual double getInfinity() const
Get solver's value for infinity.
taken directly from OsiSolverInterface.cpp on 2/17/14 from https://projects.coin-or....
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