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

Performance sensitivities with respect to service rates. More...

#include <cmath>
#include <cstddef>
#include <functional>
#include <limits>
#include <string>
#include <vector>
#include "line/api/pfqn/pfqn_sens.h"
#include "line/lang/dist_scale_rate.h"
#include "line/lang/qn/network_struct.h"
#include "line/num/number.h"
#include "line/solvers/mva/mva_types.h"
#include "line/solvers/nc/sn_pf_params.h"
#include "line/util/error.h"
#include "line/util/matrix.h"
Include dependency graph for solver_sens_table.h:

Go to the source code of this file.

Classes

struct  line::sens::SensOptions
 The name-value contract of getSensitivityTable. More...
struct  line::sens::SensRow< T >
 One (station, class) row of the table. More...
struct  line::sens::SensTable< T >
 What the table carries, plus the branch that produced it. More...

Namespaces

namespace  line
namespace  line::sens

Functions

template<class T>
SensTable< T > line::sens::solver_sensitivity_table (qn::NetworkStruct< T > &sn, const SensOptions &opt, bool exact_available, const std::function< mva::MvaSolution< T >()> &solve)
 Build the sensitivity table of sn under solve.

Detailed Description

Performance sensitivities with respect to service rates.

Port of matlab/src/solvers/@@NetworkSolver/getSensitivityTable.m. One row per (station, class) carrying dTput/dRate, dRespT/dRate, dQLen/dRate and dUtil/dRate, produced by one of two branches:

exact Analytic differentiation of a product-form recursion. A closed model goes through pfqn_sens (differentiated MVA) evaluated AT CHAIN LEVEL, an open one through the closed-form BCMP derivatives, whose stations decouple. Exact to working precision and cheaper than one extra solve, but defined only where the recursion is: single-server stations plus delays, and not a mixed model.

fd Forward or central differences on the CALLER'S OWN solver. The service at (station, class) is rate-scaled by (1 +/- h), the same solve is re-run and the quotient formed. It costs 1 + M*R solves (forward) or 2*M*R (central) and is the only branch that applies to a model with no product form.

WHY THE SOLVER IS A CALLBACK. The reference reaches this through a method on NetworkSolver, so self names both the model and the engine; there is no solver base class here, and the finite-difference branch needs to re-run THE SAME engine with THE SAME options – an MVA table produced by perturbing a model that is then solved by CTMC is not a sensitivity of anything. The callback is that engine, already bound to the struct passed in, and it is called after this code has written the perturbed service into it.

A SIMULATION SOLVER MUST BE RUN WITH COMMON RANDOM NUMBERS, or the quotient measures Monte Carlo error rather than a derivative. There is no seed to pin here – the callback owns its options – so SensOptions::simulation only widens the default step to 1e-2, and a caller wiring a stochastic engine in is responsible for handing it a fixed seed.

Definition in file solver_sens_table.h.