Changelog
Release history of the BPTK-Py business simulation framework.
Keywords
bptk, bptk-py, changelog, release notes, python, business simulation
Changelog
3.0.3
- Bugfix:
run_scenarioswithagentsbut without theagent_statesargument now counts every state the agent has, instead of raisingAttributeError - Bugfix:
begin_sessionsays that sessions run System Dynamics scenarios only when it is handed an agent-based scenario manager, instead of failing several frames down withAttributeError: _get_cache is invalid - Bugfix:
begin_sessionreports a scenario or scenario manager name that matches nothing, with a suggestion - a typo used to start a session that silently carried neither - Bugfix:
train_scenariosstops whenagent_states,agent_propertiesoragent_property_typesare passed without the argument they depend on - the four checks logged an error and then trained anyway - Bugfix:
RedisAdaptercompresses session state whencompressis set - the flag defaults to true and had no effect at all - Bugfix: compressed session state keeps the steps it was written with, instead of renumbering them to 1, 2, 3 - a session on a model starting at 0 came back with every value one step out, and a setting made in only some rounds came back under the wrong ones
- Bugfix:
Element.plot(format="axes")no longer leaves its figure in matplotlib’s global registry - the half of that fix that 3.0.2 missed, so a slider redrawing an element no longer exhausts the browser’s memory - Bugfix: importing the XMILE code generator no longer raises a
SyntaxWarningabout an invalid escape sequence - Breaking:
register_scenario_managerleaves an already registered manager untouched and logs an error - it used to drop the model but still merge the scenarios passed with it, so a new scenario ran against the model the caller had just replaced. Useregister_scenariosto add scenarios, orreset_all_scenariosto start over - Breaking: the plot settings live in one central configuration that every plot method reads, applied around each drawing call instead of being written into the global
plt.rcParamswhen abptk()is constructed - charts drawn outside BPTK are no longer restyled, andElement.plot()looks the same whether abptk()exists.configurationpassed to the constructor writes into that central configuration, so it applies to every plot in the process;BPTK_Py.plotting_config.reset()returns to the defaults - Feature:
plot_scenarios,plot_lookup,Element.plotandvisualizer.plottakematplotlib_rc_settingsto style a single plot - laid over the central configuration for that one call, which is left unchanged - Bugfix:
figure.figsizeandlines.linewidthset throughmatplotlib_rc_settingsreach the chart - they name the same thing as thefigsizeandlinewidthsettings, and the explicit argument the plot call passed used to win, so setting the rc form did nothing - Removed: the configuration keys
interactive,bptk_Py_module_pathandsd_py_compiler_root, none of which was read by anything - Upgraded dependencies: PyO3 0.29.2 in the wheel, Flask 3.1.3 in the
serverextra - both for published advisories, neither changes an API
3.0.2
- Feature:
format="plot" | "axes" | "df"onModel.plot_lookup()andbptk.plot_lookup(), matchingElement.plot()andplot_scenarios() - Bugfix:
plot_scenarios()logs and returnsNonewhen a run produced no rows, instead of raising'NoneType' object has no attribute 'columns' - Bugfix: fan-out runs in sequence under Emscripten instead of failing at
join() - Bugfix:
format="axes"no longer leaves its figure in matplotlib’s global registry - Bugfix:
Model.reset()resets the agent id counter, so a reconfigured model no longer raisesIndexError - Bugfix:
list_equations()prints converters and constants once instead of once per flow - Bugfix: a scenario constant naming an equation the model does not have is reported instead of silently ignored
- Bugfix: registering a scenario under a name that already holds a different definition is reported
- Bugfix:
series_nameskeys that match no column are reported
3.0.1
- Fix publication issue: variable pins on the Emscripten platform, so the browser wheel installs with
micropip
3.0.0
- Breaking: introduced extras
plotting,xmile,server,observability— see Installation. Base install no longer pulls matplotlib, flask, psycopg, redis, logfire, parsimonious, xmltodict, jinja2 - Breaking: removed the widget layer —
SimpleDashboard,ScenarioWidget,ModelConnection, theBPTK_Py.widgetspackage,HybridRunner.run_scenario(widget=…), ipywidgets - Breaking: removed the unused dependencies
cachetools,requests,distlib, the unusedBPTK_Py.sdcompiler.sdmodelmodule, and the Docker image — it had not built since the maturin migration - Breaking:
configure_logfire()raisesImportErrorwhen Logfire is missing instead of returningFalse - Feature: added a pure-Python wheel next to the platform wheels, so
micropipcan install BPTK in the browser - Feature: rebuilt
progress_barontqdm— works in the terminal, in marimo and in Jupyter - Feature: added
format="plot" | "axes" | "df"toElement.plot(), matchingvisualizer.plot() - Feature: replaced sympy in the XMILE built-in
CGROWTHwith a closed form; results unchanged - Various small bugfixes
2.4.1
- Bugfix: Rust backend — a feedback loop whose only time offset is a
delay()is no longer rejected as cyclic. This is the standard System Dynamics ordering policy (supply chain, capacity and workforce models), which previously fell back to the Python backend without the caller noticing - Bugfix: Rust backend — fixed a crash (
PanicException: RustSdModel is unsendable) that killed the process when a threaded WSGI server continued a step-by-step session on another thread - Bugfix: Rust backend — constant and graphical-function overrides passed with the first
run_step()now take effect in that step, as they do on the Python backend - Feature: Rust backend — when a model is rejected because its equations form a circular dependency, the error now names the equations involved (
Cyclic dependency among non-stock entities: a → b → a) instead of only reporting that one exists - Feature: a fallback from the Rust backend to Python that happens after a step-by-step session has already advanced is now logged as
[ERROR]rather than[WARN], because the Python backend cannot see the rounds the Rust engine already played and recomputes them with the settings of the current step
2.4.0
- Feature: Step-by-step execution on the Rust backend (
RustSdModel.init()/step()), wired throughbptk.run_step()so server step-by-step sessions can run on Rust - Feature: New stateless
/executeserver endpoint: POST a complete JSON model plus scenarios and get results back (primary path for the visual modeler) - Feature:
/begin-sessionaccepts abackendfield, andbptkaccepts adefault_backendconfiguration option, so a server can run Rust-backed sessions - Feature: Rust-backed session resume through the external state adapter: the engine’s memo grid is externalized and imported on resume (no re-simulation), with seed plumbing for reproducible stochastic models
- Bugfix: Various XMILE compiler fixes (
NORMAL/PREVIOUScode generation, scientific-notation parsing, Windows encoding) - Substantially expanded test coverage
2.3.0
- Feature: Add Rust-based SD execution backend (
backend="rust") for significantly faster simulation performance - Feature: Rust engine supports stocks, flows, biflows, converters, constants, all arithmetic/logical operators, stochastic/statistical distributions, and graphical functions
- Feature: Automatic silent fallback to Python backend for unsupported features (arrays, modules, custom functions)
- Feature: Add
Model.to_json()for serializing SD DSL models to JSON - Feature: Add
ln,log10,floor,ceil,negbinomialfunctions to SD DSL - Bugfix: Fix
geometricandparetodistributions in Rust engine to match Python/numpy semantics - Bugfix: Fix
ScenarioManagerSd.get_cloned_model()to properly copy_equationattribute
2.2.3
- add unittests
- fixed typos
2.2.2
- Bugfix: Fix issue in external state adapter
2.2.1
- Improve logfire logging.
2.2.0
- Feature: Add externalStateAdapters for Postgres and Redis
- Feature: Add option to externalize state completely, thus turning bptkServer into a stateless server
- Feature: Add pydantic logfire as logging backend
- Improve return message on bptkServer /stop-instance
2.1.1
- Update dependencies
2.1.0
- Feature: extend plot_scenario to accept a format parameter
- add unittests
- Bugfix: fix typos for server output
- Feature: enable operations: not named vector and int/float
- Bugfix: fix issue with configurable file-path for bptk-object
2.0.0
- Support for multidimensional sddsl
1.9.6
- Enable modulo operation for sddsl-elements
- remove unnecessary code
- add unittests/pytests
1.9.5
- Fix publication issues
1.9.4
- Fix publication issues
1.9.3
- Fix agent.py serialize method
- Removed to_string method of agent.py
- Fix csv_datacollector.py
- Removed kinesis_datacollector.py, yaml_model_parser.py and serializer.py
- Fix model.py reset method
- Adjusted model.py configure_properties method (only dict-values allowed)
- added unittests
1.9.2
- Fix to build script
1.9.1
- Bump versions of key dependencies
- Update XMILE parser grammar to remove depreciation warning
- Remove obsolete documentation files
- Update setup to use pyproject.toml
- Bump Python Version to 3.11
1.9.0
- BPTKServer:
runendpoint now also works for agent-based models - Model: Add
configure_agent,configure_propertiesanddelete_agent(s)methods - Bump versions of key dependencies
1.8.0
- BPTKServer: Add new endpoint
start-instancesthat starts multiple instances in one goo
1.7.6
- BPTK: Improve handling of floating point numbers when using small DTs
- ScenarioManagerSD: Fixed an issue that caused models with biflows to be cloned incorrectly
1.7.5
- BPTK: Fix that caused a crash when using multiple scenario files for hybrid models
1.7.4
- BPTK: Fix bug in reset_scenarios for Hybrid Scenario Managers
1.7.3
- BPTK: Update dependencies of Pandas/Matplotlib/Sympy/Parsimonious/Pyyaml/Xlsxwriter/Jinja2/Requests/Jsonpickle/Flask
- Successfully tested with Python 3.11
1.7.2
- BPTK: Fix imports of SimpleDashboard class
- BPTK: Update dependency of Scipy, Numpy and Pyyaml
1.7.1
- BPTK: reset_cache now also resets the data collector in agent based models
- BPTK: reset_cache calls the reset_cache method on all agents
- BPTK: agents now have a reset_cache method that can be used to reset agent state
- BPTK: Updated dependency on ipywidgets to 8.0.4
1.7.0
- BPTK Server: Remote authorization for root, full-metrics and metrics endpoints
- BPTK Server: Add /healthy endpoint
- BPTK Server: stop-instance and load-state are now POST resources
- Bug Fix: Remove debug print message
1.6.6
- BPTK: Defer import of matplotlib and ipywidgets until they are needed
1.6.5
- BPTK: Hybrid scenarios can now be spread accross multiple scenario files
- BPTK: Remove filename attribute from hybrid scenario manager as it is obsolete
- BPTK: Scenario definitions for SD DSL scenarios now accept a runspecs setting to override starttime, stoptime and dt
- BPTK: begin_session now accepts a settings parameter to override scenario settings
- BPTK Server: begin_session now accepts a settings parameter to override scenario settings
1.6.4
- BPTK Server: Simplified bearer token authentication
1.6.3
- BPTK Server: Added optional bearer token authentication
1.6.2
- BPTK Server: Fixed unsafe external state adapter code
- BPTK Server: start_instance now returns correct content type
1.6.1
- SimpleDashboard: Deleted superfluous import statement
- bptk: Small improvements to documentation
1.6.0
- BPTK Server: The run_step methods now also support agent-based models
- BPTK Server: A new endpoint streams_steps runs all the steps of a model and streams the results, especially useful for models that run for a long-time.
- SimpleDashboard: A new utility class that allows easy creation of dashboards based on Jupyter Widgets.
1.5.3
- BPTK Server: Since v 1.5.0, BPTK Server requires a Python version >= 3.9. The package now informs the user about this upon import. Other parts of the BPTK framework should work fine with older Python3 versions.
1.5.2
- BPTK Server: Added file adapter as a concrete example of an external adapter
- BPTK: Improve cleanup of resources when bptk instance is destroyed
1.5.1
- BPTK Server: Improvements to the new state externalisation feature
- BPTK Server: Improve cleanup of resources when an instance times out
1.5.0
- SD DSL: Added a new module class that makes it easy to structure large models
- BPTK Server: Add new endpoints to allow externalising the instance state
- BPTK Server: Changed the default timeout for equations for instances to 12h
1.4.3
- SD DSL: fix to delay function
1.4.2
- Small bugfixes in prometheus metrics.
1.4.1
- BPTK: Fix to plot_lookup
- BPTK Server: ‘flat’ version of session results
- SD DSL: small changes to SD functions pulse and delay to make them more robust.
1.4.0
- BPTK Server: add metrics endpoint
- SD DSL: fixed missing imports that caused some sddsl functions to throw an exception
1.3.12
- BPTK Server: fixed an issue that could lead to race conditions leading to server crashes
1.3.11
- BPTK Server: add a keep-alive method to keep instances from timing out
- BPTK Server: start-instances now accepts a timeout structure so that instance timeouts can be set flexibly.
- BPTK Server: fixed an issue that could lead to race conditions leading to server crashes
- XMILE: fixed an issue regarding lookups (graphical functions) that do not contain values on the x-axis
1.3.10
- BPTK: fixed an issue in train_scenarios which caused an exception in recent versions of bptk-py
1.3.9
- XMILE: Array arithmetic (such as array multiplication,…) within array functions such as SUM is now handled correctly.
1.3.8
- XMILE: Arrayed variables that have non-arrayed inputs with “apply to all” set are now handled correctly
1.3.7
- XMILE: Ensure the startime and stoptime in transpiled XMILE models are floating point values (e.g. 1.0, not 1)
- XMILE: Top level variables in a model that contains modules are now referenced correctly from submodules
- XMILE: Nested modules are now handled correctly
- XMILE: Array dimensions of length <3 are now handled correctly
1.3.6
- Add new method session_results to bptk and corresponding endpoint session-results to Bptk server that allows the session results so far to be retrieved.
1.3.5
- Fixed an issue that caused bptk-server to crash if start-instance was called after a previous instance had timed out
1.3.4
- Small improvements to the XMILE/SMILE parser regarding element names that include special characters and regarding operators surrounded by newlines.
1.3.3
- Return message from end-session resource now correctly reads “session terminated”
1.3.2
- Rename package due to issues with test pypi
1.3.1
- Add missing package in setup.py
1.3.0
- Fix bug in run_scenarios that arose with multiple scenario managers and when return_format was json or dict
- Add begin_session, end_session and run_step methods to bptk
- Add agent endpoint to BptkServer
- BptksServer now takes a bptk_factory function instead of a bptk object in its constructor
- Add start-instance endpoint to BptkServer
- Add begin-session, end-session and run-step endpoint to BptkServer
1.2.1
- Improve documentation
- Bugfix for bptk.export_scenarios
1.2.0
- Major tidy up of the bptk API, including a number of breaking changes. In particular the run_simulation method has been renamed to run_scenarios and reset_simulation_model was renamed to reset_scenario_cache. A number of rarely used methods have been removed.
- Documentation improved and extended.
- Internal refactoring.
1.1.27
- Fix bug in XMILE compiler regrading parsing of names that start with a keyword
1.1.26
- Fix bug in XMILE compiler that causes parsing of if/then/else structures to fail under some circumstances
- Fix bug in XMILE pulse function that causes the function to misbehave in some circumstances
- Fix bug in XMILE previous function that causes the function to misbehave in some circumstances
1.1.25
- Improve error handling and fault tolerance on BptkServer
1.1.24
- Update to BptkServer internals
1.1.23
- Add a new experimental feature that allows REST APIs for simulation models to be set up easily.
1.1.22
- SD DSL: Add python power operator (**) to all SD DSL operators
- XMILE: Ensure SAFEDIV works in complex expressions
1.1.21
- Improve handling of SAFEDIV in SD compiler
1.1.20
- Fix for the SD compiler regarding dimension names usage
1.1.19
- Little fix regarding the SD-Compiler
1.1.18
- Improvement of SD compiler: Support for empty initial value of
DELAYfunction. Support for dimension names as arguments for functions (e.g.SIZE(<dimension>))
1.1.17
- Improvement of Extended Data Collector: Renamed to Agent Data Collector and code optimizations
1.1.16
- Bugfix for the plotting component that solves compatibility issues with newer versions of matplotlib
1.1.15
- New dataCollector for retrieving agent-wise data
1.1.14
- Fixed a bug in the interactive scenario component that caused scenarios being plotted multiple times
- Fixed a bug that caused the SD operator
delayto not accept floating point values and fixed a bug that caused the same to be parsed incorrectly in some cases.
1.1.13
- Fixed a bug in the XMILE Converter that prevented the SAFEDIV operator to be parsed correctly
1.1.12
- SD-DSL: Fixed a bug that caused converter equations (subtraction and division) to be computed incorrectly.
1.1.11
- SD-DSL: Added support for right-hand side addition and subtraction to support equations such as
converter.equation = 1 - b - Visualisation for SD-DSL elements now follows conventions to work properly with Matplotlib 3.3+
1.1.10
- Visualisation using matplotlib now follows conventions to work properly with Matplotlib 3.3+
1.1.9
- SD-DSL: System Dynamics element such as converters did not implement comparison operators (“>”, “<”, “>=”, “==”, “!=”). They have been added
1.1.8
- Another bugfix for series renaming. Simplified the code for renaming by using Pandas’ standard method
rename
1.1.7
- Bugfix for
plot_scenarios: Theseries_namesreplacer did not work properly for when only one scenario manager / scenario is given.
1.1.6
- Bugfix for XMILE compiler: A little error in the parser prevented certain models being parsed correctly
- Bugfix for
plot_scenarios: The new error messages showed up for Agent based models although the scenarios were present
1.1.5
- The XMILE compiler is a great tool that handles model conversion from XMILE SD Models to Python. For compatibility and readability, we change the equation names to camelCasing upon conversion. This might be confusing for some users. That’s why we decided to give you a new function call that lists all equations for System Dynamics Models. Simply run
bptk.list_equations()(optionally add scenario manager(s) and scenario(s)) and get an overview over available model elements. More details in our documentation. - Improved error messages. In previous versions, a long error trace was printed when an equation was not found. Now you get a neat error message output wiht hints as to why the plotting failed.
- If an equation / scenario / scenario manager is not found,
BPTK_Pygives hints on which similar equations / scenarios / scenario managers might be available for use. - Register XMILE models without having to follow the directory structure:
BPTK_PYscans thescenariosfolder upon startup to find new scenario managers and XMILE / ABM models. We developed a simpler way to add simulation models during runtime without having to add scenarios beforehand:bptk.register_model("<path_to_itmx_stmx>","<modelname>"). You can then easily simulate the model just as you’re used to.
1.1.4
XMILE equations make use of double-quote enclosed identifiers in case it actually looks like a function call. For example, 100*"Identifier(enclosed)" is a valid equation where one element (stock/flow) is called Identifier(enclosed). However, we were not able to parse this, until now. Update BPTK-Py using the new update mechanism: documentation
1.1.3
We figured that the update mechanisms via pip might be confusing sometimes, especially for non-programmers. This is why we decided to implement an update mechanism. Details are available in the documentation
1.1.2
- Bugfix to (XMILE) SD Compiler: Added support for array expressions within function calls. We had trouble with equations that contain another expression within a function call. E.g.
DELAY(arrayedElement[1,2]*5, 1, 1)was not supported. - Improvement to (XMILE) SD Compiler: Removed replacement of currency symbols (
€,$etc.) and percentage signs with abbreviations. We had implemented this in earlier releases but figured it leads to confusion with modellers.
1.1.1
- The SD DSL now differentiates flows and biflows. Simply add a biflow using
biflow = model.biflow(<name>). - The SD DSL now supports: RANDOM, IF, NOT, AND, OR, NAN, SQRT, ROUND and all trigonometric and statistical builtins you know from XMILE. Furthermore the operators support Comparison Operators (>, <, >=, <=, ==, !=) and the modulo operator (x % y).
- RANDOM:
converter.equation = sd.Random(<min>, <max>)draws a uniformly distributed float random number betweenand - ROUND:
converter.equation = sd.Round(sd.random(0,1),2))rounds a random number between 0 and 1 to a 2 digit float - IF:
converter.equation = sd.If( <condition>, <then> , <else> )corresponds toIF <condition> THEN <then> ELSE <else>. Each term inside the IF clause can be a SD term again. Example for a valid If clause:equation = sd.If(sd.time()>10,sd.random(1,2), 100) - AND/OR:
sd.Or(<left hand side>, <right hand side>)andsd.And(<left hand side>, <right hand side>)for multiple conditions - NOT: Use
sd.Not(<condition>)for “not” conditions, e.g:sd.If(sd.Not(sd.time()>10), 1, 0 ) - NAN / INF / PI:
sd.nan()returns a NAN value,sd.Inf()gives you the infinity value,sd.pi()returns the number pi. - SQRT:
sd.sqrt(<value of function>)computes the square root - SIN / TAN / COS:
sd.sin(x) / sd.cos(x) / sd.tan(x)for sinus, cosinus or tangent of x (radians) and of course we also support ARCCOS, ARCSIN, ARCTAN with the same syntax - SINWAVE / COSWAVE:
sd.sinwave(amplitude,period)/sd.coswave(amplitude,period)to generate sine / cosine waves with given amplitude and period - More documentation and how to use the statistical (random numbers from various distributions) and trigonometric operators can be found in our online documentation
- RANDOM:
- We fixed a bug that caused BPTK to crash when an XMILE model was updated while BPTK was monitoring it
- We fixed SINWAVE in the XMILE transpiler and added support for COSWAVE
1.1.0
- We are supporting all XMILE operators now. Note that random numbers with seed are never the same as when using Stella Architect’s seed! This is due to different random number generators in Python and Stella. We neither support the min / max arguments for the random number operators. Refer to the documentation)
- RUNCOUNT and SENSIRUNCOUNT are not supported and support is not planned.
1.0.2
- Bugfix release: Better support for multidimensional arrays
1.0.1
- Bugfix release: Fixed an issue with plot_lookup
1.0.0
- SD Compiler: Added new operators
- Arrays and Array Operators (MIN, MAX, SUM, MEAN, SELF, SIZE, PROD)
- Statistical operators (COMBINATIONS, BETA, BINOMIAL, FACTORIAL, GAMMA, GAMMALN, EXPRND, GEOMETRIC)
- Trigonometric operators (ARCSIN, ARCCOS, ARCTAN)
- The
plot_scenariosAPI now supports array calls such asstock[*]orstock[dim1,dim2] - SD DSL: ABS, DT, PULSE, STARTTIME, STOPTIME