Solve & diagnostics
osecan run chains the stages and captures every solver output so feasibility issues are
easy to localise — the BCNexus debugging model.
Stages
assemble SETS + params (+ empty defaults) → results/<run>/input/
datafile otoole csv → results/<run>/osecan.txt
preprocess resources/preprocess_data.py adds index sets
solve GLPK via swiglpk on resources/osemosys_fast_osecan.txt (stock + UDC block)
results extracted → results/<run>/results_csv/
osecan solve is the pure-Python path (no glpsol binary). osecan run is the
subprocess variant (glpsol + CBC/Gurobi) for machines that have those tools.
Diagnostics bundle (results/<run>/)
| File | Contents |
|---|---|
status.json |
status (optimal / infeasible / unbounded), objective, per-stage timing, returncode |
runtime_memory_log.txt |
wall time + peak RSS per stage |
<solver>.log |
raw solver stdout/stderr |
diagnostics.txt |
human summary; on failure, a checklist of likely OSeMOSYS causes |
Debugging feasibility
The infeasibility checklist in diagnostics.txt targets the usual culprits: demand with no
supply path, over-tight capacity/activity limits (incl. WS3 feedstock caps), emission limits
below the achievable minimum, zeroed capacity factors, islanded grid demand, and reserve
margins above buildable firm capacity.
Two guards catch problems before the solver:
osecan harmonize— no parameter references a code/year absent from the SETS.glpsol --check(inside the LP stage) — catches model-generation errors.
Modelling review (auto-updated)
Every run appends an entry to modelling_review.md (status, objective, timings,
diagnostics pointer) via osecan.pipeline.review. Curate the Open issues / Potential
solutions / Feature requests sections at the top by hand; add a note any time with:
uv run python -m osecan.pipeline.review --note "QC hydro CF looks high; check CER"
Delta E+ · SFU