Skip to content

Examples#

Each example page contains the specification of one optimisation model (a spec) twice. The page has the YAML file, and the math that the typesetter prints from the file. Every spec is a file under examples/ in the repository, and the test suite loads each one. Open a page to see whether the language can state a problem like yours, and what each line of the file means.

  • Least-cost dispatch The smallest spec has a balance, a bound and a cost to minimise. Open →
  • Unit commitment An on/off decision has a previous status in three cases, so one inequality covers a running unit and a starting unit. Open →
  • Units with ports One set lists the ports of each unit, maps give each port a bus and a role, and a parameter with where: keeps only the output ports. Open →
  • A sparse set, read four ways Units on the ports they have and in the periods they run: a parameter per unit, a sum over the ports, a step in time and a sum over every port. Open →
  • One construct per spec Each form of the four operators and dual has its smallest file, beside its typeset equation. Open →
  • A curve by convex combination The smallest piecewise entry has one weight per breakpoint. The three pages after it state the same dispatch with another method. Open →
  • A curve that is not convex A binary per segment holds the weights on one segment, under the default method. Open →
  • A curve as a special ordered set The solver holds the same restriction, in place of the binaries and their rows. Open →
  • A curve as segment lines The curve is a set of inequalities, and its expansion declares no variable. Open →
  • A curve filled segment by segment Each segment fills only once the one before it is full. A status switches the curve only of a committable generator. Open →
  • A component library Several files compose into one spec with merge, each written against one shared fragment, the coupling surface. Open →
  • PyPSA The model that n.optimize() builds in the power system modelling framework PyPSA is one file, and 25 fragments that compose into it. Open →
  • TIMES Two core equations of the ETSAP energy system model, capacity transfer and trade between regions, each with the TIMES names it ports. Open →

See also