Main Content

Decide Between Problem-Based and Solver-Based Approach

Use a Global Optimization Toolbox solver to optimize a nonsmooth function, search for a global solution, or solve a multiobjective problem. Use the problem-based approach for a simpler way to set up and solve problems.

Problem-Based Characteristics

AdvantagesLimitations
Easier to set up and debugNo equation problems
Easier to run different solvers on the same problemNo custom data types
Obtain an appropriate solver automaticallyNo checkpoint file for surrogateopt
Automatically speed the solution of problems where the objective and nonlinear constraints are calculated in the same time-consuming function (typically simulations)No vectorization
You must convert variables for options that relate to the solver-based approach

Advantages:

  • Easier to set up and debug. In the problem-based approach, you use symbolic-style variables to create optimization expressions and constraints. See Problem-Based Global Optimization Setup. In the solver-based approach, you must place all variables into a single vector, which can be awkward, especially with variables of large or differing dimensions.

  • Easier to run different solvers on the same problem. Some solvers have different calling syntaxes. For example, the syntax for nonlinear constraints in surrogateopt is different from the syntax in all other solvers. To run a problem using both surrogateopt and another solver in the solver-based approach, you have to create different versions of the objective function. In contrast, the problem-based approach takes care of translating syntaxes, so you need to change only the solver name and possibly some options.

  • Obtain an appropriate solver automatically. The solve function automatically chooses a solver that can handle your objective and constraints. In the solver-based approach you must choose an appropriate solver.

  • Automatically speed the solution of problems where the objective and nonlinear constraints are calculated in the same time-consuming function (typically simulations). Frequently, a simulation or ODE solver calculates the objective and nonlinear constraints in the same function. When you convert the time-consuming function to an optimization expression using fcn2optimexpr, you can save solution time by setting the 'ReuseEvaluation' argument to true. This setting causes the solver to avoid recalculating the time-consuming function when evaluating the objective and nonlinear constraints. Achieving this time savings in the solver-based approach can require extra programming, as shown in the example Objective and Nonlinear Constraints in the Same Function.

Limitations:

See Also

Related Topics