Task 4.2 - Optimization Job

Task Overview

The Experimenter allows you to define an Optimization Job. Unlike the Experiment Job, which explicitly defines scenarios, the Optimization Job will automatically create scenarios and then test those scenarios, trying to find a scenario that best meets an objective.

All Optimization Jobs use FlexSim's optimizer, which is run by the OptQuest optimization engine.

Step 1 Adding an Optimization Job

  1. Go to the Jobs tab in the Experimenter window.
  2. Click the Add button in the top-left and choose Optimization from the menu.

Step 2 Designing the Optimization Job

  1. Set the Stop Time to 10000. This is how long the Optimizer will run each scenario to evaluate it.
  2. Set the Wall Time to 0. This usually means how long the Optimizer is allowed to run in real time. The value 0 means it has no time limit.
  3. Check the top box in the Parameters tree to include both parameters.
  4. Set Max Iterations to 50. This means the Optimizer will try no more than 50 different scenarios to find the optimal scenario.
  5. Click on the Function cell for the first objective.
  6. Click on the button that appears.
  7. Point to Performance Measures, then choose PerformanceMeasure1.

Step 3 Running the Optimization Job

  1. Go to the Run tab in the Experimenter window. Then:

    • Use the Job combobox to select the Optimization Job.
    • Click the Run button.

  2. The Optimization Job then begins running through the following loop:

    1. Guess values for Parameter1 and Parameter2. Each guess becomes more and more intelligent as the optimization runs. Each guess is called an Iteration.
    2. Run a model with those values for 10000 seconds.
    3. Evaluate the performance measures.
    4. Calculate the objective function.
    5. Rank this scenario.
    6. Use the information from this scenario to create a new scenario - new values for Parameter1 and Parameter2.
    7. Repeat from Step 2.

    The Optimization can make many simultaneous guesses, if you have more than one CPU available.

  3. As the Optimization Job progresses, the status chart will update and show the job's progress.

  4. Once the Optimizer evaluates 50 scenarios, a message will appear stating why the Optimizer stopped. In this case, it will say that the Optimizer reached the maximum number of iterations. If something went wrong, the message will contain information about the error.

Step 4 Analyzing the Results

When the optimization is finished, the Optimizer Results chart should look something like this:

The best scenario is marked with a gold star. As the Optimization Job progresses, it will generally find better and better scenarios. However, it may also try new random guesses, to make sure it isn't stuck in a local optimum. Those random guesses may not perform as well.

Answering the Original Question

The goal of this optimization was to figure out where to put the two processors. We can now very easily find the answer to this question.

  1. Hover over the best scenario (the scenario with a gold star) on the chart; a small popup will appear.

  2. Click on this scenario to select it. Now, in the Graph Options panel, change the Y Axis to Parameter2, and the X Axis to Parameter1.

  3. The scenarios that performed the best have a high value for Parameter1 and a low value for Parameter2.


An Optimization Job is a powerful tool that allows you to try hundreds of configurations automatically, as part of a search for the best objective value. Even if there are dozens of variables with complicated interactions, the optimization can still find very good scenarios, in a short amount of time.