# surrogateopt

Surrogate optimization for global minimization of time-consuming objective functions

## Syntax

## Description

`surrogateopt`

is a global solver for time-consuming
objective functions.

`surrogateopt`

attempts to solve problems of the form

$$\underset{x}{\mathrm{min}}f(x)\text{suchthat}\{\begin{array}{l}\text{lb}\le x\le \text{ub}\\ A\xb7x\le b\\ \text{Aeq}\xb7x=\text{beq}\\ c(x)\le 0\\ {x}_{i}\text{integer,}i\in \text{intcon}\text{.}\end{array}$$

The solver searches for the global minimum of a real-valued objective function in
multiple dimensions, subject to bounds, optional linear constraints, optional integer
constraints, and optional nonlinear inequality constraints.
`surrogateopt`

is best suited to objective functions that take a
long time to evaluate. The objective function can be nonsmooth. The solver requires
finite bounds on all variables. The solver can optionally maintain a checkpoint file to
enable recovery from crashes or partial execution, or optimization continuation after
meeting a stopping condition. The objective function
*f*(*x*) can be empty (`[]`

), in
which case `surrogateopt`

attempts to find a point satisfying all the
constraints.

searches for a global minimum of `x`

= surrogateopt(`objconstr`

,`lb`

,`ub`

)`objconstr(x)`

in the region
`lb <= x <= ub`

. If `objconstr(x)`

returns a structure, then `surrogateopt`

searches for a
minimum of `objconstr(x).Fval`

, subject to
`objconstr(x).Ineq <= 0`

.

**Note**

Passing Extra Parameters explains how to pass extra parameters to the objective function, if necessary.

continues running the optimization from the state in a saved checkpoint file.
See Work with Checkpoint Files.`x`

= surrogateopt(`checkpointFile`

)

continues running the optimization from the state in a saved checkpoint file,
and replaces options in `x`

= surrogateopt(`checkpointFile`

,`opts`

)`checkpointFile`

with those in
`opts`

. See Checkpoint File.

## Examples

## Input Arguments

## Output Arguments

## Algorithms

`surrogateopt`

repeatedly performs these steps:

Create a set of trial points by sampling

`MinSurrogatePoints`

random points within the bounds, and evaluate the objective function at the trial points.Create a surrogate model of the objective function by interpolating a radial basis function through all of the random trial points.

Create a merit function that gives some weight to the surrogate and some weight to the distance from the trial points. Locate a small value of the merit function by randomly sampling the merit function in a region around the incumbent point (best point found since the last surrogate reset). Use this point, called the adaptive point, as a new trial point.

Evaluate the objective at the adaptive point, and update the surrogate based on this point and its value. Count a "success" if the objective function value is sufficiently lower than the previous best (lowest) value observed, and count a "failure" otherwise.

Update the dispersion of the sample distribution upwards if three successes occur before

`max(nvar,5)`

failures, where`nvar`

is the number of dimensions. Update the dispersion downwards if`max(nvar,5)`

failures occur before three successes.Continue from step 3 until all trial points are within

`MinSampleDistance`

of the evaluated points. At that time, reset the surrogate by discarding all adaptive points from the surrogate, reset the scale, and go back to step 1 to create`MinSurrogatePoints`

new random trial points for evaluation.

For details, see Surrogate Optimization Algorithm.

## Alternative Functionality

### App

The **Optimize** Live Editor task provides a visual interface for `surrogateopt`

.

## Extended Capabilities

## See Also

**Introduced in R2018b**