LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
line::sym::SymEngine Class Referenceabstract

A computer algebra backend. More...

#include <line/api/sym/sym_engine.h>

Inheritance diagram for line::sym::SymEngine:

Public Member Functions

virtual ~SymEngine ()
virtual std::string name () const =0
 Name of the backing engine, e.g.
virtual bool isAvailable () const =0
 True if the engine answers a health probe.
virtual CtmcSolution solveCTMC (const std::vector< std::vector< std::string > > &Q, const std::vector< std::string > &symbols)=0
 Symbolic stationary distribution of a CTMC, pi Q = 0 with sum(pi) = 1.
virtual SymSensitivity ctmcSensitivity (const std::vector< std::vector< std::string > > &Q, const std::vector< std::string > &symbols, const std::string &theta, const std::vector< std::string > &reward)=0
 Exact parametric sensitivity of a steady-state reward.
virtual CtmcMeasures ctmcMeasures (const std::vector< std::vector< std::string > > &Q, const std::vector< std::string > &symbols, const std::vector< std::vector< std::string > > &weights, const std::vector< std::string > &names, const std::vector< RatioSpec > &ratios)=0
 Rewrites expressions into a normal form.
virtual Passage ctmcPassage (const std::vector< std::vector< std::string > > &S, const std::vector< std::string > &s0, const std::vector< std::string > &alpha, const std::string &atom, const std::vector< std::string > &symbols, const std::string &svar, const std::vector< std::string > &want, int nmax)=0
 First passage time into a target set: the transform and the moments.
virtual std::vector< std::string > simplify (const std::vector< std::string > &exprs, const std::string &form)=0
virtual std::vector< std::string > diff (const std::vector< std::string > &exprs, const std::string &variable, int order)=0
 Differentiates expressions.
virtual std::vector< double > eval (const std::vector< std::string > &exprs, const std::map< std::string, double > &assignment)=0
 Substitutes values for symbols and evaluates.
virtual FluidODEs fluidODEs (const std::vector< std::string > &rhs, const std::vector< std::string > &vars, const std::vector< std::string > &want)=0
 Jacobian, LaTeX form and equilibria of a fluid vector field.

Detailed Description

A computer algebra backend.

Definition at line 131 of file sym_engine.h.

Constructor & Destructor Documentation

◆ ~SymEngine()

virtual line::sym::SymEngine::~SymEngine ( )
inlinevirtual

Definition at line 133 of file sym_engine.h.

Member Function Documentation

◆ ctmcMeasures()

virtual CtmcMeasures line::sym::SymEngine::ctmcMeasures ( const std::vector< std::vector< std::string > > & Q,
const std::vector< std::string > & symbols,
const std::vector< std::vector< std::string > > & weights,
const std::vector< std::string > & names,
const std::vector< RatioSpec > & ratios )
pure virtual

Rewrites expressions into a normal form.

Parameters
exprsthe expressions
formone of simplify, factor, together, cancel, expand, latex
Returns
the rewritten expressions, in the input order Stationary distribution and a set of weighted sums of it.

Every mean SolverCTMC reports is a NUMERIC linear functional of pi, so the caller builds one weight vector per measure with no algebra at all and this one round trip returns each w . pi as a rational function: a throughput is pi . depRates, a queue length is pi . stateSpaceAggr, a marginal probability is pi . indicator and a mean reward is pi . r.

Parameters
Qgenerator entries as expression strings, row major
symbolsthe symbols appearing in Q
weightsone row per measure, each of length Q.size(); entries are parsed in the same field as Q, so an expression is admissible and not only a number
namesa name per weight row, or empty for w0, w1, ...
ratiosratios of two measures, or empty for none

Implemented in line::sym::SageRestEngine.

◆ ctmcPassage()

virtual Passage line::sym::SymEngine::ctmcPassage ( const std::vector< std::vector< std::string > > & S,
const std::vector< std::string > & s0,
const std::vector< std::string > & alpha,
const std::string & atom,
const std::vector< std::string > & symbols,
const std::string & svar,
const std::vector< std::string > & want,
int nmax )
pure virtual

First passage time into a target set: the transform and the moments.

With A the complement of the target, S = Q(A,A) the sub-generator, s0 = -S*1 the exit vector and alpha the initial law restricted to A, following Harrison and Knottenbelt (2002),

L(s) = alpha (sI - S)^-1 s0 + atom        Eqs. 1-2
(-S) M(n) = n M(n-1),  M(0) = 1           Eq. 3

THE MOMENTS COME FROM THE RECURSION, not from differentiating L: it carries no transform symbol, stays in the same fraction field and is nmax right solves against one matrix. Differentiating would leave the fraction field, and the evaluation at s = 0 can hit 0/0 where a factor of s failed to cancel.

Parameters
Sthe sub-generator on the non-target states, row major
s0the exit vector -S*1
alphathe initial law restricted to the non-target states
atomthe initial mass already inside the target set
symbolsthe rate symbols appearing in S
svarthe transform symbol; adjoined to the field only when a transform is asked for, and required to differ from every rate symbol
wantany of lst, lstall, moments, momall
nmaxhighest moment order, at least 1

Implemented in line::sym::SageRestEngine.

◆ ctmcSensitivity()

virtual SymSensitivity line::sym::SymEngine::ctmcSensitivity ( const std::vector< std::vector< std::string > > & Q,
const std::vector< std::string > & symbols,
const std::string & theta,
const std::vector< std::string > & reward )
pure virtual

Exact parametric sensitivity of a steady-state reward.

Parameters
Qgenerator entries as expression strings, row major
symbolsthe symbols appearing in Q
thetathe symbol to differentiate with respect to
rewardreward rate per state, empty for the distribution alone
Returns
the sensitivity of the distribution and, if a reward is given, of its mean

Implemented in line::sym::SageRestEngine.

◆ diff()

virtual std::vector< std::string > line::sym::SymEngine::diff ( const std::vector< std::string > & exprs,
const std::string & variable,
int order )
pure virtual

Differentiates expressions.

Parameters
exprsthe expressions
variablethe differentiation variable
orderthe order of the derivative, at least 1
Returns
the derivatives, in the input order

Implemented in line::sym::SageRestEngine.

◆ eval()

virtual std::vector< double > line::sym::SymEngine::eval ( const std::vector< std::string > & exprs,
const std::map< std::string, double > & assignment )
pure virtual

Substitutes values for symbols and evaluates.

Parameters
exprsthe expressions
assignmentvalue of each symbol
Returns
the numeric values, NaN where a free symbol remains

Implemented in line::sym::SageRestEngine.

◆ fluidODEs()

virtual FluidODEs line::sym::SymEngine::fluidODEs ( const std::vector< std::string > & rhs,
const std::vector< std::string > & vars,
const std::vector< std::string > & want )
pure virtual

Jacobian, LaTeX form and equilibria of a fluid vector field.

Parameters
rhsthe right hand side of dx/dt, one expression per state variable
varsthe state variable names
wantany of jacobian, latex, equilibria
Returns
the requested items

Implemented in line::sym::SageRestEngine.

◆ isAvailable()

virtual bool line::sym::SymEngine::isAvailable ( ) const
pure virtual

True if the engine answers a health probe.

Implemented in line::sym::SageRestEngine.

◆ name()

virtual std::string line::sym::SymEngine::name ( ) const
pure virtual

Name of the backing engine, e.g.

"sage".

Implemented in line::sym::SageRestEngine.

◆ simplify()

virtual std::vector< std::string > line::sym::SymEngine::simplify ( const std::vector< std::string > & exprs,
const std::string & form )
pure virtual

Implemented in line::sym::SageRestEngine.

◆ solveCTMC()

virtual CtmcSolution line::sym::SymEngine::solveCTMC ( const std::vector< std::vector< std::string > > & Q,
const std::vector< std::string > & symbols )
pure virtual

Symbolic stationary distribution of a CTMC, pi Q = 0 with sum(pi) = 1.

Parameters
Qgenerator entries as expression strings, row major and square
symbolsthe symbols appearing in Q, e.g. x1..xE
Returns
the solution, with pi also split over a common denominator

Implemented in line::sym::SageRestEngine.


The documentation for this class was generated from the following file: