How to Use the Problem-Based Optimize Live Editor Task
Interactively create and solve optimization problems with MATLAB®, Optimization Toolbox™, or Global Optimization Toolbox using a visual interface. The Optimize task guides you through the problem-based approach for specifying the type of problem by defining optimization variables, objective expressions, and constraint expressions.
The visual interface provides an intuitive way to set up and solve optimization problems, especially for those who do not know the MATLAB coding syntax to do so. In addition, based on the problem you define, the Optimize task automatically chooses an appropriate solver. You can easily formulate and solve constrained and unconstrained nonlinear programs, linear programs, quadratic programs, second-order cone programs, mixed-integer programs, linear and nonlinear least squares problems, and systems of nonlinear equations.
The example in the video shows how to minimize the cost of materials for a cylindrical soup can, subject to a set of linear, nonlinear, and bound constraints. While this example is conceptually simple, you apply the same approach to much more complex optimization problems.
You start by defining the optimization variables, commonly referred to as design or decision variables, as symbolic variables. You then define objectives and constraints as expressions of these optimization variables. You can specify each objective and constraint using an existing function from a file, a function local to the Live Script, or by specifying the expression on one line.
You can optionally specify some problem-dependent solver options, such as choosing a specific algorithm and modifying algorithm settings. You can choose which results to display.
Once this is done, you run the task to solve the problem and view the results. Use the generated MATLAB code to reproduce these results in applications or to share with others.
The Optimize Live Editor task makes it easier to solve your optimization problems by guiding you through the specification of the problem, adapting as you make selections, generating MATLAB code, and providing tool tips.
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.