CYCLUS
commodity_producer.cc
Go to the documentation of this file.
1 #include "commodity_producer.h"
2 
3 namespace cyclus {
4 namespace toolkit {
5 
6 CommodInfo::CommodInfo(double default_capacity, double default_cost)
7  : capacity(default_capacity),
8  cost(default_cost) {}
9 
10 CommodityProducer::CommodityProducer(double default_capacity,
11  double default_cost,
12  Agent* agent)
13  : AgentManaged(agent),
14  default_capacity_(default_capacity),
15  default_cost_(default_cost) {}
16 
18 
19 std::set<Commodity, CommodityCompare> CommodityProducer::ProducedCommodities() {
20  std::set<Commodity, CommodityCompare> commodities;
21  std::map<Commodity, CommodInfo, CommodityCompare>::iterator it;
22  for (it = commodities_.begin(); it != commodities_.end(); it++) {
23  commodities.insert(it->first);
24  }
25  return commodities;
26 }
27 
29  std::set<Commodity, CommodityCompare> commodities =
30  source->ProducedCommodities();
31  std::set<Commodity, CommodityCompare>::iterator it;
32  for (it = commodities.begin(); it != commodities.end(); it++) {
33  Add(*it);
34  SetCapacity(*it, source->Capacity(*it));
35  SetCost(*it, source->Cost(*it));
36  }
37 }
38 
39 } // namespace toolkit
40 } // namespace cyclus
CommodityProducer(double default_capacity=0, double default_cost=kModifierLimit, Agent *agent=NULL)
void SetCost(const Commodity &commodity, double cost)
Set the production cost for a given commodity.
This is a mixin class that provides an interface to access the underlying agent that manages it...
Definition: agent_managed.h:11
std::set< Commodity, CommodityCompare > ProducedCommodities()
void Add(const Commodity &commodity)
Register a commodity as being produced by this object.
void Copy(CommodityProducer *source)
Add all commodities produced by a source.
double Capacity(const Commodity &commodity)
void SetCapacity(const Commodity &commodity, double capacity)
Set the production capacity for a given commodity.
CommodInfo(double default_capacity=0, double default_cost=kModifierLimit)
The abstract base class used by all types of agents that live and interact in a simulation.
Definition: agent.h:51
taken directly from OsiSolverInterface.cpp on 2/17/14 from https://projects.coin-or.org/Osi/browser/trunk.
Definition: agent.cc:14
A mixin to provide information about produced commodities.
double Cost(const Commodity &commodity)