LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
line::lang::Nnpp Class Reference

#include <line/lang/nnpp.h>

Classes

struct  Stream
 One arrival path: renewal epoch in majorizer space, first-gap flag, last arrival. More...

Public Types

enum  Kind { EPTMP = 1 , PWLINEAR = 2 }
 The rate-function family, with the codes sn.proc carries. More...

Public Member Functions

 Nnpp ()
double rate_at (double t) const
 lambda(t), cyclic aware; zero past the horizon when not cyclic.
double mean_value (double t) const
 mu(t) = int_0^t lambda, cyclic aware; constant past the horizon when not cyclic.
double time_average_rate () const
double mean () const
double rate () const
double scv () const
double skewness () const
const std::vector< double > & majorizer_breakpoints () const
 The Q+1 majorizer breakpoints z_i = i*S/Q.
const std::vector< double > & majorizer_rates () const
 The Q piecewise-constant majorizer rates.
double mean_value_majorizer () const
 muTilde(S), the majorizer mass over one cycle.
double mean_value_majorizer (double t) const
 muTilde(t), cyclic aware.
double acceptance_rate () const
double dispersion () const
bool is_cyclic () const
double horizon () const
double weibull_shape () const
double weibull_scale () const
int q () const
int kind () const
std::string kind_name () const
std::string method () const
std::string name () const
const std::vector< double > & alpha () const
const std::vector< double > & gamma () const
const std::vector< double > & omega () const
const std::vector< double > & phi () const
const std::vector< double > & times () const
const std::vector< double > & rates () const
std::vector< double > params () const
 The params row of sn.proc, see from_params.
double majorizer_at (double tc) const
 Majorizer rate in force at an in-cycle time tc.
double majorizer_inverse (double u) const
 muTilde^{-1}(u), absolute time, cyclic aware; +Inf when the majorizer has no mass.
template<class Unif>
double equilibrium_gap (Unif &unif) const
 The equilibrium (first) renewal gap: scale * Y^(1/shape), Y ~ Gamma(1/shape, 1).
template<class Unif>
double renewal_gap (Unif &unif) const
 A noninitial renewal gap: scale * (-log(1-U))^(1/shape).
template<class Unif>
double next_arrival (Stream &s, Unif &unif) const
 The next accepted arrival epoch (absolute time) of the path s, or +Inf when a non-cyclic process has no more arrivals.
template<class Unif>
std::vector< double > sample (std::size_t n, Unif &&unif) const
 n successive interarrival times along one path from time 0.
std::vector< double > sample (std::size_t n, std::mt19937_64 &rng) const
 sample(n) off a std::mt19937_64, U drawn in (0,1).

Static Public Member Functions

static Nnpp eptmp (const std::vector< double > &alpha, const std::vector< double > &gamma, const std::vector< double > &omega, const std::vector< double > &phi, double horizon, double dispersion=1.0, bool cyclic=true, int Q=200)
 EPTMP: lambda(t) = exp(sum_i alpha_i t^i + sum_k gamma_k sin(omega_k t + phi_k)) on [0, horizon].
static Nnpp piecewise_linear (const std::vector< double > &times, const std::vector< double > &rates, double dispersion=1.0, bool cyclic=true, int Q=200)
 PWLINEAR: lambda linearly interpolated between (times[j], rates[j]); horizon = times.back().
static Nnpp from_params (int kind, const std::vector< double > &params, double horizon, double dispersion, bool cyclic, int Q)
 Rebuild from the params row of sn.proc ([m+1, p, alpha, gamma, omega, phi] for EPTMP, [n, times, rates] for PWLINEAR).
static void weibull_for_dispersion (double C, double &shape, double &scale)
 Weibull (shape, scale) whose mean is 1 and SCV is C: 200 bisection steps on x = log(shape) in [log 0.02, log 200].

Detailed Description

Definition at line 52 of file nnpp.h.

Member Enumeration Documentation

◆ Kind

The rate-function family, with the codes sn.proc carries.

Enumerator
EPTMP 
PWLINEAR 

Definition at line 55 of file nnpp.h.

Constructor & Destructor Documentation

◆ Nnpp()

line::lang::Nnpp::Nnpp ( )
inline

Definition at line 64 of file nnpp.h.

Referenced by eptmp(), from_params(), and piecewise_linear().

Member Function Documentation

◆ acceptance_rate()

double line::lang::Nnpp::acceptance_rate ( ) const
inline

Definition at line 199 of file nnpp.h.

◆ alpha()

const std::vector< double > & line::lang::Nnpp::alpha ( ) const
inline

Definition at line 211 of file nnpp.h.

Referenced by eptmp().

◆ dispersion()

double line::lang::Nnpp::dispersion ( ) const
inline

Definition at line 200 of file nnpp.h.

Referenced by eptmp(), from_params(), and piecewise_linear().

◆ eptmp()

Nnpp line::lang::Nnpp::eptmp ( const std::vector< double > & alpha,
const std::vector< double > & gamma,
const std::vector< double > & omega,
const std::vector< double > & phi,
double horizon,
double dispersion = 1.0,
bool cyclic = true,
int Q = 200 )
inlinestatic

EPTMP: lambda(t) = exp(sum_i alpha_i t^i + sum_k gamma_k sin(omega_k t + phi_k)) on [0, horizon].

Definition at line 70 of file nnpp.h.

References alpha(), dispersion(), EPTMP, gamma(), horizon(), line::InputError::InputError(), Nnpp(), omega(), and phi().

Referenced by from_params(), and line::lang::Distrib< double >::nnpp_eptmp().

◆ equilibrium_gap()

template<class Unif>
double line::lang::Nnpp::equilibrium_gap ( Unif & unif) const
inline

The equilibrium (first) renewal gap: scale * Y^(1/shape), Y ~ Gamma(1/shape, 1).

Definition at line 303 of file nnpp.h.

References line::ldes::ssj::gamma_inverse().

Referenced by next_arrival().

◆ from_params()

Nnpp line::lang::Nnpp::from_params ( int kind,
const std::vector< double > & params,
double horizon,
double dispersion,
bool cyclic,
int Q )
inlinestatic

Rebuild from the params row of sn.proc ([m+1, p, alpha, gamma, omega, phi] for EPTMP, [n, times, rates] for PWLINEAR).

Definition at line 123 of file nnpp.h.

References dispersion(), EPTMP, eptmp(), horizon(), line::InputError::InputError(), kind(), Nnpp(), params(), piecewise_linear(), and PWLINEAR.

◆ gamma()

const std::vector< double > & line::lang::Nnpp::gamma ( ) const
inline

Definition at line 212 of file nnpp.h.

Referenced by eptmp().

◆ horizon()

double line::lang::Nnpp::horizon ( ) const
inline

Definition at line 202 of file nnpp.h.

Referenced by eptmp(), and from_params().

◆ is_cyclic()

bool line::lang::Nnpp::is_cyclic ( ) const
inline

Definition at line 201 of file nnpp.h.

◆ kind()

int line::lang::Nnpp::kind ( ) const
inline

Definition at line 206 of file nnpp.h.

Referenced by from_params().

◆ kind_name()

std::string line::lang::Nnpp::kind_name ( ) const
inline

Definition at line 207 of file nnpp.h.

References EPTMP.

◆ majorizer_at()

double line::lang::Nnpp::majorizer_at ( double tc) const
inline

Majorizer rate in force at an in-cycle time tc.

Definition at line 273 of file nnpp.h.

Referenced by next_arrival().

◆ majorizer_breakpoints()

const std::vector< double > & line::lang::Nnpp::majorizer_breakpoints ( ) const
inline

The Q+1 majorizer breakpoints z_i = i*S/Q.

Definition at line 180 of file nnpp.h.

◆ majorizer_inverse()

double line::lang::Nnpp::majorizer_inverse ( double u) const
inline

muTilde^{-1}(u), absolute time, cyclic aware; +Inf when the majorizer has no mass.

Definition at line 280 of file nnpp.h.

Referenced by next_arrival().

◆ majorizer_rates()

const std::vector< double > & line::lang::Nnpp::majorizer_rates ( ) const
inline

The Q piecewise-constant majorizer rates.

Definition at line 182 of file nnpp.h.

◆ mean()

double line::lang::Nnpp::mean ( ) const
inline

Definition at line 172 of file nnpp.h.

Referenced by line::lang::Distrib< double >::nnpp_dist().

◆ mean_value()

double line::lang::Nnpp::mean_value ( double t) const
inline

mu(t) = int_0^t lambda, cyclic aware; constant past the horizon when not cyclic.

Definition at line 160 of file nnpp.h.

◆ mean_value_majorizer() [1/2]

double line::lang::Nnpp::mean_value_majorizer ( ) const
inline

muTilde(S), the majorizer mass over one cycle.

Definition at line 184 of file nnpp.h.

◆ mean_value_majorizer() [2/2]

double line::lang::Nnpp::mean_value_majorizer ( double t) const
inline

muTilde(t), cyclic aware.

Definition at line 186 of file nnpp.h.

◆ method()

std::string line::lang::Nnpp::method ( ) const
inline

Definition at line 208 of file nnpp.h.

◆ name()

std::string line::lang::Nnpp::name ( ) const
inline

Definition at line 209 of file nnpp.h.

◆ next_arrival()

template<class Unif>
double line::lang::Nnpp::next_arrival ( Stream & s,
Unif & unif ) const
inline

The next accepted arrival epoch (absolute time) of the path s, or +Inf when a non-cyclic process has no more arrivals.

unif() returns U(0,1).

Definition at line 324 of file nnpp.h.

References equilibrium_gap(), line::lang::Nnpp::Stream::first, majorizer_at(), majorizer_inverse(), renewal_gap(), line::lang::Nnpp::Stream::t_last, and line::lang::Nnpp::Stream::u.

Referenced by sample().

◆ omega()

const std::vector< double > & line::lang::Nnpp::omega ( ) const
inline

Definition at line 213 of file nnpp.h.

Referenced by eptmp().

◆ params()

std::vector< double > line::lang::Nnpp::params ( ) const
inline

The params row of sn.proc, see from_params.

Definition at line 219 of file nnpp.h.

References EPTMP.

Referenced by from_params(), and line::lang::Distrib< double >::nnpp_dist().

◆ phi()

const std::vector< double > & line::lang::Nnpp::phi ( ) const
inline

Definition at line 214 of file nnpp.h.

Referenced by eptmp().

◆ piecewise_linear()

Nnpp line::lang::Nnpp::piecewise_linear ( const std::vector< double > & times,
const std::vector< double > & rates,
double dispersion = 1.0,
bool cyclic = true,
int Q = 200 )
inlinestatic

PWLINEAR: lambda linearly interpolated between (times[j], rates[j]); horizon = times.back().

Definition at line 96 of file nnpp.h.

References dispersion(), line::InputError::InputError(), Nnpp(), PWLINEAR, rates(), and times().

Referenced by from_params(), and line::lang::Distrib< double >::nnpp_piecewise_linear().

◆ q()

int line::lang::Nnpp::q ( ) const
inline

Definition at line 205 of file nnpp.h.

◆ rate()

double line::lang::Nnpp::rate ( ) const
inline

Definition at line 175 of file nnpp.h.

◆ rate_at()

double line::lang::Nnpp::rate_at ( double t) const
inline

lambda(t), cyclic aware; zero past the horizon when not cyclic.

Definition at line 152 of file nnpp.h.

◆ rates()

const std::vector< double > & line::lang::Nnpp::rates ( ) const
inline

Definition at line 216 of file nnpp.h.

Referenced by piecewise_linear().

◆ renewal_gap()

template<class Unif>
double line::lang::Nnpp::renewal_gap ( Unif & unif) const
inline

A noninitial renewal gap: scale * (-log(1-U))^(1/shape).

Definition at line 312 of file nnpp.h.

Referenced by next_arrival().

◆ sample() [1/2]

std::vector< double > line::lang::Nnpp::sample ( std::size_t n,
std::mt19937_64 & rng ) const
inline

sample(n) off a std::mt19937_64, U drawn in (0,1).

Definition at line 364 of file nnpp.h.

References sample().

◆ sample() [2/2]

template<class Unif>
std::vector< double > line::lang::Nnpp::sample ( std::size_t n,
Unif && unif ) const
inline

n successive interarrival times along one path from time 0.

A non-cyclic process that runs out of arrivals returns fewer than n.

Definition at line 349 of file nnpp.h.

References next_arrival().

Referenced by sample().

◆ scv()

double line::lang::Nnpp::scv ( ) const
inline

Definition at line 176 of file nnpp.h.

◆ skewness()

double line::lang::Nnpp::skewness ( ) const
inline

Definition at line 177 of file nnpp.h.

◆ time_average_rate()

double line::lang::Nnpp::time_average_rate ( ) const
inline

Definition at line 171 of file nnpp.h.

Referenced by line::lang::Distrib< double >::nnpp_dist().

◆ times()

const std::vector< double > & line::lang::Nnpp::times ( ) const
inline

Definition at line 215 of file nnpp.h.

Referenced by piecewise_linear().

◆ weibull_for_dispersion()

void line::lang::Nnpp::weibull_for_dispersion ( double C,
double & shape,
double & scale )
inlinestatic

Weibull (shape, scale) whose mean is 1 and SCV is C: 200 bisection steps on x = log(shape) in [log 0.02, log 200].

C == 1 is exactly (1, 1).

Definition at line 240 of file nnpp.h.

References line::InputError::InputError().

◆ weibull_scale()

double line::lang::Nnpp::weibull_scale ( ) const
inline

Definition at line 204 of file nnpp.h.

◆ weibull_shape()

double line::lang::Nnpp::weibull_shape ( ) const
inline

Definition at line 203 of file nnpp.h.


The documentation for this class was generated from the following file: