LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
line::ldes::engine::sp::Tracker Struct Reference

The recorder's bookkeeping between two boundaries: scripts drawn and not yet bound to a job, source departures and drops, the persistent job ids, and the snapshot held since the last boundary. More...

#include <line/solvers/ldes/ldes_samplepath.h>

Collaboration diagram for line::ldes::engine::sp::Tracker:

Classes

struct  Pending

Public Member Functions

void seed (long long s)
PhaseTrace * trace_fill ()
 Hands the scratch trace to a recording sampler call.
ScriptP script_of (double value, int erlang_k)
 Script of the draw that just returned value: its walk, an Erlang reconstruction, or one segment.
void capture_service (std::size_t q, std::size_t k, double value, int erlang_k)
void capture_arrival (std::size_t st, std::size_t k, double value, int erlang_k, double now)
void source_departure (std::size_t st, std::size_t k)
void drop (std::size_t q, std::size_t k)
ScriptP bind (std::size_t q, std::size_t k, double expected, double now)
 Binds a drawn script of (q, k) to a job whose drawn total is expected.
ScriptP script_for (std::uint64_t key, std::size_t q, std::size_t k, double expected, double now)
 Script already bound to key, or a fresh binding (stored under key).
void snap_sources (Snap &s, double now, const Snap *prev) const
 Source part of a snapshot.
template<class PhaseFn>
void encode (const Snap &s, std::vector< std::vector< double > > &state, std::vector< std::vector< double > > &aggr, PhaseFn sampler_phase) const
 Encodes snapshot s as LINE State rows and per-class counts.
long long take_id ()
std::vector< Ev > diff (const Snap &a, const Snap &b)
 Events turning snapshot a into b, in the order DEP, ARV, DROP, START, PHASE.
template<class SnapFn, class PhaseFn>
int boundary (bool stopped, double now, double t_next, SnapFn snapshot, PhaseFn sampler_phase)
 Event-boundary hook (spBoundary): records what the event that just ran changed, then, unless the run is stopping, the phase changes due before t_next.

Public Attributes

std::size_t M = 0
std::size_t R = 0
std::vector< long long > node_of
 per station: 0-based node index
std::vector< bool > is_source
 per station
std::vector< bool > is_service
 per station: a Queue or a Delay
std::vector< bool > fcfs_buffer
 per station: the row carries a buffer
std::vector< std::vector< int > > phases
 per station and class
std::vector< std::vector< int > > map_vars
 per station and class
std::vector< std::vector< double > > map_var_init
std::vector< long long > station_of_sf
 per stateful node: station or -1
std::vector< std::vector< double > > const_row
 per stateful node that is no station
Recorder rec
bool done = false
bool have_held = false
Snap held
rng::JavaRandom rng
PhaseTrace scratch
bool traced = false
std::vector< Pending > pending
std::vector< std::vector< ScriptP > > src_script
 [station][class]
std::vector< std::vector< double > > src_start
std::vector< std::pair< std::size_t, std::size_t > > src_deps
std::vector< std::pair< std::size_t, std::size_t > > drops
std::map< std::uint64_t, ScriptP > scripts
std::map< std::uint64_t, long long > ids
std::deque< long long > id_fifo
long long next_id = 0
bool stopped_run = false
 True when the recorder stopped the run (stoppingReason "sample_path").
double stop_time = 0.0

Detailed Description

The recorder's bookkeeping between two boundaries: scripts drawn and not yet bound to a job, source departures and drops, the persistent job ids, and the snapshot held since the last boundary.

The engine fills the snapshots (it owns the stations); everything that does not read station internals lives here.

Definition at line 250 of file ldes_samplepath.h.

Member Function Documentation

◆ bind()

ScriptP line::ldes::engine::sp::Tracker::bind ( std::size_t q,
std::size_t k,
double expected,
double now )
inline

Binds a drawn script of (q, k) to a job whose drawn total is expected.

Definition at line 360 of file ldes_samplepath.h.

References line::ldes::engine::sp::Recorder::count_unbound_script(), line::ldes::engine::sp::Script::cum, pending, rec, line::ldes::engine::sp::Script::single(), and line::ldes::engine::sp::ulp().

Referenced by script_for().

◆ boundary()

template<class SnapFn, class PhaseFn>
int line::ldes::engine::sp::Tracker::boundary ( bool stopped,
double now,
double t_next,
SnapFn snapshot,
PhaseFn sampler_phase )
inline

Event-boundary hook (spBoundary): records what the event that just ran changed, then, unless the run is stopping, the phase changes due before t_next.

snapshot(now, prev) builds the current snapshot.

Returns
0 to continue; 1 when the recorder filled at now and the run stops there; 2 when it filled at a virtual row and the run stops at stop_time (> now), before the next event.

Definition at line 606 of file ldes_samplepath.h.

References line::ldes::engine::sp::Recorder::add_row(), diff(), done, drops, encode(), line::ldes::engine::sp::EV_PHASE, have_held, held, id_fifo, ids, line::ldes::engine::sp::Recorder::is_full(), is_service, is_source, line::ldes::engine::sp::Snap::jobs, M, next_id, node_of, pending, R, rec, line::ldes::engine::sp::Snap::src, src_deps, line::ldes::engine::sp::Snap::src_seg, line::ldes::engine::sp::Snap::src_start, stop_time, stopped_run, and line::ldes::engine::sp::Ev::v.

◆ capture_arrival()

void line::ldes::engine::sp::Tracker::capture_arrival ( std::size_t st,
std::size_t k,
double value,
int erlang_k,
double now )
inline

Definition at line 352 of file ldes_samplepath.h.

References script_of(), src_script, and src_start.

◆ capture_service()

void line::ldes::engine::sp::Tracker::capture_service ( std::size_t q,
std::size_t k,
double value,
int erlang_k )
inline

◆ diff()

◆ drop()

void line::ldes::engine::sp::Tracker::drop ( std::size_t q,
std::size_t k )
inline

Definition at line 357 of file ldes_samplepath.h.

References drops.

◆ encode()

template<class PhaseFn>
void line::ldes::engine::sp::Tracker::encode ( const Snap & s,
std::vector< std::vector< double > > & state,
std::vector< std::vector< double > > & aggr,
PhaseFn sampler_phase ) const
inline

Encodes snapshot s as LINE State rows and per-class counts.

sampler_phase(i, k) is the service sampler's walk phase (the reference's getPhase()), read for the MAP local variable of an idle class.

Definition at line 418 of file ldes_samplepath.h.

References const_row, line::ldes::engine::sp::Snap::counts, fcfs_buffer, is_service, is_source, line::ldes::engine::sp::Snap::jobs, map_var_init, map_vars, phases, R, line::ldes::engine::sp::Snap::src, line::ldes::engine::sp::Snap::src_seg, and station_of_sf.

Referenced by boundary().

◆ script_for()

ScriptP line::ldes::engine::sp::Tracker::script_for ( std::uint64_t key,
std::size_t q,
std::size_t k,
double expected,
double now )
inline

Script already bound to key, or a fresh binding (stored under key).

Definition at line 385 of file ldes_samplepath.h.

References bind(), and scripts.

◆ script_of()

ScriptP line::ldes::engine::sp::Tracker::script_of ( double value,
int erlang_k )
inline

◆ seed()

void line::ldes::engine::sp::Tracker::seed ( long long s)
inline

◆ snap_sources()

void line::ldes::engine::sp::Tracker::snap_sources ( Snap & s,
double now,
const Snap * prev ) const
inline

◆ source_departure()

void line::ldes::engine::sp::Tracker::source_departure ( std::size_t st,
std::size_t k )
inline

Definition at line 356 of file ldes_samplepath.h.

References src_deps.

◆ take_id()

long long line::ldes::engine::sp::Tracker::take_id ( )
inline

Definition at line 496 of file ldes_samplepath.h.

References id_fifo, and next_id.

Referenced by diff().

◆ trace_fill()

PhaseTrace * line::ldes::engine::sp::Tracker::trace_fill ( )
inline

Hands the scratch trace to a recording sampler call.

Definition at line 298 of file ldes_samplepath.h.

References line::ldes::engine::PhaseTrace::clear(), scratch, and traced.

Member Data Documentation

◆ const_row

std::vector<std::vector<double> > line::ldes::engine::sp::Tracker::const_row

per stateful node that is no station

Definition at line 262 of file ldes_samplepath.h.

Referenced by encode().

◆ done

bool line::ldes::engine::sp::Tracker::done = false

Definition at line 266 of file ldes_samplepath.h.

Referenced by boundary().

◆ drops

std::vector<std::pair<std::size_t, std::size_t> > line::ldes::engine::sp::Tracker::drops

Definition at line 279 of file ldes_samplepath.h.

Referenced by boundary(), diff(), and drop().

◆ fcfs_buffer

std::vector<bool> line::ldes::engine::sp::Tracker::fcfs_buffer

per station: the row carries a buffer

Definition at line 257 of file ldes_samplepath.h.

Referenced by encode().

◆ have_held

bool line::ldes::engine::sp::Tracker::have_held = false

Definition at line 267 of file ldes_samplepath.h.

Referenced by boundary().

◆ held

Snap line::ldes::engine::sp::Tracker::held

Definition at line 268 of file ldes_samplepath.h.

Referenced by boundary().

◆ id_fifo

std::deque<long long> line::ldes::engine::sp::Tracker::id_fifo

Definition at line 282 of file ldes_samplepath.h.

Referenced by boundary(), diff(), and take_id().

◆ ids

std::map<std::uint64_t, long long> line::ldes::engine::sp::Tracker::ids

Definition at line 281 of file ldes_samplepath.h.

Referenced by boundary(), and diff().

◆ is_service

std::vector<bool> line::ldes::engine::sp::Tracker::is_service

per station: a Queue or a Delay

Definition at line 255 of file ldes_samplepath.h.

Referenced by boundary(), diff(), and encode().

◆ is_source

std::vector<bool> line::ldes::engine::sp::Tracker::is_source

per station

Definition at line 254 of file ldes_samplepath.h.

Referenced by boundary(), diff(), encode(), and snap_sources().

◆ M

std::size_t line::ldes::engine::sp::Tracker::M = 0

Definition at line 252 of file ldes_samplepath.h.

Referenced by boundary(), diff(), and snap_sources().

◆ map_var_init

std::vector<std::vector<double> > line::ldes::engine::sp::Tracker::map_var_init

Definition at line 260 of file ldes_samplepath.h.

Referenced by encode().

◆ map_vars

std::vector<std::vector<int> > line::ldes::engine::sp::Tracker::map_vars

per station and class

Definition at line 259 of file ldes_samplepath.h.

Referenced by encode().

◆ next_id

long long line::ldes::engine::sp::Tracker::next_id = 0

Definition at line 283 of file ldes_samplepath.h.

Referenced by boundary(), diff(), and take_id().

◆ node_of

std::vector<long long> line::ldes::engine::sp::Tracker::node_of

per station: 0-based node index

Definition at line 253 of file ldes_samplepath.h.

Referenced by boundary(), and diff().

◆ pending

std::vector<Pending> line::ldes::engine::sp::Tracker::pending

Definition at line 276 of file ldes_samplepath.h.

Referenced by bind(), boundary(), and capture_service().

◆ phases

std::vector<std::vector<int> > line::ldes::engine::sp::Tracker::phases

per station and class

Definition at line 258 of file ldes_samplepath.h.

Referenced by encode().

◆ R

std::size_t line::ldes::engine::sp::Tracker::R = 0

Definition at line 252 of file ldes_samplepath.h.

Referenced by boundary(), diff(), encode(), and snap_sources().

◆ rec

Recorder line::ldes::engine::sp::Tracker::rec

Definition at line 265 of file ldes_samplepath.h.

Referenced by bind(), and boundary().

◆ rng

rng::JavaRandom line::ldes::engine::sp::Tracker::rng

Definition at line 269 of file ldes_samplepath.h.

Referenced by script_of(), and seed().

◆ scratch

PhaseTrace line::ldes::engine::sp::Tracker::scratch

Definition at line 270 of file ldes_samplepath.h.

Referenced by script_of(), and trace_fill().

◆ scripts

std::map<std::uint64_t, ScriptP> line::ldes::engine::sp::Tracker::scripts

Definition at line 280 of file ldes_samplepath.h.

Referenced by diff(), and script_for().

◆ src_deps

std::vector<std::pair<std::size_t, std::size_t> > line::ldes::engine::sp::Tracker::src_deps

Definition at line 279 of file ldes_samplepath.h.

Referenced by boundary(), diff(), and source_departure().

◆ src_script

std::vector<std::vector<ScriptP> > line::ldes::engine::sp::Tracker::src_script

[station][class]

Definition at line 277 of file ldes_samplepath.h.

Referenced by capture_arrival(), and snap_sources().

◆ src_start

std::vector<std::vector<double> > line::ldes::engine::sp::Tracker::src_start

Definition at line 278 of file ldes_samplepath.h.

Referenced by capture_arrival(), and snap_sources().

◆ station_of_sf

std::vector<long long> line::ldes::engine::sp::Tracker::station_of_sf

per stateful node: station or -1

Definition at line 261 of file ldes_samplepath.h.

Referenced by encode().

◆ stop_time

double line::ldes::engine::sp::Tracker::stop_time = 0.0

Definition at line 286 of file ldes_samplepath.h.

Referenced by boundary().

◆ stopped_run

bool line::ldes::engine::sp::Tracker::stopped_run = false

True when the recorder stopped the run (stoppingReason "sample_path").

Definition at line 285 of file ldes_samplepath.h.

Referenced by boundary().

◆ traced

bool line::ldes::engine::sp::Tracker::traced = false

Definition at line 271 of file ldes_samplepath.h.

Referenced by script_of(), and trace_fill().


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