## First Choose Problem-Based or Solver-Based Approach

Optimization Toolbox™ has two approaches to solving optimization problems or equations: problem-based and solver-based. Before you start to solve a problem, you must first choose the appropriate approach.

This table summarizes the main differences between the two approaches.

ApproachesCharacteristics
Problem-Based Optimization SetupEasier to create and debug
Provides a visual interface; see Optimize Live Editor task
Represents the objective and constraints symbolically
Requires translation from problem form to matrix form, potentially resulting in a longer solution time
Automatically calculates and uses gradients of objective and nonlinear constraint functions in many cases, but does not calculate Hessians; see Automatic Differentiation
See the steps in Problem-Based Optimization Workflow or Problem-Based Workflow for Solving Equations

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

Basic equation-solving example: Solve Nonlinear System of Equations, Problem-Based

Solver-Based Optimization Problem SetupHarder to create and debug
Provides a visual interface; see Optimize Live Editor task
Represents the objective and constraints as functions or matrices
Does not require translation from problem form to matrix form, potentially resulting in a shorter solution time
Allows direct inclusion of gradient or Hessian, but does not calculate them automatically

Allows use of a Hessian multiply function or Jacobian multiply function to save memory in large problems

See the steps in Solver-Based Optimization Problem Setup

Basic linear example: Mixed-Integer Linear Programming Basics: Solver-Based

Basic nonlinear example: Constrained Nonlinear Problem Using Optimize Live Editor Task or Solver

Basic equation-solving examples: Examples