Assumptions#
assumptions: states what the spec expects of the data attached to it. The
language types each predicate and prints it in the
typeset document, but the tool that attaches the data, such
as an engine, runs the check.
dimensions:
generator: { dtype: str }
parameters:
p_min: { dims: [generator] }
p_max: { dims: [generator] }
variables:
p:
dims: [generator]
bounds: { lower: p_min, upper: p_max }
constraints:
cap:
dims: [generator]
expression: p <= p_max
objective:
sense: minimize
expression: sum(p, over=generator)
assumptions:
bounds_do_not_cross: "p_min <= p_max"
The entry#
Write an entry as one where string, or as a mapping when it carries more than
the predicate.
| Field | ||
|---|---|---|
holds |
required. The predicate, in the where grammar | |
where |
which coordinates it is checked at, in the same grammar | default null |
description |
why the rule is there. A refusal quotes it | default null |
bounds_do_not_cross: "p_min <= p_max" above is the short form of
bounds_do_not_cross: { holds: "p_min <= p_max" }.
An entry has no dims:. Its predicate must hold at every coordinate of the
dimensions that holds and where name together, and a predicate narrower
than that broadcasts, as it does in any where.
What a predicate may say#
A predicate may use everything the where grammar accepts, including arithmetic on either side:
dimensions:
snapshot: { dtype: int, ordered: true }
generator: { dtype: str }
parameters:
eta: { dims: [generator] }
p_max: { dims: [generator] }
peak: { dims: [] }
load: { dims: [snapshot] }
ramp_limit: { dims: [] }
variables:
p:
dims: [snapshot, generator]
bounds: { lower: 0, upper: p_max }
constraints:
meet_load:
dims: [snapshot]
expression: sum(p, over=generator) == load
objective:
sense: minimize
expression: sum(p)
assumptions:
efficiency_is_a_fraction: "eta > 0 AND eta <= 1"
peak_is_reachable: "sum(p_max, over=generator) >= peak"
ramps_are_gentle:
holds: "load - shift(load, along=snapshot, offset=1, edge=0) <= ramp_limit"
where: "position(snapshot) > 0"
description: the first snapshot has no predecessor to ramp from
Give an entry a where: when its parameter has data only where it applies, so
that the rows where the parameter has no value are not checked.
What the loader refuses#
The loader refuses a predicate that the connectives already decide:
Assumption 'sound': the predicate'c > 0 OR true'folds to true, so it assumes nothing of the data. Delete it, or name a parameter it constrains.
A where: the connectives decide is refused the same way: one that folds to
true narrows nothing, and one that folds to false checks the entry on no row.
The loader refuses a variable in a predicate:
Assumption 'sound': variable'p'appears in'holds:', and an assumption checks only data. Name a parameter, or state the rule as a constraint.
A constraint whose sides carry no variable is refused, and its message names this section.
What a curve assumes#
A piecewise: entry named curve adds its own assumptions,
which to_spec derives from its method:, its points: and the sign on its
links. They print under the same Assumptions heading as the written ones.
| Entry | Added for | Holds |
|---|---|---|
curve_complete |
every entry | every values parameter has a row at every breakpoint the curve runs through |
curve_increasing |
convex, lp |
the pinned link's breakpoints (the first link's, when both are pinned) strictly increase along over |
curve_curvature |
convex, lp |
with a >= link the curve is convex, with <= concave; with both links pinned it bends one way only |
curve_breakpoints |
lp |
each curve has at least two breakpoints |
curve_contiguous |
an entry with points: |
the marked breakpoints are one consecutive run of at least one |
Reading a spec and its program says how a tool runs them.