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();
68 : capacity_(capacity),
69 converter_(converter),
72 throw ValueError(
"Capacity is not positive, no trades will be executed");
78 : capacity_(capacity),
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,
103 Arc const * a = NULL,
105 return converter_->convert(offer, a, ctx);
109 inline int id()
const {
133 inline bool operator<(const CapacityConstraint<T>& lhs,
135 return (lhs.id() < rhs.id());
140 #endif // CYCLUS_SRC_CAPACITY_CONSTRAINT_H_ The default converter returns the resource's quantity.
a simple interface for converting resource objects to unit capacities
An arc represents a possible connection between two nodes in the bipartite resource exchange graph...
For values that are too big, too small, etc.
Converter< T >::Ptr converter() const
A CapacityConstraint provides an ability to determine an agent's constraints on resource allocation g...
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
virtual bool operator==(Converter &other) const
operator== is available for subclassing, see cyclus::TrivialConverter for an example ...
CapacityConstraint(const CapacityConstraint &other)
constructor for a constraint with a non-trivial converter
double convert(boost::shared_ptr< T > offer, Arc const *a=NULL, ExchangeTranslationContext< T > const *ctx=NULL) const
CapacityConstraint(double capacity, typename Converter< T >::Ptr converter)
constructor for a constraint with a non-trivial converter
bool operator!=(Converter &other) const
An ExchangeTranslationContext is a simple holder class for any information needed to translate a Reso...
boost::shared_ptr< Converter< T > > Ptr
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
taken directly from OsiSolverInterface.cpp on 2/17/14 from https://projects.coin-or.org/Osi/browser/trunk.
CapacityConstraint(double capacity)
constructor for a constraint with a trivial converter (i.e., one that simply returns 1) ...