Stochastic Robustness Explorer
Analyse stochastic playback ensembles for the synthetic medium bundle using preset sampling configurations.
[1]:
import sys
from pathlib import Path
PROJECT_ROOT = Path.cwd().resolve()
while PROJECT_ROOT != PROJECT_ROOT.parent and not (PROJECT_ROOT / "pyproject.toml").exists():
PROJECT_ROOT = PROJECT_ROOT.parent
if not (PROJECT_ROOT / "pyproject.toml").exists():
raise RuntimeError(
"Notebook must be executed within a FHOPS checkout (pyproject.toml not found)."
)
if str(PROJECT_ROOT) not in sys.path:
sys.path.insert(0, str(PROJECT_ROOT))
from docs.examples.analytics import utils
SCENARIO = PROJECT_ROOT / "examples/synthetic/medium/scenario.yaml"
ASSIGNMENTS = (
PROJECT_ROOT / "docs/examples/analytics/data/scaling_medium_sa_assignments.csv"
) # update with fresh assignments if desired
(tables, sampling_config) = utils.run_stochastic_summary(SCENARIO, ASSIGNMENTS, tier="medium")
print(f"Samples: {sampling_config.samples}")
tables.shift.head()
Samples: 12
[1]:
| day | shift_id | machine_id | machine_role | sample_id | production_units | total_hours | idle_hours | mobilisation_cost | sequencing_violations | blackout_conflicts | available_hours | utilisation_ratio | downtime_hours | downtime_events | weather_severity_total | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 1 | S1 | M2 | forwarder | 0 | 14.589 | 8.0 | 0.0 | 0.0 | 0 | 0 | 8.0 | 1.0 | 0.0 | 0 | 0.1 |
| 1 | 2 | S1 | M2 | forwarder | 0 | 6.484 | 8.0 | 0.0 | 0.0 | 0 | 0 | 8.0 | 1.0 | 0.0 | 0 | 0.6 |
| 2 | 8 | S1 | M1 | harvester | 0 | 15.034 | 8.0 | 0.0 | 0.0 | 0 | 0 | 8.0 | 1.0 | 0.0 | 0 | 0.0 |
| 3 | 1 | S1 | M1 | harvester | 1 | 9.251 | 8.0 | 0.0 | 0.0 | 0 | 0 | 0.0 | NaN | 0.0 | 0 | 0.0 |
| 4 | 2 | S1 | M2 | forwarder | 1 | 16.210 | 8.0 | 0.0 | 0.0 | 0 | 0 | 8.0 | 1.0 | 0.0 | 0 | 0.0 |
Production Distribution
Inspect the distribution of production across ensemble samples.
[2]:
utils.plot_distribution(
tables.shift.groupby("sample_id")["production_units"].sum(),
title="Production Distribution",
xlabel="Production Units",
)
[2]: