When to Use a Hybrid Function

A hybrid function is a function that continues the optimization after the original solver terminates.

These Global Optimization Toolbox solvers can automatically run a hybrid function, or second solver, after they finish:

To run a hybrid function, set the `HybridFcn` option to the second solver.

A hybrid function can obtain a more accurate solution, starting from the relatively rough solution found by the first solver, in the following circumstances:

• Whether or not the objective function has nonsmooth regions, if the solution is in a smooth region with smooth constraints, then use a hybrid function from Optimization Toolbox™, such as `fmincon`.

• If the objective function or a constraint is nonsmooth near the solution, then use `patternsearch` as a hybrid function.

• Suppose that the problem has multiple local minima, and you want to obtain an accurate global solution. The single-objective solvers can search for the vicinity of a global solution, but do not necessarily obtain an extremely accurate result. If the objective function is smooth, then use a hybrid function from Optimization Toolbox, such as `fminunc`.

• For smooth multiobjective problems, a hybrid function usually improves on solutions from `gamultiobj`.

To see which solvers are available as hybrid functions, refer to the `options` input argument on the reference page for the original solver. To tune the hybrid function, you can include a separate set of options for the hybrid function. For example, if the hybrid function is `fmincon`:

```hybridopts = optimoptions('fmincon','OptimalityTolerance',1e-10); options = optimoptions('ga','HybridFcn',{'fmincon',hybridopts}); [x,fval] = ga(fun,nvars,A,b,Aeq,beq,lb,ub,nonlcon,options)```