OptQuest for Simul8

OptQuest is a Simul8 plug-in (provided with Simul8 Professional) that automatically searches for a best possible solution to an Objective.

OptQuest runs Simul8 Trials and makes changes within the parameters that you set. Its purpose in this is to improve on the result achieved from the previous Simul8 Trial. In OptQuest you specify certain parameters (that must be listed on the KPI Summary) that will be changed from Trial to Trial that the optimization will be conducted on.

The following is a tutorial on how to use OptQuest for Simul8.

OptQuest Tutorial

Open the Makepack2.s8 example simulation file supplied with Simul8. You'll find it in the OptQuest folder in the example directory. Run the simulation at a slow speed (say 50% of maximum). This will let you become familiar with the dynamics of this simulation before running OptQuest.

Makepack2.S8 contains Resources of 3 skill levels.

Skill 1 is assigned to the Make It 1 Activity, and Skill 2 is assigned to the Make It 2 Activity. Packers are assigned to the Packing Activity.

The Sorters resource is a Pooled Resource that allows either Skill 1 or Skill 2 to perform the Sorting Operation.

The Sorting Operation will share out the work items 60% to Make It 1 and 40% to Make It 2.

It is the Objective of this tutorial to identify the most appropriate number of staff in each skill level to maximize throughput.

We are told that it is possible to employ between 1 and 20 staff members in each Skill Set, have the budget to purchase up to 5 Sorting machines, 3 Make It 1 machines, 3 make It 2 machines and 2 Packing machines. It is currently not possible to affect the supply, or flow of items into the simulation.

Getting Started with OptQuest for Simul8

Add relevant Simul8 results to the Simul8 KPI Summary. Any results entered to the Simul8 KPI Summary will be available within OptQuest and may be used as part of the decision and optimization process.

Normally you should consider what the objective of the OptQuest trial is going to be - for example, you may want to maximize throughput or minimize queue time, and also consider what parameters you will allow to change - for example, staff numbers may vary between 1 and 10 staff.

Open the Makepack2 simulation and then add the Number Complete result from the End Point, and the Number of Skill Type Available from each of the 3 Resources.

The KPI Summary should look like this:

From the Advanced tab click the OptQuest button. OptQuest for Simul8 will open. Select the New button on the toolbar and OptQuest will open a new optimization and import any data entered to the KPI Summary.

The Wizard will run by default. The first screen is the Decision Variable Selection screen. This screen allows you to enter the aspects of the simulation that can change from run to run.

Enter the Lower and Upper Bounds. In this case we have been told that we can have between 1 and 20 staff members in each skill level, so alter the Decision Variable Selection to:

Press OK and the Constraints input screen will appear. We will ignore this just now, so click OK and the Objective Window will appear. The Objective Window allows you to set the item from the Simul8 KPI Summary window that will be used as the basis of the optimization. This means that the decision variables will be changed by OptQuest in an attempt to improve on the result achieved for the item set in the Objective Selection window.

Select Maximize Objective beside the Work Complete 1.Number Completed option. Click OK and OptQuest will ask for run durations and execute the optimization when OK is pressed. The purpose of this Optimization in this case is to maximize the throughput of the process, however OptQuest can Optimize on any result listed in the Objective Selection window, such as Profit or Queuing Times. This enables financial or service standard based optimizations.

OptQuest will now run for the specified time, or number of runs. It will identify a “best” solution, record this and note the parameters used to achieve this.

It is quickly apparent that the limiting factor in this simulation is the capacity of the Sorting machine. To investigate the opportunities that more machines or work stations offer you can manually alter the Replication number in Simul8 Activities. But this is a bit time consuming and it will be easier to allow OptQuest to run all combinations simultaneously.

Expanding Our Optimization

The original specification was given was that it is possible to employ between 1 and 20 staff members in each Skill Set and to:

  • purchase up to 5 Sorting machines
  • 3 Make It 1 machines
  • 3 make It 2 machines
  • 2 Packing machines

Assume that we have now been told that staff numbers must not exceed 10 in total. Some changes will need to be made to Simul8 to allow OptQuest to investigate all the possibilities in the specification for this problem.

First of all create an Activity Object Variable in the Information Store.

Next, create 4 Number variables, 1 for each of the machines in the simulation and call each the name of the machine plus the word “replication” to remind you what the variable is used for.

Create a final Number variable called Total Staff Number.

Next enter the Visual Logic below. Use Time Check Visual Logic.

The objective of this is to allow OptQuest to alter the Replications of each Activity by changing the value of the variables.

NB: To allow OptQuest to optimize on a Simul8 variable it must be added to the KPI Summary. To do this open the Information Store, and Right Click on the variable. And select “Add to KPIs”. When this data is imported to OptQuest the Decision Variable Selection screen will have changed. Amend the Lower and Upper Bounds to:

Select OK, and the Constraints input screen will again appear. This time enter the following:

You can enter information to the Constraints input screen by selecting the appropriate button from the right hand side of the OptQuest screen.

Finally, click OK to produce the Objective Selection screen.

OptQuest will again request instruction for run duration and then run the optimization.

Rescale the Performance Graph to see small improvements more clearly.

Optimizing On Different Time Slots

Optimizing on a single result is quite easy – you can simply specify this in the Objective Window in OptQuest and select Minimize or Maximize.

However, in some simulations the Objective will change over the course of a day. For example if your objective is to Minimize staff numbers in a Call Center then the optimal number of staff will change over the course of the day. Here’s a graph of call volumes in a simple call center:

So, in order to staff this center there should be more staff in the 10:00 to 12:30 slots and the 14:00 to 16:30 slots than during the rest of the day.

It is normal when approaching an optimization to clearly state what the objective is. In this case it could simply be to “Minimize Staff Numbers”. This is however compellingly simple and only a part of the story. In reality the Objective would be to minimize staff numbers, while maintaining an acceptable throughput of calls or maintaining a service level like “answer 90% of calls within 1 minute. In this case assume that we must answer 350 calls per day, so the objective will be “Minimize staff numbers, while maintaining a call throughput of at least 350 per day”.

To use QptQuest to optimize in a scenario like this, where the certain parameters are changing means that the simulation needs to be set up to allow this.

In the simple Call Center case set up the simulation like this:

Working in minutes, set the Results Collection period to 300. Accept the default settings for all of the objects except:

  • Set the Call Queue Shelf Life to 1 minute
  • Set the Expiring Activity Routing In discipline set to Expiring
  • Set the Expiring Activity Process Time to 0, Fixed
  • Attach the Resource to the Call Handler Activity
  • Set the replication in the Call Handler Activity to 20

OptQuest will change the number of resources so there is no need to alter the default.

Next, create a spreadsheet in the Simul8 Information Store. This will store the number of calls due to arrive in each time slot. Add this sample data:

Next, create a new Global Data item in the Information Store and call it hour. Set it to Number and set the Reset value to 2.

Finally, in Time Check Visual Logic enter this:

This Visual Logic works by setting the inter arrival time to the content of a cell in the spreadsheet, so at the start of the day, cell [2,2] in the Volumes spreadsheet will be looked at (remember that hour is set to 2 on Reset). The figure 100 is produced, meaning that 100 calls are due to arrive, and as Simul8 asks for an inter arrival rate a simple calculation is all that is required to produce this. So, 60/100 gives and inter arrival time of 0.6.

Hour is then increased by 1 to 3, ready for the next Time Check.

The next Time Check event happens 60 minutes later, and the hour Global Data Item has been increased to 3 at this point, so the cell [2,3] is looked up. The figure 200 is found, so the inter arrival time is set to 60/200, or 0.3.

The last 2 lines in this block of code set the hour Global Data Item back to 2, so that when the bottom of the spreadsheet is reached the data is recycled and a zero value is not read into Simul8.

Also, we need to build in the ability to change staff numbers through the course of the day. This can be accomplished by using the Visual Logic Set command. As we have 5 hours in our working day create 5 variables (in this example they have been called “Resource in hour 1”, “Resource in hour 2” and so on.

Alter the Visual Logic in Time Check to:

This means that when the variable called “hour” has a value of 2 (the starting value) then the number of Resource 1 available is set to the variable “resource in hour 1”. OptQuest will the value of the “resource in hour.” variables. Finally enter this Visual Logic in End Run Logic:

You will need to create 3 variables in the Simul8 Information Store to do this. Call them:

  • Total
  • Success
  • Sum to be Minimized

Each of these is a Number variable.

This Visual Logic is different to that normally written as part of a simulation. What this Visual Logic is doing is assuming that the sum of completed calls and staff over the 5 hours in the day should be minimized. By setting the variable Success to either 0 if more than the required 350 calls have been completed, or to a very large number if they have not been completed we have a basis for optimization.

If we fail to produce 350 calls that the Sum to Minimize is set to the number of staff used plus a very large number, and so will be large. If more than 350 calls are completed then the Sum to Minimize will be set only to the number of staff used in the Simul8 Trial. To now use OptQuest to conduct an Optimization, simply start OptQuest and enter the Upper and Lower bounds for the Decision Variables.

There is no requirement here to set any constraints, so select the Objective window and select Minimize on Sum to Minimize.

Now run the Optimization. You will see large values indicating that the required number of calls have not been completed, and values of 100 or less (100 is the maximum number of staff used over the 5 time slots) indicating that a valid set of conditions has been found.

The longer or greater the number of Trials that OptQuest is allowed to run, the greater the likelihood of a near optimal set of conditions being found.