LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
line::mc::detail_hit Namespace Reference

Classes

struct  Checked

Functions

void input (const char *kind, const std::string &msg)
void numerical (const char *kind, const std::string &msg)
std::string fmt_g (double v)
void seed_stream (rng::Mrg32k3a &g, long long seed)
 Six MRG32k3a seeds from one integer, the affine map of sim_prio_tailquantile.
double vsum (const std::vector< double > &x)
long long pick (const std::vector< double > &w, double u)
 Index drawn from the weights w by the uniform u, by a left-to-right scan; -1 if none is positive.
double var (const std::vector< double > &x)
 Sample variance with the n - 1 denominator.
Checked check_options (const std::vector< double > &t, const HittingDistOptions &opt)
 The option and time checks MATLAB runs before looking at the chain, in its order.
template<class State, class Step, class IsRates, class Target>
void run_cycle (const Step &step, const IsRates &isr, bool useIS, const Target &target, const State &x0, double maxsteps, rng::Mrg32k3a &g, double &a, bool &hit, double &L)
 One regenerative cycle from x0: a = T ^ tau, hit = I(T < tau) and L the likelihood ratio of the path (1 without a change of measure).
template<class State, class Step, class IsRates, class Target>
HittingDistResult estimate (const Step &step, const IsRates &isr, bool hasIS, const Target &target, const State &x0, const std::vector< double > &t, const Checked &c, const HittingDistOptions &opt)
 The cycles and the five estimators, common to both forms.
HittingDistResult generator_form (const Matrix< double > &Q, int x0, const std::function< std::vector< char >(std::size_t)> &makeMask, const std::vector< double > &t, const HittingDistOptions &opt)
 Generator form after the target has been turned into a mask by makeMask(n).
Matrix< double > to_matrix (const std::vector< std::vector< double > > &Q)
std::function< std::vector< char >(std::size_t)> index_mask (const std::vector< int > &target)
std::function< std::vector< char >(std::size_t)> bool_mask (const std::vector< bool > &target)

Function Documentation

◆ bool_mask()

std::function< std::vector< char >(std::size_t)> line::mc::detail_hit::bool_mask ( const std::vector< bool > & target)
inline

Definition at line 554 of file ctmc_hitting_dist.h.

References bool_mask(), and input().

Referenced by bool_mask(), line::mc::ctmc_hitting_dist(), and line::mc::ctmc_hitting_dist().

◆ check_options()

Checked line::mc::detail_hit::check_options ( const std::vector< double > & t,
const HittingDistOptions & opt )
inline

◆ estimate()

template<class State, class Step, class IsRates, class Target>
HittingDistResult line::mc::detail_hit::estimate ( const Step & step,
const IsRates & isr,
bool hasIS,
const Target & target,
const State & x0,
const std::vector< double > & t,
const Checked & c,
const HittingDistOptions & opt )

◆ fmt_g()

std::string line::mc::detail_hit::fmt_g ( double v)
inline

Definition at line 157 of file ctmc_hitting_dist.h.

References fmt_g().

Referenced by estimate(), fmt_g(), and run_cycle().

◆ generator_form()

HittingDistResult line::mc::detail_hit::generator_form ( const Matrix< double > & Q,
int x0,
const std::function< std::vector< char >(std::size_t)> & makeMask,
const std::vector< double > & t,
const HittingDistOptions & opt )
inline

◆ index_mask()

std::function< std::vector< char >(std::size_t)> line::mc::detail_hit::index_mask ( const std::vector< int > & target)
inline

Definition at line 542 of file ctmc_hitting_dist.h.

References index_mask(), and input().

Referenced by line::mc::ctmc_hitting_dist(), line::mc::ctmc_hitting_dist(), and index_mask().

◆ input()

void line::mc::detail_hit::input ( const char * kind,
const std::string & msg )
inline

◆ numerical()

void line::mc::detail_hit::numerical ( const char * kind,
const std::string & msg )
inline

Definition at line 153 of file ctmc_hitting_dist.h.

References numerical(), and line::NumericError::NumericError().

Referenced by estimate(), numerical(), and run_cycle().

◆ pick()

long long line::mc::detail_hit::pick ( const std::vector< double > & w,
double u )
inline

Index drawn from the weights w by the uniform u, by a left-to-right scan; -1 if none is positive.

Definition at line 182 of file ctmc_hitting_dist.h.

References pick(), and vsum().

Referenced by estimate(), pick(), and run_cycle().

◆ run_cycle()

template<class State, class Step, class IsRates, class Target>
void line::mc::detail_hit::run_cycle ( const Step & step,
const IsRates & isr,
bool useIS,
const Target & target,
const State & x0,
double maxsteps,
rng::Mrg32k3a & g,
double & a,
bool & hit,
double & L )

One regenerative cycle from x0: a = T ^ tau, hit = I(T < tau) and L the likelihood ratio of the path (1 without a change of measure).

Step: void(const State& x, std::vector<State>& Y, std::vector<double>& rt) IsRates: void(const State& x, const std::vector<State>& Y, const std::vector<double>& rt, std::vector<double>& ri) Target: bool(const State& x)

Definition at line 248 of file ctmc_hitting_dist.h.

References fmt_g(), input(), line::InternalError::InternalError(), line::rng::Mrg32k3a::next_double(), numerical(), pick(), run_cycle(), and vsum().

Referenced by estimate(), and run_cycle().

◆ seed_stream()

void line::mc::detail_hit::seed_stream ( rng::Mrg32k3a & g,
long long seed )
inline

Six MRG32k3a seeds from one integer, the affine map of sim_prio_tailquantile.

Definition at line 164 of file ctmc_hitting_dist.h.

References seed_stream(), and line::rng::Mrg32k3a::set_seed().

Referenced by estimate(), and seed_stream().

◆ to_matrix()

Matrix< double > line::mc::detail_hit::to_matrix ( const std::vector< std::vector< double > > & Q)
inline

◆ var()

double line::mc::detail_hit::var ( const std::vector< double > & x)
inline

Sample variance with the n - 1 denominator.

Definition at line 197 of file ctmc_hitting_dist.h.

References var(), and vsum().

Referenced by estimate(), and var().

◆ vsum()

double line::mc::detail_hit::vsum ( const std::vector< double > & x)
inline

Definition at line 175 of file ctmc_hitting_dist.h.

References vsum().

Referenced by estimate(), pick(), run_cycle(), var(), and vsum().