![]() |
LINE Solver (C++)
Templated C++ port of the LINE queueing solver
|
Classes | |
| struct | AgOptions |
| struct | AgResult |
| What the RCAT analyzer returns beyond the metrics. More... | |
| struct | AgWirePayload |
| One agent's static description, in the wire form the worker expects. More... | |
| class | AgWorkerPool |
| The connections to every configured worker, plus the agent partition. More... | |
Functions | |
| template<class T> | |
| mva::AvgResult< T > | solver_ag_run_analyzer (const qn::NetworkStruct< T > &L, const AgOptions &opt) |
| SolverAG.runAnalyzer: the converged agents as mean measures. | |
| template<class T, class Gen, class Sol> | |
| void | ag_sweep_serial (std::size_t n, Gen gen, Sol sol, std::vector< Matrix< T > > &Q, std::vector< std::vector< T > > &pi) |
| Evaluate every agent of one sweep. | |
| template<class T, class Gen, class Sol> | |
| void | ag_sweep_parallel (std::size_t n, unsigned nworkers, Gen gen, Sol sol, std::vector< Matrix< T > > &Q, std::vector< std::vector< T > > &pi) |
| The same sweep over a thread pool. | |
| template<class T, class Gen, class Sol, class Payload> | |
| void | ag_sweep_cluster (std::size_t n, AgWorkerPool &workers, const std::vector< T > &x, Gen gen, Sol sol, Payload payload, std::vector< Matrix< T > > &Q, std::vector< std::vector< T > > &pi) |
| The same sweep with the agents partitioned over remote ag-worker processes. | |
| const char * | exec_serial () |
| The caller's own loop, in agent order. | |
| const char * | exec_parallel () |
| Fan the agents of a sweep out over a local thread pool. | |
| const char * | exec_para () |
| The accepted alias of exec_parallel(), as SolverSSA spells it. | |
| bool | exec_is_parallel (const std::string &mode) |
| True for either spelling of the local-thread-pool backend. | |
| const char * | exec_cluster () |
| Partition the agents over remote ag-worker processes. | |
| std::vector< std::array< double, 3 > > | ag_triplets (const Matrix< double > &m) |
| Non-zero entries of M as [row, col, value] triplets, 0-based. | |
| bool | rcat_supports_process (lang::ProcessType t) |
| The process types the RCAT construction can give a phase dimension to. | |
| template<class T> | |
| AgResult< T > | solver_ag (const qn::NetworkStruct< T > &L, const AgOptions &opt, std::size_t max_states=0) |
| Port of solver_ag.m. | |
| template<class T> | |
| mva::MvaSolution< T > | solver_ag_autocat (const qn::NetworkStruct< T > &, const AgOptions &) |
| The reference signature takes RCAT rate matrices and an action-process map rather than a NetworkStruct, because autocat sits below the network layer. | |
| std::vector< std::string > | list_valid_methods () |
| Every method SolverAG serves, as the other families expose theirs. | |
| template<class T> | |
| AgResult< T > | solver_ag_solve (const qn::NetworkStruct< T > &L, const AgOptions &opt) |
| The gates and the dispatch of SolverAG's runAnalyzer. | |
| template<class T> | |
| Matrix< T > | kron (const Matrix< T > &A, const Matrix< T > &B) |
| Kronecker product. | |
| template<class T> | |
| Matrix< T > | krons (const Matrix< T > &A, const Matrix< T > &B) |
| Kronecker sum, MATLAB's krons: kron(A, I_nb) + kron(I_na, B). | |
| template<class T> | |
| Matrix< T > | qbd_R_logred (const Matrix< T > &B, const Matrix< T > &L, const Matrix< T > &F, unsigned iter_max, const T &tol) |
| R by logarithmic reduction (qbd_R_logred.m). | |
| void line::ag::ag_sweep_cluster | ( | std::size_t | n, |
| AgWorkerPool & | workers, | ||
| const std::vector< T > & | x, | ||
| Gen | gen, | ||
| Sol | sol, | ||
| Payload | payload, | ||
| std::vector< Matrix< T > > & | Q, | ||
| std::vector< std::vector< T > > & | pi ) |
The same sweep with the agents partitioned over remote ag-worker processes.
The generator is rebuilt here in any case – the metrics stage reads it, and assembling it is O(N^2) against the O(N^3) solve – so only the stationary vector crosses the wire back. An unreachable, slow or broken worker is not fatal: its agents fall through to sol on this process.
Definition at line 114 of file ag_exec.h.
References ag_sweep_cluster(), line::ag::AgWorkerPool::ensure_assigned(), line::ag::AgWorkerPool::sweep(), and line::UnsupportedError::UnsupportedError().
Referenced by ag_sweep_cluster().
| void line::ag::ag_sweep_parallel | ( | std::size_t | n, |
| unsigned | nworkers, | ||
| Gen | gen, | ||
| Sol | sol, | ||
| std::vector< Matrix< T > > & | Q, | ||
| std::vector< std::vector< T > > & | pi ) |
The same sweep over a thread pool.
Each task owns one agent and writes only its own slot, so no synchronisation beyond the join is needed and the result cannot depend on the interleaving.
Definition at line 78 of file ag_exec.h.
References ag_sweep_parallel(), and ag_sweep_serial().
Referenced by ag_sweep_parallel().
| void line::ag::ag_sweep_serial | ( | std::size_t | n, |
| Gen | gen, | ||
| Sol | sol, | ||
| std::vector< Matrix< T > > & | Q, | ||
| std::vector< std::vector< T > > & | pi ) |
Evaluate every agent of one sweep.
| n | number of agents |
| gen | k -> agent k's generator at the current reversed rates |
| sol | (Q_k, k) -> agent k's stationary vector |
| Q,pi | per-agent output slots, resized by the caller |
Definition at line 64 of file ag_exec.h.
References ag_sweep_serial().
Referenced by ag_sweep_parallel(), and ag_sweep_serial().
|
inline |
Non-zero entries of M as [row, col, value] triplets, 0-based.
Definition at line 66 of file ag_worker_client.h.
References ag_triplets(), line::Matrix< T >::cols(), and line::Matrix< T >::rows().
Referenced by ag_triplets().
|
inline |
Partition the agents over remote ag-worker processes.
Definition at line 47 of file ag_types.h.
References exec_cluster().
Referenced by exec_cluster(), and solver_ag().
|
inline |
True for either spelling of the local-thread-pool backend.
Definition at line 43 of file ag_types.h.
References exec_is_parallel(), exec_para(), and exec_parallel().
Referenced by exec_is_parallel(), and solver_ag().
|
inline |
The accepted alias of exec_parallel(), as SolverSSA spells it.
Definition at line 41 of file ag_types.h.
References exec_para().
Referenced by exec_is_parallel(), and exec_para().
|
inline |
Fan the agents of a sweep out over a local thread pool.
Named 'parallel', with 'para' accepted as an alias – the same pair SolverSSA's replica analyzer answers to (case {'para','parallel'} in solver_ssa_analyzer.m, m == "para" || m == "parallel" in solver_ssa_parallel.h), so one spelling convention covers both solvers. It was called 'threads' until 2026-08-19; that name is no longer accepted, and exec_is_parallel is the only place either spelling is recognised.
Definition at line 39 of file ag_types.h.
References exec_parallel().
Referenced by exec_is_parallel(), and exec_parallel().
|
inline |
The caller's own loop, in agent order.
The reference.
Definition at line 28 of file ag_types.h.
References exec_serial().
Referenced by exec_serial(), and solver_ag().
| Matrix< T > line::mam::kron | ( | const Matrix< T > & | A, |
| const Matrix< T > & | B ) |
Kronecker product.
Definition at line 57 of file mmap_lambda.h.
| Matrix< T > line::mam::krons | ( | const Matrix< T > & | A, |
| const Matrix< T > & | B ) |
Kronecker sum, MATLAB's krons: kron(A, I_nb) + kron(I_na, B).
Definition at line 71 of file mmap_lambda.h.
|
inline |
Every method SolverAG serves, as the other families expose theirs.
auto_family_methods asks each family for its own list rather than keeping a second copy, so the "ag" row of the AUTO report is this list and cannot drift from the one check_method refuses against.
Definition at line 180 of file solver_ag_runner.h.
References list_valid_methods().
Referenced by line::autosolver::auto_family_methods(), and list_valid_methods().
| Matrix< T > line::mam::qbd_R_logred | ( | const Matrix< T > & | B, |
| const Matrix< T > & | L, | ||
| const Matrix< T > & | F, | ||
| unsigned | iter_max, | ||
| const T & | tol ) |
R by logarithmic reduction (qbd_R_logred.m).
Builds the matrix S of the taboo probabilities of ever going down, doubling the horizon at every step, then recovers R = -F (L + F S)^-1. Quadratically convergent; the stopping test is on how close S e is to e, i.e. on how much mass of the downward passage is still unaccounted for.
|
inline |
The process types the RCAT construction can give a phase dimension to.
After sn_nonmarkov_toph (which the RCAT methods run with the phase-type fit and no Det preservation) each of these holds a genuine (D0,D1) pair with non-negative off-diagonal rates and a single arrival per epoch. The list is an ALLOW-list on purpose: a process type nobody has checked against this construction must be refused, not answered. Refused are the laws whose matrices are not a generator (ME, RAP), those that are not time-homogeneous (NHPP, MAPt, PHt), those that are not continuous-time (DMAP), and those that arrive in batches (BMAP, MMAP), since a batch moves the level by more than one.
Definition at line 1259 of file solver_ag.h.
References line::lang::APH, line::lang::COX2, line::lang::COXIAN, line::lang::DET, line::lang::DISABLED, line::lang::ERLANG, line::lang::EXP, line::lang::GAMMA, line::lang::HYPEREXP, line::lang::IMMEDIATE, line::lang::LOGNORMAL, line::lang::MAP, line::lang::MMPP2, line::lang::PARETO, line::lang::PH, rcat_supports_process(), line::lang::REPLAYER, line::lang::UNIFORM, and line::lang::WEIBULL.
Referenced by rcat_supports_process().
| AgResult< T > line::ag::solver_ag | ( | const qn::NetworkStruct< T > & | L, |
| const AgOptions & | opt, | ||
| std::size_t | max_states = 0 ) |
Port of solver_ag.m.
max_states is the reference's options.config.maxStates, the truncation of every OPEN component. It defaults to AgOptions::max_states, which carries the reference's 100; the explicit parameter overrides it for a caller that has no options object to hand.
Definition at line 1308 of file solver_ag.h.
References line::ag::AgResult< T >::actualmethod, line::ag::AgWorkerPool::AgWorkerPool(), line::mc::ctmc_makeinfgen(), exec_cluster(), exec_is_parallel(), exec_serial(), line::InputError::InputError(), line::Matrix< T >::Matrix(), line::qn::NetworkStruct< T >::nclasses, line::qn::NetworkStruct< T >::nstations, line::ag::AgResult< T >::rcat_residual, line::ag::AgResult< T >::sol, solver_ag(), line::UnsupportedError::UnsupportedError(), and line::vecmul().
Referenced by solver_ag(), and solver_ag_solve().
| mva::MvaSolution< T > line::ag::solver_ag_autocat | ( | const qn::NetworkStruct< T > & | , |
| const AgOptions & | ) |
The reference signature takes RCAT rate matrices and an action-process map rather than a NetworkStruct, because autocat sits below the network layer.
The port keeps the struct-level signature the dispatch would need, since there is no body for the other one to feed.
It returns the plain mva::MvaSolution<T> the other analyzers return, not a wrapper carrying actualmethod: nothing can observe the return of a function that always throws, and the wrapper would leave the dispatch with a third result shape to unpack for no gain. solver_mam_ag.h's AgResult stays a wrapper because it carries a payload of its own.
Definition at line 61 of file solver_ag_autocat.h.
References solver_ag_autocat(), and line::UnsupportedError::UnsupportedError().
Referenced by solver_ag_autocat().
| mva::AvgResult< T > line::ag::solver_ag_run_analyzer | ( | const qn::NetworkStruct< T > & | L, |
| const AgOptions & | opt ) |
SolverAG.runAnalyzer: the converged agents as mean measures.
Definition at line 34 of file ag_dispatch.h.
References line::ag::AgResult< T >::actualmethod, line::mva::AvgResult< T >::actualmethod, line::mva::AvgResult< T >::AN, line::mva::ArvR, line::mva::MvaSolution< T >::C, line::mva::AvgResult< T >::CN, line::mva::filter_metric(), line::lang::GlobalConstants::FineTol, line::mva::AvgResult< T >::iter, line::mva::MvaSolution< T >::iter, line::mva::AvgResult< T >::method, line::qn::NetworkStruct< T >::nclasses, line::qn::NetworkStruct< T >::nstations, line::mva::MvaSolution< T >::Q, line::mva::QLen, line::mva::AvgResult< T >::QN, line::mva::MvaSolution< T >::R, line::mva::ResidT, line::mva::RespT, line::mva::AvgResult< T >::RN, line::mva::sn_get_arvr_from_tput(), line::mva::sn_get_residt_from_respt(), line::ag::AgResult< T >::sol, solver_ag_run_analyzer(), solver_ag_solve(), line::qn::NetworkStruct< T >::stations, line::mva::AvgResult< T >::TN, line::mva::MvaSolution< T >::Tp, line::mva::Tput, line::mva::MvaSolution< T >::U, line::mva::AvgResult< T >::UN, line::mva::Util, line::mva::AvgResult< T >::WN, line::mva::MvaSolution< T >::X, and line::mva::AvgResult< T >::XN.
Referenced by solver_ag_run_analyzer().
| AgResult< T > line::ag::solver_ag_solve | ( | const qn::NetworkStruct< T > & | L, |
| const AgOptions & | opt ) |
The gates and the dispatch of SolverAG's runAnalyzer.
The conversion is not method-dependent, unlike SolverMAM's: EVERY AG method builds a CTMC per agent out of (D0,D1), so a preserved Det would reach it with no matrix at all and be read back as its mean rate, and a concentrated matrix exponential is not a generator at all.
Definition at line 193 of file solver_ag_runner.h.
References line::qn::ag_feature_set(), line::qn::feature_gate(), line::api::NonmarkovOptions::order, line::api::Ph, line::api::NonmarkovOptions::phfit, line::api::NonmarkovOptions::preserve_det, line::api::sn_has_nonmarkov(), line::api::sn_nonmarkov_toph(), solver_ag(), and solver_ag_solve().
Referenced by solver_ag_run_analyzer(), and solver_ag_solve().