Error training with flexsim_training.py

Error training with flexsim_training.py

lorenzo_pio_g
Not applicable
684 Views
4 Replies
Message 1 of 5

Error training with flexsim_training.py

lorenzo_pio_g
Not applicable

[ FlexSim 22.2.2 ]

1665770307006.png

Hi. I have developed a model in flexsim in which I need to optimize the idle rate of a processor by applying RL to a robot. It has to pick up the boxes from the right queue and decide on which combiner to leave it, based on the number of boxes present on the pallet placed on the top combiner (Combiner1). However, the moment I go to train the agent through the code in flexsim_training.py, this writing remains perpetually and the agent is not trained.

progettoTesi.fsm

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

Jacob_White
Community Manager
Community Manager
@Lorenzo_pio G,

Are you able to run the flexsim_env.py code? It seems like visual studio is unable to connect to FlexSim.

0 Likes
Message 3 of 5

lorenzo_pio_g
Not applicable

The connection to FlexSim is made correctly. In fact, FlexSim opens the moment I run the code. I also tested the flexsim_env.py file on the fsm ChangeoverTime file, which I implemented to follow the RL tutorial, and everything works correctly. There must be an error in initializing the RL parameters in my project, but I can't figure out what it is.

0 Likes
Message 4 of 5

Jeanette_Fullmer
Community Manager
Community Manager
Can you post your model? It looks like you may have tried to but there is not an attachment.
0 Likes
Message 5 of 5

Jacob_White
Community Manager
Community Manager
Accepted solution

Hi @Lorenzo_pio G,

It looks like the reason your model wasn't able to train is because the reinforcement learning was never able to make a decision with the "On request action" activity. If you run your model you will see that the value in your Action parameter table will never change.

The reason behind this is that reinforcement learning decision events cannot be linked to object flows. You can however use the custom code activity to act as request decision itself. This option can be found by selecting "Control," Reinforcement learning," and then request decision. Select the reinforcement learning tool that you will be using, and then whenever a token enters that activity it will drive the decision making process in the reinforcement learning.

reinforcement-learning.jpg

Once that is fixed, your model should be ready to start training.

RL_JW.fsm

0 Likes