Limitations
agent-based modeling, abm, bptk, bptk-py, python, business simulation
Limitations
Currently the BPTK_Py framework is geared towards our own need and has a number of limitations. We are more than happy to extend the framework to suit YOUR need, so please let us know what you need so that we can prioritize our activities. You can reach us at support@transentis.com
The Rust execution engine
The Rust engine runs System Dynamics scenarios only. A scenario manager registered as agent-based ("type": "abm") - which is how agent-based and hybrid models are run - always runs on the Python engine, its agents and its System Dynamics part alike, and ignores backend.
The Rust engine runs a serialised copy of the model. It cannot run the following:
- A System Dynamics model with agents and a user-defined function — the function could read what the agents produced. The two halves advance one step at a time, and the engine computes every step of a run at once, so such a function would read a step that has not happened yet. A model that merely has agents is fine; it is the combination that is refused.
- A user-defined function registered with
elementwise=False— it is handed a whole array and answers once, and the engine’s callback answers with one number. - A model class of your own that is no
Model— and a file transpiled from XMILE by a release before 3.5.0 whose source is gone. Only aModelis serialised; a model compiled from XMILE today is one. - An installation without the engine — the pure-Python wheel, which is what micropip installs in a browser.
Asking for backend="rust" on a model from that list raises RustBackendError, naming the cause. See Execution Backends for how to catch it.
Arrayed models are not in that list. They run on the Rust engine like any other: an arrayed element’s sub-elements are ordinary scalar elements named with brackets, the aggregations became engine-side functions over them, and dot is expanded into a sum of products before the model is handed over. User-defined functions are not in that list either: a model that has them runs on the engine, which calls back into Python at those nodes and says so at [WARN].
A stochastic session continues after a restart without a seed, but it draws different numbers from then on. To get the same results as before, pass an explicit seed to begin_session - see Execution Backends.
Running the documentation in a browser
Most pages of this documentation run in your browser, on Pyodide. A page whose model is read from files beside it is shown with its results instead, because those files do not reach the browser. Pyodide is Python compiled to run inside the browser. It differs from the Python on your machine in three ways:
- The Python engine only. There is no Rust engine in the browser - see Execution Backends.
- One kind of interaction per page load. A slider answers move after move, and a cell edit re-runs everything downstream. Doing both in one session eventually exhausts the browser’s heap and the page goes quiet until you reload it. Every plot leaves its figure behind, and the page shares one heap for everything on it. Large models and long runs fill the heap sooner, so they are better run on your own machine than in the browser - preferably on the Rust engine.
- No progress bars.
progress_bar=Trueneeds a lock that the browser platform does not provide, and the run stops rather than slows.
None of this applies when you run the same notebook on your own machine. The Installation page shows how.
Capabilities that need an extra
The base install deliberately does not carry everything. Plotting, the server and Logfire logging each need an extra. If you use one of them without its extra installed, BPTK-Py raises an error that names the extra to install - see Installation.
Simulation and XMILE
- BPTK-Py integrates with Euler’s method only. The transpiler refuses a Stella model set to Runge-Kutta rather than run it with Euler.
- Which XMILE builtins the transpiler compiles, what it does not compile, and how each builtin is written in the SD DSL: see XMILE in the SD DSL.