12 return (exclusive_orders && a.
exclusive()) ?
25 std::vector<ExchangeNode::Ptr>::iterator n_it;
26 std::map<Arc, std::vector<double> >::iterator c_it;
27 std::map<Arc, double>::iterator p_it;
28 std::vector<RequestGroup::Ptr>::iterator rg_it;
29 std::vector<ExchangeNodeGroup::Ptr>::iterator sg_it;
30 double min_cap, pref, coeff;
32 double max_coeff = std::numeric_limits<double>::min();
33 double min_unit_cap = std::numeric_limits<double>::max();
38 std::vector<ExchangeNode::Ptr>& nodes = (*sg_it)->nodes();
39 for (n_it = nodes.begin(); n_it != nodes.end(); ++n_it) {
41 std::map<Arc, std::vector<double> >::iterator c_it;
42 std::map<Arc, std::vector<double> >& caps = (*n_it)->unit_capacities;
43 for (c_it = caps.begin(); c_it != caps.end(); ++c_it) {
44 std::vector<double>& ucaps = c_it->second;
46 min_cap = *std::min_element(ucaps.begin(), ucaps.end());
47 if (min_cap < min_unit_cap)
48 min_unit_cap = min_cap;
57 std::vector<ExchangeNode::Ptr>& nodes = (*rg_it)->nodes();
58 for (n_it = nodes.begin(); n_it != nodes.end(); ++n_it) {
60 std::map<Arc, std::vector<double> >::iterator c_it;
61 std::map<Arc, std::vector<double> >& caps = (*n_it)->unit_capacities;
62 for (c_it = caps.begin(); c_it != caps.end(); ++c_it) {
63 std::vector<double>& ucaps = c_it->second;
65 min_cap = *std::min_element(ucaps.begin(), ucaps.end());
66 if (min_cap < min_unit_cap)
67 min_unit_cap = min_cap;
72 std::map<Arc, double>& prefs = (*n_it)->prefs;
73 for (p_it = prefs.begin(); p_it != prefs.end(); ++p_it) {
75 const Arc& a = p_it->first;
77 if (coeff > max_coeff)
83 return max_coeff / min_unit_cap * (1 + cost_factor);
89 for (
int i = 0; i != arcs.size(); i++) {
90 const Arc& a = arcs[i];
94 max_cost = std::max(max_cost,
ArcCost(a) * factor);
96 return max_cost * (1 + cost_factor);
const std::vector< Arc > & arcs() const
double PseudoCostByCap(double cost_factor)
An arc represents a possible connection between two nodes in the bipartite resource exchange graph...
const std::vector< ExchangeNodeGroup::Ptr > & supply_groups() const
double ArcCost(const Arc &a)
return the cost of an arc
double PseudoCostByPref(double cost_factor)
const std::vector< RequestGroup::Ptr > & request_groups() const
taken directly from OsiSolverInterface.cpp on 2/17/14 from https://projects.coin-or.org/Osi/browser/trunk.
double PseudoCost()
Calculates the ratio of the maximum objective coefficient to minimum unit capacity plus an added cost...
static double Cost(const Arc &a, bool exclusive_orders=kDefaultExclusive)
return the cost of an arc