# Problem-Based Nonlinear Optimization

Solve nonlinear optimization problems in serial or parallel using the
problem-based approach

Before you begin to solve an optimization problem, you must choose the appropriate approach: problem-based or solver-based. For details, see First Choose Problem-Based or Solver-Based Approach.

Formulate your objective and nonlinear constraint functions as
expressions in optimization variables, or convert MATLAB^{®} functions using `fcn2optimexpr`

. For problem setup, see Problem-Based Optimization Setup.

## Functions

`evaluate` | Evaluate optimization expression or objectives and constraints in problem |

`fcn2optimexpr` | Convert function to optimization expression |

`infeasibility` | Constraint violation at a point |

`optimproblem` | Create optimization problem |

`optimvar` | Create optimization variables |

`prob2struct` | Convert optimization problem or equation problem to solver form |

`solve` | Solve optimization problem or equation problem |

## Live Editor Tasks

Optimize | Optimize or solve equations in the Live Editor (Since R2020b) |

## Topics

### Unconstrained Problem-Based Applications

**Rational Objective Function, Problem-Based**

This example shows how to create a rational objective function using optimization variables and solve the resulting unconstrained problem.

### Constrained Problem-Based Applications

**Solve Constrained Nonlinear Optimization, Problem-Based**

This example shows how to solve a constrained nonlinear problem based on optimization expressions. The example also shows how to convert a nonlinear function to an optimization expression.**Convert Nonlinear Function to Optimization Expression**

Convert nonlinear functions, whether expressed as function files or anonymous functions, by using`fcn2optimexpr`

.**Constrained Electrostatic Nonlinear Optimization Using Optimization Variables**

Define objective and constraint functions for a structured nonlinear optimization in the problem-based approach.**Discretized Optimal Trajectory, Problem-Based**

This example shows how to solve a discretized optimal trajectory problem using the problem-based approach.**Problem-Based Nonlinear Minimization with Linear Constraints**

Shows how to use optimization variables to create linear constraints, and`fcn2optimexpr`

to convert a function to an optimization expression.**Effect of Automatic Differentiation in Problem-Based Optimization**

Automatic differentiation lowers the number of function evaluations for solving a problem.**Supply Derivatives in Problem-Based Workflow**

How to include derivative information in problem-based optimization when automatic derivatives do not apply.**Obtain Generated Function Details**

Find the values of extra parameters in nonlinear functions created by`prob2struct`

.**Objective and Constraints Having a Common Function in Serial or Parallel, Problem-Based**

Save time when the objective and nonlinear constraint functions share common computations in the problem-based approach.**Solve Nonlinear Feasibility Problem, Problem-Based**

Solve a feasibility problem, which is a problem with constraints only.**Feasibility Using Problem-Based Optimize Live Editor Task**

Solve a nonlinear feasibility problem using the problem-based Optimize Live Editor task and several solvers.**Obtain Solution Using Feasibility Mode**

Solve a problem with difficult constraints using`fmincon`

feasibility mode.**Output Function for Problem-Based Optimization**

Use an output function in the problem-based approach to record iteration history and to make a custom plot.

### Parallel Computing

**What Is Parallel Computing in Optimization Toolbox?**

Use multiple processors for optimization.**Using Parallel Computing in Optimization Toolbox**

Perform gradient estimation in parallel.**Improving Performance with Parallel Computing**

Investigate factors for speeding optimizations.

### Simulation or ODE

**Optimizing a Simulation or Ordinary Differential Equation**

Special considerations in optimizing simulations, black-box objective functions, or ODEs.

### Algorithms and Other Theory

**Unconstrained Nonlinear Optimization Algorithms**

Minimizing a single objective function in*n*dimensions without constraints.**Constrained Nonlinear Optimization Algorithms**

Minimizing a single objective function in*n*dimensions with various types of constraints.**fminsearch Algorithm**

Steps that`fminsearch`

takes to minimize a function.**Optimization Options Reference**

Explore optimization options.**Local vs. Global Optima**

Explains why solvers might not find the smallest minimum.**Smooth Formulations of Nonsmooth Functions**

Reformulate some nonsmooth functions as smooth functions by using auxiliary variables.**Optimization Bibliography**

Lists published materials that support concepts implemented in the optimization solver algorithms.