@@ -126,8 +126,38 @@ Multi-Resource Buffer Inventory Tracker [C++]
126
126
127
127
Material Buy Policy Class [C++]
128
128
+++++++++++++++++++++++++++++++
129
- The ``cyclus::toolkit::MatlBuyPolicy `` class manages the process of requesting
130
- a particular commodity.
129
+ The ``cyclus::toolkit::MatlBuyPolicy `` class performs semi-automatic
130
+ inventory management of a material buffer .
131
+ For simple behavior, policies virtually eliminate the need to write any code
132
+ for resource exchange. Just assign a few policies to work with a few buffers
133
+ and focus on writing the physics and other behvavior of your agent. Typical
134
+ usage goes something like this:
135
+
136
+ .. code-block :: c++
137
+ class YourAgent : public cyclus::Facility {
138
+ public:
139
+ ...
140
+
141
+ void EnterNotify() {
142
+ cyclus::Facility: :EnterNotify(); // always do this first
143
+
144
+ policy _.Init(this, &inbuf_, "inbuf-label").Set(incommod, comp).Start();
145
+ }
146
+ ...
147
+
148
+ private:
149
+ MatlBuyPolicy policy _;
150
+ ResBuf<Material> inbuf _;
151
+ ...
152
+ }
153
+
154
+
155
+ The policy needs to be initialized with its owning agent and the material
156
+ buffer that is is managing. It also needs to be activated by calling the
157
+ Start function for it to begin participation in resource exchange. And
158
+ don't forget to add some commodities to request by calling Set. All policy
159
+ configuration should usually occur in the agent's EnterNotify member
160
+ function.
131
161
132
162
The following inventory management strategies are available:
133
163
@@ -170,5 +200,48 @@ Material Buy Policy Class [C++]
170
200
171
201
Material Sell Policy Class [C++]
172
202
++++++++++++++++++++++++++++++++
173
- The ``cyclus::toolkit::MatlSellPolicy `` class manages the process of providing
174
- a particular commodity to the DRE.
203
+ The ``cyclus::toolkit::MatlSellPolicy `` class performs semi-automatic inventory
204
+ management of a material buffer by making offers and trading away materials
205
+ in an attempt to empty the buffer's inventory every time step.
206
+
207
+ For simple behavior, policies virtually eliminate the need to write any code
208
+ for resource exchange. Just assign a few policies to work with a few buffers
209
+ and focus on writing the physics and other behvavior of your agent. Typical
210
+ usage goes something like this:
211
+
212
+ .. code-block :: c++
213
+ class YourAgent : public Facility {
214
+ public:
215
+ ...
216
+
217
+ void EnterNotify() {
218
+ Facility::EnterNotify(); // always do this first
219
+
220
+ policy _.Init(this, &outbuf_, "outbuf-label", ...).Set(outcommod).Start();
221
+ }
222
+ ...
223
+
224
+ private:
225
+ MatlSellPolicy policy _;
226
+ ResBuf<Material> outbuf _;
227
+ ...
228
+ }
229
+
230
+ The policy needs to be initialized with its owning agent and the material
231
+ buffer that is is managing. It also needs to be activated by calling the
232
+ Start function for it to begin participation in resource exchange. And
233
+ don't forget to add some commodities to offer on by calling Set. All policy
234
+ configuration should usually occur in the agent's EnterNotify member
235
+ function.
236
+
237
+ When a policy's managing agent is deallocated, you MUST either
238
+ call the policy's Stop function or delete the policy. Otherwise SEGFAULT.
239
+
240
+ ``MatlSellPolicy `` can be initialized with a package and transport unit.
241
+ When responding to requests for bids, the policy will only offer resources
242
+ in quantities that can be packaged (and placed into transport units, if
243
+ applicable). The packaging process occurs only after trades have been accepted,
244
+ in the case that partial trades are accepted. Note that partial acceptance of
245
+ bids may result in "failed" trades where the accepted amount cannot be packaged
246
+ and thus only a portion of the bid gets packaged and sent to the receiving
247
+ agent.
0 commit comments