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.
Example models
The examples below demonstrate a range of different topics and implementation options. The source model/scripts and further information about each are available to download from the GitHub repository.
Simulation for training and testing AI – Email Pack
AnyLogic simulation is the training and testing platform for AI in business. With AnyLogic general-purpose simulation, you can construct detailed and robust virtual environments for training and testing your AI models. The unique multi-method simulation capabilities provide a comprehensive tool for use in machine learning. Established in use at leading companies across industries, this fully cloud enabled platform with open API is enhancing and accelerating AI development today. Find out more about this powerful machine learning tool in our AI email pack and white paper!
AI pack and white paper