![]() |
LINE Solver (C++)
Templated C++ port of the LINE queueing solver
|
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>
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 |
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.
|
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().
|
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.
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.
|
inline |
Definition at line 352 of file ldes_samplepath.h.
References script_of(), src_script, and src_start.
|
inline |
Definition at line 345 of file ldes_samplepath.h.
References line::ldes::engine::sp::Tracker::Pending::k, pending, line::ldes::engine::sp::Tracker::Pending::q, line::ldes::engine::sp::Tracker::Pending::s, and script_of().
Events turning snapshot a into b, in the order DEP, ARV, DROP, START, PHASE.
Definition at line 504 of file ldes_samplepath.h.
References line::ldes::engine::sp::Snap::counts, drops, line::ldes::engine::sp::EV_ARV, line::ldes::engine::sp::EV_DEP, line::ldes::engine::sp::EV_DROP, line::ldes::engine::sp::EV_PHASE, line::ldes::engine::sp::EV_START, id_fifo, ids, line::ldes::engine::sp::Job::in_service, is_service, is_source, line::ldes::engine::sp::Snap::jobs, M, next_id, node_of, line::ldes::engine::sp::Job::phase(), R, scripts, line::ldes::engine::sp::Snap::src, src_deps, line::ldes::engine::sp::Snap::src_seg, take_id(), and line::ldes::engine::sp::Ev::v.
Referenced by boundary().
|
inline |
Definition at line 357 of file ldes_samplepath.h.
References drops.
|
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().
|
inline |
Script already bound to key, or a fresh binding (stored under key).
Definition at line 385 of file ldes_samplepath.h.
|
inline |
Script of the draw that just returned value: its walk, an Erlang reconstruction, or one segment.
Definition at line 305 of file ldes_samplepath.h.
References line::ldes::engine::PhaseTrace::dt, line::rng::JavaRandom::next_double(), line::ldes::engine::PhaseTrace::phase, rng, scratch, line::ldes::engine::sp::Script::single(), line::ldes::engine::PhaseTrace::size(), line::ldes::engine::PhaseTrace::total(), traced, and line::ldes::engine::sp::ulp().
Referenced by capture_arrival(), and capture_service().
|
inline |
Definition at line 288 of file ldes_samplepath.h.
References rng, line::ldes::engine::sp::SEED_OFFSET, and line::rng::JavaRandom::set_seed().
|
inline |
Source part of a snapshot.
Definition at line 394 of file ldes_samplepath.h.
References is_source, M, R, line::ldes::engine::sp::Snap::src, src_script, line::ldes::engine::sp::Snap::src_seg, line::ldes::engine::sp::Snap::src_start, and src_start.
|
inline |
Definition at line 356 of file ldes_samplepath.h.
References src_deps.
|
inline |
Definition at line 496 of file ldes_samplepath.h.
References id_fifo, and next_id.
Referenced by diff().
|
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.
| 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().
| bool line::ldes::engine::sp::Tracker::done = false |
Definition at line 266 of file ldes_samplepath.h.
Referenced by boundary().
| 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().
| 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().
| bool line::ldes::engine::sp::Tracker::have_held = false |
Definition at line 267 of file ldes_samplepath.h.
Referenced by boundary().
| Snap line::ldes::engine::sp::Tracker::held |
Definition at line 268 of file ldes_samplepath.h.
Referenced by boundary().
| 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().
| 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().
| 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().
| 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().
| 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().
| 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().
| std::vector<std::vector<int> > line::ldes::engine::sp::Tracker::map_vars |
| 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().
| 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().
| 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().
| std::vector<std::vector<int> > line::ldes::engine::sp::Tracker::phases |
| 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().
| Recorder line::ldes::engine::sp::Tracker::rec |
Definition at line 265 of file ldes_samplepath.h.
Referenced by bind(), and boundary().
| rng::JavaRandom line::ldes::engine::sp::Tracker::rng |
Definition at line 269 of file ldes_samplepath.h.
Referenced by script_of(), and seed().
| PhaseTrace line::ldes::engine::sp::Tracker::scratch |
Definition at line 270 of file ldes_samplepath.h.
Referenced by script_of(), and trace_fill().
| 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().
| 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().
| 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().
| 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().
| 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().
| double line::ldes::engine::sp::Tracker::stop_time = 0.0 |
Definition at line 286 of file ldes_samplepath.h.
Referenced by boundary().
| 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().
| bool line::ldes::engine::sp::Tracker::traced = false |
Definition at line 271 of file ldes_samplepath.h.
Referenced by script_of(), and trace_fill().