Optimization Toolbox™ provides functions for finding parameters that minimize or maximize objectives while satisfying constraints. The toolbox includes solvers for linear programming (LP), mixed-integer linear programming (MILP), quadratic programming (QP), second-order cone programming (SOCP), nonlinear programming (NLP), constrained linear least squares, nonlinear least squares, and nonlinear equations.
You can define your optimization problem with functions and matrices, either programmatically or with an app. Alternatively, you can use expressions of optimization variables that reflect the underlying mathematics. You can use automatic differentiation of objective and constraint functions for faster and more accurate solutions.
Optimization Toolbox™ provides solvers for finding a maximum or a minimum of an objective function subject to constraints. This enables you to find optimal designs, minimize risk for financial applications, optimize decision making, and estimate parameters.
You can use the problem-based approach to define the optimization variables and their bounds, set the objective, and then solve. On this problem, the solve function recognizes the problem is nonlinear, applies a nonlinear solver, and uses automatic differentiation for faster gradient evaluations.
Optimization problems often have sets of variables or constraints like in this production planning problem. You can define arrays of optimization variables and constraints, and index with numbers or strings, resulting in readable and compact representations of large problems.
You can use the problem-based approach even when some functions are not naturally expressed as optimization expressions. This problem’s objective function requires solving an ODE. We can convert this to an optimization expression and use it in the problem to be optimized.
You can add integer constraints to linear problems involving variables which must take on integer values. This includes when the variables represent a yes or no decision, like whether a process is assigned to a processor in this scheduling example.
In addition to solvers for nonlinear, linear, and mixed-integer linear programs, Optimization Toolbox includes specialized solvers for quadratic programs, second-order cone programs, multiobjective, and linear and nonlinear least squares.
You can quickly solve large and sparse problems with thousands of variables. Here, a quadratic problem with over 40,000 variables is solved in around thirty seconds.
As an alternative to the problem-based approach, you can use Optimization Toolbox with the solver-based approach. After representing your objectives and constraints as MATLAB functions and matrices, the Optimize Live Task helps guide you through this approach by indicating where to select a solver and insert your predefined MATLAB constructs.
Optimization Toolbox works in conjunction with other MATLAB® tools. You can accelerate numerical gradient calculations using Parallel Computing Toolbox™.
You can compile your applications into apps or libraries with MATLAB Compiler™ and MATLAB Compiler SDK™.
You can generate portable and readable C/C++ code to solve your optimization problems using MATLAB Coder™. Use this code to deploy applications to enterprise and embedded systems.
For more information, return to the Optimization Toolbox page or choose a link below.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .Select web site
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.