An example of what you build on lpspec. A capacity-expansion planner: the model is 69 lines of YAML, the job that solves and archives it 380 lines of Python, this site 1225 lines of Markdown and SQL over the parquet the job wrote, and the notebook 342 lines. All of it is in the source; nothing else is behind it.

The model, as math

Printed from the model.yaml that the solve job archived, by the language's own typesetter, in the notation that models/pathway.symbols.yaml declares. No data binds and no solver runs to produce this page: every equation below is what the YAML states, and every number on the other pages is what the solver made of it.

One investment period of a capacity-expansion pathway: what to build, and how the fleet runs on a few typical days. The file never mentions the period. The solve job filters every source to one year, so this is the math for a year and the job decides which years, in which order, inheriting what.

Sets

Symbol Meaning
index — day — typical days, each standing for many real ones
index — hour — hours within a typical day
index — generator — generating technologies

Parameters

Symbol Meaning
weight over — how many real days this typical day represents
load over — demand to be met, in MW
avail over — capacity factor, between 0 and 1
invest over — annualised build cost per MW
cost over — variable cost per MWh
rate over — tonnes of CO2 per MWh
cap (scalar) — the CO2 the year may emit, in tonnes
existing over — capacity carried in from the previous period, in MW

Variables

Symbol Meaning
build over — capacity added in this period
total over — capacity standing after this period's build, and what the next period inherits
p over — output of a technology in one hour of a typical day

Definitions

Symbol Meaning
capex over — annualised cost of what this period built
opex over — what running each technology costs across the year
emissions (scalar) — CO2 released across the year

Objective

Subject to

accumulate

capacity

balance

carbon

Definitions

capex

opex

emissions

Variable domains

build

total

p