Professional Documents
Culture Documents
Most Optimization Toolbox™ solvers run faster and more accurately when Products Used
your objective and constraint function files include derivative calculations. Some
■ MATLAB®
solvers also benefit from second derivatives, or Hessians. While calculating a
■ Optimization Toolbox™
derivative is straightforward, it is also quite tedious and error-prone. Calculating
■ Symbolic Math Toolbox™
second derivatives is even more tedious and fraught with opportunities for error.
How can you get your solver to run faster and more accurately without the pain
of computing derivatives manually?
Running a Symbolically
Defined Optimization
Suppose we want to minimize the func-
tion x + y + cosh(x – 1.1y) + sinh(z/4) over
the region defined by the implicit equation
z2 = sin(z – x2y2), –1 ≤ x ≤ 1, –1 ≤ y ≤ 1, 0 ≤ z ≤ 1.
The region is shown in Figure 1.
Technical Support
www.mathworks.com/support
Demos
www.mathworks.com/demos
Figure 5. Including the Hessian function and running the optimization. Training Services
www.mathworks.com/training
Third-Party Products
Including the Hessian and Services
For More Information www.mathworks.com/connections
A Hessian function lets us solve the problem
even more efficiently. For the interior-point ■ Example: Using Symbolic Math Toolbox Worldwide CONTACTS
algorithm, we write a function that is the Functions to Calculate Gradients and www.mathworks.com/contact
Hessian of the Lagrangian. This means that Hessians
www.mathworks.com/symbolic-math-functions e-mail
if ƒ is the objective function, c is the vector
info@mathworks.com
■ Demo: Using Symbolic Mathematics with
of nonlinear inequality constraints, ceq is the
Optimization Toolbox Solvers
vector of nonlinear equality constraints, and www.mathworks.com/optimization-solvers
λ is the vector of associated Lagrange multi-
© 2010 The MathWorks, Inc. MATLAB and Simulink
pliers, the Hessian H is are registered trademarks of The MathWorks, Inc. See
www.mathworks.com/trademarks for a list of additional
trademarks. Other product or brand names may be trade-
Η = ∇2 f ( x) + ∑ l i ∇2 ci ( x) + ∑ l j ∇2 ceq j ( x). marks or registered trademarks of their respective holders.
i j
1
For nonlinear equality constraints in Optimization Toolbox version 9b or earlier, you must subtract, not add, the Lagrange multiplier.
See http://www.mathworks.com/support/bugreports/566464