![]() |
LINE Solver (C++)
Templated C++ port of the LINE queueing solver
|
Client of the line-sage-rest service. More...
#include <line/api/sym/sage_rest_engine.h>
Public Member Functions | |
| SageRestEngine (const std::string &baseUrl) | |
| SageRestEngine & | setTimeoutSeconds (int seconds) |
| Sets the per-request timeout. | |
| int | getTimeoutSeconds () const |
| const std::string & | getBaseUrl () const |
| std::string | name () const override |
| Name of the backing engine, e.g. | |
| bool | isAvailable () const override |
| True if the engine answers a health probe. | |
| bool | isUsable () const |
| Checks that the service can actually EVALUATE, not merely that it answers. | |
| detail::Json | info () const |
| Reads the service identity, used to tell a line-sage-rest server apart from another line-*-rest service on the same conventional port. | |
| CtmcSolution | solveCTMC (const std::vector< std::vector< std::string > > &Q, const std::vector< std::string > &symbols) override |
| Symbolic stationary distribution of a CTMC, pi Q = 0 with sum(pi) = 1. | |
| 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) override |
| Exact parametric sensitivity of a steady-state reward. | |
| std::vector< std::string > | simplify (const std::vector< std::string > &exprs, const std::string &form) override |
| Rewrites expressions into a normal form. | |
| std::vector< std::string > | diff (const std::vector< std::string > &exprs, const std::string &variable, int order) override |
| Differentiates expressions. | |
| std::vector< double > | eval (const std::vector< std::string > &exprs, const std::map< std::string, double > &assignment) override |
| Substitutes values for symbols and evaluates. | |
| FluidODEs | fluidODEs (const std::vector< std::string > &rhs, const std::vector< std::string > &vars, const std::vector< std::string > &want) override |
| Jacobian, LaTeX form and equilibria of a fluid vector field. | |
| Public Member Functions inherited from line::sym::SymEngine | |
| virtual | ~SymEngine () |
Static Public Attributes | |
| static constexpr int | DEFAULT_TIMEOUT_SECONDS = 300 |
| Default per-request timeout, in seconds. | |
Client of the line-sage-rest service.
Definition at line 140 of file sage_rest_engine.h.
|
inlineexplicit |
| baseUrl | base URL of the service, e.g. "http://localhost:8080" |
Definition at line 148 of file sage_rest_engine.h.
References DEFAULT_TIMEOUT_SECONDS, and line::InputError::InputError().
Referenced by setTimeoutSeconds().
|
inlineoverridevirtual |
Exact parametric sensitivity of a steady-state reward.
| Q | generator entries as expression strings, row major |
| symbols | the symbols appearing in Q |
| theta | the symbol to differentiate with respect to |
| reward | reward rate per state, empty for the distribution alone |
Implements line::sym::SymEngine.
Definition at line 270 of file sage_rest_engine.h.
References line::sym::SymSensitivity::dpi, line::sym::SymSensitivity::Er, line::sym::SymSensitivity::hasReward, line::sym::SymSensitivity::pi, line::sym::SymSensitivity::S, and line::sym::SymSensitivity::SS.
|
inlineoverridevirtual |
Differentiates expressions.
| exprs | the expressions |
| variable | the differentiation variable |
| order | the order of the derivative, at least 1 |
Implements line::sym::SymEngine.
Definition at line 299 of file sage_rest_engine.h.
|
inlineoverridevirtual |
Substitutes values for symbols and evaluates.
| exprs | the expressions |
| assignment | value of each symbol |
Implements line::sym::SymEngine.
Definition at line 308 of file sage_rest_engine.h.
|
inlineoverridevirtual |
Jacobian, LaTeX form and equilibria of a fluid vector field.
| rhs | the right hand side of dx/dt, one expression per state variable |
| vars | the state variable names |
| want | any of jacobian, latex, equilibria |
Implements line::sym::SymEngine.
Definition at line 329 of file sage_rest_engine.h.
References line::sym::FluidODEs::equilibria, line::sym::FluidODEs::hasEquilibria, line::sym::FluidODEs::hasJacobian, line::sym::FluidODEs::hasLatex, line::sym::FluidODEs::jacobian, and line::sym::FluidODEs::latex.
|
inline |
Definition at line 174 of file sage_rest_engine.h.
|
inline |
Definition at line 171 of file sage_rest_engine.h.
|
inline |
Reads the service identity, used to tell a line-sage-rest server apart from another line-*-rest service on the same conventional port.
Definition at line 250 of file sage_rest_engine.h.
|
inlineoverridevirtual |
True if the engine answers a health probe.
Implements line::sym::SymEngine.
Definition at line 178 of file sage_rest_engine.h.
|
inline |
Checks that the service can actually EVALUATE, not merely that it answers.
The line-sage-rest image ships a FLINT built for CPUs that have BMI2 and ADX. On an older host the first multi-limb exact operation raises SIGILL, the worker dies mid-request and the call returns no bytes at all; /api/v1/health is pure Python and keeps answering, so it cannot see this. The canary is the weighted-average softmin form, which is what the fluid export actually sends, and is the smallest expression observed to trigger it. Verdicts are cached per URL, so this costs one small request the first time a service is considered and nothing after. See _kb/11-conventions-and-gotchas.md.
Definition at line 203 of file sage_rest_engine.h.
References line::http::post_json().
|
inlineoverridevirtual |
Name of the backing engine, e.g.
"sage".
Implements line::sym::SymEngine.
Definition at line 176 of file sage_rest_engine.h.
|
inline |
Sets the per-request timeout.
| seconds | timeout in seconds; not positive disables it |
Definition at line 165 of file sage_rest_engine.h.
References SageRestEngine().
Referenced by line::fluid::fluid_jacobian().
|
inlineoverridevirtual |
Rewrites expressions into a normal form.
| exprs | the expressions |
| form | one of simplify, factor, together, cancel, expand, latex |
Implements line::sym::SymEngine.
Definition at line 291 of file sage_rest_engine.h.
|
inlineoverridevirtual |
Symbolic stationary distribution of a CTMC, pi Q = 0 with sum(pi) = 1.
| Q | generator entries as expression strings, row major and square |
| symbols | the symbols appearing in Q, e.g. x1..xE |
Implements line::sym::SymEngine.
Definition at line 252 of file sage_rest_engine.h.
References line::sym::CtmcSolution::connComp, line::sym::CtmcSolution::den, line::sym::CtmcSolution::nConnComp, line::sym::CtmcSolution::num, and line::sym::CtmcSolution::pi.
|
staticconstexpr |
Default per-request timeout, in seconds.
Definition at line 143 of file sage_rest_engine.h.
Referenced by SageRestEngine().