1#ifndef CYCLUS_SRC_EXCHANGE_MANAGER_H_
2#define CYCLUS_SRC_EXCHANGE_MANAGER_H_
31 debug_ =
Env::GetEnv(
"CYCLUS_DEBUG_DRE").size() > 0;
44 RecordDebugInfo(
exchng.ex_ctx());
61 std::vector< Trade<T> >
trades;
67 exec.ExecuteTrades(ctx_);
72 typename std::vector<typename RequestPortfolio<T>::Ptr>::iterator
it;
74 std::vector<Request<T>*>
reqs = (*it)->requests();
75 typename std::vector<Request<T>*>::iterator
it2;
82 ->AddVal(
"ReqId",
ss.str())
83 ->AddVal(
"RequesterID",
r->requester()->manager()->id())
84 ->AddVal(
"Commodity",
r->commodity())
85 ->AddVal(
"Preference",
r->preference())
86 ->AddVal(
"Exclusive",
r->exclusive())
87 ->AddVal(
"ResType",
r->target()->type())
88 ->AddVal(
"Quantity",
r->target()->quantity())
89 ->AddVal(
"ResUnits",
r->target()->units())
94 typename std::vector<typename BidPortfolio<T>::Ptr>::iterator
it3;
96 std::set<Bid<T>*> bids = (*it3)->bids();
97 typename std::set<Bid<T>*>::iterator
it4;
98 for (
it4 = bids.begin();
it4 != bids.end(); ++
it4) {
101 double pref =
exctx.trader_prefs[
r->requester()][
r][
b];
102 std::stringstream
ss;
103 ss << ctx_->
time() <<
"_" <<
b->request();
106 ->AddVal(
"BidderId",
b->bidder()->manager()->id())
107 ->AddVal(
"BidQuantity",
b->offer()->quantity())
108 ->AddVal(
"Exclusive",
b->exclusive())
109 ->AddVal(
"Preference", pref)
a holding class for information related to a TradeExecutor
A simulation context provides access to necessary simulation-global functions and state.
Datum * NewDatum(std::string title)
See Recorder::NewDatum documentation.
ExchangeSolver * solver()
Returns the exchange solver associated with this context.
virtual int time()
Returns the current simulation timestep.
Datum * AddVal(const char *field, boost::spirit::hold_any val, std::vector< int > *shape=NULL)
Add an arbitrary field-value pair to the datum.
void Record()
Record this datum to its Recorder.
static std::string GetEnv(std::string var)
Method to check the existence of and return an environment variable.
boost::shared_ptr< ExchangeGraph > Ptr
The ExchangeManager is designed to house all of the internals involved in executing a resource exchan...
ExchangeManager(Context *ctx)
void Execute()
execute the full resource sequence
double Solve(ExchangeGraph *graph=NULL)
interface for solving a given exchange graph
An ExchangeTranslator facilitates translation from a resource specific exchange to a resource-neutral...
A Request encapsulates all the information required to communicate the needs of an agent in the Dynam...
The ResourceExchange class manages the communication for the supply and demand of resources in a simu...
The TradeExecutor is an object whose task is to execute a collection of Trades.
taken directly from OsiSolverInterface.cpp on 2/17/14 from https://projects.coin-or....
@ LEV_DEBUG1
debugging information - least verbose
T OptionalQuery(InfileTree *tree, std::string query, T default_val)
a query method for optional parameters
double b(int nuc)
Computes the scattering length [cm] from the coherent and incoherent components.
The ExchangeContext is designed to provide an ease-of-use interface for querying and reaggregating in...