question

Lambert avatar image
0 Likes"
Lambert asked Jordan Johnson answered

Run optimizer silently

Hi, I've seen some post describing how to open flexsim silently and run a simulation via command prompt, e.g. https://answers.flexsim.com/questions/21116/automatically-configure-and-run-a-flexsim-model.html

however, is there a way to do the same thing and run the optimizer?

thank you

FlexSim 23.0.5
optimizer command prompt
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
0 Likes"
Jordan Johnson answered

Here is the code to start an optimization (which is a type of Experiment job) through FlexScript:

treenode exp = node("/Tools/Experimenter", model());

// If something has changed that would change the results of the optimization,
// e.g. an input table, delete the results file.
treenode dbNode = function_s(exp, "getDBConnection");
function_s(dbNode, "deleteFile");

treenode job = getvarnode(exp, "jobs").subnodes[1];
function_s(exp, "run", job);

My guess is that you'll want to add this kind of code to your OnModelOpen trigger, after any import code you want to run, so that your tables will be up to date. Then when you run the model via command prompt, it will automatically start the optimization. Use the On End of Job trigger on the Experimenter to (possibly) export the results and exit FlexSim.

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.