5#ifndef LINE_SOLVERS_SOLVER_H
6#define LINE_SOLVERS_SOLVER_H
74 : row_(&
row), sn_(&
sn) {}
76 double total(std::size_t node)
const;
78 double at(std::size_t node, std::size_t cls)
const;
80 const std::vector<double>&
row()
const {
return *row_; }
83 std::size_t column(std::size_t node, std::size_t cls)
const;
84 const std::vector<double>* row_;
97 std::vector<double>
t;
98 std::vector<double>
F;
99 std::vector<double>
f;
109 std::vector<double>
m;
111 std::vector<double>
p;
222#define LINE_DECLARE_SOLVER(Cls, tag) \
223 class Cls : public NetworkSolver { \
225 explicit Cls(Network& m, const SolverOptions& o = SolverOptions()) \
226 : NetworkSolver(m, tag, o) {} \
227 Cls(Network& m, const std::string& method) \
228 : NetworkSolver(m, tag, SolverOptions().set_method(method)) {} \
236#undef LINE_DECLARE_SOLVER
259 std::vector<std::vector<CdfCurve> >
cdf_respt();
273 double prob_aggr(std::size_t node,
const std::vector<double>& state);
299 double prob_aggr(std::size_t node,
const std::vector<double>& state);
301 std::vector<double>
marg_aggr(std::size_t node);
303 std::vector<std::vector<CdfCurve> >
cdf_respt();
323 const std::vector<double>& tset = std::vector<double>());
327 const std::vector<double>& tset = std::vector<double>());
336 std::size_t nmax = 3,
340 std::size_t nmax = 3,
372 std::vector<std::vector<CdfCurve> >
cdf_respt();
413 bool jobs_ready_ =
false;
427 std::vector<std::vector<CdfCurve> >
cdf_respt();
488 std::string
choose_solver(
const std::string& getter =
"getAvg")
const;
499 std::vector<AutoCandidate>
find_solver(
const std::string& metric = std::string(),
500 bool show_all =
false)
const;
502 std::vector<io::Citation>
citations()
const {
return std::vector<io::Citation>(); }
505 std::vector<std::vector<CdfCurve> >
cdf_respt();
509 double prob_aggr(std::size_t node,
const std::vector<double>& state);
531 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.
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,...
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.
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.
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.
SolverLDES: the discrete-event simulator, which also answers the empirical response-time law.
SolverLDES(Network &m, const SolverOptions &o=SolverOptions())
SolverLDES & init_from_jobs(const Matrix< double > &jobs)
initFromJobs(jobs): start from a job-level initial state, one row per job [station,...
SolverLDES(Network &m, const std::string &method)
std::vector< std::vector< CdfCurve > > cdf_respt()
getCdfRespT(): the EMPIRICAL response-time CDF per (station, class), from the per-job samples.
const Matrix< double > & job_departures()
The [id, station, class, time] of every departure of a tagged job, from the same run.
const Matrix< double > & final_jobs()
getFinalJobs(): the jobs present at the end of the run, in the init_from_jobs layout.
SolverLDES & init_from_solver(NetworkSolver &aux)
initFromSolver(initSolver): warm-start from an auxiliary solver's steady state.
SolverLDES(Network &m, NetworkSolver &aux, const SolverOptions &o=SolverOptions())
SolverLDES(model, initSolver): warm-started from aux's steady state, see init_from_solver.
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.
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.
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...
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.
SolverBA(model, method).getBoundsTable().
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
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).
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.