Main Content

Interpret surrogateoptplot

The surrogateoptplot plot function provides a good deal of information about the surrogate optimization steps.

Minimize Bounded Function

For example, consider the plot of the steps surrogateopt takes on the test function rastriginsfcn, which is available when you run this example. This function has a global minimum value of 0 at the point [0,0].

Create a surface plot of rastriginsfcn.


Plot Minimization Process

By giving asymmetric bounds, you encourage surrogateopt to search away from the global minimum. Set asymmetric bounds of [-3,-3] and [9,10]. Set options to use the surrogateoptplot plot function, and then call surrogateopt.

lb = [-3,-3];
ub = [9,10];
options = optimoptions('surrogateopt','PlotFcn','surrogateoptplot');
[x,fval] = surrogateopt(@rastriginsfcn,lb,ub,options);

surrogateopt stopped because it exceeded the function evaluation limit set by 

Interpret Plot

Begin interpreting the plot from its left side. For details of the algorithm steps, see Surrogate Optimization Algorithm.

  • The first points are black triangles, indicating quasirandom samples of the function within the problem bounds. These points come from the Construct Surrogate phase.

  • Next are black dots indicating the adaptive points, the points created in the Search for Minimum phase.

  • The thick green line represents the best (lowest) objective function value found. Shortly after evaluation number 30, surrogateopt is stuck in a local minimum with an objective function value near 8. Zoom in to see this behavior more clearly.

xlim([20 100])
ylim([0 15])

  • Near evaluation number 120, a vertical line indicates a surrogate reset. At this point, the algorithm returns to the Construct Surrogate phase.

  • The dark blue x points represent the incumbent, which is the best point found since the previous surrogate reset.

  • Near evaluation number 150, the incumbent improves on the previous best point by attaining a value of about 4. Zoom in to see this behavior more clearly.

xlim([140 200])
ylim([0 6])

  • The solver has another surrogate reset after evaluation 190.

  • The optimization halts at evaluation number 200 because it is the default function evaluation limit for a 2-D problem.

Problem with Nonlinear and Integer Constraints

The surrogateoptplot display changes when you have nonlinear constraints. Impose the constraint that x(1) is integer-valued, and the nonlinear constraint that x2x12-2. For the function that implements this constraint, see rasfcn at the end of this example.

fun = @rasfcn;

Set integer constraints by setting intcon = 1, and run the minimization.

intcon = 1;
[x,fval] = surrogateopt(fun,lb,ub,intcon,options);

surrogateopt stopped because it exceeded the function evaluation limit set by 

The plot now shows red markers where surrogateopt evaluates an infeasible point. The final point is close to the true minimum point of [0,0].

   1.0e-04 *

         0    0.6798

The integer constraint likely helps surrogateopt find the true minimum by reducing the search space.

function F = rasfcn(x)
F.Fval = rastriginsfcn(x);
F.Ineq = x(1)^2 - 2 - x(2);

See Also

Related Topics