1#ifndef CYCLUS_SRC_CAPACITY_CONSTRAINT_H_
2#define CYCLUS_SRC_CAPACITY_CONSTRAINT_H_
4#include <boost/shared_ptr.hpp>
17 typedef boost::shared_ptr< Converter<T> >
Ptr;
26 boost::shared_ptr<T> offer,
47 boost::shared_ptr<T> offer,
50 return offer->quantity();
72 throw ValueError(
"Capacity is not positive, no trades will be executed");
81 throw ValueError(
"Capacity is not positive, no trades will be executed");
87 : capacity_(
other.capacity_),
88 converter_(
other.converter_),
102 boost::shared_ptr<T> offer,
105 return converter_->convert(offer,
a, ctx);
109 inline int id()
const {
120template<
class T>
int CapacityConstraint<T>::next_id_ = 0;
126 return ((
lhs.capacity() ==
rhs.capacity()) &&
127 (*
lhs.converter() == *
rhs.converter()));
135 return (
lhs.id() <
rhs.id());
An arc represents a possible connection between two nodes in the bipartite resource exchange graph.
A CapacityConstraint provides an ability to determine an agent's constraints on resource allocation g...
double convert(boost::shared_ptr< T > offer, Arc const *a=NULL, ExchangeTranslationContext< T > const *ctx=NULL) const
CapacityConstraint(double capacity)
constructor for a constraint with a trivial converter (i.e., one that simply returns 1)
CapacityConstraint(const CapacityConstraint &other)
constructor for a constraint with a non-trivial converter
CapacityConstraint(double capacity, typename Converter< T >::Ptr converter)
constructor for a constraint with a non-trivial converter
Converter< T >::Ptr converter() const
For values that are too big, too small, etc.
taken directly from OsiSolverInterface.cpp on 2/17/14 from https://projects.coin-or....
bool operator<(const CapacityConstraint< T > &lhs, const CapacityConstraint< T > &rhs)
CapacityConstraint-CapacityConstraint comparison operator, allows usage in ordered containers.
bool operator==(const CapacityConstraint< T > &lhs, const CapacityConstraint< T > &rhs)
CapacityConstraint-CapacityConstraint equality operator.
T OptionalQuery(InfileTree *tree, std::string query, T default_val)
a query method for optional parameters
a simple interface for converting resource objects to unit capacities
virtual bool operator==(Converter &other) const
operator== is available for subclassing, see cyclus::TrivialConverter for an example
boost::shared_ptr< Converter< T > > Ptr
bool operator!=(Converter &other) const
virtual double convert(boost::shared_ptr< T > offer, Arc const *a=NULL, ExchangeTranslationContext< T > const *ctx=NULL) const =0
convert a capacitated quantity for an offer in its exchange context
An ExchangeTranslationContext is a simple holder class for any information needed to translate a Reso...
The default converter returns the resource's quantity.
virtual bool operator==(Converter< T > &other) const
virtual double convert(boost::shared_ptr< T > offer, Arc const *a=NULL, ExchangeTranslationContext< T > const *ctx=NULL) const