LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
mam_lowering.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2012-2026, QORE Lab, Imperial College London
3 * All rights reserved.
4 */
5#ifndef LINE_LANG_LAL_MAM_LOWERING_H
6#define LINE_LANG_LAL_MAM_LOWERING_H
7
8/**
9 * @file
10 * @ingroup line_lang
11 * LINE Agent Language (LAL): lowering of embedded LINE networks to the agents
12 * SolverMAM's LAL methods read. Port of python/line_solver/lal/mam_lowering.py.
13 *
14 * SolverMAM's composition methods (finite and infinite QBDs, Jackson,
15 * parallel QBDs, the source decomposition and marked thinning) recognize a
16 * level agent whose states count the jobs of a queue, and source agents whose
17 * states are the phases of a MAP or MMAP. An embedded Network is lowered to
18 * exactly those agents when its structure allows it, so that the
19 * matrix-analytic methods solve the network itself rather than its truncated
20 * enumeration:
21 *
22 * - every station is a Queue visited by ONE open class, with exponential
23 * service on c servers, or phase-type service on one server (a separate
24 * service clock whose completions are the departures), FCFS, LCFS, SIRO or
25 * PS scheduling, and an infinite or finite capacity;
26 * - a finite capacity under LINE's DROP rule loses the arriving job, which is
27 * a self-event of the full queue; under a blocking rule the arrival is
28 * blocked;
29 * - routing is `sn.rtnodes` between Queue nodes and to a Sink, with no class
30 * switching; a Source contributes its Exp, MAP or marked-MAP arrival
31 * process, each class going to a single queue;
32 * - hand agents may inject arrivals of a queue's class; a hand observer of a
33 * node event is not lowered.
34 *
35 * The lowered transitions keep route-specific names (`Q.to_Q2`, `Q.out`), so
36 * the solvers' raw rows stay distinct per route, which `getQueueTable` needs;
37 * `labels` maps them to LINE's node-event labels (`Q.DEP[Jobs]`, the service
38 * clock's phase moves as `Q.PHASE[Jobs]`, a Source's emissions as
39 * `Src.DEP[cls]`) for the presented action table. A network outside this
40 * structure is refused by name, and SolverCTMC remains the method for it.
41 */
42
43#include <algorithm>
44#include <cctype>
45#include <cmath>
46#include <map>
47#include <optional>
48#include <set>
49#include <string>
50#include <utility>
51#include <vector>
52
54#include "line/lang/lal/ctmc.h"
56
57namespace line {
58namespace lal {
59
60/** A composition lowered for SolverMAM, with the map of lowered action labels to node-event labels. */
63 bool lowered = false;
64 std::map<std::string, std::string> labels; ///< python `_lal_labels`
65};
66
67namespace detail {
68
69[[noreturn]] inline void refuse_lowering(const std::string& message) {
70 throw UnsupportedError(ErrorKind("Model"), "SolverMAM cannot lower the embedded network: " + message);
71}
72
73/** The lowering itself; a friend of Composition (it writes the lowered synchronisations). */
74struct Lowering {
75 typedef std::pair<double, std::optional<std::size_t>> Route; ///< (probability, destination queue node)
76
77 static LoweredComposition lower(const Composition& composition) {
78 if (composition.embedded_.empty()) return LoweredComposition{composition, false, {}};
79 if (!composition.ext_syncs_.empty())
80 refuse_lowering("a hand agent observes or gates a node event; only injected arrivals are lowered.");
81 if (composition.embedded_.size() != 1) refuse_lowering("it embeds more than one LINE model.");
82 EmbeddedNetwork* part = dynamic_cast<EmbeddedNetwork*>(composition.embedded_.front().get());
83 if (!part) refuse_lowering("a EmbeddedEnvironment has no queue structure for the matrix-analytic methods.");
84 std::vector<Agent> agents;
85 std::vector<Sync> syncs;
86 std::map<std::string, std::string> relabel;
87 lower_network(*part, composition, agents, syncs, relabel);
88 std::vector<Agent> all = composition.agents_;
89 all.insert(all.end(), agents.begin(), agents.end());
90 LoweredComposition out{Composition(all), true, relabel};
91 Composition& lowered = out.composition;
92 for (const Sync& s : composition.syncs_) {
93 bool injection = false;
94 for (const auto& p : s.node_passive)
95 if (p.first == part->name()) injection = true;
96 for (const Endpoint& p : s.passive)
97 if (p.first == part->name()) injection = true;
98 if (!injection) lowered.syncs_.push_back(s);
99 }
100 lowered.syncs_.insert(lowered.syncs_.end(), syncs.begin(), syncs.end());
101 lowered.min_syncs_ = composition.min_syncs_;
102 lowered.hidden_ = composition.hidden_;
103 lowered.rewards_ = composition.rewards_;
104 lowered.source_truncated = composition.source_truncated;
105 return out;
106 }
107
108 private:
109 static std::string upper(std::string s) {
110 for (char& c : s) c = static_cast<char>(std::toupper(static_cast<unsigned char>(c)));
111 return s;
112 }
113
114 /**
115 * The services python takes as phase-type, `isinstance(dist, PH) or
116 * hasattr(dist, 'getInitProb')`: the PH family with its alpha, and the
117 * (non-marked) MAPs, whose getInitProb is map_pie. A marked law has no
118 * getInitProb in python, so it reaches the "has a ... service" refusal.
119 */
120 static bool is_ph_service(lang::ProcessType t) {
124 }
125
126 /** `dist.getInitProb()`: alpha of a PH-family law, map_pie of a MAP. */
127 static std::vector<double> init_prob_of(const lang::Distrib<double>& d) {
128 if (d.type == lang::ProcessType::MAP || d.type == lang::ProcessType::MMPP2)
129 return mam::map_pie(mam::Map<double>{d.D0, d.D1});
130 return embed_detail::init_prob(d);
131 }
132
133 static double exp_rate(const lang::Distrib<double>& d) {
134 if (d.has_map() && d.D0.rows() == 1) return -d.D0(0, 0);
135 return 1.0 / d.mean;
136 }
137
138 static void lower_network(EmbeddedNetwork& part, const Composition& composition, std::vector<Agent>& agents,
139 std::vector<Sync>& syncs, std::map<std::string, std::string>& relabel) {
140 const qn::NetworkStruct<double>& sn = part.model_struct();
141 const std::size_t K = sn.nclasses, N = sn.nodes.size();
142 std::vector<std::string> names, cnames;
143 for (const qn::NodeDef& nd : sn.nodes) names.push_back(nd.name);
144 for (const qn::JobClass& c : sn.classes) cnames.push_back(c.name);
145 for (double nj : sn.njobs())
146 if (std::isfinite(nj)) refuse_lowering("it has a closed class.");
147 const Matrix<double>& rt = sn.rtnodes;
148 if (rt.rows() < N * K || rt.cols() < N * K) refuse_lowering("it has no node-level routing matrix.");
149 auto R = [&](std::size_t i, std::size_t r, std::size_t j, std::size_t s) { return rt(i * K + r, j * K + s); };
150 std::vector<std::size_t> queues, sources; // 0-based node indices, in node order
151 for (std::size_t i = 0; i < N; ++i) {
152 const lang::NodeType t = sn.nodes[i].nodetype;
154 queues.push_back(i);
155 else if (t == lang::NodeType::Source)
156 sources.push_back(i);
157 else if (t != lang::NodeType::Sink)
158 refuse_lowering("node " + names[i] + " is a " + lang::node_type_to_text(t) +
159 "; only Source, Queue and Sink are lowered.");
160 }
161 if (queues.empty()) refuse_lowering("it has no Queue node.");
162 auto is_queue = [&](std::size_t j) { return std::find(queues.begin(), queues.end(), j) != queues.end(); };
163 // the class of each queue, from the routing that reaches it
164 std::map<std::size_t, std::set<std::size_t>> visits;
165 std::vector<std::size_t> visit_order;
166 for (std::size_t q : queues) {
167 visits[q];
168 visit_order.push_back(q);
169 }
170 for (std::size_t i = 0; i < N; ++i)
171 for (std::size_t r = 0; r < K; ++r)
172 for (std::size_t j : queues)
173 for (std::size_t s = 0; s < K; ++s)
174 if (R(i, r, j, s) > 0) {
175 if (r != s) refuse_lowering("it switches class.");
176 visits[j].insert(s);
177 }
178 // injected arrivals: (hand active endpoint, node key), per queue in first-seen order
179 std::map<std::size_t, std::vector<Endpoint>> injected;
180 std::vector<std::size_t> injected_order;
181 for (const Sync& s : composition.syncs_)
182 for (const auto& ep : s.node_passive) {
183 if (ep.first != part.name()) continue;
184 const NodeEvent& key = ep.second;
185 if (key.event != lang::EventType::ARV)
186 refuse_lowering(key.label() + " is injected, but only arrivals are.");
187 // refused in mam_lowering.py's order, BEFORE the class count of a
188 // queue is read: an unknown node or class indexed past `names`
189 // and `cnames`, and a non-queue reached the class-count refusal
190 const std::vector<std::string>::const_iterator nit = std::find(names.begin(), names.end(), key.node);
191 if (nit == names.end())
192 refuse_lowering(key.label() + " is injected, but " + part.name() + " has no node " + key.node +
193 ".");
194 const std::size_t q = static_cast<std::size_t>(nit - names.begin());
195 if (!is_queue(q)) refuse_lowering(key.node + " is injected, but only queues are lowered.");
196 if (!key.index)
197 refuse_lowering(key.label() + " is injected without a class; name the class of the arrival.");
198 const std::vector<std::string>::const_iterator cit = std::find(cnames.begin(), cnames.end(), *key.index);
199 if (cit == cnames.end())
200 refuse_lowering(key.label() + " is injected, but " + part.name() + " has no class " + *key.index +
201 ".");
202 const std::size_t c = static_cast<std::size_t>(cit - cnames.begin());
203 if (!visits.count(q)) visit_order.push_back(q);
204 visits[q].insert(c);
205 if (!injected.count(q)) injected_order.push_back(q);
206 injected[q].push_back(s.active);
207 }
208 for (std::size_t q : visit_order)
209 if (visits[q].size() != 1)
210 refuse_lowering("queue " + names[q] + " is visited by " + std::to_string(visits[q].size()) +
211 " classes; each queue must serve one class.");
212 std::map<std::size_t, std::size_t> qclass;
213 for (std::size_t q : visit_order) qclass[q] = *visits[q].begin();
214
215 std::map<std::size_t, std::vector<std::string>> arrivals;
216 for (std::size_t q : queues) arrivals[q];
217 std::map<std::size_t, std::vector<std::pair<std::string, Route>>> routes_of;
218 for (std::size_t q : queues) {
219 const std::size_t r = qclass[q];
220 std::vector<std::pair<std::string, Route>> out;
221 for (std::size_t j = 0; j < N; ++j) {
222 const double p = R(q, r, j, r);
223 if (!(p > 0)) continue;
224 if (is_queue(j)) {
225 out.push_back(std::make_pair("to_" + names[j], Route(p, j)));
226 arrivals[j].push_back("from_" + names[q]);
227 } else if (sn.nodes[j].nodetype == lang::NodeType::Sink) {
228 bool merged = false;
229 for (auto& o : out)
230 if (o.first == "out") {
231 o.second.first += p;
232 merged = true;
233 }
234 if (!merged) out.push_back(std::make_pair("out", Route(p, std::nullopt)));
235 } else {
236 refuse_lowering("queue " + names[q] + " routes to " + names[j] + ".");
237 }
238 }
239 if (out.empty()) out.push_back(std::make_pair("out", Route(1.0, std::nullopt)));
240 routes_of[q] = out;
241 }
242 for (std::size_t q : injected_order) {
243 for (std::size_t k = 0; k < injected[q].size(); ++k) arrivals[q].push_back("in" + std::to_string(k));
244 }
245 // True when the Source releases class r (a live arrival law or a mark).
246 auto emits = [&](std::size_t s, std::size_t r) {
247 const qn::Station<double>& st = sn.stations[sn.nodes[s].station - 1];
248 if (!st.marked_classes.empty())
249 return std::find(st.marked_classes.begin(), st.marked_classes.end(), r + 1) != st.marked_classes.end();
250 const std::size_t ist = sn.nodes[s].station;
251 return ist - 1 < sn.service.size() && r < sn.service[ist - 1].size() &&
252 sn.service[ist - 1][r].type != lang::ProcessType::DISABLED;
253 };
254 for (std::size_t s : sources)
255 for (std::size_t r = 0; r < K; ++r) {
256 std::vector<std::size_t> dests;
257 for (std::size_t j : queues)
258 if (R(s, r, j, r) > 0) dests.push_back(j);
259 if (dests.empty() || !emits(s, r)) continue;
260 if (dests.size() != 1 || std::fabs(R(s, r, dests[0], r) - 1.0) > 1e-12)
261 refuse_lowering("source " + names[s] + " splits class " + cnames[r] + " over several queues.");
262 arrivals[dests[0]].push_back("src_" + names[s] + "_" + cnames[r]);
263 }
264
265 // the declared initial state, for the initial queue lengths
266 qn::NetState<double> init;
267 const bool has_init = ctmc::analyzer_detail::default_init_state(sn, init);
268
269 for (std::size_t q : queues) {
270 const std::size_t r = qclass[q];
271 const std::size_t ist = sn.nodes[q].station;
272 const qn::Station<double>& st = sn.stations[ist - 1];
273 const std::string& qname = names[q];
274 const std::string& cname = cnames[r];
275 const std::string sched = upper(lang::sched_to_text(st.sched));
276 if (sched != "FCFS" && sched != "LCFS" && sched != "SIRO" && sched != "PS")
277 refuse_lowering("queue " + qname + " uses " + sched + " scheduling.");
278 if (!std::isfinite(st.nservers)) refuse_lowering("queue " + qname + " has infinitely many servers.");
279 const long servers = static_cast<long>(st.nservers);
280 const std::optional<long> capacity =
281 std::isfinite(st.cap) ? std::optional<long>(static_cast<long>(st.cap)) : std::nullopt;
282 const lang::Distrib<double>& dist = sn.service[ist - 1][r];
283 long initial = 0;
284 const std::size_t isf = sn.stateful_index(q + 1);
285 if (has_init && isf != 0 && isf <= init.local.size()) {
286 const qn::Marginal<double> m = embed_detail::station_marginal(sn, ist, init.local[isf - 1]);
287 initial = static_cast<long>(std::llround(m.ni));
288 }
289 NamedWeights route_probs;
290 for (const auto& o : routes_of[q]) route_probs.push_back(std::make_pair(o.first, o.second.first));
291 auto in_routes = [&](const std::string& a) {
292 for (const auto& rp : route_probs)
293 if (rp.first == a) return true;
294 return false;
295 };
296 const std::string dep = qname + ".DEP[" + cname + "]";
297 const lang::ProcessType kind = declared_law(dist).type;
298 Agent agent = Agent(qname, std::vector<std::string>{"n_0"}, "n_0");
299 if (kind == lang::ProcessType::EXP) {
300 QueueOptions o;
301 o.capacity = capacity;
302 o.service_rate = exp_rate(dist);
303 o.servers = servers;
304 o.arrivals = arrivals[q];
305 o.departures = route_probs;
306 o.initial = initial;
307 agent = Records::queue(qname, o);
308 } else if (is_ph_service(kind)) {
309 if (servers != 1)
310 refuse_lowering("queue " + qname + " has phase-type service on " + std::to_string(servers) +
311 " servers.");
312 const std::vector<double> alpha = init_prob_of(dist);
313 const Matrix<double>& T = dist.D0;
314 const Agent clock = Records::ph_service(qname + "_service", alpha, T, route_probs);
315 std::vector<std::string> inputs;
316 for (const auto& rp : route_probs) inputs.push_back("svc_" + rp.first);
317 bool phase = false;
318 for (const Transition& t : clock.transitions()) phase = phase || t.action == "_phase";
319 QueueOptions o;
320 o.capacity = capacity;
321 o.arrivals = arrivals[q];
322 o.initial = initial;
323 o.service_inputs = inputs;
324 if (phase) o.service_phase = std::string("svc_phase");
325 agent = Records::queue(qname, o);
326 for (const Transition& t : clock.transitions())
327 relabel[clock.name() + "." + t.action] =
328 in_routes(t.action) ? dep : qname + ".PHASE[" + cname + "]";
329 agents.push_back(clock);
330 for (const auto& rp : route_probs) {
331 const std::optional<std::size_t> dest = route_dest(routes_of[q], rp.first);
332 Sync s;
333 s.active = Endpoint(clock.name(), rp.first);
334 s.passive.push_back(Endpoint(qname, "svc_" + rp.first));
335 if (dest) s.passive.push_back(Endpoint(names[*dest], "from_" + qname));
336 syncs.push_back(s);
337 }
338 if (phase) {
339 Sync s;
340 s.active = Endpoint(clock.name(), "_phase");
341 s.passive.push_back(Endpoint(qname, "svc_phase"));
342 syncs.push_back(s);
343 }
344 } else {
345 refuse_lowering("queue " + qname + " has a " + law_name(dist) + " service.");
346 }
347 int drop = 0;
348 for (int d : st.droprule)
349 if (d != 0) {
350 drop = d;
351 break;
352 }
353 if (capacity && (drop == 0 || drop == static_cast<int>(lang::DropStrategy::DROP))) {
354 // LINE loses a job that finds the queue full: a self-event of n_K
355 const std::string full = "n_" + std::to_string(*capacity);
356 std::vector<Transition> extra;
357 for (const std::string& a : arrivals[q]) {
358 Transition t;
359 t.source = full;
360 t.action = a;
361 t.role = Role::Passive;
362 t.value = 1.0;
363 t.target = full;
364 extra.push_back(t);
365 }
366 Records::extend_queue(agent, extra);
367 }
368 for (const Transition& t : agent.transitions())
369 if (t.role == Role::Active && in_routes(t.action)) relabel[qname + "." + t.action] = dep;
370 agents.push_back(agent);
371 if (kind == lang::ProcessType::EXP)
372 for (const auto& o : routes_of[q])
373 if (o.second.second) {
374 Sync s;
375 s.active = Endpoint(qname, o.first);
376 s.passive.push_back(Endpoint(names[*o.second.second], "from_" + qname));
377 syncs.push_back(s);
378 }
379 const auto inj = injected.find(q);
380 if (inj != injected.end())
381 for (std::size_t k = 0; k < inj->second.size(); ++k) {
382 Sync s;
383 s.active = inj->second[k];
384 s.passive.push_back(Endpoint(qname, "in" + std::to_string(k)));
385 syncs.push_back(s);
386 }
387 }
388
389 for (std::size_t s : sources) {
390 const std::string& sname = names[s];
391 const std::size_t ist = sn.nodes[s].station;
392 const qn::Station<double>& st = sn.stations[ist - 1];
393 std::map<std::size_t, std::size_t> routed;
394 std::vector<std::size_t> routed_order;
395 for (std::size_t r = 0; r < K; ++r)
396 for (std::size_t j : queues)
397 if (R(s, r, j, r) > 0) {
398 routed[r] = j;
399 routed_order.push_back(r);
400 break;
401 }
402 if (!st.marked_classes.empty()) {
403 const std::size_t carrier = st.marked_classes.front() - 1;
404 const lang::Distrib<double>& proc = sn.service[ist - 1][carrier];
405 std::vector<std::string> labels;
406 for (std::size_t k = 0; k < st.marked_classes.size(); ++k) labels.push_back("m" + std::to_string(k));
407 mam::Mmap<double> m{proc.D0, proc.D1, proc.Dmark};
408 const Agent agent = Records::from_marked_map(sname, m, labels);
409 for (const Transition& t : agent.transitions()) {
410 const auto it = std::find(labels.begin(), labels.end(), t.action);
411 relabel[sname + "." + t.action] =
412 it != labels.end()
413 ? sname + ".DEP[" + cnames[st.marked_classes[static_cast<std::size_t>(it - labels.begin())] - 1] + "]"
414 : sname + ".PHASE";
415 }
416 agents.push_back(agent);
417 for (std::size_t k = 0; k < st.marked_classes.size(); ++k) {
418 const std::size_t r = st.marked_classes[k] - 1;
419 if (!routed.count(r)) continue;
420 Sync sy;
421 sy.active = Endpoint(sname, labels[k]);
422 sy.passive.push_back(Endpoint(names[routed[r]], "src_" + sname + "_" + cnames[r]));
423 syncs.push_back(sy);
424 }
425 continue;
426 }
427 for (std::size_t r : routed_order) {
428 const std::size_t q = routed[r];
429 if (ist - 1 >= sn.service.size() || r >= sn.service[ist - 1].size()) continue;
430 const lang::Distrib<double>& dist = sn.service[ist - 1][r];
431 const lang::ProcessType kind = declared_law(dist).type;
432 if (kind == lang::ProcessType::DISABLED) continue;
433 const std::string aname = sname + "_" + cnames[r];
434 Agent agent = Agent(aname, std::vector<std::string>{"phase_0"}, "phase_0");
435 if (kind == lang::ProcessType::EXP) {
436 const double rate = exp_rate(dist);
437 agent = Records::mmap(aname, Matrix<double>{{-rate}}, {{"arrival", Matrix<double>{{rate}}}});
438 } else if (kind == lang::ProcessType::MMAP || kind == lang::ProcessType::MPH ||
439 kind == lang::ProcessType::BMAP) {
440 refuse_lowering("source " + sname + " declares a marked process per class; use set_marked_arrival.");
441 } else if (dist.has_map()) {
442 agent = Records::mmap(aname, dist.D0, {{"arrival", dist.D1}});
443 } else {
444 refuse_lowering("source " + sname + " has a " + law_name(dist) + " arrival process.");
445 }
446 for (const Transition& t : agent.transitions())
447 relabel[aname + "." + t.action] = t.action == "arrival" ? sname + ".DEP[" + cnames[r] + "]"
448 : sname + ".PHASE[" + cnames[r] + "]";
449 agents.push_back(agent);
450 Sync sy;
451 sy.active = Endpoint(aname, "arrival");
452 sy.passive.push_back(Endpoint(names[q], "src_" + sname + "_" + cnames[r]));
453 syncs.push_back(sy);
454 }
455 }
456 }
457
458 static std::optional<std::size_t> route_dest(const std::vector<std::pair<std::string, Route>>& routes,
459 const std::string& action) {
460 for (const auto& o : routes)
461 if (o.first == action) return o.second.second;
462 return std::nullopt;
463 }
464};
465
466} // namespace detail
467
468/**
469 * A Composition of plain agents equivalent to `composition`, or itself
470 * (`lower`). `lowered` is set and `labels` filled when anything was lowered.
471 */
472inline LoweredComposition lower(const Composition& composition) { return detail::Lowering::lower(composition); }
473
474/**
475 * Rename lowered action rows to their node-event labels, summing rows that
476 * share one (`relabel_action_table`). The attributes are kept.
477 */
478inline ActionTable relabel_action_table(const ActionTable& table, const std::map<std::string, std::string>& mapping) {
479 if (mapping.empty()) return table;
480 ActionTable out;
481 std::vector<std::string> order;
482 std::map<std::string, double> values;
483 for (const ActionRow& row : table.rows) {
484 const auto it = mapping.find(row.action);
485 const std::string key = it != mapping.end() ? it->second : row.action;
486 if (!values.count(key)) {
487 order.push_back(key);
488 values[key] = row.throughput;
489 } else {
490 values[key] += row.throughput;
491 }
492 }
493 for (const std::string& k : order) out.rows.push_back(ActionRow{k, values[k]});
494 out.attrs = table.attrs;
495 return out;
496}
497
498} // namespace lal
499} // namespace line
500
501#endif // LINE_LANG_LAL_MAM_LOWERING_H
LINE Agent Language (LAL): programmatic construction of finite agents and their composition,...
UnsupportedError(const std::string &what)
Definition error.h:119
Agent(const std::string &name, const std::vector< std::string > &states, const std::string &initial)
Definition builder.h:288
A collection of agents and embedded LINE models with atomic synchronisations (Composition).
Definition builder.h:655
LINE Agent Language (LAL): the result tables every LAL solver returns, the exact finite CTMC analysis...
std::vector< double > init_prob(const lang::Distrib< double > &d)
The initial vector of a Markovian law with a (D0, D1) pair (getInitProb).
Definition embed.h:1444
qn::Marginal< double > station_marginal(const qn::NetworkStruct< double > &sn, std::size_t ist, const std::vector< double > &row)
The queue-length / phase marginal of a station row (toMarginal).
Definition embed.h:91
Definition ag.h:49
std::vector< std::pair< std::string, double > > NamedWeights
Definition builder.h:77
std::pair< std::string, std::string > Endpoint
(agent, action).
Definition core.h:139
std::string law_name(const lang::Distrib< double > &d)
A short readable name of a law for refusal messages (law_name).
Definition markov.h:62
ActionTable relabel_action_table(const ActionTable &table, const std::map< std::string, std::string > &mapping)
Rename lowered action rows to their node-event labels, summing rows that share one (relabel_action_ta...
LoweredComposition lower(const Composition &composition)
A Composition of plain agents equivalent to composition, or itself (lower).
const lang::Distrib< double > & declared_law(const lang::Distrib< double > &d)
The declared law of a distribution (the original when a solver fitted a surrogate).
Definition markov.h:57
@ ARV
a job arrives
Definition lang_types.h:119
const char * node_type_to_text(NodeType t)
Name of a node kind, for diagnostics.
Definition lang_types.h:362
ProcessType
Distribution kinds, with the values of MATLAB ProcessType.
Definition lang_types.h:524
@ MPH
The MARKED families, MATLAB's ProcessType.m:36-38.
Definition lang_types.h:598
const char * sched_to_text(SchedStrategy s)
Definition lang_types.h:248
NodeType
Node kinds, with the values of MATLAB NodeType.
Definition lang_types.h:345
const std::string * get(const Element *el, const std::string &key)
el.get(key), with Python's None as a null pointer.
Definition srvn_writer.h:62
std::vector< T > map_pie(const Map< T > &m)
Phase distribution seen by an arriving job, pie = pi D1 / (pi D1 e).
Definition map_moment.h:89
Conservation laws of a layered queueing network, enumerated from its structure.
Definition aoi_dist2ph.h:51
Port of solver_ctmc_analyzer.m and the parts of @@SolverCTMC/runAnalyzer.m that surround one solve: t...
ErrorKind(std::string n)
Definition error.h:39
One row of an action table: Action, Throughput.
Definition ctmc.h:62
std::vector< ActionRow > rows
Definition ctmc.h:80
TableAttrs attrs
Definition ctmc.h:81
A composition lowered for SolverMAM, with the map of lowered action labels to node-event labels.
std::map< std::string, std::string > labels
python _lal_labels