question

mark zhen avatar image
0 Likes"
mark zhen asked Kavika F commented

I want to understand the parameters of reinforcement learning in tutorialia

So can you explain how the reward function illustrated by the case is designed? and the source of the parameters


For example, the meaning and source of MODEL.TIME


Meaning of CURRENT.TIME and other sources -

FlexSim 22.0.0
reward function
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

Kavika F avatar image
1 Like"
Kavika F answered Kavika F commented

The example Reward Function in the tutorial is as follows:

1663093428157.png

It starts by creating a local variable called reward and setting it equal to the Label "Reward" that's found on the Sink1 object in the 3D model. If we look at the Reward label, it is set by the following On Entry Trigger:

1663093568802.png

This trigger tells the Sink to first increment the Reward label by

  1. 10 / (Model.time - current.LastTime)

This calculation takes the difference between the Model.time (which is the current time in the model when this trigger occurs) and the label LastTime. LastTime is set following the Increment of the Reward label to be whatever that current time is. This calculation results in Model.time - current.LastTime being the time between items finishing.

Back to the first set of code, the second line resets the Reward label on the Sink back to 0. If this wasn't done, then the Rewards would compound and no meaningful learning would take place because all actions would be rewarded at an increasing amount.

We then make a second local variable done to see if the Model has finished by checking the current model time (Model.time) to see if it is greater than 1000 (model units, in this case seconds).

Finally, we return a list with the first element as the reward given and the second element a 0 or 1 denoting whether or not the model is finished running.


1663093428157.png (4.3 KiB)
1663093568802.png (12.4 KiB)
· 2
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.