A complete model, in a few lines
A workshop that sells at the price it sets: demand depends on price, the margin is a quantity computed at any time, and an invariant forbids selling at a loss. The same text serves the manager, the engine and the AI assistant. The model is written with the English words of the language.
- 01Describe
Entities, state, flows, levers.
- 02Feed
Today's facts replace the assumptions.
- 03Play
Month after month, with each scenario.
- 04Prove
Invariants, scenarios, sweeps.
# language: en
# to-model: 1.1
Model: Workshop
Parameters:
| name | value |
| purchase_cost | 60 |
| target_margin | 0.40 |
| gain | 0.6 |
| lag | 2 |
State:
| name | start |
| cash | 20000 |
Levers:
| name | domain | step | start | decided by | kind |
| price | 60 .. 200 | 1 | 100 | model | setting |
Quantities:
| name | expression |
| margin | (price - purchase_cost) / price |
Flow: Sales
Every month
Let volume = ROUND(1000 * (100 / price) ^ 1.2)
Then cash += volume * (price - purchase_cost)
Invariant: Never sell at a loss
Then always price > purchase_cost