Task 4.2 - Optimization Job
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
- Go to the Jobs tab in the Experimenter window.
- Click the Add button in the top-left and choose Optimization from the menu.
Step 2 Designing the Optimization Job
- Set the Stop Time to
10000. This is how long the Optimizer will run each scenario to evaluate it.
- 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.
- Check the top box in the Parameters tree to include both parameters.
- Set Max Iterations to
50. This means the Optimizer will try no more than 50 different scenarios to find the optimal scenario.
- Click on the Function cell for the first objective.
- Click on the button that appears.
- Point to Performance Measures, then choose PerformanceMeasure1.
Step 3 Running the Optimization Job
Go to the Run tab in the Experimenter window. Then:
- Use the Job combobox to select the Optimization Job.
- Click the Run button.
The Optimization Job then begins running through the following loop:
- Guess values for Parameter1 and Parameter2. Each guess becomes more and more intelligent as the optimization runs. Each guess is called an Iteration.
- Run a model with those values for 10000 seconds.
- Evaluate the performance measures.
- Calculate the objective function.
- Rank this scenario.
- Use the information from this scenario to create a new scenario - new values for Parameter1 and Parameter2.
- Repeat from Step 2.
The Optimization can make many simultaneous guesses, if you have more than one CPU available.
As the Optimization Job progresses, the status chart will update and show the job's progress.
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.
Hover over the best scenario (the scenario with a gold star) on the chart; a small popup will appear.
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.
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.