Contenuto principale

Tune Solution for Analysis

When using the problem-based approach, you can try different options and methods to tune the solver and produce results more quickly.

Try Differentiation Options

The solve function typically uses the most effective automatic differentiation method. However, your problem might run faster using a different method, or no automatic differentiation at all.

To obtain faster solutions, try different automatic differentiation options for solve. Set the ObjectiveDerivative name-value argument to a nondefault value. For example:

[sol,fval] = solve(prob,x0,ObjectiveDerivative="auto-forward")

Try Evaluation Methods

When applicable, try evaluating an optimization expression directly, without using fcn2optimexpr. Then evaluate the expression with fcn2optimexpr and compare the results. Similarly, try using fcn2optimexpr with the Analysis argument set to "off" in addition to using it with the default setting "on". Although the default settings can be the most efficient, a nondefault setting might work best for your problem.

See Also

| |

Topics