Optimization Toolbox

Total Page:16

File Type:pdf, Size:1020Kb

Optimization Toolbox Optimization Toolbox™ 4 User’s Guide How to Contact The MathWorks www.mathworks.com Web comp.soft-sys.matlab Newsgroup www.mathworks.com/contact_TS.html 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. 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–2008 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 reproduced 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, for, or through the federal government of the United States. By accepting delivery of the Program or Documentation, the government hereby agrees that this software or documentation qualifies as commercial computer software or commercial computer software documentation as such terms are used or defined in FAR 12.212, DFARS Part 227.72, and DFARS 252.227-7014. Accordingly, the terms and conditions of this Agreement and only those rights specified in this Agreement, shall pertain to and govern the use, modification, reproduction, release, performance, display, and disclosure of the Program and Documentation by the federal government (or other entity acquiring for or through the federal government) and shall supersede any conflicting contractual terms or conditions. If this License fails to meet the government’s needs or is inconsistent in any respect with federal procurement law, the government agrees to return the Program and Documentation, unused, to The MathWorks, Inc. Trademarks MATLAB and Simulink 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 trademarks or registered trademarks of their respective holders. Patents The MathWorks products are protected by one or more U.S. patents. Please see www.mathworks.com/patents for more information. Revision 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) June 2004 Fifth printing Revised for Version 3.0 (Release 14) October 2004 Online only Revised for Version 3.0.1 (Release 14SP1) March 2005 Online only Revised for Version 3.0.2 (Release 14SP2) September 2005 Online only Revised for Version 3.0.3 (Release 14SP3) March 2006 Online only Revised for Version 3.0.4 (Release 2006a) September 2006 Sixth printing Revised for Version 3.1 (Release 2006b) March 2007 Seventh printing Revised for Version 3.1.1 (Release 2007a) September 2007 Eighth printing Revised for Version 3.1.2 (Release 2007b) March 2008 Online only Revised for Version 4.0 (Release 2008a) October 2008 Online only Revised for Version 4.1 (Release 2008b) Acknowledgments Acknowledgments The MathWorks™ would like to acknowledge the following contributors to Optimization Toolbox™ algorithms. Thomas F. Coleman researched and contributed the large-scale algorithms for constrained and unconstrained minimization, nonlinear least squares and curve fitting, constrained linear least squares, quadratic programming, and nonlinear equations. Dr. Coleman is Dean of Faculty of Mathematics and Professor of Combinatorics and Optimization at University of Waterloo. Dr. Coleman has published 4 books and over 70 technical papers in the areas of continuous optimization and computational methods and tools for large-scale problems. Yin Zhang researched and contributed the large-scale linear programming algorithm. Dr. Zhang is Professor of Computational and Applied Mathematics on the faculty of the Keck Center for Interdisciplinary Bioscience Training at Rice University. Dr. Zhang has published over 50 technical papers in the areas of interior-point methods for linear programming and computation mathematical programming. Acknowledgments Contents Getting Started 1 Product Overview ................................. 1-2 Introduction ...................................... 1-2 Optimization Functions ............................ 1-2 Optimization Tool GUI ............................. 1-3 Example: Nonlinear Constrained Minimization ...... 1-4 Problem Formulation: Rosenbrock’s Function .......... 1-4 Defining the Problem in Toolbox Syntax ............... 1-5 Running the Optimization .......................... 1-7 Interpreting the Result ............................. 1-12 Optimization Overview 2 Introduction to Optimization Toolbox Solvers ........ 2-2 Writing Objective Functions ........................ 2-4 Writing Objective Functions ......................... 2-4 Jacobians of Vector and Matrix Objective Functions ..... 2-6 Anonymous Function Objectives ..................... 2-9 Maximizing an Objective ........................... 2-9 Writing Constraints ................................ 2-11 Types of Constraints ............................... 2-11 Bound Constraints ................................ 2-12 Linear Inequality Constraints ....................... 2-13 Linear Equality Constraints ......................... 2-13 Nonlinear Constraints ............................. 2-14 An Example Using All Types of Constraints ............ 2-15 vii Passing Extra Parameters .......................... 2-17 Anonymous Functions .............................. 2-17 Nested Functions ................................. 2-19 Global Variables .................................. 2-20 Choosing a Solver ................................. 2-21 Problems Handled by Optimization Toolbox Functions ... 2-21 Optimization Decision Table ........................ 2-24 Solver Inputs and Outputs ......................... 2-27 Iterations and Function Counts ...................... 2-27 First-Order Optimality Measure ..................... 2-28 Tolerances and Stopping Criteria .................... 2-31 Lagrange Multiplier Structures ...................... 2-32 Output Structures ................................. 2-33 Output Functions ................................. 2-33 Default Options Settings ........................... 2-41 Introduction ...................................... 2-41 Changing the Default Settings ....................... 2-41 Large-Scale vs. Medium-Scale Algorithms ............. 2-45 Displaying Iterative Output ........................ 2-47 Introduction ...................................... 2-47 Most Common Output Headings ..................... 2-47 Function-SpecificOutputHeadings ................... 2-48 Typical Problems and How to Deal with Them ....... 2-54 Local vs. Global Optima ............................ 2-57 What Are Local and Global Optima? .................. 2-57 Basins of Attraction ............................... 2-57 Searching For Global Optima ........................ 2-59 Reference ......................................... 2-62 viii Contents Optimization Tool 3 Getting Started with the Optimization Tool .......... 3-2 Introduction ...................................... 3-2 Opening the Optimization Tool ...................... 3-2 Steps for Using the Optimization Tool ................. 3-5 Running a Problem in the Optimization Tool ......... 3-6 Introduction ...................................... 3-6 Pausing and Stopping the Algorithm .................. 3-7 Viewing Results ................................... 3-7 Final Point ....................................... 3-7 Starting a New Problem ............................ 3-8 Closing the Optimization Tool ....................... 3-9 Specifying Certain Options ......................... 3-10 Plot Functions .................................... 3-10 Output function ................................... 3-11 Display to Command Window ....................... 3-11 Getting Help in the Optimization Tool ............... 3-13 Quick Reference .................................. 3-13 Additional Help ................................... 3-13 Importing and Exporting Your Work ................ 3-14 Exporting to the MATLAB Workspace ................ 3-14 Importing Your Work .............................. 3-16 Generating an M-File .............................. 3-16 Optimization Tool Examples ........................ 3-18 About Optimization Tool Examples ................... 3-18 Optimization Tool with the fmincon Solver ............. 3-18 Optimization Tool with the lsqlin Solver ............... 3-22 ix Using Optimization Toolbox Solvers 4 Optimization Theory Overview ..................... 4-2 Unconstrained Nonlinear Optimization .............. 4-3 Definition ........................................ 4-3 Large Scale fminunc Algorithm ...................... 4-3 Medium Scale fminunc Algorithm .................... 4-6 fminsearch Algorithm .............................. 4-11 Unconstrained Nonlinear Optimization Examples .... 4-14 Example: fminunc Unconstrained Minimization ........ 4-14 Example: Nonlinear Minimization with Gradient and Hessian ....................................... 4-16 Example: Nonlinear Minimization with Gradient
Recommended publications
  • Numerical Methods in MATLAB
    Numerical methods in MATLAB Mariusz Janiak p. 331 C-3, 71 320 26 44 c 2015 Mariusz Janiak All Rights Reserved Contents 1 Introduction 2 Ordinary Differential Equations 3 Optimization Introduction Using numeric approximations to solve continuous problems Numerical analysis is a branch of mathematics that solves continuous problems using numeric approximation. It involves designing methods that give approximate but accurate numeric solutions, which is useful in cases where the exact solution is impossible or prohibitively expensive to calculate. Numerical analysis also involves characterizing the convergence, accuracy, stability, and computational complexity of these methods.a aThe MathWorks, Inc. Introduction Numerical methods in Matlab Interpolation, extrapolation, and regression Differentiation and integration Linear systems of equations Eigenvalues and singular values Ordinary differential equations (ODEs) Partial differential equations (PDEs) Optimization ... Introduction Numerical Integration and Differential Equations Ordinary Differential Equations – ordinary differential equation initial value problem solvers Boundary Value Problems – boundary value problem solvers for ordinary differential equations Delay Differential Equations – delay differential equation initial value problem solvers Partial Differential Equations – 1-D Parabolic-elliptic PDEs, initial-boundary value problem solver Numerical Integration and Differentiation – quadratures, double and triple integrals, and multidimensional derivatives Ordinary Differential Equations An ordinary differential equation (ODE) contains one or more derivatives of a dependent variable y with respect to a single independent variable t, usually referred to as time. The notation used here for representing derivatives of y with respect to t is y 0 for a first derivative, y 00 for a second derivative, and so on. The order of the ODE is equal to the highest-order derivative of y that appears in the equation.
    [Show full text]
  • Optimization Toolbox User's Guide
    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.
    [Show full text]
  • Overview of Optimization Software
    Stanford University, Management Science & Engineering (and ICME) MS&E 318 (CME 338) Large-Scale Numerical Optimization Instructor: Michael Saunders Spring 2018 Notes 2: Overview of Optimization Software 1 Optimization problems We study optimization problems involving linear and nonlinear constraints: NP minimize φ(x) n x∈R 0 x 1 subject to ` ≤ @ Ax A ≤ u, c(x) where φ(x) is a linear or nonlinear objective function, A is a sparse matrix, c(x) is a vector of nonlinear constraint functions ci(x), and ` and u are vectors of lower and upper bounds. We assume the functions φ(x) and ci(x) are smooth: they are continuous and have continuous first derivatives (gradients). Sometimes gradients are not available (or too expensive) and we use finite difference approximations. Sometimes we need second derivatives. We study algorithms that find a local optimum for problem NP. Some examples follow. If there are many local optima, the starting point is important. „ x « LP Linear Programming min cTx subject to ` ≤ ≤ u Ax MINOS, SNOPT, SQOPT LSSOL, QPOPT, NPSOL (dense) CPLEX, Gurobi, LOQO, HOPDM, MOSEK, XPRESS CLP, lp solve, SoPlex (open source solvers [7, 34, 54]) „ x « QP Quadratic Programming min cTx + 1 xTHx subject to ` ≤ ≤ u 2 Ax MINOS, SQOPT, SNOPT, QPBLUR LSSOL (H = BTB, least squares), QPOPT (H indefinite) CLP, CPLEX, Gurobi, LANCELOT, LOQO, MOSEK BC Bound Constraints min φ(x) subject to ` ≤ x ≤ u MINOS, SNOPT LANCELOT, L-BFGS-B „ x « LC Linear Constraints min φ(x) subject to ` ≤ ≤ u Ax MINOS, SNOPT, NPSOL 0 x 1 NC Nonlinear Constraints min φ(x) subject to ` ≤ @ Ax A ≤ u MINOS, SNOPT, NPSOL c(x) CONOPT, LANCELOT Filter, KNITRO, LOQO (second derivatives) IPOPT (open source solver [30]) Algorithms for finding local optima are used to construct algorithms for more complex optimization problems: stochastic, nonsmooth, global, mixed integer.
    [Show full text]
  • Optimization Toolbox for Use with MATLAB®
    Optimization Toolbox For Use with MATLAB® User’s Guide Version 3 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 - 2004 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, for, or through the federal government of the United States. By accepting delivery of the Program or Documentation, the government hereby agrees that this software or documentation qualifies as commercial computer software or commercial computer software documentation as such terms are used or defined in FAR 12.212, DFARS Part 227.72, and DFARS 252.227-7014. Accordingly, the terms and conditions of this Agreement and only those rights specified in this Agreement, shall pertain to and govern the use, modification, reproduction, release, performance, display, and disclosure of the Program and Documentation by the federal government (or other entity acquiring for or through the federal government) and shall supersede any conflicting contractual terms or conditions.
    [Show full text]
  • Optimization Toolbox User's Guide
    Optimization Toolbox For Use with MATLAB® Thomas Coleman Mary Ann Branch Andrew Grace Computation Visualization Programming User’s Guide Version 2 How to Contact The MathWorks: 508-647-7000 Phone 508-647-7001 Fax The MathWorks, Inc. Mail 24 Prime Park Way Natick, MA 01760-1500 http://www.mathworks.com Web ftp.mathworks.com Anonymous FTP server 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] Subscribing user registration [email protected] Order status, license renewals, passcodes [email protected] Sales, pricing, and general information Optimization Toolbox User’s Guide COPYRIGHT 1990 - 1999 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. U.S. GOVERNMENT: If Licensee is acquiring the Programs on behalf of any unit or agency of the U.S. Government, the following shall apply: (a) For units of the Department of Defense: the Government shall have only the rights specified in the license under which the commercial computer software or commercial software documentation was obtained, as set forth in subparagraph (a) of the Rights in Commercial Computer Software or Commercial Software Documentation Clause at DFARS 227.7202-3, therefore the rights set forth herein shall apply; and (b) For any other unit or agency: NOTICE: Notwithstanding any other lease or license agreement that may pertain to, or accompany the delivery of, the computer software and accompanying documentation, the rights of the Government regarding its use, reproduction, and disclo- sure are as set forth in Clause 52.227-19 (c)(2) of the FAR.
    [Show full text]
  • Nonlinear Constrained Optimization: Methods and Software
    ARGONNE NATIONAL LABORATORY 9700 South Cass Avenue Argonne, Illinois 60439 Nonlinear Constrained Optimization: Methods and Software Sven Leyffer and Ashutosh Mahajan Mathematics and Computer Science Division Preprint ANL/MCS-P1729-0310 March 17, 2010 This work was supported by the Office of Advanced Scientific Computing Research, Office of Science, U.S. Department of Energy, under Contract DE-AC02-06CH11357. Contents 1 Background and Introduction1 2 Convergence Test and Termination Conditions2 3 Local Model: Improving a Solution Estimate3 3.1 Sequential Linear and Quadratic Programming......................3 3.2 Interior-Point Methods....................................5 4 Globalization Strategy: Convergence from Remote Starting Points7 4.1 Augmented Lagrangian Methods..............................7 4.2 Penalty and Merit Function Methods............................8 4.3 Filter and Funnel Methods..................................9 4.4 Maratos Effect and Loss of Fast Convergence....................... 10 5 Globalization Mechanisms 11 5.1 Line-Search Methods..................................... 11 5.2 Trust-Region Methods.................................... 11 6 Nonlinear Optimization Software: Summary 12 7 Interior-Point Solvers 13 7.1 CVXOPT............................................ 13 7.2 IPOPT.............................................. 13 7.3 KNITRO............................................ 15 7.4 LOQO............................................. 15 8 Sequential Linear/Quadratic Solvers 16 8.1 CONOPT...........................................
    [Show full text]
  • MATLAB's Optimization Toolbox Algorithms
    Appendix A MATLAB’s Optimization Toolbox Algorithms Abstract MATLAB’s Optimization Toolbox (version 7:2) includes a family of algorithms for solving optimization problems. The toolbox provides functions for solving linear programming, mixed-integer linear programming, quadratic program- ming, nonlinear programming, and nonlinear least squares problems. This chapter presents the available functions of this toolbox for solving LPs. A computational study is performed. The aim of the computational study is to compare the efficiency of MATLAB’s Optimization Toolbox solvers. A.1 Chapter Objectives • Present the linear programming algorithms of MATLAB’s Optimization Tool- box. • Understand how to use the linear programming solver of MATLAB’s Optimiza- tion Toolbox. • Present all different ways to solve linear programming problems using MAT- LAB. • Compare the computational performance of the linear programming algorithms of MATLAB’s Optimization Toolbox. A.2 Introduction MATLAB is a matrix language intended primarily for numerical computing. MATLAB is especially designed for matrix computations like solving systems of linear equations or factoring matrices. Users that are not familiar with MATLAB are referred to [3, 7]. Experienced MATLAB users that want to further optimize their codes are referred to [1]. MATLAB’s Optimization Toolbox includes a family of algorithms for solving optimization problems. The toolbox provides functions for solving linear pro- gramming, mixed-integer linear programming, quadratic programming, nonlinear programming, and nonlinear least squares problems. MATLAB’s Optimization Toolbox includes four categories of solvers [9]: © Springer International Publishing AG 2017 565 N. Ploskas, N. Samaras, Linear Programming Using MATLAB®, Springer Optimization and Its Applications 127, DOI 10.1007/978-3-319-65919-0 566 Appendix A MATLAB’s Optimization Toolbox Algorithms • Minimizers: solvers that attempt to find a local minimum of the objective function.
    [Show full text]