![]() |
LINE Solver (C++)
Templated C++ port of the LINE queueing solver
|
#include <line/solvers/ln/solver_ln.h>
Public Member Functions | |
| SolverLN (const LqnStruct< T > &lqn_in, const LnOptions &options) | |
| bool | warmstarted () const |
| True once init() seeded the iterate from config.warmstart; converged() then drops iter_min. | |
| const std::vector< double > & | nlp_solution () const |
| method='nlp': the program's solution, clipped at zero, in the program's variable order. | |
| double | nlp_objective () const |
| method='nlp': the program's objective at nlp_solution(). | |
| ::line::lqn::NlpProgram | nlp_program () const |
| The QD-AMVA program of this model under the solver's nlp options, the program method='nlp' roots and warmstart='nlp' seeds from. | |
| LnSolution< T > | get_ensemble_avg () |
| Port of getEnsembleAvg: run the iteration and aggregate onto LQN elements. | |
| LnSolution< T > | trapped_overlay (LnSolution< T > s) const |
| Nested blocking of the reference tasks trapped at a zero-capacity element (ln_zero_capacity): every element on a blocked call path holds the requests stuck below it and never completes one. | |
| std::vector< LnCdf > | get_cdf_respt () |
| Port of @SolverLN/getCdfRespT: the per-entry response-time distribution. | |
| LnTranSolution | get_tran_avg () |
| Port of @SolverLN/getTranAvg: the block-diagonal aggregate transient. | |
| LnSensTable< T > | get_sensitivity_table (const sens::SensOptions &sopt) |
| Port of @SolverLN/getSensitivityTable: solve the ensemble, then concatenate each layer solver's own table under a leading Layer column. | |
| LnSolution< T > | box_bounds () |
| Majumdar-Woodside robust box bounds, reported in the shape of a solution. | |
| std::size_t | nlayers () const |
| const std::vector< qn::Layer< T > > & | layers () const |
| LnLayerBlocks | layer_blocks () const |
| Port of LayeredNetwork.layerBlocks: the block-diagonal layout of the layers in the aggregate (station x class) view. | |
| void | get_block_avg (Matrix< T > &QN, Matrix< T > &UN, Matrix< T > &TN) const |
| Port of getBlockAvg: the layers' own STEADY averages, in the block-diagonal layout of layer_blocks (each off-block cell 0). | |
| void | init_from_marginal (const Matrix< double > &n) |
| Port of LayeredNetwork.initFromMarginal: split an aggregate (M x K) mean queue-length matrix into per-layer blocks and warm-start each layer from its own. | |
| void | set_tran_grid (const std::vector< double > &g) |
| Install the explicit output grid of the layered transient; see LnOptions::tran_grid. | |
| const std::vector< std::vector< LayerResult< T > > > & | iteration_results () const |
| Diagnostic access to the per-iteration layer results, for the regression. | |
| const std::vector< T > & | state_servt () const |
| const std::vector< T > & | state_residt () const |
| const std::vector< T > & | state_tput () const |
| const std::vector< T > & | state_thinkt () const |
| const std::vector< T > & | state_callservt () const |
| const std::vector< T > & | state_callresidt () const |
| const std::vector< Distrib< T > > & | state_servtproc () const |
| const std::vector< Distrib< T > > & | state_thinktproc () const |
| const std::vector< Distrib< T > > & | state_callservtproc () const |
| const std::vector< T > & | state_util () const |
| const std::vector< double > & | state_maxitererr () const |
| Per iteration, the layer-summed max queue-length change the convergence test reads (index 0 unused). | |
| const std::string & | state_lnmethod () const |
| The method the layers were built for: "srvn.ph", "srvn.cs" or "moment3". | |
| const std::string & | state_interlock_method () const |
| The interlock tracking method this run USES: "ilrate", "refpath" or "none". | |
| const std::vector< double > & | state_refpath_stages () const |
| Per reference-path stage key, the stage mean the last iteration installed. | |
| LnInterlockChoice | interlock_method_for () const |
| Port of SolverLN.interlockMethodFor: the method a solve would use, asked through the same query build_layers asks. | |
Static Public Member Functions | |
| static std::vector< std::string > | list_valid_methods () |
| Port of SolverLN.listValidMethods. | |
Definition at line 543 of file solver_ln.h.
|
inline |
Definition at line 558 of file solver_ln.h.
|
inline |
Majumdar-Woodside robust box bounds, reported in the shape of a solution.
mw.upper reports the upper bound of both throughput and processor utilization, mw.lower the lower bound of both. Everything the bound does not define – queue length, response time, residence time, arrival rate – is left UNDEFINED rather than zeroed.
Definition at line 786 of file solver_ln.h.
References line::ln::LnSolution< T >::AN, line::ln::LnSolution< T >::converged, line::ln::LnSolution< T >::defined_A, line::ln::LnSolution< T >::defined_Q, line::ln::LnSolution< T >::defined_R, line::ln::LnSolution< T >::defined_T, line::ln::LnSolution< T >::defined_U, line::ln::LnSolution< T >::defined_W, line::ln::LnSolution< T >::is_bound, line::ln::LnSolution< T >::iterations, line::lqn::lqn_boxbounds(), line::ln::LnSolution< T >::QN, line::ln::LnSolution< T >::RN, line::ln::LnSolution< T >::TN, line::ln::LnSolution< T >::UN, and line::ln::LnSolution< T >::WN.
Referenced by get_ensemble_avg().
|
inline |
Port of getBlockAvg: the layers' own STEADY averages, in the block-diagonal layout of layer_blocks (each off-block cell 0).
This is not get_ensemble_avg, whose answer is indexed by LQN element and carries no station or class meaning. It reads the last iterate of the fixed point and does NOT run it, so get_ensemble_avg must have run. A non-finite cell is an ABSENT station-class pair and is returned as 0.
Definition at line 857 of file solver_ln.h.
References line::ln::LnLayerBlocks::coff, line::Matrix< T >::cols(), line::InputError::InputError(), line::ln::LnLayerBlocks::K, line::ln::LnLayerBlocks::ksz, layer_blocks(), line::ln::LnLayerBlocks::M, line::Matrix< T >::Matrix(), line::ln::LnLayerBlocks::msz, line::ln::LayerResult< T >::QN, line::ln::LnLayerBlocks::roff, line::Matrix< T >::rows(), line::ln::LayerResult< T >::TN, and line::ln::LayerResult< T >::UN.
|
inline |
Port of @SolverLN/getCdfRespT: the per-entry response-time distribution.
ONLY THE moment3 METHOD PRODUCES ONE. The reference reacts to an empty table by re-running getAvg under method='moment3' and restoring the caller's method afterwards, and so does this: the distribution is the whole point of that method, and the mean-based update has no distribution to report, not a coarser one.
Indexed by entry NUMBER 1..nentries, as the reference's entrycdfrespt{eidx - (nhosts+ntasks)} is.
Definition at line 669 of file solver_ln.h.
References line::UnsupportedError::UnsupportedError().
Referenced by line::ln::lqn_cdf_respt().
|
inline |
Port of getEnsembleAvg: run the iteration and aggregate onto LQN elements.
Definition at line 600 of file solver_ln.h.
References box_bounds(), and trapped_overlay().
Referenced by line::lqn::focus_detail::build(), and line::lqn::focus_detail::solve().
|
inline |
Port of @SolverLN/getSensitivityTable: solve the ensemble, then concatenate each layer solver's own table under a leading Layer column.
WHAT THESE DERIVATIVES MEAN, and the reference is emphatic about it: each entry is a partial derivative WITHIN ITS LAYER, taken with the layer parameters the fixed point produced held fixed. Perturbing a host demand moves the think times, populations and demands of every other layer through the fixed-point map, and that indirect term is NOT included. The table attributes a bottleneck inside a layer; it does not predict the effect of a parameter change on the solved layered model.
Definition at line 735 of file solver_ln.h.
References line::sens::SensRow< T >::dQLen, line::sens::SensRow< T >::dRespT, line::sens::SensRow< T >::dTput, line::sens::SensRow< T >::dUtil, line::sens::SensRow< T >::jobclass, line::ln::LnSensTable< T >::layer_methods, line::ln::LnSensTable< T >::layer_tables, line::ln::LnSensTable< T >::method, line::sens::SensTable< T >::method, line::ln::LnSensTable< T >::rows, line::sens::SensTable< T >::rows, line::sens::SensOptions::simulation, line::sens::solver_sensitivity_table(), line::sens::SensRow< T >::station, and line::UnsupportedError::UnsupportedError().
Referenced by line::opt::LineEvaluator::evaluate_layered_sensitivities(), and line::ln::lqn_sensitivity_table().
|
inline |
Port of @SolverLN/getTranAvg: the block-diagonal aggregate transient.
opt.ln_transient selects the coupling; both modes return the same layout, and iteration 0 of the coupled relaxation IS the decoupled answer.
Definition at line 712 of file solver_ln.h.
References line::InputError::InputError(), and line::UnsupportedError::UnsupportedError().
Referenced by line::ln::lqn_tran_avg().
|
inline |
Port of LayeredNetwork.initFromMarginal: split an aggregate (M x K) mean queue-length matrix into per-layer blocks and warm-start each layer from its own.
WHY THIS IS RECORDED AND NOT APPLIED HERE, which is the trap the JAR and python ports both hit: the layered fixed point RESETS its layers as it converges, so a warm start installed before the solve does not survive it. The blocks are therefore kept and replayed by run_layer_transient, i.e. after the fixed point and immediately before each layer's transient – the steady solve ignores an initial state, the transient does not.
THE BLOCK IS NOT ROUNDED. The reference rounds a replayed block onto the integer lattice for every layer engine EXCEPT the fluid one, and the layered transient exists only over fluid layers (require_transient_ready refuses the rest), so the branch that would round has no reachable case here. Rounding a fluid state would quantize the very quantity SolverENV's fixed point is iterating on.
An empty matrix clears the warm start, so a caller can put the layers back on their default initial state without rebuilding the solver.
Definition at line 902 of file solver_ln.h.
References line::ln::LnLayerBlocks::coff, line::Matrix< T >::cols(), line::Matrix< T >::empty(), line::fluid::FluidLayout::enabled, line::fluid::fluid_layout(), line::InputError::InputError(), line::ln::LnLayerBlocks::K, line::ln::LnLayerBlocks::ksz, layer_blocks(), line::ln::LnLayerBlocks::M, line::ln::LnLayerBlocks::msz, line::qn::NetworkStruct< T >::nclasses, line::fluid::FluidLayout::nstates, line::qn::NetworkStruct< T >::nstations, line::fluid::FluidLayout::qidx, line::ln::LnLayerBlocks::roff, and line::Matrix< T >::rows().
|
inline |
Port of SolverLN.interlockMethodFor: the method a solve would use, asked through the same query build_layers asks.
Like the reference it does not see the construct-time demotion of a refpath that merged nothing; that recorded answer is state_interlock_method().
Definition at line 967 of file solver_ln.h.
References line::ln::ln_interlock_method().
|
inline |
Diagnostic access to the per-iteration layer results, for the regression.
Definition at line 937 of file solver_ln.h.
|
inline |
Port of LayeredNetwork.layerBlocks: the block-diagonal layout of the layers in the aggregate (station x class) view.
Available as soon as the solver is constructed – build_layers runs in the constructor – which is what lets SolverENV compare the shapes of its stages before solving any of them.
Definition at line 830 of file solver_ln.h.
References line::ln::LnLayerBlocks::coff, line::ln::LnLayerBlocks::K, line::ln::LnLayerBlocks::ksz, line::ln::LnLayerBlocks::M, line::ln::LnLayerBlocks::msz, and line::ln::LnLayerBlocks::roff.
Referenced by get_block_avg(), and init_from_marginal().
|
inline |
Definition at line 820 of file solver_ln.h.
|
inlinestatic |
Port of SolverLN.listValidMethods.
Each name states the LAYERING and the ENCODING; ln_requested_method normalises the alias spellings ("ph", "cs", "srvncs", "flatcs", "squashed", "squashed.ph") onto these, and they are left out here to keep the list unambiguous, exactly as the reference does.
Definition at line 553 of file solver_ln.h.
|
inline |
Definition at line 819 of file solver_ln.h.
|
inline |
method='nlp': the program's objective at nlp_solution().
Definition at line 585 of file solver_ln.h.
|
inline |
The QD-AMVA program of this model under the solver's nlp options, the program method='nlp' roots and warmstart='nlp' seeds from.
Definition at line 591 of file solver_ln.h.
References line::lqn::NlpOptions::alpha, line::lqn::NlpOptions::fork, and line::lqn::NlpOptions::lld.
|
inline |
method='nlp': the program's solution, clipped at zero, in the program's variable order.
Definition at line 583 of file solver_ln.h.
|
inline |
Install the explicit output grid of the layered transient; see LnOptions::tran_grid.
Definition at line 934 of file solver_ln.h.
|
inline |
Definition at line 943 of file solver_ln.h.
|
inline |
Definition at line 942 of file solver_ln.h.
|
inline |
Definition at line 946 of file solver_ln.h.
|
inline |
The interlock tracking method this run USES: "ilrate", "refpath" or "none".
Recorded by build_layers and, when no layer merged a reference chain, demoted from "refpath" to "ilrate" at the end of construct.
Definition at line 957 of file solver_ln.h.
|
inline |
The method the layers were built for: "srvn.ph", "srvn.cs" or "moment3".
Definition at line 951 of file solver_ln.h.
|
inline |
Per iteration, the layer-summed max queue-length change the convergence test reads (index 0 unused).
Definition at line 949 of file solver_ln.h.
|
inline |
Per reference-path stage key, the stage mean the last iteration installed.
Definition at line 959 of file solver_ln.h.
|
inline |
Definition at line 939 of file solver_ln.h.
|
inline |
Definition at line 938 of file solver_ln.h.
|
inline |
Definition at line 944 of file solver_ln.h.
|
inline |
Definition at line 941 of file solver_ln.h.
|
inline |
Definition at line 945 of file solver_ln.h.
|
inline |
Definition at line 940 of file solver_ln.h.
|
inline |
Definition at line 947 of file solver_ln.h.
|
inline |
Nested blocking of the reference tasks trapped at a zero-capacity element (ln_zero_capacity): every element on a blocked call path holds the requests stuck below it and never completes one.
A processor keeps its undefined queue length. Port of trappedOverlay in @SolverLN/getEnsembleAvg.m.
Definition at line 622 of file solver_ln.h.
References line::ln::LnSolution< T >::defined_Q, line::ln::LnSolution< T >::defined_R, line::ln::LnSolution< T >::defined_T, line::ln::LnSolution< T >::defined_W, line::ln::LnSolution< T >::QN, line::ln::LnSolution< T >::RN, line::ln::LnSolution< T >::TN, and line::ln::LnSolution< T >::WN.
Referenced by get_ensemble_avg().
|
inline |
True once init() seeded the iterate from config.warmstart; converged() then drops iter_min.
Definition at line 581 of file solver_ln.h.