LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Toggle main menu visibility
Loading...
Searching...
No Matches
mam_types.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_SOLVERS_MAM_MAM_TYPES_H
6
#define LINE_SOLVERS_MAM_MAM_TYPES_H
7
8
/**
9
* @file
10
* @ingroup line_solvers
11
* The option and result types SolverMAM shares with its analyzers.
12
*
13
* The solution type IS `mva::MvaSolution<T>`: the MAM analyzers return the same
14
* [Q,U,R,T,C,X] tuple, and `@@NetworkSolver/getAvg` applies the same
15
* solver-independent metric filter afterwards, so reusing it is what keeps the
16
* two runners from drifting apart.
17
*/
18
19
#include <cstddef>
20
#include <limits>
21
#include <string>
22
23
#include "
line/solvers/mva/mva_types.h
"
24
25
namespace
line
{
26
namespace
mam
{
27
28
/** The options SolverMAM reads. Defaults are SolverOptions('MAM'). */
29
struct
MamOptions
{
30
std::string
method
=
"default"
;
31
double
tol
= 1e-4;
32
/** SolverOptions('MAM') lowers this from the global 1000 to 100. */
33
int
iter_max
= 100;
34
/**
35
* `options.config.space_max`: the order budget of the per-station arrival
36
* superposition, handed to mmap_super_safe. `dec.poisson` is exactly this
37
* set to 1, which collapses every stream to marked Poisson.
38
*/
39
std::size_t
space_max
= 128;
40
/**
41
* `options.config.preserveDet`: keep a Det service as Det so the exact
42
* MAP/D/c solver can claim it, instead of Erlang-approximating it. The
43
* analyzer turns this on when the caller has not.
44
*/
45
bool
preserve_det
=
true
;
46
/**
47
* `options.config.nonmkvorder`: the phase budget `sn_nonmarkov_toph` spends
48
* replacing a non-Markovian service law. The reference default is 20.
49
*/
50
std::size_t
nonmkv_order
= 20;
51
/**
52
* `options.config.phfit`: true selects the two-moment concentrated-ME fit
53
* (the reference default), false the Bernstein density fit. MAM consumes a
54
* matrix exponential happily, so the default stands here.
55
*/
56
bool
phfit_cme
=
true
;
57
/**
58
* `options.config.num_cdf_pts`: how many points the response-time CDF is
59
* evaluated at. The GLOBAL default is 200, not the 100 that
60
* `solver_mam_passage_time.m`'s own fallback names -- the fallback is dead,
61
* because SolverOptions always sets the field. Measured: MATLAB returns 200
62
* rows for a model whose `options.config` was never touched.
63
*/
64
std::size_t
num_cdf_pts
= 200;
65
/**
66
* `options.cutoff`: the level truncation `getProb` / `getProbMarg` use for
67
* an OPEN model, where the queue length is unbounded. 0 selects the
68
* reference's default of 100.
69
*/
70
std::size_t
cutoff
= 0;
71
/**
72
* `options.config.bgstates_max`: the cap on the number of states of the
73
* bgchain background chain, which enumerates the closed-class population
74
* vector and so grows as nchoosek(N+Mc-1,Mc-1) per background class. 0
75
* selects the default of 20000. Exceeding it is a named error, not a silent
76
* degradation.
77
*/
78
std::size_t
bgstates_max
= 0;
79
/**
80
* `options.config.bgaggr`: the number G of AGGREGATE background classes the
81
* bgchain method carries, so the chain has 1 + G classes. G = 1 is the
82
* classic tagged/aggregate pair and the default; G >= R-1 aggregates nothing
83
* and carries every closed chain exactly. 0 selects the default of 1.
84
*/
85
std::size_t
bgaggr
= 0;
86
/**
87
* `options.config.qbdphases_max`: the cap on the phase count of one bgchain
88
* station QBD, the product (arrival order) x (environment states) x (service
89
* phases). 0 selects the default of 500.
90
*/
91
std::size_t
qbdphases_max
= 0;
92
/**
93
* `options.config.fj_accuracy`: the FJ_codes truncation C of the
94
* queue-length DIFFERENCE between the two fork-join branches. Larger is
95
* more accurate and costs (C + 1) m^2 ma in every matrix dimension; the
96
* reference default is 100.
97
*/
98
std::size_t
fj_accuracy
= 100;
99
/**
100
* `options.config.fj_tmode`: which route `computeT.m` takes to the T
101
* matrix, 'NARE' (Riccati, the reference default) or 'Sylves' (the
102
* fixed-point iteration of Section 5.1).
103
*/
104
std::string
fj_tmode
=
"NARE"
;
105
/**
106
* `options.config.timescale`: "auto", "discrete" or "continuous". "auto"
107
* lets the distributions decide whether the model is slotted; the other two
108
* force the reading and raise when the model does not admit it.
109
*/
110
std::string
timescale
=
"auto"
;
111
/** `options.config.slotlength`: the slot in model time units. */
112
double
slotlength
= 1.0;
113
/**
114
* `options.timespan`: the transient horizon. SolverOptions('MAM') defaults
115
* it to [Inf, Inf], i.e. steady state only, and `runAnalyzer` treats a
116
* finite upper bound as the request for a transient solve.
117
*/
118
double
timespan_start
= 0.0;
119
double
timespan_end
= std::numeric_limits<double>::infinity();
120
};
121
122
/** What the MAM dispatch returns: the metrics plus the algorithm that ran. */
123
template
<
class
T>
124
struct
MamSolution
{
125
mva::MvaSolution<T>
sol
;
126
/** The concrete algorithm, as the reference's `actualmethod`. */
127
std::string
actualmethod
;
128
};
129
130
}
// namespace mam
131
}
// namespace line
132
133
#endif
// LINE_SOLVERS_MAM_MAM_TYPES_H
mva_types.h
The option and result types every MVA analyzer shares.
line::mam
Definition
amap2_adjust_gamma.h:78
line
Definition
aoi_dist2ph.h:52
line::mam::MamOptions
The options SolverMAM reads.
Definition
mam_types.h:29
line::mam::MamOptions::preserve_det
bool preserve_det
options.config.preserveDet: keep a Det service as Det so the exact MAP/D/c solver can claim it,...
Definition
mam_types.h:45
line::mam::MamOptions::iter_max
int iter_max
SolverOptions('MAM') lowers this from the global 1000 to 100.
Definition
mam_types.h:33
line::mam::MamOptions::num_cdf_pts
std::size_t num_cdf_pts
options.config.num_cdf_pts: how many points the response-time CDF is evaluated at.
Definition
mam_types.h:64
line::mam::MamOptions::timespan_start
double timespan_start
options.timespan: the transient horizon.
Definition
mam_types.h:118
line::mam::MamOptions::bgstates_max
std::size_t bgstates_max
options.config.bgstates_max: the cap on the number of states of the bgchain background chain,...
Definition
mam_types.h:78
line::mam::MamOptions::timescale
std::string timescale
options.config.timescale: "auto", "discrete" or "continuous".
Definition
mam_types.h:110
line::mam::MamOptions::bgaggr
std::size_t bgaggr
options.config.bgaggr: the number G of AGGREGATE background classes the bgchain method carries,...
Definition
mam_types.h:85
line::mam::MamOptions::phfit_cme
bool phfit_cme
options.config.phfit: true selects the two-moment concentrated-ME fit (the reference default),...
Definition
mam_types.h:56
line::mam::MamOptions::fj_accuracy
std::size_t fj_accuracy
options.config.fj_accuracy: the FJ_codes truncation C of the queue-length DIFFERENCE between the two ...
Definition
mam_types.h:98
line::mam::MamOptions::qbdphases_max
std::size_t qbdphases_max
options.config.qbdphases_max: the cap on the phase count of one bgchain station QBD,...
Definition
mam_types.h:91
line::mam::MamOptions::tol
double tol
Definition
mam_types.h:31
line::mam::MamOptions::method
std::string method
Definition
mam_types.h:30
line::mam::MamOptions::cutoff
std::size_t cutoff
options.cutoff: the level truncation getProb / getProbMarg use for an OPEN model, where the queue len...
Definition
mam_types.h:70
line::mam::MamOptions::nonmkv_order
std::size_t nonmkv_order
options.config.nonmkvorder: the phase budget sn_nonmarkov_toph spends replacing a non-Markovian servi...
Definition
mam_types.h:50
line::mam::MamOptions::space_max
std::size_t space_max
options.config.space_max: the order budget of the per-station arrival superposition,...
Definition
mam_types.h:39
line::mam::MamOptions::fj_tmode
std::string fj_tmode
options.config.fj_tmode: which route computeT.m takes to the T matrix, 'NARE' (Riccati,...
Definition
mam_types.h:104
line::mam::MamOptions::slotlength
double slotlength
options.config.slotlength: the slot in model time units.
Definition
mam_types.h:112
line::mam::MamOptions::timespan_end
double timespan_end
Definition
mam_types.h:119
line::mam::MamSolution
What the MAM dispatch returns: the metrics plus the algorithm that ran.
Definition
mam_types.h:124
line::mam::MamSolution::actualmethod
std::string actualmethod
The concrete algorithm, as the reference's actualmethod.
Definition
mam_types.h:127
line::mam::MamSolution::sol
mva::MvaSolution< T > sol
Definition
mam_types.h:125
line::mva::MvaSolution
Class-level results, the [Q,U,R,T,C,X] of the MATLAB analyzers.
Definition
mva_types.h:96
include
line
solvers
mam
mam_types.h
Generated by
1.18.0