Documentation |
On this page… |
---|
This example uses the objective function, ps_example, which is included with Global Optimization Toolbox software. View the code for the function by entering
type ps_example
The following figure shows a plot of the function.
To find the minimum of ps_example, perform the following steps:
optimtool
and then choose the patternsearch solver.
In the Objective function field of the Optimization app, enter @ps_example.
In the Start point field, type [2.1 1.7].
Leave the fields in the Constraints pane blank because the problem is unconstrained.
The Run solver and view results pane displays the results of the pattern search.
The reason the optimization terminated is that the mesh size became smaller than the acceptable tolerance value for the mesh size, defined by the Mesh tolerance parameter in the Stopping criteria pane. The minimum function value is approximately –2. The Final point pane displays the point at which the minimum occurs.
To see the performance of the pattern search, display plots of the best function value and mesh size at each iteration. First, select the following check boxes in the Plot functions pane:
Best function value
Mesh size
Then click Start to run the pattern search. This displays the following plots.
The upper plot shows the objective function value of the best point at each iteration. Typically, the objective function values improve rapidly at the early iterations and then level off as they approach the optimal value.
The lower plot shows the mesh size at each iteration. The mesh size increases after each successful iteration and decreases after each unsuccessful one, explained in How Pattern Search Polling Works.