citylearn.random_streams module
Versioned derivation of the simulator’s random streams.
CityLearn draws random values for unspecified device parameters, the state of charge of electric
vehicles away from their charger, occupant set-point interactions and stochastic power outages.
random_stream_version selects how those streams are derived from random_seed:
'v1'The derivation of CityLearn 3.6.0 and earlier, kept so that an existing seed reproduces earlier results. Every device parameter is the first draw of a new
RandomState, so all of them sit at the same quantile; the electric-vehicle drift seed isseed + episode, so seedsin episode 1 repeats seeds + 1in episode 0; every occupant drawsRandomState(seed + time_step), the same value in every building and episode; and stochastic outages skip day 0 and the partial last day and floor their durations.'v2'(default)Each stream comes from
numpy.random.SeedSequencewith the seed as entropy and the purpose, entity and episode as its spawn key, so streams for different purposes, objects and episodes are independent. Each object keeps one generator per stream.
- citylearn.random_streams.generator(seed: int, purpose: str, *parts: Hashable) Generator[source]
New
numpy.random.Generator(PCG64) for seed, purpose and parts.
- citylearn.random_streams.parse_random_stream_version(value: str | int | None, path: str = 'random_stream_version') str[source]
Return the canonical random-stream version for value; None gives the default.
- citylearn.random_streams.seed_sequence(seed: int, purpose: str, *parts: Hashable) SeedSequence[source]
numpy.random.SeedSequencefor seed, purpose and the entity/episode parts.