CYCLUS
Loading...
Searching...
No Matches
building_manager.h
Go to the documentation of this file.
1#ifndef CYCLUS_SRC_TOOLKIT_BUILDING_MANAGER_H_
2#define CYCLUS_SRC_TOOLKIT_BUILDING_MANAGER_H_
3
4#include <map>
5#include <vector>
6
7#include "agent_managed.h"
8#include "builder.h"
10
12
13namespace cyclus {
14
15class ProgTranslatorContext;
16
17namespace toolkit {
18
19/// A struct for a build order: the number of producers to build.
26
27/// The BuildingManager class is a managing entity that makes decisions
28/// about which objects to build given certain conditions.
29///
30/// Specifically, the BuildingManager queries the SupplyDemandManager
31/// to determine if there exists unmet demand for a Commodity, and then
32/// decides which object(s) amongst that Commodity's producers should be
33/// built to meet that demand. This decision takes the form of an
34/// integer program:
35///
36/// \f[
37/// \min \sum_{i=1}^{N}c_i*y_i \\
38/// s.t. \sum_{i=1}^{N}\phi_i*y_i \ge \Phi \\
39/// n_i \in [0,\infty) \forall i \in I, y_i integer
40/// \f]
41///
42/// Where y_i is the number of objects of type i to build, c_i is the
43/// cost to build the object of type i, \f$\phi_i\f$ is the nameplate
44/// capacity of the object, and \f$\Phi\f$ is the capacity demand. Here
45/// the set I corresponds to all producers of a given commodity.
47 public:
49
50 /// Register a builder with the manager
51 /// @param builder the builder
52 inline void Register(Builder* builder) { builders_.insert(builder); }
53
54 /// Unregister a builder with the manager
55 /// @param builder the builder
56 inline void Unregister(Builder* builder) { builders_.erase(builder); }
57
58 /// Given a certain commodity and demand, a decision is made as to
59 /// how many producers of each available type to build this
60 /// function constructs an integer program through the
61 /// SolverInterface
62 /// @param commodity the commodity being demanded
63 /// @param demand the additional capacity required
64 /// @return a vector of build orders as decided
65 std::vector<BuildOrder> MakeBuildDecision(Commodity& commodity,
66 double demand);
67
68 inline const std::set<Builder*>& builders() const {
69 return builders_;
70 }
71
72 private:
73 std::set<Builder*> builders_;
74
75 void SetUp_(OsiCbcSolverInterface& iface,
77 std::map<CommodityProducer*, Builder*>& p_to_b,
78 std::map<int, CommodityProducer*>& idx_to_p,
79 Commodity& commodity,
80 double demand);
81
82 void Solve_(OsiCbcSolverInterface& iface,
84 std::map<CommodityProducer*, Builder*>& p_to_b,
85 std::map<int, CommodityProducer*>& idx_to_p,
86 std::vector<BuildOrder>& orders);
87};
88
89} // namespace toolkit
90} // namespace cyclus
91
92#endif // CYCLUS_SRC_TOOLKIT_BUILDING_MANAGER_H_
The abstract base class used by all types of agents that live and interact in a simulation.
Definition agent.h:49
This is a mixin class that provides an interface to access the underlying agent that manages it.
A mixin to provide information about commodity producers that can be built.
Definition builder.h:14
The BuildingManager class is a managing entity that makes decisions about which objects to build give...
void Unregister(Builder *builder)
Unregister a builder with the manager.
std::vector< BuildOrder > MakeBuildDecision(Commodity &commodity, double demand)
Given a certain commodity and demand, a decision is made as to how many producers of each available t...
void Register(Builder *builder)
Register a builder with the manager.
const std::set< Builder * > & builders() const
A mixin to provide information about produced commodities.
A simple class defining a commodity; it is currently super simple.
Definition commodity.h:12
taken directly from OsiSolverInterface.cpp on 2/17/14 from https://projects.coin-or....
Definition agent.cc:14
T OptionalQuery(InfileTree *tree, std::string query, T default_val)
a query method for optional parameters
struct to hold all problem instance state
A struct for a build order: the number of producers to build.
CommodityProducer * producer
BuildOrder(int n, Builder *b, CommodityProducer *cp)