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

Port of solver_ctmc_reward.m and the @@SolverCTMC reward surface (runRewardAnalyzer, getAvgReward, getTranReward, getAccReward). More...

#include <cmath>
#include <cstddef>
#include <string>
#include <vector>
#include "line/api/mc/ctmc_accumulated.h"
#include "line/lang/qn/network_struct.h"
#include "line/solvers/ctmc/solver_ctmc_analyzer.h"
#include "line/solvers/ctmc/solver_ctmc_transient.h"
#include "line/util/error.h"
#include "line/util/matrix.h"
Include dependency graph for solver_ctmc_reward.h:

Go to the source code of this file.

Classes

struct  line::ctmc::CtmcReward< T >
 What the reward analyzer produces, per declared reward. More...
struct  line::ctmc::CtmcAccReward< T >
 What solver_ctmc_acc_reward produces. More...

Namespaces

namespace  line
 Conservation laws of a layered queueing network, enumerated from its structure.
namespace  line::ctmc

Functions

template<class T>
CtmcReward< T > line::ctmc::solver_ctmc_reward (const NetworkStruct< T > &sn, const CtmcOptions &opt, std::size_t tmax=1000)
 Port of solver_ctmc_reward.m.
template<class T>
std::vector< std::vector< T > > line::ctmc::solver_ctmc_tran_reward (const NetworkStruct< T > &sn, const CtmcOptions &opt, const T &t0, const T &t1, std::vector< T > *tout=nullptr, std::vector< std::string > *names=nullptr)
 Port of @@SolverCTMC/getTranReward: E[r(X(t))] = sum_s pi_t(s) r(s).
template<class T>
CtmcAccReward< T > line::ctmc::solver_ctmc_acc_reward (const NetworkStruct< T > &sn_arg, const CtmcOptions &opt, const T &t0, const T &t1)
 Port of @@SolverCTMC/getAccReward: the reward ACCUMULATED over [t0, t], E[int_{t0}^t r(X(s)) ds] = L(t - t0) r with L(h) = int_0^h pi0 exp(Q s) ds computed by uniformisation (mc::ctmc_accumulated; Haverkort 1998, 15.2.4), and its time average over the interval.
template<class T>
std::vector< T > line::ctmc::solver_ctmc_avg_reward (const NetworkStruct< T > &sn, const CtmcOptions &opt, std::vector< std::string > *names=nullptr)
 Port of @@SolverCTMC/getAvgReward: the steady-state expected rewards.

Detailed Description

Port of solver_ctmc_reward.m and the @@SolverCTMC reward surface (runRewardAnalyzer, getAvgReward, getTranReward, getAccReward).

TWO DIFFERENT QUANTITIES SHARE THE WORD "REWARD", and conflating them is the trap this file exists to avoid:

steady state E[r] = sum_s pi(s) r(s), a RATE – the long-run average reward earned per unit time. value function V^k(s), the reward ACCUMULATED over k uniformized steps starting from s. It grows without bound in a recurrent chain, because it is a total and not an average.

V is therefore not "the transient version of E[r]" and does not converge to it; its SLOPE does. The reference reports both and so does this port.

UNIFORMIZATION IS WHAT MAKES THE VALUE ITERATION A CTMC ANSWER. The embedded chain P = Q/q + I with q = max|diag(Q)| has the same stationary law as Q and a uniform step of mean duration 1/q, so iteration index k maps to time k/q. Any q at least as large as the maximum exit rate is valid; taking the maximum is the tightest, hence the fastest-mixing, choice.

Definition in file solver_ctmc_reward.h.