Skip to content

How this book works

Foundation

Three products, one knowledge base

flowchart TB
    K[Energy Operations Research] --> B[Book<br/>MkDocs]
    K --> L[Labs<br/>Google Colab]
    K --> Y[Library<br/>energy_or]
    B --> V[Visualisation<br/>Manim + in-browser models]
    L --> V
    Y --> V
    V --> P[Production system]
  • The book (this site) teaches the intuition and the mathematics.
  • The labs are Jupyter notebooks that open in Google Colab. They install the library with one line and let you change parameters and break things.
  • The library, energy_or, holds the reusable, tested model code. Notebooks call it; they do not copy it.
  • The visualisations are generated from solver output. Manim never decides anything; it draws what the optimiser decided.

The chapter template

Every modelling chapter follows the same fifteen steps, so you always know where you are:

  1. Real-world problem — the operational situation in plain language
  2. Physical system — what is physically happening
  3. Decision — what are we actually deciding?
  4. Variables — the decision variables, with units
  5. Objective — what we maximise or minimise
  6. Constraints — what we are not allowed to do
  7. Formulation — the optimisation problem, written out
  8. Visualisation — what the mathematics looks like
  9. Implementation — Python, using energy_or
  10. Solve — with an open-source solver
  11. Interpret — back into MW, MWh, $, availability, risk
  12. Backtest — against history, where it makes sense
  13. Add realism — progressively harder constraints
  14. Challenge — exercises
  15. Production perspective — how this would run continuously

Chapter 1 is the reference implementation of this template.

Four views of every model

Where it is meaningful, each optimisation problem is shown four ways:

View Shows
Physical What is happening to the asset or system
Mathematical Variables, objective, constraints, feasible region
Optimiser How the solution is reached, what binds
Operational / economic MW, MWh, $, SOC, availability, downtime, risk

Three tracks

The book has three tracks that advance together. You learn a modelling technique, then immediately operationalise it.

After this modelling chapter… …this engineering lab
Linear programming Package and test the model
BESS dispatch Expose it through an API
Price forecasting Track experiments, register the model
Rolling-horizon BESS Containerise and schedule it
Fleet optimisation Profile it and cut solve latency
Forecast + optimise Instrument the whole pipeline (observability)
— Incident labs: break it deliberately, then recover

The engineering track includes OptOps: the optimisation-layer counterpart of MLOps (solver status, solve time, optimality gap, infeasibility diagnosis, binding-constraint monitoring), and latency budgets for decisions that must be made every five minutes.

Difficulty markers

Foundation no prior optimisation needed · Intermediate builds on earlier chapters · Advanced heavier mathematics · Production running systems

You can skip derivations marked Advanced on a first read and come back later.

Exercises

Each major chapter ends with five kinds of exercise:

  • Guided — change one parameter and predict the result before running it
  • Engineering — add a physical constraint
  • Market — add an economic condition
  • Challenge — extend the formulation
  • Production — think about running the model continuously

Running the labs

Click the Open in Colab badge on any chapter. The first cell installs the library:

!pip install -q git+https://github.com/nocturnaljojo/energy-operations-research.git

To work locally instead:

git clone https://github.com/nocturnaljojo/energy-operations-research.git
cd energy-operations-research
uv sync
uv run --with jupyterlab jupyter lab   # or open notebooks/ in VS Code