EquaFlow DSL reference

← Documentation home · How to use the app

The importer is intentionally small. One non-comment statement goes on each line.

Fields

Entity.field = 25                    // input
Entity.field = Other.field * 2       // formula
Entity.field = ?                     // unknown to solve

Entity and field names use letters, digits and _; write a field reference as Entity.field.

Constraints

constraint Budget.total <= 50000
constraint Decision.approved == 1
constraint Risk.rate != 1

Supported comparisons are >, <, >=, <=, == and !=.

Collections / variates

Option*4.monthlyDemand = 3200
Option.automationRate = 0.55
Portfolio.totalDemand = sum(Option.monthlyDemand)
Portfolio.averageRate = mean(Option.automationRate)

Entity*N makes N repeated members of the same schema. Use it for options, teams, regions or other comparable variates. The aggregate functions are sum, mean, min, max and count.

Time series

Demand.cases_initial = 1000
Demand.growthRate = 0.04
Demand.cases[t] = Demand.cases[t-1] * (1 + Demand.growthRate)

[t] means a value varies by period. [t-1] refers to the previous period. A field named field_initial supplies the initial value for field[t].

Expressions

Use +, -, *, /, ** and parentheses. The importer also recognises IF(condition, whenTrue, whenFalse), MIN(...), MAX(...) and logical AND(...).

Decision.paybackMonths = Cost.upfront / MAX(Benefit.monthly, 1)
Decision.approved = IF(AND(Benefit.annual > 250000, Adoption.rate >= 0.5), 1, 0)
Risk.squaredProbability = Risk.incidentProbability ** 2

** is supported by the Python/Z3 solver for non-negative integer powers. Avoid fractional or negative exponents.

Comments and complete examples

Start a line with // or # for a comment. The importer exposes two complete examples. They deliberately repeat each aggregate and comparison form in useful formulas so people and model-building AI can see every construct in context.

Start with the built-in examples rather than copying a partial snippet from this page.