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 M1 tethered_harvester 0 6.207174 5.367787 0.000000 0.0 0 0 0.0 NaN 2.632213 1 0.0
1 1 S1 M2 tethered_shovel_or_skidder 0 0.000000 8.000000 0.000000 0.0 0 0 8.0 1.000000 0.000000 0 0.0
2 2 S1 M2 tethered_shovel_or_skidder 0 0.000000 8.000000 0.000000 0.0 0 0 8.0 1.000000 0.000000 0 0.0
3 2 S1 M4 loader 0 0.000000 3.712075 4.287925 0.0 0 0 8.0 0.464009 4.287925 1 0.0
4 5 S1 M3 processor 0 0.000000 4.806026 3.193974 0.0 0 0 8.0 0.600753 3.193974 1 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]: