Please review them to get some inspiration of possible use cases and to better understand the workflow. There are demos and example models provided with the library. If you press the "get x" button first, an error will be thrown because you tried to get the value of a variable before you defined it! Run the model! You should first click the "set x" button, then press the "get x" button afterwards, the number specified should be printed.The double class is passed to convert the feedback (a string by default) to a floating point value. An Attempt object is returned, containing a function to check whether the command executed successfully - isSuccessful() - and a function to get the response - getFeedback(). Traceln(xValue) The runResults function is used when you want to retrieve a value from Python. The passed string is what is sent to Python it defines a new Python variable, x, which is set to the floating point number 3.14ĭrag in another button, set its label to "get x", and in its Action field, type the following code:Īttempt attempt = p圜nResults("x") ĭouble xValue = attempt.getFeedback(double.class) P圜n("x = 3.14") The run function is used to send statements to Python that expect no response (e.g., variable assignments or import statements). Set its label to "set x", and in its Action field, type the following code: In the AnyLogic editor, drag in a new button from the Controls palette. Basic tutorialīuilding on the model made in the previous section, try the following: If you do not see this, or you receive an error, please refer to the troubleshooting section of the wiki. The inspection window should show the version of Python and the path to the Python executable that's being run.In your running model, click the Communicator object.Drag in a Python Communicator from the Pypeline palette tab keep its default name ("p圜ommunicator"). To ensure proper connection is made, first run a simple test: *For a full explanation of how to use, including a deeper description of the available functions, please refer to the wiki. This section goes over testing the connection works and a simple tutorial. You should see a new palette item for Pypeline with the custom Python Communicator agent.A step-by-step explanation of how to do this is available in the AnyLogic help article "Managing Libraries". Download the Pypeline.jar file (from the releases) and place it somewhere it won't be moved (or accidently deleted).You need to have AnyLogic with any valid license (PLE, University, or Professional) and a version of Python installed on your machine. They are described more thoroughly in the provided wiki (which is what the user guide migrated to). These instructions will get Pypeline integrated with AnyLogic. Using simulation as a testbed for testing trained artificial intelligence policies.Being able to use any Python-exclusive library.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |