![]() |
LINE Solver (C++)
Templated C++ port of the LINE queueing solver
|
Port of @@SolverCTMC/getSymbolicGenerator and getSymbolicSolution. More...
#include <cmath>#include <cstddef>#include <cstdio>#include <memory>#include <string>#include <vector>#include "line/api/mc/ctmc_solve.h"#include "line/api/sym/sage_rest_engine.h"#include "line/api/sym/sym_engine.h"#include "line/api/sym/sym_engines.h"#include "line/lang/qn/network_struct.h"#include "line/lang/qn/state.h"#include "line/lang/qn/state_events.h"#include "line/solvers/ctmc/solver_ctmc_analyzer.h"#include "line/solvers/ctmc/solver_ctmc_getters.h"#include "line/util/error.h"#include "line/util/matrix.h"Go to the source code of this file.
Classes | |
| struct | line::ctmc::CtmcSymbolicOptions |
| Backend selection, mirroring options.config.symbolic and its timeout. More... | |
| struct | line::ctmc::CtmcSymbolicGenerator< T > |
| The outputs of @@SolverCTMC/getSymbolicGenerator. More... | |
| struct | line::ctmc::CtmcSymbolicSolution< T > |
| What @@SolverCTMC/getSymbolicSolution.m returns, plus the engine that answered. More... | |
Namespaces | |
| namespace | line |
| namespace | line::ctmc |
Functions | |
| template<class T> | |
| CtmcSymbolicGenerator< T > | line::ctmc::ctmc_symbolic_generator (const NetworkStruct< T > &sn, const CtmcOptions &opt, bool invert_symbol=false) |
| Port of @@SolverCTMC/getSymbolicGenerator.m. | |
| template<class T> | |
| Matrix< T > | line::ctmc::ctmc_symbolic_eval_infgen (const CtmcSymbolicGenerator< T > &g, const std::vector< T > &x) |
| Evaluates the symbolic generator at a symbol assignment, the twin of the JAR's evalInfGen. | |
| template<class T> | |
| CtmcSymbolicSolution< T > | line::ctmc::ctmc_symbolic_solution (const NetworkStruct< T > &sn, const CtmcOptions &opt, const CtmcSymbolicOptions &symopt=CtmcSymbolicOptions()) |
| Port of @@SolverCTMC/getSymbolicSolution.m: pi Q = 0 with sum(pi) = 1 over the field of rational functions in x1..xE. | |
Port of @@SolverCTMC/getSymbolicGenerator and getSymbolicSolution.
THE TWO HALVES ARE NOT THE SAME KIND OF PROBLEM, which is why they live in one header but only one of them needs a backend. The generator is LINEAR in the event symbols: each synchronization contributes one numeric filtration, normalized by its own minimum positive rate, scaled by its symbol x1..xE. So the symbolic generator is a sum of numeric matrices with symbolic coefficients, assembled here with no algebra system in sight and printed as expression strings at the end. Solving pi Q = 0 with it is a linear solve whose pivots are multivariate polynomials, which needs exact arithmetic with cancellation in a rational function field; that half is delegated to the backend api/sym resolves, exactly as the reference delegates it to the Symbolic Math Toolbox or to line-sage-rest.
WHY THE FILTRATION IS NORMALIZED. Dividing event e's filtration by its smallest positive rate makes the nominal value of x_e that rate, so the printed coefficients are RATIOS within one event and are 1 wherever the event fires at its base rate. Substituting the minimum positive rates therefore reproduces the numeric generator; ctmc_symbolic_eval_infgen does exactly that and is the check to run before trusting a printed normal form.
COEFFICIENT TEXT IS READ AS AN EXACT RATIONAL SERVER SIDE, so how a non-integer coefficient is printed changes the answer, not merely its appearance. This port prints the SHORTEST decimal that round-trips to the double, which is what the JAR's Double.toString emits; MATLAB prints %.17g, so on a coefficient such as 1/10 the two send different exact rationals to the same service. The divergence is deliberate here: the shortest form is the one whose exact value is the coefficient's intended decimal. The expressions were never text-comparable across codebases anyway – symbol numbering follows event enumeration order and normal forms depend on the engine – so compare by substituting rates and comparing numbers.
AN EVENT WITH NO POSITIVE RATE CONTRIBUTES NO SYMBOL. Its slot in symbols is the empty string and its filtration and term are empty matrices, mirroring MATLAB's empty cell and the JAR's null. Dropping it from the vectors instead would renumber every later symbol and silently change which rate x_e means.
Definition in file solver_ctmc_symbolic.h.