You can run optimization from the API.
One common appliation is to run several iterations of multiple types of optimization, see https://awrcorp.com/download/faq/english/scripts/Optimizers.aspx
Setting Optimizer Type
The number will the number in the list when you open the optimizer in the user interface.
We don't recommend setting optimizer by number as this order could change.
Alternately, you can set by the name
You can write a simple script to print out all the types.
Sub Main Debug.Clear For i = 1 To Project.Optimizer.TypeCount Debug.Print Project.Optimizer.TypeName(i) Next i End Sub
The output of this will be in the debug window
Pointer - Robust Optimization Pointer - Train an Optimizer Pointer - Run Trained Optimizer Pointer - Gradient Optimization Random (Local) Gradient Optimization Conjugate Gradient Simplex Optimizer Genetic (Uniform Mutation) Genetic (Gaussian Mutation) Simulated Annealing (Simplex) Simulated Annealing (Local) Random (Global) Direction Set Method
* Alternately, you can write a function to call the optimizer by name and have it return the index if the name is matched, example shown below.
Project.Optimizer.Type=find_opt_type("Simplex Optimizer") Function find_opt_type(nm As String) As Integer Dim typ As Integer typ = -1 For i = 1 To Project.Optimizer.TypeCount If nm = Project.Optimizer.TypeName(i) Then typ = i End If Next i If typ = -1 Then MsgBox ("could not find optimizer name specified:" & nm) End If find_opt_type = typ End Function
Setting Optimizer Iterations
Running the Optimizer
simple to start, write a loop to check to see if running on when to continue.
Project.Optimizer.Start While Project.Optimizer.Running=True Wend