CYCLUS
Loading...
Searching...
No Matches
cyclus::RequestPortfolio< T > Class Template Reference

Detailed Description

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

A RequestPortfolio is a group of (possibly constrained) 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.,

// add some requests
rp->AddRequest(/* args */);
// declare some of them as multi-commodity requests (i.e., any one will
// satisfy this demand).
rp->AddMutualReqs(/* args */);
A RequestPortfolio is a group of (possibly constrained) requests for resources.
boost::shared_ptr< RequestPortfolio< T > > Ptr
T OptionalQuery(InfileTree *tree, std::string query, T default_val)
a query method for optional parameters

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 86 of file request_portfolio.h.

#include <request_portfolio.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
 
typedef Request< T > * request_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

◆ cost_function_t

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.

◆ Ptr

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

Definition at line 89 of file request_portfolio.h.

◆ request_ptr

template<class T >
typedef Request<T>* cyclus::RequestPortfolio< T >::request_ptr

Definition at line 91 of file request_portfolio.h.

Constructor & Destructor Documentation

◆ RequestPortfolio()

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

Definition at line 93 of file request_portfolio.h.

◆ ~RequestPortfolio()

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

deletes all requests associated with it

Definition at line 96 of file request_portfolio.h.

Member Function Documentation

◆ AddConstraint()

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 167 of file request_portfolio.h.

◆ AddMutualReqs()

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 150 of file request_portfolio.h.

◆ AddRequest() [1/2]

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 116 of file request_portfolio.h.

◆ AddRequest() [2/2]

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 139 of file request_portfolio.h.

◆ constraints()

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

Definition at line 185 of file request_portfolio.h.

◆ qty()

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 179 of file request_portfolio.h.

◆ qty_converter()

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

returns a capacity converter for this portfolios request quantities

Definition at line 190 of file request_portfolio.h.

◆ requester()

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 173 of file request_portfolio.h.

◆ requests()

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

Definition at line 182 of file request_portfolio.h.


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