Here, you'll learn how to set up your model to translate the action decisions prescribed by Pathmind into a format that your AnyLogic model can interpret. We'll explain what that means below.
Step 1 - First, determine the number of actions that your simulation requires. It may take many iterations to get this right.
@Discrete is one of several types of action spaces that Pathmind supports. We'll only cover discrete action spaces in this article to keep things simple.
n is total number of possible actions that a single agent can perform. For example, in the case of a street light, it'd be n = 2 (stop or go).
size indicates the total number of decision points in your model. For example, if your simulation contains three street lights that require an action for each at any given moment, then size = 3 (a decision for each of the three street lights).
Now create a new function and assign it the name
Next, click the
doAction function to inspect its properties.
Step 2 - Accept
action as an argument in
First, ensure that
Just action (returns nothing) radio button is selected.
Then inside "Arguments"...
- Set the Name to
- Set the Type to whatever data type you had specified in Pathmind Helper. In this case, it was an
Step 3 - Write your doAction function.
doAction function will accept an argument from Pathmind which inform the agent what to do next.
1 - Agent to do action
[5, 2] - Agent 0 to do action
5 and Agent 1 to do action
The job of
doAction is to map this number into something that AnyLogic can interpret.
Finally, you can inspect your
doAction by following the instructions here.