# Solver-Based Nonlinear Optimization

Solve nonlinear minimization and semi-infinite programming problems in
serial or parallel using the solver-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.

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

## Functions

`fminbnd` | Find local minimum of single-variable function on fixed interval |

`fmincon` | Find minimum of constrained nonlinear multivariable function |

`fminsearch` | Search for local minimum of unconstrained multivariable function using derivative-free method |

`fminunc` | Find minimum of unconstrained multivariable function |

`fseminf` | Find minimum of semi-infinitely constrained multivariable nonlinear function |

`checkGradients` | Check first derivative function against finite-difference
approximation (Since R2023b) |

`optim.coder.infbound` | Infinite bound support for code generation (Since R2022b) |

## Live Editor Tasks

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

## Topics

### Unconstrained Solver-Based Applications

**Banana Function Minimization**

Shows how to solve for the minimum of Rosenbrock's function using different solvers, with or without gradients.**Solve Nonlinear Problem with Many Variables**

Choose appropriate options for large nonlinear problems.**Unconstrained Minimization Using fminunc**

Example of unconstrained nonlinear programming.**Minimization with Gradient and Hessian**

Example of unconstrained nonlinear programming including derivatives.**Minimization with Gradient and Hessian Sparsity Pattern**

Example of nonlinear programming using some derivative information.

### Constrained Solver-Based Applications

**Tutorial for Optimization Toolbox**

Tutorial example showing how to solve nonlinear problems and pass extra parameters.**Optimize Live Editor Task with fmincon Solver**

Example of nonlinear programming with constraints using the Optimize Live Editor Task.**Nonlinear Inequality Constraints**

Example of nonlinear programming with nonlinear inequality constraints.**Nonlinear Constraints with Gradients**

Example of nonlinear programming with derivative information.**fmincon Interior-Point Algorithm with Analytic Hessian**

Example of nonlinear programming with all derivative information.**Linear or Quadratic Objective with Quadratic Constraints**

This example shows how to solve an optimization problem that has a linear or quadratic objective and quadratic inequality constraints.**Nonlinear Equality and Inequality Constraints**

Nonlinear programming with both types of nonlinear constraints.**How to Use All Types of Constraints**

Example showing all constraints.**Obtain Best Feasible Point**

Find the best feasible point in the`output`

structure.**Solve Nonlinear Problem with Many Variables**

Choose appropriate options for large nonlinear problems.**Minimization with Bound Constraints and Banded Preconditioner**

Example showing efficiency gains possible with structured nonlinear problems.**Minimization with Linear Equality Constraints, Trust-Region Reflective Algorithm**

Example showing nonlinear programming with only linear equality constraints.**Minimization with Dense Structured Hessian, Linear Equalities**

Example showing how to save memory in nonlinear programming with a structured Hessian and only linear equality constraints or only bounds.**Monitor Solution Process with optimplot**

View details of the optimization solution process using`optimplot`

.**Calculate Gradients and Hessians Using Symbolic Math Toolbox**

Example showing how to calculate derivatives symbolically for optimization solvers.**Using Symbolic Mathematics with Optimization Toolbox Solvers**

Use Symbolic Math Toolbox™ to generate gradients and Hessians.

### Code Generation

**Code Generation in fmincon Background**

Prerequisites to generate C code for nonlinear optimization.**Code Generation for Optimization Basics**

Learn the basics of code generation for the`fmincon`

optimization solver.**Static Memory Allocation for fmincon Code Generation**

Use static memory allocation in code generation when the problem changes.**Optimization Code Generation for Real-Time Applications**

Explore techniques for handling real-time requirements in generated code.

### Semi-Infinite Constraints

**One-Dimensional Semi-Infinite Constraints**

Example showing how to use one-dimensional semi-infinite constraints in nonlinear programming.**Two-Dimensional Semi-Infinite Constraint**

Example showing how to use two-dimensional semi-infinite constraints in nonlinear programming.**Analyzing the Effect of Uncertainty Using Semi-Infinite Programming**

This example shows how to use semi-infinite programming to investigate the effect of uncertainty in the model parameters of an optimization problem.

### 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.**Minimizing an Expensive Optimization Problem Using Parallel Computing Toolbox**

Example showing how to use parallel computing in both Global Optimization Toolbox and Optimization Toolbox™ solvers.

### 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.