OptQuest Visual Logic Commands
OptQuest is a powerful optimization tool built into Simul8. It allows you to move from asking ‘What if?’ questions to ‘What’s best?’.
Read more on our OptQuest web page or see an OptQuest tutorial here.
To make optimization even quicker, you can use Visual Logic to create and run optimizations using Simul8 and OptQuest. There are four commands specifically linked to OptQuest.
Add/Modify Optimization Objective
Use this command to add your Objectives to an optimization, just as you would in the OptQuest dialog.
Parameters:
- Result to be added – Result property to be added as Objective. Add as string (e.g. “End 1: Number Completed”).
- Objective – Do you want to Maximize, Minimize or set a Goal for this Objective (e.g. “Maximize”, “Minimize” or “Goal”).
- Weight - Weight given to the Objective (only for use with Weighted Multi-Objective Optimization setups – set to 0 if using single Objective or Pattern Frontier).
- Goal – Goal value given to Objective (set to 0 if Maximize or Minimize).
Example:
Add/Modify Optimization Objective “End 1:Number completed” , “Maximize” , 0 , 0
Add/Modify Optimization Constraint
Use this command to add your Constraints to an optimization.
Parameters:
- Constraint ID – What is the ID of the Constraint? If this is the first Constraint you are adding, then it will be 1.
- Value – What is the value of the Constraint? (Can be 0 if adding compound conditions, as in the example below).
- Result – Name of the result to be added to the Constraint. Add as a string (e.g. “Resource 1: Number Available”).
- Operator – the operator for the Constraint.
- 0: Less than or equal to ( < = )
- 1: Equals ( = )
- 2: greater than or equal to ( >= )
- 3: Plus ( + )
- 4: Minus ( - )
Example:
If I wanted to add a constraint that the total number of Resource 1 and Resource 2 that I have available cannot exceed 25, I would enter:
Add/Modify Optimization Constraint 1 , 0 , “Resource 1: Number Available” , 3
Add/Modify Optimization Constraint 1 , 25 , “Resource 2: Number Available” , 0
Add/Modify Optimization Decision Variable
Use this command to add your Decision Variables to an optimization.
Parameters:
- Results to be added – Result property to be added as a Decision Variable. Add as string (e.g. “Resource 1: Number Available” or “Var1[3,2]:Value”).
- Lower Bound – Lower bound of the results property.
- Suggested Value – Suggested value of the results property (use -1 to skip optional suggested value).
- Upper Bound – Upper bound of the results property.
- Step Size – Step size to increment the value by.
Example:
Add/Modify Optimization Decision Variable “Resource 1: Number Available” , 1 , -1 , 20 , 2
Run Optimization
Runs OptQuest with the parameters that have been set up either through the dialog or by using the Visual logic commands listed above.
Parameters:
- Run mode – default is 1
- 1 = Run for (number) trials
- 2 = Run for (number) minutes
- Number – number of trials/minutes to run the optimization. The default is 50 for trials or 5 if minutes is selected.
- Results Spreadsheet – Spreadsheet to save the optimization results to. If left blank, the default spreadsheet “Optimization” will be used.
Example:
If I wanted to run an optimization for 200 trials and save the results to the default spreadsheet, I would enter:
Run Optimization 1 , 200 , “”