5#ifndef LINE_SOLVERS_SOLVER_H
6#define LINE_SOLVERS_SOLVER_H
80 : row_(&
row), sn_(&
sn) {}
82 double total(std::size_t node)
const;
84 double at(std::size_t node, std::size_t cls)
const;
86 const std::vector<double>&
row()
const {
return *row_; }
89 std::size_t column(std::size_t node, std::size_t cls)
const;
90 const std::vector<double>* row_;
103 std::vector<double>
t;
104 std::vector<double>
F;
105 std::vector<double>
f;
115 std::vector<double>
m;
117 std::vector<double>
p;
130 std::vector<double>
t;
131 std::vector<std::vector<double> >
metric;
132 std::vector<std::vector<double> >
avg;
233 std::vector<Matrix<double>>
avg_tard();
253#define LINE_DECLARE_SOLVER(Cls, tag) \
254 class Cls : public NetworkSolver { \
256 explicit Cls(Network& m, const SolverOptions& o = SolverOptions()) \
257 : NetworkSolver(m, tag, o) {} \
258 Cls(Network& m, const std::string& method) \
259 : NetworkSolver(m, tag, SolverOptions().set_method(method)) {} \
266#undef LINE_DECLARE_SOLVER
311 std::vector<std::vector<CdfCurve> >
cdf_respt();
325 double prob_aggr(std::size_t node,
const std::vector<double>& state);
351 double prob_aggr(std::size_t node,
const std::vector<double>& state);
353 std::vector<double>
marg_aggr(std::size_t node);
355 std::vector<std::vector<CdfCurve> >
cdf_respt();
375 const std::vector<double>& tset = std::vector<double>());
379 const std::vector<double>& tset = std::vector<double>());
388 std::size_t nmax = 3,
392 std::size_t nmax = 3,
450 std::vector<double>
t;
451 std::vector<std::vector<double> >
metric;
467 std::vector<std::vector<CdfCurve> >
cdf_respt();
477 std::vector<PerctRespTCI>
perct_respt(
const std::vector<double>& percentiles = std::vector<double>(),
478 long job_class = -1,
const std::string& method = std::string());
480 std::vector<PerctRespTCI>
perct_respt(
const std::vector<double>& percentiles,
const std::string& job_class,
481 const std::string& method = std::string());
546 double prob_aggr(std::size_t node,
const std::vector<double>& counts = std::vector<double>());
571 std::vector<double>
avg_reward(std::vector<std::string>* names = 0);
584 const std::vector<std::size_t>& orders = std::vector<std::size_t>());
613 bool jobs_ready_ =
false;
614 std::string last_perct_method_;
628 std::vector<std::vector<CdfCurve> >
cdf_respt();
689 std::string
choose_solver(
const std::string& getter =
"getAvg")
const;
700 std::vector<AutoCandidate>
find_solver(
const std::string& metric = std::string(),
701 bool show_all =
false)
const;
703 std::vector<io::Citation>
citations()
const {
return std::vector<io::Citation>(); }
706 std::vector<std::vector<CdfCurve> >
cdf_respt();
710 double prob_aggr(std::size_t node,
const std::vector<double>& state);
732 static std::vector<std::string>
family_metrics(
const std::string& family);
The result tables a solver returns.
What a solver observed about the Cache nodes of a model.
The shared surface of every solver, Python's NetworkSolver.
Matrix< double > avg_respt_chain()
const SolverOptions & options() const
The options this solver was built with.
const solvers::CacheMetrics< double > & cache_metrics()
What the same solve observed at each Cache node, the data behind getAvgCacheTable() and getAvgItemTab...
std::vector< double > miss_ratio(const std::string &cache)
cache.getMissRatio() after the solve, with hit_ratio's conventions.
AvgFJTable avg_fj_table()
getAvgFJTable() (aliases getAvgFJT, fjAvgT, aFJT): the same metrics as a labelled table.
const solvers::FjMetrics< double > & avg_fj()
getAvgFJ(): the fork-join section metrics of the same solve, one row per Fork/Join pair (fj_sorted_pa...
solvers::FjMetrics< double > fj_
const std::string & get_name() const
getName(): the solver's own name, e.g.
AvgChain avg_chain()
getAvgChain(): the station table of the same solve aggregated by chain, (nstations x nchains).
solvers::CacheMetrics< double > cache_
AvgMetricTable avg_qlen_table()
getAvgQLenTable(): avg_table()'s Station, JobClass and QLen columns.
std::string method_used()
getMethodUsed(): the method the solve actually resolved to.
AvgSysTable avg_sys_table()
getAvgSysTable(): per-chain system response time and throughput of the same solve.
Matrix< double > avg_residt_chain()
std::vector< double > avg_sys_tput()
getAvgSysTput(): the per-chain system throughput column of avg_sys_table.
Matrix< double > avg_qlen_chain()
getAvgQLenChain() and its siblings: one matrix of avg_chain() each.
std::vector< Matrix< double > > avg_tard()
getAvgTard(): mean class tardiness E[(R - D)^+] against the JobClass deadlines, as {Tard (stations x ...
const AvgTable & run_analyzer()
runAnalyzer(): force the solve, returning the table it produced.
AvgMetricTable avg_respt_table()
getAvgRespTTable(): avg_table()'s Station, JobClass and RespT columns.
AvgMetricTable avg_tput_table()
getAvgTputTable(): avg_table()'s Station, JobClass and Tput columns.
std::vector< std::string > list_valid_methods() const
listValidMethods(): the methods this solver advertises on this model.
const AvgTable & avg_table()
getAvgTable(): the average table, solving on first demand.
std::vector< double > hit_ratio(const std::string &cache)
cache.getHitRatio() after the solve: the per-class hit probability at the named Cache,...
bool timed_out()
timedOut: whether the last solve stopped early on options.timeout (the metrics are then the interim s...
AvgMetricTable avg_util_table()
getAvgUtilTable(): avg_table()'s Station, JobClass and Util columns.
bool is_solved() const
isSolved() / hasResults(): whether a solve has been performed.
Network & model() const
The model this solver was built on.
void reset()
reset(): discard the cached solve.
NetworkSolver(Network &m, const std::string &name, const SolverOptions &o)
Matrix< double > avg_util_chain()
Matrix< double > avg_arvr_chain()
Matrix< double > avg_tput_chain()
AvgChainTable avg_chain_table()
getAvgChainTable(): avg_chain() as a labelled table, one row per (station, chain).
std::vector< double > avg_sys_respt()
getAvgSysRespT(): the per-chain system response time column of avg_sys_table.
solvers::LossnInfo lossn_
result.LossN: loss-network inputs of the last NC solve, else empty
A node of the model: the index it was given, and the model that owns it.
SolverAUTO (aliases AUTO, SolverAuto, LINE): the solver that picks a solver, a port of matlab/src/sol...
std::vector< std::string > proposed_solver_names(const std::string &getter="getAvg") const
delegate's retry order for that getter, as facade names; the chosen solver comes first.
static std::vector< std::string > family_names()
familyNames(): the method families, in the order a bare method name is looked up.
std::string choose_solver(const std::string &getter="getAvg") const
chooseSolver(getter): the facade name the configured method picks for that getter.
std::vector< io::Citation > citations() const
citations(): the selection policy's references, none.
SolverBA ba_solver() const
baSolver(): the SolverBA the bound calls go to, method 'auto' unless a bound method was named.
static std::vector< std::string > metric_groups()
metricGroups(), metricGroupOf(name) and familyMetrics(family).
std::vector< std::string > list_all_methods() const
listAllMethods(): every method name the constructor accepts, independent of the model.
Matrix< double > generator()
Matrix< double > state_space()
std::vector< std::vector< CdfCurve > > cdf_respt()
getCdfRespT(), delegated through the 'getCdfRespT' ranking.
static bool supports(Network &model)
supports(model): whether the model uses only features some family declares.
SymbolicSolution symbolic_solution()
BoundsTable bounds_table()
std::vector< std::string > candidate_solver_names() const
getCandidateSolverNames(): the facade names of the feasible candidates, in slot order.
SolverNC nc_solver() const
ncSolver(): the SolverNC the normalizing-constant calls go to.
SolverFLD fld_solver() const
fldSolver(): the SolverFLD the fluid-only calls go to.
std::string selected_solver_name()
getSelectedSolverName(): the facade name ("MVA", "FLD", ...) of the delegate that answered the last r...
SolverCTMC ctmc_solver() const
ctmcSolver(): the SolverCTMC the generator and state-space calls go to, with these options.
static std::vector< std::string > family_metrics(const std::string &family)
static std::string metric_group_of(const std::string &name)
static std::vector< std::string > feature_set()
getFeatureSet(): the union of the feature sets of SolverMVA, NC, CTMC, FLD, MAM, SSA,...
std::vector< AutoCandidate > find_solver(const std::string &metric=std::string(), bool show_all=false) const
findSolver(metric, showAll): which (family, method) pairs answer metric on this model.
std::string selected_method()
getSelectedMethod(): the method FAMILY of that delegate, lowercase ("mva", "fld").
bool is_stochastic()
isStochastic(): by the delegate that ran, else whether any candidate is a simulator.
TranAvg tran_avg()
getTranAvg(), delegated through the 'getTranAvg' ranking.
SolverAUTO(Network &m, const SolverOptions &o=SolverOptions())
double prob_aggr(std::size_t node, const std::vector< double > &state)
getProbAggr(node, state), delegated through the 'getProbAggr' ranking.
static std::vector< std::string > selection_intents()
selectionIntents().
bool is_composite() const
isComposite(): false, since this facade holds a flat Network.
SolverBA: the bounding solver, whose result is a bounds table.
BoundsTable bounds_table()
getBoundsTable(): the per-class queue-length and throughput bounds.
SolverBA(Network &m, const std::string &method)
SolverBA(Network &m, const SolverOptions &o=SolverOptions())
SolverCTMC: the average table plus the chain it was computed from.
static void print_inf_gen(const Matrix< double > &Q, const Matrix< double > &space)
CTMC.printInfGen(Q, SS): the generator beside the state it belongs to.
Matrix< double > generator()
getGenerator(): the infinitesimal generator over that space.
double prob_aggr(std::size_t node, const std::vector< double > &state)
getProbAggr(node, state): the aggregate marginal of one state.
Matrix< double > state_space()
getStateSpace(): the aggregate state space, one row per state.
FirstPassage cdf_first_passt(const Matrix< double > &A, const Matrix< double > &B, const Matrix< double > &C=Matrix< double >(), const std::vector< double > &tset=std::vector< double >())
getCdfFirstPassT(A, B, C, tset): the FIRST PASSAGE TIME from the state set A into the state set B.
SolverCTMC(Network &m, const SolverOptions &o=SolverOptions())
SymbolicSolution symbolic_solution()
getSymbolicSolution(): the stationary law over the rate symbols x1..xE.
AccReward acc_reward(const std::string &name=std::string())
getAccReward(name): the reward accumulated over [0, options.timespan_end] by uniformisation (mc::ctmc...
FirstPassageMoments first_passt_moments(const Matrix< double > &A, const Matrix< double > &B, std::size_t nmax=3, const Matrix< double > &C=Matrix< double >())
getFirstPassTMoments(A, B, nmax, C): moments of order 1..nmax of the same passage,...
std::vector< double > marg_aggr(std::size_t node)
getProbStateAggr(node): the marginal over every state of one station.
std::vector< std::vector< CdfCurve > > cdf_respt()
getCdfRespT(): the response-time CDF per (station, class).
Matrix< double > state_space_aggr()
getStateSpaceAggr(): per-(station, class) job counts of every state, in (ist-1)*K + k column order,...
SolverCTMC(Network &m, const std::string &method)
SolverFLD: the fluid solver, which also answers a transient.
SolverFLD(Network &m, const std::string &method)
std::vector< std::vector< CdfCurve > > cdf_respt()
getCdfRespT(): the response-time CDF per (station, class).
TranAvg tran_avg()
getTranAvg(): the transient mean queue length per station.
SolverFLD(Network &m, const SolverOptions &o=SolverOptions())
SolverJMT: the Java Modelling Tools client, which also answers a transient, a response-time law,...
TranAvg tran_avg()
getTranAvg(): E[N](t), averaged over options.config.replications (SolverOptions::replications,...
SolverJMT(Network &m, const SolverOptions &o=SolverOptions())
SamplePath sample(std::size_t events=0, std::size_t node=0)
sampleSysAggr(events), or sampleAggr(node, events) when node is given: one logged trajectory.
SolverJMT(Network &m, const std::string &method)
std::vector< std::vector< CdfCurve > > cdf_respt()
getCdfRespT(): the EMPIRICAL response-time CDF per (station, class).
double prob_aggr(std::size_t node, const std::vector< double > &state)
getProbAggr(node, state): the time the declared state is held for.
TranReward tran_reward(const std::string &name=std::string())
getTranReward(name): the rewards along the sampled path; an empty name gives all of them.
SolverLDES(Network &m, const SolverOptions &o=SolverOptions())
SamplePath sample(std::size_t node, std::size_t events)
sample(node, events): the EXACT sample path of one stateful node (1-based node), from one unaveraged ...
const qn::NetworkStruct< double > & get_struct()
getStruct(): the model's struct, after the named refusal of an uncapped PAS buffer.
double prob_aggr(std::size_t node, const std::vector< double > &counts=std::vector< double >())
getProbAggr(node, counts): the probability of per-class counts at a station node.
SamplePath sample_sys(std::size_t events)
sampleSys(events): the LINE State of every stateful node per step, and every event.
SolverLDES & init_from_jobs(const Matrix< double > &jobs)
initFromJobs(jobs): start from a job-level initial state, one row per job [station,...
static std::vector< std::string > ln_feature_set()
getLNFeatureSet(): the features the layered LDES engine accepts.
SolverLDES(Network &m, const std::string &method)
std::vector< std::vector< CdfCurve > > tran_cdf_passt()
getTranCdfPassT(): the same measurement under the name the reference gives it.
std::vector< std::vector< CdfCurve > > cdf_respt()
getCdfRespT(): the EMPIRICAL response-time CDF per (station, class), from the per-job samples.
static std::vector< CdfCurve > cdf_respt_ln(const lqn::LqnStruct< double > &lsn, const SolverOptions &o=SolverOptions())
getCdfRespTLN(): the empirical response-time CDF of every entry of a layered model,...
SamplePath sample_aggr(std::size_t node, std::size_t events)
sampleAggr(node, events): the same path as per-class job counts.
const Matrix< double > & job_departures()
The [id, station, class, time] of every departure of a tagged job, from the same run.
SamplePath sample_sys_aggr(std::size_t events)
sampleSysAggr(events): the per-class counts of every stateful node per step.
static std::vector< std::string > feature_set()
getFeatureSet(): the features the LDES engine declares for a Network.
const Matrix< double > & final_jobs()
getFinalJobs(): the jobs present at the end of the run, in the init_from_jobs layout.
double prob_sys_aggr()
getProbSysAggr(): the same quantity, the histogram being aggregate already.
std::vector< PerctRespTCI > perct_respt(const std::vector< double > &percentiles=std::vector< double >(), long job_class=-1, const std::string &method=std::string())
getPerctRespT(percentiles, jobclass, method): steady-state response-time percentiles with confidence ...
TranAvg tran_avg()
getTranAvg(): the transient E[N](t) per (station, class) over [0, options.timespan_end],...
const std::string & last_perct_method() const
lastPerctMethod: the procedure the last perct_respt actually used ('fquest' / 'firquest').
double prob(std::size_t node, const Matrix< double > &state=Matrix< double >())
getProb(node, state): the probability of a DETAILED state of one station node (1-based node),...
SolverLDES & init_from_solver(NetworkSolver &aux)
initFromSolver(initSolver): warm-start from an auxiliary solver's steady state.
BusyPeriodTable avg_busy_period(const std::vector< std::size_t > &stations=std::vector< std::size_t >(), long job_class=-1, const std::vector< std::size_t > &orders=std::vector< std::size_t >())
getAvgBusyPeriod(stations, jobclass, n): the mean busy periods of the given orders.
SolverLDES(Network &m, NetworkSolver &aux, const SolverOptions &o=SolverOptions())
SolverLDES(model, initSolver): warm-started from aux's steady state, see init_from_solver.
double prob_sys()
getProbSys(): the joint probability that every station holds its current-state counts.
static bool supports(Network &model)
supports(model): whether the Network uses only features the engine declares.
std::vector< std::vector< CdfCurve > > tran_cdf_respt()
getTranCdfRespT(): the empirical passage law, which is the same ECDF as cdf_respt.
std::vector< double > avg_reward(std::vector< std::string > *names=0)
getAvgReward(): E[r] for every declared reward, exact on the joint-state histogram,...
SolverNC: the normalizing-constant solver.
const solvers::LossnInfo & lossn_info()
The loss-network inputs (nu, A, C, link names, method) of the last solve, the reference's result....
SolverNC(Network &m, const SolverOptions &o=SolverOptions())
AvgLinkTable avg_link_table()
getAvgLinkTable(): per-link Capacity, Demand, Occupancy, LinkBlocking and RouteLoss of a loss network...
SolverNC(Network &m, const std::string &method)
One CTMC state as a state-set predicate sees it, the reference's RewardState: the AGGREGATE row of st...
double total(std::size_t node) const
s.at(node).total(): jobs of every class at a station node; a handle converts.
const std::vector< double > & row() const
The aggregate row itself.
double at(std::size_t node, std::size_t cls) const
s.at(node, cls): jobs of class cls (1-based; a handle converts) at a station node.
StateView(const std::vector< double > &row, const qn::NetworkStruct< double > &sn)
A network plus its refreshed NetworkStruct.
A queueing network under construction.
The routing matrix a model script fills in, MATLAB's P cell array.
Fork-join section metrics: FJQLen, FJRespT and FJTput of every Fork/Join pair.
Bibliographic references for the algorithms a run used.
The inputs of a loss network solved by SolverNC, kept beside the result.
Dense matrix and non-owning view.
Conservation laws of a layered queueing network, enumerated from its structure.
qn::RoutingMatrix< double > RoutingMatrix
model.init_routing_matrix()'s type, Python's RoutingMatrix.
qn::Network< double > Network
Network as a user names it: the double model, Python's Network.
AvgMetricTable avg_metric_view(const AvgTable &table, const std::string &metric)
The one-metric view of table, keeping every row of it.
std::function< bool(const StateView &)> StatePredicate
A STATE SET named by a predicate, the reference's function-handle form, e.g.
LINE_DECLARE_SOLVER(SolverMVA, "MVA")
The Network constructor API: Queue, Delay, Source, Sink, Router, ClassSwitch, Cache,...
The keyword arguments a solver takes, as one struct.
getAccReward(name): the reward accumulated over [t0, t], one row per reward.
std::vector< double > t
the absolute time grid, t[0] = t0
std::vector< std::vector< double > > avg
(nrewards x nt) time-averaged reward
std::vector< std::vector< double > > metric
(nrewards x nt) accumulated reward
std::vector< std::string > names
the reward names, in declaration order
One row of SolverAUTO::find_solver: a (family, method) pair and whether this model can run it.
bool runnable
the model passes this method's own support gate
std::string solver
the method family: "mva", "ctmc", "ldes", ...
std::string method
the qualified method name to pass, "mva.exact"
std::string method_class
"exact", "approx", "bound" or "simulation"
std::string reason
why a refused pair was refused, "" when runnable
std::string metrics
the measure groups the family answers, comma-joined
getAvgChainTable: the station table aggregated by CHAIN, one row per (station, chain),...
getAvgChain(): the station x chain matrices, @NetworkSolver/getAvgChain.m's outputs.
getAvgFJTable(): one row per (Fork/Join pair, class) with a nonzero metric, the fork-join SECTION met...
SolverNC.getAvgLinkTable(): the per-link measures of a loss network (an open model whose single Delay...
getAvgQLenTable(), getAvgUtilTable(), getAvgRespTTable(), getAvgTputTable(): the Station and JobClass...
getAvgSysTable(): one row per CHAIN, the cycle time and the completing throughput at the chain's refe...
std::vector< double > SysRespT
std::vector< double > SysTput
getAvgTable, one row per (station, class) that carries a metric.
bool timed_out
Whether the solve stopped early on SolverOptions::timeout, read from the budget's TRIPPED latch (line...
SolverBA(model, method).getBoundsTable().
SolverLDES: the discrete-event simulator, which also answers the empirical response-time law.
std::vector< std::size_t > orders
the busy period order of each column, 1-based
std::vector< std::string > names
getFirstPassTMoments(A, B, nmax, C): [m, mall, p] with the resolved sets.
Matrix< double > mall
(nstates x nmax), one row per starting state
std::vector< std::size_t > source
0-based state rows of A; empty = conditional stationary
std::vector< double > p
(nstates) probability of entering B before C
std::vector< std::size_t > target
0-based state rows of B
std::vector< double > m
moments 1..nmax from A (conditional on B before C)
std::vector< std::size_t > taboo
0-based state rows of C minus B
getCdfFirstPassT(A, B, C, tset): the curve, the reach probabilities and the resolved sets.
double tabooprob
probability of entering C before B
std::vector< std::size_t > taboo
0-based state rows of C minus B
std::vector< std::size_t > source
0-based state rows of A; empty = conditional stationary
std::vector< double > t
the grid: the caller's, else 1000 points to the horizon
double reachprob
probability of entering B (before C)
std::vector< double > F
F(t), DEFECTIVE under a taboo set.
std::vector< std::size_t > target
0-based state rows of B
std::vector< double > f
the density at t
One (station, class) row of SolverLDES::perct_respt: steady-state response-time percentiles with conf...
std::vector< double > values
std::vector< double > halfwidth
std::vector< bool > heuristic
std::vector< double > upper
std::vector< double > percentiles
std::vector< double > lower
sampleSysAggr / sampleAggr: ONE simulated trajectory, not a mean.
The knobs a solver reads; a negative or empty field keeps the engine default.
getSymbolicSolution: the stationary law as a function of the rate symbols.
getTranAvg: the transient mean queue length per (station, class).
getTranReward(name): each reward evaluated along the sampled state path, one row per reward.
std::vector< double > t
the time of each path point
std::vector< std::vector< double > > metric
(nrewards x nt) the reward at each point
std::vector< std::string > names
the reward names, in declaration order
Every Cache node of the model, in node order; empty on a model with none.
self.result.FJ: one row per Fork/Join pair, one column per class.