1#ifndef CYCLUS_SRC_GREEDY_SOLVER_H_
2#define CYCLUS_SRC_GREEDY_SOLVER_H_
4#include <boost/shared_ptr.hpp>
28 int lu = l.
unode()->agent_id;
29 int lv = l.
vnode()->agent_id;
30 int ru = r.
unode()->agent_id;
31 int rv = r.
vnode()->agent_id;
32 double lpref = l.
unode()->prefs[l];
33 double rpref = r.
unode()->prefs[r];
34 return (lpref != rpref) ? (lpref > rpref) : (lu > ru || (lu == ru && lv > rv));
41 int lid = l->agent_id;
42 int rid = r->agent_id;
45 return (lpref != rpref) ? (lpref > rpref) : (lid > rid);
49class GreedyPreconditioner;
101 double Capacity(
const Arc& a,
double u_curr_qty,
double v_curr_qty);
120 return Capacity(n, a, min_cap, 0.0);
123 return Capacity(n, a,
true, curr_qty);
148 void UpdateObj(
double qty,
double pref);
151 std::map<ExchangeNode::Ptr, double> n_qty_;
152 std::map<ExchangeNodeGroup*, std::vector<double> > grp_caps_;
An arc represents a possible connection between two nodes in the bipartite resource exchange graph.
boost::shared_ptr< ExchangeNode > vnode() const
boost::shared_ptr< ExchangeNode > unode() const
boost::shared_ptr< ExchangeNodeGroup > Ptr
a very simple interface for solving translated resource exchanges
A GreedyPreconditioner conditions an ExchangeGraph for a GreedySolver by ordering the RequestGroups a...
The GreedySolver provides the implementation for a "greedy" solution to a resource exchange graph.
virtual double SolveGraph()
the GreedySolver solves an ExchangeGraph by iterating over each RequestGroup and matching requests wi...
double Capacity(ExchangeNode::Ptr n, const Arc &a, double curr_qty)
GreedySolver()
GreedySolver constructor.
double Capacity(ExchangeNode::Ptr n, const Arc &a, bool min_cap)
double Capacity(const Arc &a, double u_curr_qty, double v_curr_qty)
the capacity of the arc
double Capacity(const Arc &a)
void Condition()
Uses the provided (or a default) GreedyPreconditioner to condition the solver's ExchangeGraph so that...
double Capacity(ExchangeNode::Ptr n, const Arc &a)
void Init()
Initialize member values based on the given graph.
boost::shared_ptr< RequestGroup > Ptr
taken directly from OsiSolverInterface.cpp on 2/17/14 from https://projects.coin-or....
double AvgPref(ExchangeNode::Ptr n)
void Capacity(cyclus::Arc const &, double, double)
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....
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