Bellman-SYM¶
Summary
Write a household's consumption problem in .bl, inspect its equations, then separate consumption, discounting, and investment into reusable stages. YAML supplies their connections, numerical choices, and parameter values. This guide covers authoring, assembly, inspection, and the Python interfaces; Bellman calculus develops the mathematical foundations.
Relationship with other documents
Builds on — Overview: the stage, its perches and fields, and the joining of stages into periods and a trellis, in prose. Used by — Stages: the complete income-and-consumption tutorial. Formal account — Bellman calculus: staged Bellman problems and their mathematical interpretation.
1 Reading order¶
Begin with the buffer-stock consumption tutorial. The household observes income, consumes from its available resources, and saves without borrowing. A stage is a module of that decision problem with three information sets, its perches: arrival, decision and continuation. The later examples reuse consumption as a separate stage and join it to discounting and investment.
| Step | Read | What to establish |
|---|---|---|
| Write a stage | Stages | The household's information, admissible choices, resource transitions, and value equations. |
| Inspect its meaning | From syntax to a mathematical problem, then the API | The same equations with explicit state arguments and their required assumptions. |
| Reuse and compose | Field equations, Periods, and Trellises | Separate consumption, discounting, and investment; choose the period boundary and terminal inputs. |
| Choose methods and parameters | Methodization and The Bellman factory | Numerical choices and economic parameter values for each use of a stage. |
| Keep numerical results | Solutions at the perches | Where a solver keeps what it computes: one plain dictionary for each stage occurrence, keyed by perch and by field, filled by the stage's compiled kernels. |
| Examine a numerical application | the lesson tutorials/models/cons-port/03-solving-the-two-orders.ipynb of the repository |
The portfolio–consumption model solved in both orders of its stages and the consumption rules and risky shares compared. |
The lesson solves with the model's own numerical tool; parsing or constructing a stage solves nothing. A stage occurrence is one use of a stage file at one position of a period. A general recipe can bind calibration, methods and settings by period position. In a modular model, repeated occurrences use their declaration's recorded calibration sources, and quantities such as age can change as fields. Solving also requires numerical routines and supplied continuation data.
For discrete alternatives, read Branching, which uses the separate work-or-retire example. Choosing a continuous portfolio share is not a discrete branch.
For data indexed by a parameter-defined number of cities or shock outcomes, see Indexed data. For an integer state whose values mean, for example, newborn or old, see Category codes; Periods explains how connections preserve those meanings.
2 Files and authoring reference¶
| File | Contents | Guide |
|---|---|---|
.bl |
Stage declarations, functions, shock laws, and equations. | Stages and Field equations. |
| Period and trellis YAML | Stage occurrences and compatible field connections. | Periods and Trellises. |
Methods file (.bl), with the settings and calibration YAML |
The methods, grids and handlers typed at the places of a stage, the settings they read and the economic parameter values. | Methodization. |
| Specification-recipe YAML | Which sources supply methods, settings and calibration, their precedence, and period-dependent assignments. | The Bellman factory. |
For individual spellings, use Equation parsing rules, Perch tagging rules, Constraints for bounds and the complementary-slackness clause, Expression forms, Shock distributions, Method types, and Symbol conventions. Operations lists the kinds of operation of which a builder, the operator a block of a stage file defines, is composed, and Refusals the rules under which a stage file, an entry of a methods file or a model's files are refused. The model directory layout describes the files of a model and where each is kept.
3 Inspection and Python interfaces¶
Inspection is part of using Bellman-SYM. The API lists every function in three tables, one for each of bellman.stage, bellman.period and bellman.trellis, and every path of the stage object in a fourth, and its pages take the object one level at a time, from the stage to the binding verbs: the mathematical structure a constructed stage retains, its equations, its typed quantities and its numerical attachments. The factories load and specify those stages:
| Page | Responsibility |
|---|---|
| The factory API | The fourteen functions of the Bellman factory and the page that states each. |
| Stage functions | Load a stage file into a record, elaborate it, and bind one stage. |
| Recipe functions | Read a registry through its recipe: the merge, the slots and the fills. |
| Period functions | Append a period, derive the order of its stages from their fields, and make the drawing of the period. |
| The trellis factory | Read a trellis file, elaborate and bind every period, and make the drawing of the trellis. |
The trellis factory elaborates, calibrates, methodizes and configures, and this is the recommended order for one stage (Methodization §7). The stage API also permits calibration after methodization. Each binding returns the stage it binds; methodization must precede configuration, since the methods name the settings (Methodization §5). Inspecting the equations and attachments is separate from obtaining numerical policies.
4 Mathematical reference¶
The Bellman calculus guide explains the mathematical foundations. Within this language guide, Appendix C gives rules R1–R12 for interpreting equations, including the assumptions for representing fields as functions of states. Appendix D explains computation boundaries, collection selection, and implicit policy relations.
Folded abstract-grammar boxes use ASDL, a notation describing syntax-tree structure. Their constructor listings do not prove the economic assumptions needed for an equation's interpretation. The concept wiki defines recurring terms.