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

The engine's randomness, in the SHAPE the Java engine uses it. More...

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

Collaboration diagram for line::ldes::engine::Rng:

Public Member Functions

 Rng (long long seed, long long stream_offset, long long aux_offset)
 A run seed and the TWO offsets the reference derives, one per generator.
 Rng (long long seed, long long offset)
 The common case, where the reference uses one offset for both.

Public Attributes

rng::Mrg32k3a stream
 SSJ MRG32k3a: every renewal family.
rng::JavaRandom aux
 java.util.Random: the Markovian samplers
pfqn::McRng mc
 the residual RAP/ME path, not yet aligned

Detailed Description

The engine's randomness, in the SHAPE the Java engine uses it.

Solver_ssj carries TWO generators wherever it samples, and which one serves depends on the family rather than on the call site:

MRG32k3a stream = new MRG32k3a();
stream.setSeed(new long[]{ seed+offset, ..., seed+offset+5 });
this.svcRng[i][k] = new java.util.Random(seed + offset);

The SSJ randvar generators (Exponential, Erlang, Uniform, Weibull, Pareto, Lognormal, Gamma, Poisson, Binomial, Bernoulli) are built on the MRG STREAM; the Markovian families do not go through SSJ at all – MapSampleGen calls Map_sample.map_sample(D0, D1, 1, rng) with the java.util.Random. So a C++ engine that means to walk the same sample path needs both, seeded from the same seed + offset, and must send each family to the same one.

mc is the third generator and the one still out of step: rap_sample and me_sample take pfqn::McRng by reference, and the RAP/ME path has no SSJ or java.util.Random counterpart to align to yet.

Definition at line 81 of file ldes_sampler.h.

Constructor & Destructor Documentation

◆ Rng() [1/2]

line::ldes::engine::Rng::Rng ( long long seed,
long long stream_offset,
long long aux_offset )
inline

A run seed and the TWO offsets the reference derives, one per generator.

They are not always equal, which is why this takes both. At a SERVICE site Solver_ssj seeds the stream and the java.util.Random from the same ((numSources + svcIdx) * numClasses + k) * 10 + 1000; at an ARRIVAL site the stream gets (srcIdx * numClasses + k) * 10 and the Random the same expression PLUS 2000. Seeding both from one offset would put the Markovian arrival samplers on a stream the reference never uses.

Definition at line 96 of file ldes_sampler.h.

References aux, mc, line::rng::Mrg32k3a::set_seed_offset(), and stream.

Referenced by Rng().

◆ Rng() [2/2]

line::ldes::engine::Rng::Rng ( long long seed,
long long offset )
inline

The common case, where the reference uses one offset for both.

Definition at line 102 of file ldes_sampler.h.

References Rng().

Member Data Documentation

◆ aux

rng::JavaRandom line::ldes::engine::Rng::aux

java.util.Random: the Markovian samplers

Definition at line 83 of file ldes_sampler.h.

Referenced by Rng().

◆ mc

pfqn::McRng line::ldes::engine::Rng::mc

the residual RAP/ME path, not yet aligned

Definition at line 84 of file ldes_sampler.h.

Referenced by Rng().

◆ stream

rng::Mrg32k3a line::ldes::engine::Rng::stream

SSJ MRG32k3a: every renewal family.

Definition at line 82 of file ldes_sampler.h.

Referenced by Rng(), and line::ldes::engine::uniform01().


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