RL model reward

RL model reward

mhosseini457NG
Advocate Advocate
10 Views
4 Replies
Message 1 of 5

RL model reward

mhosseini457NG
Advocate
Advocate

[ FlexSim 24.0.0 ]

I followed all the steps in the reinforcement learning tutorial, but I'm facing an issue and that is the reward is not updating like it's supposed to. Plus, when I open the model, the time inside it skyrockets to something huge. Can't figure out what's going wrong here. Can anyone help on this?

* I've got all the Python packages updated and in place, and the model is set up in meters, so that's why the Boxes might seem a bit on the small side.

Socket connected
Waiting for READY message
READY
Waiting for ActionSpace message
Waiting for ObservationSpace message
Sending Reset message
Waiting for Observation message
{"done":0,"reward":0,"state":2}
Sending Action message: 3
Waiting for Observation message


Also, is this the last version of env.py after update to gymnasium from gym?example-flexsim-env.py

ChangeoverTimesRL_1.fsm

0 Likes
Accepted solutions (1)
11 Views
4 Replies
Replies (4)
Message 2 of 5

nilP8GEZ
Observer
Observer
Accepted solution

Hello Maryam

I just saw your question and it seems you're encountering the same issue as Clara (Reinforcement learning - FlexSim Community).


I hope the solution provided to Clara will be helpful to you as well.



0 Likes
Message 3 of 5

mhosseini457NG
Advocate
Advocate
@Nil Ns Thanks! yes, this is very helpful, I have one question:

how do you know all decision events in RL failing? was it just by looking at the stack up issue in the visual model or is there any other way to check these things?



0 Likes
Message 4 of 5

nilP8GEZ
Observer
Observer

Hello,

I realized that the events were not triggering because in the model, the `LastItemType` parameter only updates when this event triggers. When it wasn't updating, I began to suspect there was an issue. To confirm this, I opened the code of the request action and placed a debug point (the model stops each time it's going to execute that line). Seeing how it only stopped at the reset, I realized there was a problem.

1706628371461.png

1706628379850.png


Another option could have been to print to the Output Console every time a call is made to the RL (in the On Observation code).

1706628397638.png

0 Likes
Message 5 of 5

mhosseini457NG
Advocate
Advocate
@Nil Ns got it, thanks for your clarification!
0 Likes