4#include <boost/math/special_functions/next.hpp>
42 : qty(
std::numeric_limits<double>::max()),
59 boost::shared_ptr<ExchangeNode> vnode)
62 exclusive_ =
unode->exclusive ||
vnode->exclusive;
64 double fqty =
unode->qty;
65 double sqty =
vnode->qty;
68 double dist = boost::math::float_distance(fqty, sqty);
71 }
else if (
unode->exclusive) {
83 : unode_(other.unode()),
84 vnode_(other.vnode()),
86 exclusive_(other.exclusive()),
87 excl_val_(other.excl_val()) {}
92 nodes_.push_back(node);
97 std::vector<ExchangeNode::Ptr>
nodes;
98 nodes.push_back(node);
99 excl_node_groups_.push_back(
nodes);
108 if (node->exclusive) {
118 request_groups_.push_back(prs);
123 supply_groups_.push_back(pss);
129 int id = next_arc_id_++;
130 arc_ids_.insert(std::pair<Arc, int>(a,
id));
131 arc_by_id_.insert(std::pair<int, Arc>(
id, a));
132 node_arc_map_[a.
unode()].push_back(a);
133 node_arc_map_[a.
vnode()].push_back(a);
138 matches_.push_back(std::make_pair(a, qty));
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
Arc()
default required for usage in maps
void AddRequestGroup(RequestGroup::Ptr prs)
adds a request group to the graph
void AddSupplyGroup(ExchangeNodeGroup::Ptr prs)
adds a supply group to the graph
void AddMatch(const Arc &a, double qty)
adds a match for a quanity of flow along an arc
void AddArc(const Arc &a)
adds an arc to the graph
boost::shared_ptr< ExchangeNodeGroup > Ptr
virtual void AddExchangeNode(ExchangeNode::Ptr node)
Add the node to the ExchangeNodeGroup and informs the node it is a member of this ExchangeNodeGroup.
const std::vector< ExchangeNode::Ptr > & nodes() const
void AddExclNode(ExchangeNode::Ptr n)
adds a single node to the set of exclusive node groupings, in general this function is used for deman...
virtual void AddExchangeNode(ExchangeNode::Ptr node)
Add the node to the ExchangeNodeGroup and informs the node it is a member of this ExchangeNodeGroup,...
RequestGroup(double qty=0.0)
boost::shared_ptr< RequestGroup > Ptr
Code providing rudimentary logging capability for the Cyclus core.
taken directly from OsiSolverInterface.cpp on 2/17/14 from https://projects.coin-or....
static const double float_ulp_eq
distance in ULP within which floating point numbers should be considered equal.
bool operator==(const CapacityConstraint< T > &lhs, const CapacityConstraint< T > &rhs)
CapacityConstraint-CapacityConstraint equality operator.
ExchangeNodes are used in ExchangeGraphs to house information about a given translated Bid or Request...
bool exclusive
whether this node represents an exclusive request or offer
ExchangeNodeGroup * group
the parent ExchangeNodeGroup to which this ExchangeNode belongs
std::map< Arc, std::vector< double > > unit_capacities
unit values associated with this ExchangeNode corresponding to capacties of its parent ExchangeNodeGr...
double qty
the maximum amount of a resource that can be associated with this node
boost::shared_ptr< ExchangeNode > Ptr
std::string commod
the commodity associated with this exchange node