LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
solver_ctmc_sens.h File Reference

Port of @@SolverCTMC/getSensitivity and getSensitivityRanking: the parametric sensitivity of a steady-state reward to a scalar model parameter, following Trivedi and Bobbio (2017), Sec. More...

#include <algorithm>
#include <cmath>
#include <cstddef>
#include <functional>
#include <string>
#include <vector>
#include <map>
#include <memory>
#include "line/api/mc/ctmc_sens.h"
#include "line/api/sym/sym_engine.h"
#include "line/lang/qn/network_struct.h"
#include "line/solvers/ctmc/solver_ctmc_analyzer.h"
#include "line/solvers/ctmc/solver_ctmc_symbolic.h"
#include "line/util/error.h"
#include "line/util/matrix.h"
Include dependency graph for solver_ctmc_sens.h:

Go to the source code of this file.

Classes

struct  line::ctmc::CtmcSensParam< T >
 The scalar parameter a sensitivity is taken with respect to. More...
struct  line::ctmc::CtmcSens< T >
 What one sensitivity computation returns. More...
struct  line::ctmc::CtmcSensRank< T >
 One row of the ranking table. More...

Namespaces

namespace  line
namespace  line::ctmc

Functions

template<class T>
CtmcSens< T > line::ctmc::solver_ctmc_sensitivity (const NetworkStruct< T > &sn, const CtmcOptions &opt, const CtmcSensParam< T > &param, const std::vector< T > &reward=std::vector< T >(), const std::string &method="fd", const CtmcSymbolicOptions &symopt=CtmcSymbolicOptions())
 Port of @@SolverCTMC/getSensitivity.
template<class T>
std::vector< CtmcSensRank< T > > line::ctmc::solver_ctmc_sensitivity_ranking (const NetworkStruct< T > &sn, const CtmcOptions &opt, const std::vector< CtmcSensParam< T > > &params, const std::vector< T > &reward)
 Port of @@SolverCTMC/getSensitivityRanking: rank parameters by influence.

Detailed Description

Port of @@SolverCTMC/getSensitivity and getSensitivityRanking: the parametric sensitivity of a steady-state reward to a scalar model parameter, following Trivedi and Bobbio (2017), Sec.

9.7.

WHERE THE ERROR ACTUALLY COMES FROM, which is what the reference's two methods differ about. Differentiating pi Q = 0 gives (dpi/dtheta) Q = -pi (dQ/dtheta), one extra solve with the matrix the stationary solve already factored (ctmc_sens, which is EXACT). So the only approximation is dQ/dtheta, and the reference obtains it by central differences on the RATES with the state space held fixed – legitimate because the state space depends on the topology and the cutoff, never on a rate value. That is O(h^2) on the generator alone, not on the solve.

The reference's 'symbolic' method removes even that by solving pi as a rational function of the rate symbols in a computer-algebra backend and differentiating it exactly, leaving only the RATE MAP x_e(theta) differenced. That map is affine in theta in the common cases – a rate set to theta, or scaled by it – and a central difference is exact on an affine map, so the whole O(h^2) error of 'fd' disappears. It is served here through api/sym, the same line-sage-rest service the reference talks to.

WHAT THE SYMBOLIC METHOD REFUSES RATHER THAN APPROXIMATES: a theta that RESHAPES an event's filtration instead of merely scaling it. The chain rule above assumes each event contributes one rate, so a parameter that changes the relative weights inside one filtration breaks the premise; the shape is compared before any round trip and the request is refused by name.

ANY PERTURBATION THAT RESIZES THE STATE SPACE IS AN ERROR, not something to paper over: it means theta switched a transition on or off (a rate crossing zero, or an immediate transition appearing), so the two generators describe different chains and their difference is meaningless.

Definition in file solver_ctmc_sens.h.