For use cases that would benefit from being able to run and control runs of an AnyLogic model locally in a Python script, namely for training a reinforcement learning policy, the Alpyne library can be used.
To prepare an AnyLogic model for usage in this context, one must simply create and define a Reinforcement Learning Experiment and create decision points at which some action is desired to be taken. After installing the Alpyne library in your desired Python environment, you can take the model exported from the Reinforcement Learning Experiment and create new runs with some desired configuration, query the model state, take actions, and retrieve outputs—all from your Python environment.
Note that due to the range of libraries and techniques usable for training policies, Alpyne’s focus is on the usage of the model outside of AnyLogic. To query trained policies inside your AnyLogic model requires an implementation appropriate to how it was trained.
Usage is available for any edition of AnyLogic (Personal Learning Edition, University, or Professional), though any limitations still apply, and is compatible with Python 3.10 or above.
The AnyLogic Company has developed Alpyne as a third-party library that is a free and optional connectivity tool, without obligation to provide official support or a promise of compatibility of any kind. Users of the library may ask questions or provide comments on the Issue or Discussion tabs of the GitHub page.