How alaa-sleimi/pypsa-mga-explorer works
pypsa-mga-explorer is a notebook-driven tool for exploring near-optimal alternatives in PyPSA energy-system models. Its preparation phase finds the cost optimum, samples the near-optimal space, prices the samples, and caches the results. Its interactive phase loads those samples, turns user preferences into a target, and analyzes the path to that target; it can also project the space for plotting and attempt experimental surrogate cost recovery. The README and sampled module docstrings establish the main stages; the notebook’s cell-level wiring and some module internals were not sampled, so uncertain links are omitted.
Main entry points: mga_exploration.ipynb Workflow notebook · preparation_state.py Preparation orchestration · vertex_sampling.py Boundary sampling · interior_sampling.py Interior sampling
Components 15
Preparation
- PoI definitions
mga_engine/poi.py - Boundary sampling
mga_engine/vertex_sampling.py - Interior sampling
mga_engine/interior_sampling.py - Sample pricing
mga_engine/gp_solver.py - Preparation orchestration
mga_engine/preparation_state.py
Exploration
- Workflow notebook
mga_exploration.ipynb - Preference navigation
mga_engine/navigation.py - Path analysis
mga_engine/traverse.py - CCP solver
mga_engine/ccp_solver.py
Analysis and plots
- Live projection
mga_engine/projection.py - Sample projection
mga_engine/alpha_projection.py - Surrogate recovery
mga_engine/surrogate.py
Cached state
- Preparation cache
mga_engine/preparation_state.py
Other components
- Analyst
- HiGHS solver
Connections 21
- Analyst → Workflow notebook: runs workflow
- Workflow notebook → Preparation orchestration: requests preparation
- Preparation orchestration → PoI definitions: builds PoIs
- Preparation orchestration → Boundary sampling: samples boundary
- Preparation orchestration → Interior sampling: samples interior
- Interior sampling → Boundary sampling: calls sampler
- Preparation orchestration → Sample pricing: prices samples
- Preparation orchestration → Preparation cache: saves state
- Preparation cache → Workflow notebook: loads state
- Workflow notebook → Preference navigation: submits preferences
- Workflow notebook → Path analysis: requests path analysis
- Path analysis → CCP solver: prices path points
- Workflow notebook → Live projection: requests live projection
- Workflow notebook → Sample projection: requests sample projection
- Workflow notebook → Surrogate recovery: requests recovery
- Boundary sampling → HiGHS solver: solves LP
- Sample pricing → HiGHS solver: solves LP
- Preference navigation → HiGHS solver: solves LPs
- CCP solver → HiGHS solver: solves LP
- Live projection → HiGHS solver: solves LPs
- Surrogate recovery → HiGHS solver: solves MILP