![]() |
LINE Solver (C++)
Templated C++ port of the LINE queueing solver
|
#include <line/solvers/solver.h>
Public Member Functions | |
| SolverLDES (Network &m, const SolverOptions &o=SolverOptions()) | |
| SolverLDES (Network &m, const std::string &method) | |
| SolverLDES (Network &m, NetworkSolver &aux, const SolverOptions &o=SolverOptions()) | |
| SolverLDES(model, initSolver): warm-started from aux's steady state, see init_from_solver. | |
| std::vector< std::vector< CdfCurve > > | cdf_respt () |
| getCdfRespT(): the EMPIRICAL response-time CDF per (station, class), from the per-job samples. | |
| 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 intervals, one row per (station, class) with samples. | |
| std::vector< PerctRespTCI > | perct_respt (const std::vector< double > &percentiles, const std::string &job_class, const std::string &method=std::string()) |
| The same, restricted to the class with this name. | |
| const std::string & | last_perct_method () const |
| lastPerctMethod: the procedure the last perct_respt actually used ('fquest' / 'firquest'). | |
| 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 run stopped after events rows (--sample-path). | |
| SamplePath | sample_aggr (std::size_t node, std::size_t events) |
| sampleAggr(node, events): the same path as per-class job counts. | |
| SamplePath | sample_sys (std::size_t events) |
| sampleSys(events): the LINE State of every stateful node per step, and every event. | |
| SamplePath | sample_sys_aggr (std::size_t events) |
| sampleSysAggr(events): the per-class counts of every stateful node per step. | |
| SolverLDES & | init_from_solver (NetworkSolver &aux) |
| initFromSolver(initSolver): warm-start from an auxiliary solver's steady state. | |
| SolverLDES & | init_from_jobs (const Matrix< double > &jobs) |
| initFromJobs(jobs): start from a job-level initial state, one row per job [station, class, remaining, elapsed, qage, sage, order, id] with 0-based indexes. | |
| const Matrix< double > & | final_jobs () |
| getFinalJobs(): the jobs present at the end of the run, in the init_from_jobs layout. | |
| const Matrix< double > & | job_departures () |
| The [id, station, class, time] of every departure of a tagged job, from the same run. | |
| 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), one row per state. | |
| 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. | |
| double | prob_sys () |
| getProbSys(): the joint probability that every station holds its current-state counts. | |
| double | prob_sys_aggr () |
| getProbSysAggr(): the same quantity, the histogram being aggregate already. | |
| std::vector< std::vector< CdfCurve > > | tran_cdf_respt () |
| getTranCdfRespT(): the empirical passage law, which is the same ECDF as cdf_respt. | |
| std::vector< std::vector< CdfCurve > > | tran_cdf_passt () |
| getTranCdfPassT(): the same measurement under the name the reference gives it. | |
| TranAvg | tran_avg () |
| getTranAvg(): the transient E[N](t) per (station, class) over [0, options.timespan_end], as INTERVAL MEANS of the queue length (--timespan with --trajectory). | |
| std::vector< double > | avg_reward (std::vector< std::string > *names=0) |
| getAvgReward(): E[r] for every declared reward, exact on the joint-state histogram, so a nonlinear reward is answered correctly. | |
| TranReward | tran_reward (const std::string &name=std::string()) |
| getTranReward(name): the rewards along the sampled path; an empty name gives all of them. | |
| 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. | |
| const qn::NetworkStruct< double > & | get_struct () |
| getStruct(): the model's struct, after the named refusal of an uncapped PAS buffer. | |
| Public Member Functions inherited from line::NetworkSolver | |
| virtual | ~NetworkSolver () |
| const std::string & | get_name () const |
| getName(): the solver's own name, e.g. | |
| const SolverOptions & | options () const |
| The options this solver was built with. | |
| Network & | model () const |
| The model this solver was built on. | |
| const AvgTable & | avg_table () |
| getAvgTable(): the average table, solving on first demand. | |
| AvgSysTable | avg_sys_table () |
| getAvgSysTable(): per-chain system response time and throughput of the same solve. | |
| AvgMetricTable | avg_qlen_table () |
| getAvgQLenTable(): avg_table()'s Station, JobClass and QLen columns. | |
| AvgMetricTable | avg_util_table () |
| getAvgUtilTable(): avg_table()'s Station, JobClass and Util columns. | |
| 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< double > | avg_sys_respt () |
| getAvgSysRespT(): the per-chain system response time column of avg_sys_table. | |
| std::vector< double > | avg_sys_tput () |
| getAvgSysTput(): the per-chain system throughput column of avg_sys_table. | |
| AvgChain | avg_chain () |
| getAvgChain(): the station table of the same solve aggregated by chain, (nstations x nchains). | |
| Matrix< double > | avg_qlen_chain () |
| getAvgQLenChain() and its siblings: one matrix of avg_chain() each. | |
| Matrix< double > | avg_util_chain () |
| Matrix< double > | avg_respt_chain () |
| Matrix< double > | avg_residt_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). | |
| const AvgTable & | run_analyzer () |
| runAnalyzer(): force the solve, returning the table it produced. | |
| std::vector< std::string > | list_valid_methods () const |
| listValidMethods(): the methods this solver advertises on this model. | |
| bool | is_solved () const |
| isSolved() / hasResults(): whether a solve has been performed. | |
| bool | timed_out () |
| timedOut: whether the last solve stopped early on options.timeout (the metrics are then the interim solution). | |
| void | reset () |
| reset(): discard the cached solve. | |
| std::string | method_used () |
| getMethodUsed(): the method the solve actually resolved to. | |
| const solvers::CacheMetrics< double > & | cache_metrics () |
| What the same solve observed at each Cache node, the data behind getAvgCacheTable() and getAvgItemTable(). | |
| std::vector< double > | hit_ratio (const std::string &cache) |
| cache.getHitRatio() after the solve: the per-class hit probability at the named Cache, NaN for a class that does not read it. | |
| std::vector< double > | hit_ratio (const Node &cache) |
| std::vector< double > | miss_ratio (const std::string &cache) |
| cache.getMissRatio() after the solve, with hit_ratio's conventions. | |
| std::vector< double > | miss_ratio (const Node &cache) |
| const solvers::FjMetrics< double > & | avg_fj () |
| getAvgFJ(): the fork-join section metrics of the same solve, one row per Fork/Join pair (fj_sorted_pairs), one column per class. | |
| AvgFJTable | avg_fj_table () |
| getAvgFJTable() (aliases getAvgFJT, fjAvgT, aFJT): the same metrics as a labelled table. | |
| AvgFJTable | avg_fjt () |
| AvgFJTable | fj_avg_t () |
| std::vector< Matrix< double > > | avg_tard () |
| getAvgTard(): mean class tardiness E[(R - D)^+] against the JobClass deadlines, as {Tard (stations x classes), SysTard (1 x classes)}. | |
Static Public Member Functions | |
| 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, in entry order, empty where the run observed nothing. | |
| static std::vector< std::string > | feature_set () |
| getFeatureSet(): the features the LDES engine declares for a Network. | |
| static std::vector< std::string > | ln_feature_set () |
| getLNFeatureSet(): the features the layered LDES engine accepts. | |
| static bool | supports (Network &model) |
| supports(model): whether the Network uses only features the engine declares. | |
| static bool | supports (const lqn::LqnStruct< double > &lsn) |
| supports(model) for a layered model: false when a host or task declares a load-, class- or joint-dependent rate, which the layered engine would serve at its nominal rate. | |
Additional Inherited Members | |
| Protected Member Functions inherited from line::NetworkSolver | |
| NetworkSolver (Network &m, const std::string &name, const SolverOptions &o) | |
| Protected Attributes inherited from line::NetworkSolver | |
| Network * | model_ |
| std::string | name_ |
| SolverOptions | opts_ |
| AvgTable | table_ |
| solvers::CacheMetrics< double > | cache_ |
| solvers::FjMetrics< double > | fj_ |
| solvers::LossnInfo | lossn_ |
| result.LossN: loss-network inputs of the last NC solve, else empty | |
| bool | solved_ = false |
|
inlineexplicit |
Definition at line 456 of file solver.h.
References line::NetworkSolver::NetworkSolver().
Referenced by line::SolverAUTO::cdf_respt(), init_from_jobs(), and init_from_solver().
|
inline |
Definition at line 458 of file solver.h.
References line::NetworkSolver::NetworkSolver().
|
inline |
SolverLDES(model, initSolver): warm-started from aux's steady state, see init_from_solver.
Definition at line 461 of file solver.h.
References init_from_solver(), and line::NetworkSolver::NetworkSolver().
| BusyPeriodTable line::SolverLDES::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.
stations are 1-based station indexes; empty returns EVERY target the engine measured, otherwise the one whose station set and class match (a set of two or more is declared with --busyperiod-subnet), and LINE:input:Argument when none does. job_class is 0-based, -1 for every class. orders defaults to {1}.
Definition at line 1973 of file solver_facade.cpp.
References line::ldes::LdesOptions::busy_period_orders, line::ldes::LdesOptions::busy_period_subnets, line::ldes::LdesResult::busy_periods, line::BusyPeriodTable::count, line::ExternalError::ExternalError(), line::qn::Network< T >::get_struct(), line::InputError::InputError(), line::ldes::LdesResult::BusyPeriodTarget::job_class, line::BusyPeriodTable::mean, line::NetworkSolver::model_, line::ldes::LdesResult::BusyPeriodTarget::name, line::BusyPeriodTable::names, line::NetworkSolver::opts_, line::BusyPeriodTable::orders, line::Matrix< T >::size(), line::ldes::solver_ldes(), and line::ldes::LdesResult::BusyPeriodTarget::stations.
| std::vector< double > line::SolverLDES::avg_reward | ( | std::vector< std::string > * | names = 0 | ) |
getAvgReward(): E[r] for every declared reward, exact on the joint-state histogram, so a nonlinear reward is answered correctly.
names (when given) receives the reward names.
Definition at line 1920 of file solver_facade.cpp.
References get_struct(), line::ldes::LdesResult::histogram_space, line::ldes::LdesResult::histogram_time, line::InputError::InputError(), line::NetworkSolver::opts_, line::Matrix< T >::rows(), and line::ldes::solver_ldes().
| std::vector< std::vector< CdfCurve > > line::SolverLDES::cdf_respt | ( | ) |
getCdfRespT(): the EMPIRICAL response-time CDF per (station, class), from the per-job samples.
Definition at line 1592 of file solver_facade.cpp.
References line::ExternalError::ExternalError(), line::qn::Network< T >::get_struct(), line::ldes::ldes_cdf_respt(), line::NetworkSolver::model_, line::NetworkSolver::opts_, line::ldes::LdesResult::respTimeSamples, line::Matrix< T >::rows(), and line::ldes::solver_ldes().
Referenced by tran_cdf_passt(), and tran_cdf_respt().
|
static |
getCdfRespTLN(): the empirical response-time CDF of every entry of a layered model, in entry order, empty where the run observed nothing.
Static because this facade holds a Network: the layered model is passed in, and is simulated by the in-process LN engine.
Definition at line 2053 of file solver_facade.cpp.
References line::ldes::engine::ldes_ln_cdf_respt(), and line::ldes::ldes_ln_engine_solve().
|
static |
getFeatureSet(): the features the LDES engine declares for a Network.
Definition at line 2064 of file solver_facade.cpp.
References line::qn::feature_name(), line::qn::ldes_feature_set(), and line::qn::FeatureSet::list().
| const Matrix< double > & line::SolverLDES::final_jobs | ( | ) |
getFinalJobs(): the jobs present at the end of the run, in the init_from_jobs layout.
A run made with track_jobs is reused; otherwise one is made with it. A transient run (timespan_end) is read at its horizon.
Definition at line 1712 of file solver_facade.cpp.
| const qn::NetworkStruct< double > & line::SolverLDES::get_struct | ( | ) |
getStruct(): the model's struct, after the named refusal of an uncapped PAS buffer.
Definition at line 2047 of file solver_facade.cpp.
References line::qn::Network< T >::get_struct(), line::NetworkSolver::model_, and line::io::require_finite_pas_buffers().
Referenced by avg_reward(), prob(), prob_aggr(), prob_sys(), tran_avg(), and tran_reward().
| SolverLDES & line::SolverLDES::init_from_jobs | ( | const Matrix< double > & | jobs | ) |
initFromJobs(jobs): start from a job-level initial state, one row per job [station, class, remaining, elapsed, qage, sage, order, id] with 0-based indexes.
remaining is the work still owed (-1 a fresh draw, -2 the residual given elapsed), qage and sage the time already spent at the station and in the system, order the rank at the station (the first ones take the servers), id an optional tag (-1 untagged). The layout is the one final_jobs returns, so s2.init_from_jobs(s1.final_jobs()) continues a run where it stopped, residual work included. Held by the solver rather than the model, since only LDES can honour it; takes precedence over the model state and init_sol, and enables track_jobs. Supported at FCFS queues, the PS family and Delays.
Definition at line 1690 of file solver_facade.cpp.
References line::Matrix< T >::cols(), line::SolverOptions::init_jobs, line::InputError::InputError(), line::NetworkSolver::opts_, line::NetworkSolver::reset(), line::Matrix< T >::rows(), SolverLDES(), and line::SolverOptions::track_jobs.
| SolverLDES & line::SolverLDES::init_from_solver | ( | NetworkSolver & | aux | ) |
initFromSolver(initSolver): warm-start from an auxiliary solver's steady state.
A SolverCTMC gives the mode of its exact aggregate stationary distribution, any other solver its mean queue lengths rounded to a placement conserving each closed population. The placement is declared as the MODEL initial state, one row per station under a prior of one, which LDES starts from as every state-driven solver does, so it changes the model shared with any other solver. The transient filter is then disabled (tranfilter=fixed, warmupfrac=0), since the run starts near steady state.
Definition at line 1646 of file solver_facade.cpp.
References line::NetworkSolver::avg_table(), line::qn::from_marginal(), line::NetworkSolver::get_name(), line::qn::Network< T >::get_struct(), line::InputError::InputError(), line::AvgTable::JobClass, line::NetworkSolver::model_, line::NetworkSolver::NetworkSolver(), line::NetworkSolver::options(), line::NetworkSolver::opts_, line::AvgTable::QLen, line::NetworkSolver::reset(), line::qn::Network< T >::set_state_prior(), SolverLDES(), line::lang::Source, line::AvgTable::Station, line::SolverOptions::tranfilter, line::ldes::warm_start_placement_from_ctmc(), line::ldes::warm_start_placement_from_qlen(), and line::SolverOptions::warmupfrac.
Referenced by SolverLDES().
| const Matrix< double > & line::SolverLDES::job_departures | ( | ) |
The [id, station, class, time] of every departure of a tagged job, from the same run.
Definition at line 1717 of file solver_facade.cpp.
|
inline |
lastPerctMethod: the procedure the last perct_respt actually used ('fquest' / 'firquest').
|
static |
getLNFeatureSet(): the features the layered LDES engine accepts.
Definition at line 2071 of file solver_facade.cpp.
References line::qn::feature_name().
| std::vector< PerctRespTCI > line::SolverLDES::perct_respt | ( | const std::vector< double > & | percentiles, |
| const std::string & | job_class, | ||
| const std::string & | method = std::string() ) |
The same, restricted to the class with this name.
Definition at line 1638 of file solver_facade.cpp.
References line::qn::Network< T >::get_struct(), line::InputError::InputError(), line::NetworkSolver::model_, and perct_respt().
| std::vector< PerctRespTCI > line::SolverLDES::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 intervals, one row per (station, class) with samples.
percentiles are fractions in (0,1) or percentages (empty: 10,25,50,75,90,95,99 percent). method "" / "default" picks 'fquest' when options().replications <= 1 and 'firquest' when it is >= 2; naming the other one is LINE:input:Method. job_class is a 0-based index, -1 for every class. The level is options().confint when set, else 0.95.
Definition at line 1612 of file solver_facade.cpp.
References line::qn::Network< T >::get_struct(), line::PerctRespTCI::halfwidth, line::PerctRespTCI::heuristic, line::PerctRespTCI::job_class, line::ldes::ldes_perct_method(), line::ldes::ldes_perct_respt(), line::ldes::ldes_replications(), line::PerctRespTCI::level, line::PerctRespTCI::lower, line::PerctRespTCI::method, line::NetworkSolver::model_, line::NetworkSolver::opts_, line::PerctRespTCI::percentiles, line::PerctRespTCI::samples, line::PerctRespTCI::station, line::PerctRespTCI::upper, and line::PerctRespTCI::values.
Referenced by perct_respt().
| double line::SolverLDES::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), one row per state.
Each row is aggregated to its per-class counts (toMarginal) before it is matched, since the engine's histogram records counts and not buffer order or phases; several rows sum, all against ONE run. An empty state takes the model's current (declared, else default) state. A node that is not a station is LINE:input:Argument.
Definition at line 1821 of file solver_facade.cpp.
References line::Matrix< T >::cols(), get_struct(), line::ldes::ldes_prob_from_histogram(), line::qn::Marginal< T >::nir, line::NetworkSolver::opts_, line::Matrix< T >::rows(), and line::qn::to_marginal().
| double line::SolverLDES::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.
Definition at line 1856 of file solver_facade.cpp.
References get_struct(), line::ldes::ldes_prob_from_histogram(), and line::NetworkSolver::opts_.
| double line::SolverLDES::prob_sys | ( | ) |
getProbSys(): the joint probability that every station holds its current-state counts.
A Source takes no part in the match (it holds no jobs and its columns are zero).
Definition at line 1866 of file solver_facade.cpp.
References line::ldes::LdesStateQuery::counts, get_struct(), line::ldes::ldes_prob_from_histogram(), line::NetworkSolver::opts_, line::lang::Source, and line::ldes::LdesStateQuery::station.
Referenced by prob_sys_aggr().
| double line::SolverLDES::prob_sys_aggr | ( | ) |
getProbSysAggr(): the same quantity, the histogram being aggregate already.
Definition at line 1881 of file solver_facade.cpp.
References prob_sys().
| SamplePath line::SolverLDES::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 run stopped after events rows (--sample-path).
Row k is the LINE State occupied until t[k], as in SolverSSA, and event holds the node's events with persistent job ids and service phases. Refused by name (LINE:unsupported:SamplePath) at a node whose detailed state the engine cannot encode; sample_aggr still answers there.
Definition at line 1754 of file solver_facade.cpp.
References line::qn::Network< T >::get_struct(), line::ldes::ldes_sample(), line::NetworkSolver::model_, and line::NetworkSolver::opts_.
| SamplePath line::SolverLDES::sample_aggr | ( | std::size_t | node, |
| std::size_t | events ) |
sampleAggr(node, events): the same path as per-class job counts.
Definition at line 1759 of file solver_facade.cpp.
References line::qn::Network< T >::get_struct(), line::ldes::ldes_sample_aggr(), line::NetworkSolver::model_, and line::NetworkSolver::opts_.
| SamplePath line::SolverLDES::sample_sys | ( | std::size_t | events | ) |
sampleSys(events): the LINE State of every stateful node per step, and every event.
Definition at line 1764 of file solver_facade.cpp.
References line::qn::Network< T >::get_struct(), line::ldes::ldes_sample_sys(), line::NetworkSolver::model_, and line::NetworkSolver::opts_.
| SamplePath line::SolverLDES::sample_sys_aggr | ( | std::size_t | events | ) |
sampleSysAggr(events): the per-class counts of every stateful node per step.
Definition at line 1769 of file solver_facade.cpp.
References line::qn::Network< T >::get_struct(), line::ldes::ldes_sample_sys_aggr(), line::NetworkSolver::model_, and line::NetworkSolver::opts_.
|
static |
supports(model) for a layered model: false when a host or task declares a load-, class- or joint-dependent rate, which the layered engine would serve at its nominal rate.
Definition at line 2108 of file solver_facade.cpp.
References line::ldes::ldes_ln_refusal().
|
static |
supports(model): whether the Network uses only features the engine declares.
Definition at line 2102 of file solver_facade.cpp.
References line::qn::feature_set_supports(), line::qn::Network< T >::get_struct(), line::qn::ldes_feature_set(), line::NetworkSolver::model(), line::qn::SupportResult::ok, and line::qn::used_lang_features().
| TranAvg line::SolverLDES::tran_avg | ( | ) |
getTranAvg(): the transient E[N](t) per (station, class) over [0, options.timespan_end], as INTERVAL MEANS of the queue length (--timespan with --trajectory).
A finite positive timespan_end is required.
Definition at line 1887 of file solver_facade.cpp.
References line::ExternalError::ExternalError(), get_struct(), line::InputError::InputError(), line::SamplePath::label, line::NetworkSolver::opts_, line::ldes::LdesResult::QNt, line::ldes::solver_ldes(), line::ldes::LdesResult::t, and line::SolverOptions::timespan_end.
| std::vector< std::vector< CdfCurve > > line::SolverLDES::tran_cdf_passt | ( | ) |
getTranCdfPassT(): the same measurement under the name the reference gives it.
Definition at line 1885 of file solver_facade.cpp.
References cdf_respt().
| std::vector< std::vector< CdfCurve > > line::SolverLDES::tran_cdf_respt | ( | ) |
getTranCdfRespT(): the empirical passage law, which is the same ECDF as cdf_respt.
Definition at line 1883 of file solver_facade.cpp.
References cdf_respt().
| TranReward line::SolverLDES::tran_reward | ( | const std::string & | name = std::string() | ) |
getTranReward(name): the rewards along the sampled path; an empty name gives all of them.
Definition at line 1944 of file solver_facade.cpp.
References line::Matrix< T >::cols(), get_struct(), line::InputError::InputError(), line::TranReward::metric, line::TranReward::names, line::NetworkSolver::opts_, line::Matrix< T >::rows(), line::ldes::solver_ldes(), line::TranReward::t, line::ldes::LdesResult::traj_space, and line::ldes::LdesResult::traj_time.