Optimization Toolbox User's Guide
Total Page:16
File Type:pdf, Size:1020Kb
Optimization Toolbox For Use with MATLAB® User’s Guide Version 2 How to Contact The MathWorks: www.mathworks.com Web comp.soft-sys.matlab Newsgroup [email protected] Technical support [email protected] Product enhancement suggestions [email protected] Bug reports [email protected] Documentation error reports [email protected] Order status, license renewals, passcodes [email protected] Sales, pricing, and general information 508-647-7000 Phone 508-647-7001 Fax The MathWorks, Inc. Mail 3 Apple Hill Drive Natick, MA 01760-2098 For contact information about worldwide offices, see the MathWorks Web site. Optimization Toolbox User’s Guide COPYRIGHT 1990 - 2003 by The MathWorks, Inc. The software described in this document is furnished under a license agreement. The software may be used or copied only under the terms of the license agreement. No part of this manual may be photocopied or repro- duced in any form without prior written consent from The MathWorks, Inc. FEDERAL ACQUISITION: This provision applies to all acquisitions of the Program and Documentation by or for the federal government of the United States. By accepting delivery of the Program, the government hereby agrees that this software qualifies as "commercial" computer software within the meaning of FAR Part 12.212, DFARS Part 227.7202-1, DFARS Part 227.7202-3, DFARS Part 252.227-7013, and DFARS Part 252.227-7014. The terms and conditions of The MathWorks, Inc. Software License Agreement shall pertain to the government’s use and disclosure of the Program and Documentation, and shall supersede any conflicting contractual terms or conditions. If this license fails to meet the government’s minimum needs or is inconsistent in any respect with federal procurement law, the government agrees to return the Program and Documentation, unused, to MathWorks. MATLAB, Simulink, Stateflow, Handle Graphics, and Real-Time Workshop are registered trademarks, and TargetBox is a trademark of The MathWorks, Inc. Other product or brand names are trademarks or registered trademarks of their respective holders. Printing History: November 1990 First printing December 1996 Second printing For MATLAB 5 January 1999 Third printing For Version 2 (Release 11) September 2000 Fourth printing For Version 2.1 (Release 12) June 2001 Online only Revised for Version 2.1.1 (Release 12.1) September 2003 Online only Revised for Version 2.3 (Release 13SP1) Contents Preface What Is the Optimization Toolbox? . viii Related Products . ix Using This Guide . xi Configuration Information . xii Technical Conventions . xiii Matrix, Vector, and Scalar Notation . xiii Typographical Conventions . xiv Acknowledgments . xv A Simple Optimization Example 1 Example . 1-2 Setting Up the Example . 1-3 Finding the Solution . 1-4 More Examples . 1-4 i Tutorial 2 Introduction . 2-3 Problems Covered by the Toolbox . 2-3 Using the Optimization Functions . 2-5 Examples that Use Standard Algorithms . 2-7 Unconstrained Minimization Example . 2-8 Nonlinear Inequality Constrained Example . 2-9 Constrained Example with Bounds . 2-11 Constrained Example with Gradients . 2-12 Gradient Check: Analytic Versus Numeric . 2-14 Equality Constrained Example . 2-15 Maximization . 2-16 Greater-Than-Zero Constraints . 2-16 Additional Arguments: Avoiding Global Variables . 2-16 Nonlinear Equations with Analytic Jacobian . 2-17 Nonlinear Equations with Finite-Difference Jacobian . 2-20 Multiobjective Examples . 2-21 Large-Scale Examples . 2-33 Problems Covered by Large-Scale Methods . 2-34 Nonlinear Equations with Jacobian . 2-37 Nonlinear Equations with Jacobian Sparsity Pattern . 2-40 Nonlinear Least-Squares with Full Jacobian Sparsity Pattern . 2-42 Nonlinear Minimization with Gradient and Hessian . 2-44 Nonlinear Minimization with Gradient and Hessian Sparsity Pattern . 2-45 Nonlinear Minimization with Bound Constraints and Banded Preconditioner . 2-47 Nonlinear Minimization with Equality Constraints . 2-51 Nonlinear Minimization with a Dense but Structured Hessian and Equality Constraints . 2-52 Quadratic Minimization with Bound Constraints . 2-56 Quadratic Minimization with a Dense but Structured Hessian . 2-58 Linear Least-Squares with Bound Constraints . 2-61 Linear Programming with Equalities and Inequalities . 2-62 ii Contents Linear Programming with Dense Columns in the Equalities . 2-63 Default Parameter Settings . 2-66 Changing the Default Settings . 2-66 Displaying Iterative Output . 2-69 Output Headings: Medium-Scale Algorithms . 2-69 Output Headings: Large-Scale Algorithms . 2-72 Calling an Output Function Iteratively . 2-75 Creating the Output Function . 2-75 Running the Example . 2-77 Optimization of Inline Objects Instead of M-Files . 2-80 Typical Problems and How to Deal with Them . 2-82 Selected Bibliography . 2-86 Standard Algorithms 3 Optimization Overview . 3-3 Unconstrained Optimization . 3-4 Quasi-Newton Methods . 3-6 Line Search . 3-8 Quasi-Newton Implementation . 3-11 Least-Squares Optimization . 3-18 Gauss-Newton Method . 3-19 Levenberg-Marquardt Method . 3-20 Nonlinear Least-Squares Implementation . 3-22 Nonlinear Systems of Equations . 3-24 Gauss-Newton Method . 3-24 iii Trust-Region Dogleg Method . 3-24 Nonlinear Equations Implementation . 3-26 Constrained Optimization . 3-28 Sequential Quadratic Programming (SQP) . 3-29 Quadratic Programming (QP) Subproblem . 3-30 SQP Implementation . 3-31 Simplex Algorithm . 3-37 Multiobjective Optimization . 3-42 Introduction . 3-42 Goal Attainment Method . 3-48 Algorithm Improvements for Goal Attainment Method . 3-49 Selected Bibliography . 3-52 Large-Scale Algorithms 4 Trust-Region Methods for Nonlinear Minimization . 4-2 Preconditioned Conjugate Gradients . 4-5 Linearly Constrained Problems . 4-7 Linear Equality Constraints . 4-7 Box Constraints . 4-7 Nonlinear Least-Squares . 4-10 Quadratic Programming . 4-11 Linear Least-Squares . 4-12 Large-Scale Linear Programming . 4-13 Main Algorithm . 4-13 Preprocessing . 4-16 iv Contents Selected Bibliography . 4-17 Function Reference 5 Functions – By Category . 5-2 Minimization . 5-2 Equation Solving . 5-2 Least Squares (Curve Fitting) . 5-3 Utility . 5-3 Demos of Large-Scale Methods . 5-3 Demos of Medium-Scale Methods . 5-4 Function Arguments . 5-5 Input Arguments . 5-5 Output Arguments . 5-8 Optimization Parameters . 5-10 Output Function . 5-15 Structure of the Output Function . 5-15 Functions — Alphabetical List . 5-24 Index v vi Contents Preface The Preface consists of these sections: What Is the Optimization Toolbox? Introduces the Optimization Toolbox, and describes its (p. viii) intended use and its capabilities. Related Products (p. ix) Lists products that are relevant to the kinds of tasks you can perform with the Optimization Toolbox. Using This Guide (p. xi) Explains the organization of this guide. Configuration Information (p. xii) Directs you to installation and configuration information. Technical Conventions (p. xiii) Describes mathematical notation used in this.