question

Tuan avatar image
1 Like"
Tuan asked Kavika F answered

Running experimenter too many times caused it to crash or not run

Connect flexsim and python via Socket

python as client flexsim as server

python is responsible for passing variables to flexsim

flexsim take variables to scenario and executes experimenter

After flexsim executes the experimenter, the value is passed to python

Execute repeatedly until the algorithm reaches the number of iterations

But the number of iterations has not been reached, flexsim will crash or stop working

How to solve??

PBnB.zip

Model.fsm

FlexSim 20.0.10
pythonexperimetersocket
pbnb.zip (62.6 KiB)
model.fsm (143.0 KiB)
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

Hey @Tuan, I think the main reason this program takes so long is because your python script makes O(n^4) calls to a function that sends and receives messages from FlexSim. FlexSim has to run the experimenter (which takes time). That many calls to the experimenter will cause a lot of waiting time. In addition, I noticed that as I ran the experimenter for longer, the memory usage of FlexSim increased over time.

I timed how long it took for you to run the function that calls FlexSim and receive a response. On average, it took 8.5 seconds to execute that function. In one depth of your nested for-loops, you call that function 200 times. That comes out to nearly 30 minutes to run that one loop. That loop is repeated another place - now 1 hour total - all underneath a loop that repeats twelve times. So, if you want to run this whole thing; you'll be waiting about 12 hours. That doesn't take into account other loops and branches you have that also run that function.

5 |100000

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