User's Guide for Tomlab 7
Total Page:16
File Type:pdf, Size:1020Kb
USER'S GUIDE FOR TOMLAB 71 Kenneth Holmstr¨om2, Anders O. G¨oran3 and Marcus M. Edvall4 May 5, 2010 -TOMLAB NOW INCLUDES THE MODELING ENGINE, TomSym [See section 4.3]! 1More information available at the TOMLAB home page: http://tomopt.com/ and at the Applied Optimization and Modeling TOM home page http://www.ima.mdh.se/tom. E-mail: [email protected]. 2Professor in Optimization, M¨alardalenUniversity, Department of Mathematics and Physics, P.O. Box 883, SE-721 23 V¨aster˚as, Sweden, [email protected]. 3Tomlab Optimization AB, V¨aster˚asTechnology Park, Trefasgatan 4, SE-721 30 V¨aster˚as,Sweden, [email protected]. 4Tomlab Optimization Inc., 1260 SE Bishop Blvd Ste E, Pullman, WA 99163, USA, [email protected]. 1 Contents Contents 2 1 Introduction 8 1.1 What is TOMLAB?............................................8 1.2 The Organization of This Guide.....................................9 1.3 Further Reading.............................................. 10 2 Overall Design 11 2.1 Structure Input and Output........................................ 11 2.2 Introduction to Solver and Problem Types................................ 11 2.3 The Process of Solving Optimization Problems............................. 13 2.4 Low Level Routines and Gateway Routines............................... 15 3 Problem Types and Solver Routines 18 3.1 Problem Types Defined in TOMLAB................................... 18 3.2 Solver Routines in TOMLAB....................................... 23 3.2.1 TOMLAB Base Module...................................... 23 3.2.2 TOMLAB /BARNLP....................................... 24 3.2.3 TOMLAB /CGO.......................................... 24 3.2.4 TOMLAB /CONOPT....................................... 25 3.2.5 TOMLAB /CPLEX........................................ 25 3.2.6 TOMLAB /KNITRO....................................... 25 3.2.7 TOMLAB /LGO.......................................... 25 3.2.8 TOMLAB /MINLP........................................ 25 3.2.9 TOMLAB /MINOS........................................ 25 3.2.10 TOMLAB /OQNLP........................................ 25 3.2.11 TOMLAB /NLPQL........................................ 26 3.2.12 TOMLAB /NPSOL........................................ 26 3.2.13 TOMLAB /PENBMI....................................... 27 3.2.14 TOMLAB /PENSDP....................................... 27 3.2.15 TOMLAB /SNOPT........................................ 27 3.2.16 TOMLAB /SOL.......................................... 27 3.2.17 TOMLAB /SPRNLP....................................... 27 3.2.18 TOMLAB /XA........................................... 28 2 3.2.19 TOMLAB /Xpress......................................... 28 3.2.20 Finding Available Solvers..................................... 29 4 Defining Problems in TOMLAB 31 4.1 The TOMLAB Format........................................... 31 4.2 Modifying existing problems........................................ 32 4.2.1 add A................................................ 32 4.2.2 keep A................................................ 33 4.2.3 remove A.............................................. 33 4.2.4 replace A.............................................. 34 4.2.5 modify b L............................................. 34 4.2.6 modify b U............................................. 35 4.2.7 modify c............................................... 35 4.2.8 modify c L............................................. 36 4.2.9 modify c U............................................. 36 4.2.10 modify x 0............................................. 36 4.2.11 modify x L............................................. 37 4.2.12 modify x U............................................. 37 4.3 TomSym................................................... 39 4.3.1 Modeling.............................................. 39 4.3.2 Ezsolve............................................... 40 4.3.3 Usage................................................ 41 4.3.4 Scaling variables.......................................... 42 4.3.5 SDP/LMI/BMI interface..................................... 42 4.3.6 Interface to MAD and finite differences............................. 42 4.3.7 Simplifications........................................... 44 4.3.8 Special functions.......................................... 45 4.3.9 Procedure vs parse-tree...................................... 46 4.3.10 Problems and error messages................................... 49 4.3.11 Example............................................... 49 5 Solving Linear, Quadratic and Integer Programming Problems 51 5.1 Linear Programming Problems...................................... 51 5.1.1 A Quick Linear Programming Solution.............................. 52 5.2 Quadratic Programming Problems.................................... 53 5.2.1 A Quick Quadratic Programming solution............................ 53 3 5.3 Mixed-Integer Programming Problems.................................. 55 6 Solving Unconstrained and Constrained Optimization Problems 60 6.1 Defining the Problem in Matlab m-files................................. 60 6.1.1 Communication between user routines.............................. 63 6.2 Unconstrained Optimization Problems.................................. 64 6.3 Direct Call to an Optimization Routine................................. 66 6.4 Constrained Optimization Problems................................... 66 6.5 Efficient use of the TOMLAB solvers................................... 69 7 Solving Global Optimization Problems 70 7.1 Box-Bounded Global Optimization Problems.............................. 70 7.2 Global Mixed-Integer Nonlinear Problems................................ 72 8 Solving Least Squares and Parameter Estimation Problems 74 8.1 Linear Least Squares Problems...................................... 74 8.2 Linear Least Squares Problems using the SOL Solver LSSOL..................... 75 8.3 Nonlinear Least Squares Problems.................................... 76 8.4 Fitting Sums of Exponentials to Empirical Data............................ 79 8.5 Large Scale LS problems with Tlsqr................................... 81 9 Multi Layer Optimization 84 10 tomHelp - The Help Program 85 11 TOMLAB Solver Reference 86 11.1 TOMLAB Base Module.......................................... 86 11.1.1 clsSolve............................................... 86 11.1.2 conSolve............................................... 90 11.1.3 cutPlane............................................... 94 11.1.4 DualSolve.............................................. 97 11.1.5 expSolve............................................... 100 11.1.6 glbDirect.............................................. 102 11.1.7 glbSolve............................................... 106 11.1.8 glcCluster.............................................. 109 11.1.9 glcDirect.............................................. 112 11.1.10 glcSolve............................................... 118 11.1.11 infLinSolve............................................. 123 4 11.1.12 infSolve............................................... 125 11.1.13 linRatSolve............................................. 127 11.1.14 lpSimplex.............................................. 129 11.1.15 L1Solve............................................... 131 11.1.16 MILPSOLVE............................................ 133 11.1.17 minlpSolve............................................. 145 11.1.18 mipSolve.............................................. 150 11.1.19 multiMin.............................................. 153 11.1.20 multiMINLP............................................ 157 11.1.21 nlpSolve............................................... 160 11.1.22 pdcoTL............................................... 163 11.1.23 pdscoTL............................................... 166 11.1.24 qpSolve............................................... 169 11.1.25 slsSolve............................................... 171 11.1.26 sTrustr............................................... 174 11.1.27 Tfmin................................................ 177 11.1.28 Tfzero................................................ 178 11.1.29 ucSolve............................................... 180 11.1.30 Additional solvers......................................... 183 12 TOMLAB Utility Functions 184 12.1 tomRun................................................... 184 12.2 addPwLinFun................................................ 186 12.3 binbin2lin.................................................. 188 12.4 bincont2lin................................................. 189 12.5 checkFuncs................................................. 190 12.6 checkDerivs................................................. 191 12.7 cpTransf................................................... 192 12.8 estBestHessian............................................... 194 12.9 lls2qp.................................................... 195 12.10LineSearch................................................. 196 12.11preSolve................................................... 198 12.12PrintResult................................................. 199 12.13runtest.................................................... 201 12.14SolverList.................................................. 202 12.15StatLS.................................................... 203 5 12.16systest.................................................... 204 13 Approximation of Derivatives 205 14 Special Notes and Features 213 14.1 Speed and Solution of Optimization Subproblems...........................