question

Sean avatar image
0 Likes"
Sean asked Jordan Johnson answered

How to put GA into my model

PERFECT.py

1698304212060.png1698304365096.png

I need to put GA into my model,but I don't know how to put in

FlexSim 22.2.0
pythonflexsimpygenetic algorithm
1698304212060.png (259.8 KiB)
1698304365096.png (89.6 KiB)
perfect.py (5.1 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

·
Jordan Johnson avatar image
2 Likes"
Jordan Johnson answered

It looks like you are trying to put python code directly in the FlexScript window. This is not possible. You should write a .py file, not in the model, and then only reference a file name and function name in FlexSim. You also need to toggle the node as "external" not as FlexScript.

1698337037164.png

If you want to optimize your model, you should consider an optimizer license. The optimizer that comes with FlexSim uses many evolutionary algorithms, including GA, to optimize the model.

If you really want to write your own optimization algorithm, I'd recommend you use FlexSimPy and treat the model as a black box, rather than trying to optimize within FlexSim. Create a model that is governed by model parameters. Then use FlexSimPy to launch the model, set the parameters, and obtain performance measures. You can do this in a loop.

https://github.com/flexsim/FlexSimPy


1698337037164.png (25.9 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.

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.