1 #ifndef CYCLUS_SRC_GREEDY_SOLVER_H_ 2 #define CYCLUS_SRC_GREEDY_SOLVER_H_ 27 int lu = l.
unode()->agent_id;
28 int lv = l.
vnode()->agent_id;
29 int ru = r.
unode()->agent_id;
30 int rv = r.
vnode()->agent_id;
31 double lpref = l.
unode()->prefs[l];
32 double rpref = r.
unode()->prefs[r];
33 return (lpref != rpref) ? (lpref > rpref) : (lu > ru || (lu == ru && lv > rv));
40 int lid = l->agent_id;
41 int rid = r->agent_id;
44 return (lpref != rpref) ? (lpref > rpref) : (lid > rid);
100 double Capacity(
const Arc& a,
double u_curr_qty,
double v_curr_qty);
119 return Capacity(n, a, min_cap, 0.0);
122 return Capacity(n, a,
true, curr_qty);
147 void UpdateObj(
double qty,
double pref);
150 std::map<ExchangeNode::Ptr, double> n_qty_;
151 std::map<ExchangeNodeGroup*, std::vector<double> > grp_caps_;
158 #endif // CYCLUS_SRC_GREEDY_SOLVER_H_ bool AvgPrefComp(ExchangeNode::Ptr l, ExchangeNode::Ptr r)
A comparison function for sorting a container of Nodes by the nodes preference in decensing order (i...
double Capacity(const Arc &a, double u_curr_qty, double v_curr_qty)
the capacity of the arc
double Capacity(ExchangeNode::Ptr n, const Arc &a)
void Condition()
Uses the provided (or a default) GreedyPreconditioner to condition the solver's ExchangeGraph so that...
An arc represents a possible connection between two nodes in the bipartite resource exchange graph...
boost::shared_ptr< RequestGroup > Ptr
boost::shared_ptr< ExchangeNode > unode() const
bool ReqPrefComp(const Arc &l, const Arc &r)
double Capacity(const Arc& a, double u_curr_qty, double v_curr_qty) { return 0; } ...
boost::shared_ptr< ExchangeNode > Ptr
void Init()
Initialize member values based on the given graph.
boost::shared_ptr< ExchangeNodeGroup > Ptr
boost::shared_ptr< ExchangeNode > vnode() const
virtual double SolveGraph()
the GreedySolver solves an ExchangeGraph by iterating over each RequestGroup and matching requests wi...
A GreedyPreconditioner conditions an ExchangeGraph for a GreedySolver by ordering the RequestGroups a...
void Capacity(cyclus::Arc const &, double, double)
GreedySolver()
GreedySolver constructor.
taken directly from OsiSolverInterface.cpp on 2/17/14 from https://projects.coin-or.org/Osi/browser/trunk.
double AvgPref(ExchangeNode::Ptr n)
a very simple interface for solving translated resource exchanges
double Capacity(ExchangeNode::Ptr n, const Arc &a, double curr_qty)
An ExchangeGraph is a resource-neutral representation of a ResourceExchange.
double Capacity(const Arc &a)
The GreedySolver provides the implementation for a "greedy" solution to a resource exchange graph...
double Capacity(ExchangeNode::Ptr n, const Arc &a, bool min_cap)