There are two approaches to solving optimization problems using Optimization Toolbox™: problem-based and solver-based. Before you start to solve an optimization problem, you must first choose an approach.
The problem-based approach currently does not apply to:
Multiobjective or semi-infinite programming problems
If you have a problem of these types, use the solver-based approach Solver-Based Optimization Problem Setup.
Here is a summary of the main differences between the two approaches.
|Problem-Based Optimization Setup||Easier to create and debug|
|Not for equation-solving or nonlinear least-squares|
|Represent the objective and constraints symbolically|
|Solution time is longer because of translation time from problem form to matrix form|
|Does not directly allow inclusion of gradient or Hessian; see Include Derivatives in Problem-Based Workflow|
|See the steps in Problem-Based Workflow|
|Basic linear example: Mixed-Integer Linear Programming Basics: Problem-Based or the video Solve a Mixed-Integer Linear Programming Problem using Optimization Modeling. Basic nonlinear example: Solve a Constrained Nonlinear Problem, Problem-Based.|
|Solver-Based Optimization Problem Setup||Harder to create and debug|
|Represent the objective and constraints as functions or matrices|
|Solution time is shorter because there is no translation time to matrix form|
|Allows inclusion of gradient or Hessian|
|To save memory in large problems, allows use of Hessian multiply function or Jacobian multiply function. See Quadratic Minimization with Dense, Structured Hessian or Jacobian Multiply Function with Linear Least Squares.|
|See the steps in Solver-Based Optimization Problem Setup|
|Basic linear example: Mixed-Integer Linear Programming Basics: Solver-Based. Basic nonlinear example: Solve a Constrained Nonlinear Problem, Solver-Based.|