question

Hanifi.Yilmaz avatar image
0 Likes"
Hanifi.Yilmaz asked Kavika F edited

FlexSimPy - run simulation from python

I just extended a genetic algorithm with flexsim. Now i have two problems, where i dont know where it comes from.

1.) The model gets "destroyed" every time it finishes an optimization process. Flexsim opens a script console for every run, i dont know why.

- Do I have to open the model in every run or just once at the start?

- When do i have to stop the controller? Only in the end or for every solution in the optimization?


1678795268870.png

2.) Python automatically restarts the script: I dont know if this problem has to do with flexsim or python. After some iterations, i always get the information "Restart python shell". Do you know where it can come from?

1678795588162.png

Thanks.

FlexSim 22.2.4
flexsimpy
1678795268870.png (67.2 KiB)
1678795588162.png (3.4 KiB)
· 8
5 |100000

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

Kavika F avatar image Kavika F ♦ commented ·
Hey @Hanifi.Yilmaz, from the looks of your screenshot, it is opening a System Console each run, which makes me think that there's an error in your model that is trying to print a statement.

If you have no license, then you can't run an optimization job with the experimenter. You also can't run any scripts within FlexSim.

0 Likes 0 ·
Hanifi.Yilmaz avatar image Hanifi.Yilmaz Kavika F ♦ commented ·

Hey @Kavika F


I have a license and i dont use the experimenter at the Moment. The Problem is deterministic.

Even when i set every solution from the algorithm manually in Flexsim, i got the same result as in Python. It solves the Problem, but destroys the Model. I use the Controller.setParameter(name,value)method to set the parameters in flexsim. Maybe the problem is the way of using the methods of flexsimpy. Do i have To open the script only once? And what does the „Controller.stop()“ methods exactly do?


Another question: Is it possible to start the Experimenter with FlexSimPy to make MC Simulations? My next step is to solve a stochastic problem.

Thanks

0 Likes 0 ·
Hanifi.Yilmaz avatar image Hanifi.Yilmaz Kavika F ♦ commented ·
Update: I solved the first problem. My mistake was that i opened the script in every iteration instead of opening it once. For the other (2) problem, i dont have a solution.. The script always restarts itself. @Kavika F
0 Likes 0 ·
Kavika F avatar image Kavika F ♦ Hanifi.Yilmaz commented ·
Is there a loop in your code calling itself? Could you post it so I could see what could be happening?
0 Likes 0 ·
Show more comments

0 Answers

·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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