Skip to content

Reference#

The reference pages describe exactly what mathspec accepts, what it refuses, and what it prints. The tutorials teach the language to a reader who has not yet written the specification of an optimisation model (a spec).

The language#

  • The language lists the rules a spec file must meet, and which page states each rule in full.
  • File shape lists the top-level keys of a spec file, and how mathspec reads the YAML.
  • Given, parameters, variables, objective and constraints lists the keys of the data, the decisions, the rules and the goal, and of the given: section.
  • Dimensions lists the keys of a named set of labels (a dimension).
  • Relations lists the keys of a table between two dimensions (a relation), and how an expression uses a relation.
  • Expressions defines the grammar of arithmetic and of conditions, and how dimensions combine.
  • Named expressions, conditions and macros describes the three ways to name a piece of an expression and use it again.
  • Operators lists every construct built into the language (an operator), such as sum and shift, and the math mathspec prints for each.
  • Piecewise curves and SOS lists the keys of a piecewise-linear curve and of a special ordered set (SOS).
  • Assumptions lists the keys that state what a spec expects of its data.
  • Absence and where describes which rows do not exist (absent), and how absence spreads through an expression.
  • Errors and advice lists what mathspec refuses at load, and what it advises without refusing.

Tools and the Python API#

  • Composing specs describes the rules that merge and override follow when they build one spec from several files.
  • Typeset output describes the document that mathspec prints in each output format, LaTeX, Typst and Markdown.
  • Command line lists every command of python -m mathspec, its flags with their Python keywords, and its exit codes.
  • Python API lists every public function of the mathspec package, and where each class is documented.

Glossary and changelog#

  • Glossary defines each word these pages use in a fixed sense.
  • Changelog lists what changed in each release.

Examples#

  • Examples are whole specs, each beside the math that mathspec prints from it.

See also