CYCLUS
Public Types | Public Member Functions | List of all members
cyclus::RequestPortfolio< T > Class Template Reference

Detailed Description

template<class T>
class cyclus::RequestPortfolio< T >

A RequestPortfolio is a group of (possibly constrainted) requests for resources.

The portfolio contains a grouping of resource requests that may be mutually met by suppliers. These requests may share a common set of constraints. Take, for instance, a facility that needs fuel, of which there are two commodity types, fuelA and fuelB. If some combination of the two suffice the facility's needs, then requests for both would be added to the portfolio along with a capacity constraint.

The ExchangeTranslator will automatically add a mass-based constraint, that accounts for mutual requests, if the portfolio has them. , e.g.,

RequestPortfolio<SomeResource>());
// add some requests
rp->AddRequest(/* args */);
// declare some of them as multicommodity requsts (i.e., any one will
// satisfy this demand).
rp->AddMutualReqs(/* args */);

A default constraint will add unity for normal requests in the portfolio, but will add a weighted coefficient for requests that meet the same mutual demand. For example, if 10 kg of MOX and 9 kg of UOX meet the same demand for fuel, coefficients are added such that a full order of either will determine the demand as "met". In this case, the total demand is 9.5, the MOX order is given a coefficient of 9.5 / 10, and the UOX order is given a coefficient of 9.5 / 9.

Definition at line 21 of file request.h.

#include <request.h>

Inheritance diagram for cyclus::RequestPortfolio< T >:

Public Types

typedef std::function< double(boost::shared_ptr< T >)> cost_function_t
 
typedef boost::shared_ptr< RequestPortfolio< T > > Ptr
 

Public Member Functions

void AddConstraint (const CapacityConstraint< T > &c)
 
void AddMutualReqs (const std::vector< Request< T > * > &rs)
 
Request< T > * AddRequest (boost::shared_ptr< T > target, Trader *requester, std::string commodity, double preference, bool exclusive, cost_function_t cost_function)
 
Request< T > * AddRequest (boost::shared_ptr< T > target, Trader *requester, std::string commodity="", double preference=kDefaultPref, bool exclusive=false)
 
const std::set< CapacityConstraint< T > > & constraints () const
 
double qty () const
 
Converter< T >::Ptr qty_converter ()
 
Traderrequester () const
 
 RequestPortfolio ()
 
const std::vector< Request< T > * > & requests () const
 
 ~RequestPortfolio ()
 

Member Typedef Documentation

template<class T>
typedef std::function<double(boost::shared_ptr<T>)> cyclus::RequestPortfolio< T >::cost_function_t

Definition at line 90 of file request_portfolio.h.

template<class T>
typedef boost::shared_ptr<RequestPortfolio<T> > cyclus::RequestPortfolio< T >::Ptr

Definition at line 89 of file request_portfolio.h.

Constructor & Destructor Documentation

template<class T>
cyclus::RequestPortfolio< T >::RequestPortfolio ( )
inline

Definition at line 92 of file request_portfolio.h.

template<class T>
cyclus::RequestPortfolio< T >::~RequestPortfolio ( )
inline

deletes all requests associated with it

Definition at line 95 of file request_portfolio.h.

Member Function Documentation

template<class T>
void cyclus::RequestPortfolio< T >::AddConstraint ( const CapacityConstraint< T > &  c)
inline

add a capacity constraint associated with the portfolio, if it doesn't already exist

Parameters
cthe constraint to add

Definition at line 166 of file request_portfolio.h.

template<class T>
void cyclus::RequestPortfolio< T >::AddMutualReqs ( const std::vector< Request< T > * > &  rs)
inline

adds a collection of requests (already having been registered with this portfolio) as multicommodity requests

Parameters
rsthe collection of requests to add

Definition at line 149 of file request_portfolio.h.

template<class T>
Request<T>* cyclus::RequestPortfolio< T >::AddRequest ( boost::shared_ptr< T >  target,
Trader requester,
std::string  commodity,
double  preference,
bool  exclusive,
cost_function_t  cost_function 
)
inline

add a request to the portfolio

Parameters
targetthe target resource associated with this request
requesterthe requester
commoditythe commodity associated with this request
preferencethe preference associated with this request (relative to others in the portfolio)
exclusivea flag denoting that this request must be met exclusively, i.e., in its entirety by a single offer
cost_functionThe cost function that the requester sets so that the bidder may evaluate many potential resources.
Exceptions
KeyErrorif a request is added from a different requester than the original or if the request quantity is different than the original

Definition at line 115 of file request_portfolio.h.

template<class T>
Request<T>* cyclus::RequestPortfolio< T >::AddRequest ( boost::shared_ptr< T >  target,
Trader requester,
std::string  commodity = "",
double  preference = kDefaultPref,
bool  exclusive = false 
)
inline

add a request to the portfolio

Parameters
targetthe target resource associated with this request
requesterthe requester
commoditythe commodity associated with this request
preferencethe preference associated with this request (relative to others in the portfolio)
exclusivea flag denoting that this request must be met exclusively, i.e., in its entirety by a single offer
Exceptions
KeyErrorif a request is added from a different requester than the original or if the request quantity is different than the original

Definition at line 138 of file request_portfolio.h.

template<class T>
const std::set<CapacityConstraint<T> >& cyclus::RequestPortfolio< T >::constraints ( ) const
inline
Returns
const access to the request constraints

Definition at line 184 of file request_portfolio.h.

template<class T>
double cyclus::RequestPortfolio< T >::qty ( ) const
inline

, all requests in a portfolio must have the same quantity, which is checked during AddRequest()

Returns
the request quantity associated with the portfolio.

Definition at line 178 of file request_portfolio.h.

template<class T>
Converter<T>::Ptr cyclus::RequestPortfolio< T >::qty_converter ( )
inline

returns a capacity converter for this portfolios request quantities

Definition at line 189 of file request_portfolio.h.

template<class T>
Trader* cyclus::RequestPortfolio< T >::requester ( ) const
inline
Returns
the agent associated with the portfolio. if no reqeusts have been added, the requester is NULL.

Definition at line 172 of file request_portfolio.h.

template<class T>
const std::vector<Request<T>*>& cyclus::RequestPortfolio< T >::requests ( ) const
inline
Returns
const access to the unconstrained requests

Definition at line 181 of file request_portfolio.h.


The documentation for this class was generated from the following files: