Optimization Toolbox

 

Optimization Toolbox

Solve linear, quadratic, conic, integer, and nonlinear optimization problems

Get Started:

Defining Optimization Problems

Model a design or decision problem as an optimization problem. Set design parameters and decisions as optimization variables. Use them in defining an objective function to optimize and use constraints to limit possible variable values.

Problem-Based Optimization

Write objectives and constraints with expressions of optimization variables. Solve faster and more robustly with automatic differentiation on the nonlinear expressions. Apply an automatically selected solver. Interactively create and solve the problem with the Optimize Live Editor task and then generate code for sharing or use in your application.

Solver-Based Optimization

Write nonlinear objectives and constraints using functions; write linear objectives and constraints using coefficient matrices. Interactively create and solve the problem with the Optimize Live Editor task and then generate code for sharing or use in your application.

Solving Optimization Problems

Apply a solver to the optimization problem to find an optimal solution: a set of optimization variable values that produce the optimal value of the objective function, if any, and meet the constraints, if any.

Setting Options

Set optimization options to tune the optimization process, for example, to choose the optimization algorithm used by the solver, or to set termination conditions. Set options to monitor and plot optimization solver progress.

Reviewing and Improving Results

Review the exit messages, optimality measures, and the iterative display to assess the solution. Improve performance on nonlinear problems by using automatic differentiation, supplying gradients, or using parallel computing to estimate gradients.

Monitoring solver progress with the iterative display

Monitoring solver progress with the iterative display.

Nonlinear Programming

Solve optimization problems that have a nonlinear objective or are subject to nonlinear constraints.

Solvers

Apply quasi-Newton, trust-region, or Nelder-Mead simplex algorithms to solve unconstrained problems. Apply interior-point, sequential-quadratic-programming (SQP), or trust-region-reflective algorithms to solve constrained problems.

Applications

Use nonlinear optimization for estimating and tuning parameters, finding optimal designs, computing optimal trajectories, constructing robust portfolios, and other applications where there is a nonlinear relationship between variables.

Linear, Quadratic, and Conic Programming

Solve convex optimization problems that have linear or quadratic objectives and are subject to linear or second-order cone constraints.

Linear Programming Solvers

Apply dual-simplex or interior-point algorithms to solve linear programs.

Optimal Solution

Feasible region and optimal solution of a linear program.

Quadratic and Second-Order Cone Programming Solvers

Apply interior-point, active-set, or trust-region-reflective algorithms to solve quadratic programs. Apply interior-point methods to solve second-order cone programs.

Optimal Solution

Feasible region and optimal solution of a quadratic program.

Applications

Use linear programming on problems such as resource allocation, production planning, blending, and investment planning. Use quadratic and second-order cone programming on problems such as design optimization, portfolio optimization, and control of hydroelectric dams.

Hydroelectric Plant Operating Plan

Optimal control strategy found with quadratic programming.

Mixed-Integer Linear Programming

Solve optimization problems that have linear objectives subject to linear constraints, with the additional constraint that some or all variables must be integer-valued.

Solvers

Solve mixed-integer linear programming problems using the branch and bound algorithm, which includes preprocessing, heuristics for generating feasible points, and cutting planes.

Optimal Solution

Applying the branch and bound algorithm. 

Mixed-Integer Linear Programming-Based Algorithms

Use the mixed-integer linear programming solver to build special-purpose algorithms.

Solution of a 200 City Traveling Salesman Problem

The shortest tour visiting each city only once.

Applications

Model with integer variables when there are on/off decisions or logical constraints as well as when variable values must be integral. Routing, scheduling, planning, assignment, and capital budgeting problems are typical applications.

Optimal Generator Schedule

Schedule for two generators under varying electricity prices.

Multiobjective Optimization

Solve optimization problems that have multiple objective functions subject to a set of constraints.

Solvers

Formulate problems as either goal-attainment or minimax. Use goal-attainment when there are optionally weighted goal values for each of the objectives. Use minimax to minimize the worst-case value of a set of objective functions.

Pareto Plot

Pareto front computed using the fgoalattain function.

Applications

Use multiobjective optimization when tradeoffs are required for conflicting objectives. Examples are weight and strength in structural design and risk and return in portfolio optimization.

FIR Filter Design

Magnitude response for initial and optimized filter coefficients.

Least Squares and Equation Solving

Solve linear and nonlinear least-squares problems, and nonlinear systems of equations, subject to bound, linear, and nonlinear constraints.

Nonlinear Data Fitting

Comparison of local and global approaches.

Linear Least-Squares Applications

Use linear least-squares solvers to fit a linear model to acquired data or to solve a system of linear equations, including when the parameters are subject to bound and linear constraints.

Optical Deblurring

Recovering a blurred image by solving a linear least-squares problem.

Nonlinear Least-Squares Applications

Use nonlinear least-squares solvers to fit a nonlinear model to acquired data or to solve a system of nonlinear equations, including when the parameters are subject to bound, linear, and nonlinear constraints.

Fitting a Circular Path to the Lorenz System.

Fitting a circular path to the Lorenz system of ordinary differential equations.

Deployment

Build optimization-based decision support and design tools, integrate with enterprise systems, and deploy optimization algorithms to embedded systems.

MATLAB Compiler Support

Use MATLAB Compiler™ and MATLAB Compiler SDK™ to deploy MATLAB® optimization models as standalone executables, web apps, C/C++ shared libraries, Microsoft® .NET assemblies, Java® classes, and Python® packages.

Unit Commitment App

App that computes an optimal power generation schedule.

Code Generation

Generate portable and readable C or C++ code to solve optimization problems using MATLAB Coder™. Compile the generated code for any hardware, including embedded systems.

MATLAB Coder report

MATLAB Coder report for a trajectory optimization function.