The TOMLAB Optimization Environment in Matlab1
Total Page:16
File Type:pdf, Size:1020Kb
AMO - Advanced Modeling and Optimization Volume 1, Number 1, 1999 The TOMLAB Optimization Environment in Matlab Kenneth Holmstrom Center for Mathematical Mo deling Department of Mathematics and Physics Malardalen University PO Box SE Vasteras Sweden Abstract TOMLAB is a general purp ose op en and integrated Matlab development environment for research and teaching in optimization on Unix and PC systems One motivation for TOMLAB is to simplify research on practical optimization problems giving easy access to all types of solvers at the same time having full access to the p ower of Matlab The design principle is dene your problem once optimize using any suitable solver In this pap er we discuss the design and contents of TOMLAB as well as some applications where TOMLAB has b een successfully applied TOMLAB is based on NLPLIB TB a Matlab to olb ox for nonlinear programming and pa rameter estimation and OPERA TB a Matlab to olb ox for linear and discrete optimization More than dierent algorithms and graphical utilities are implemented It is p ossible to call solvers in the Matlab Optimization Toolb ox and generalpurp ose solvers implemented in For tran or C using a MEXle interface Currently MEXle interfaces have b een developed for MINOS NPSOL NPOPT NLSSOL LPOPT QPOPT and LSSOL A problem is solved by a direct call to a solver or by a general multisolver driver routine or interactively using a graphical user interface GUI or a menu system If analytical derivatives are not available automatic dierentiation is easy using an interface to ADMATADMIT TB Furthermore ve types of numerical dierentiation metho ds are included in NLPLIB TB A large set of standard test problems are included as well as example and demonstration les New userdened problems are easily added Furthermore using MEXle interfaces problems in the CUTE test problem data base and problems dened in the AMPL mo deling language can b e solved TOMLAB currently solves small and medium size dense problems where the available memory is the limit TOMLAB is free for academic purp oses and down loadable at our home page Keywords Mathematical Programming Nonlinear Programming Op erations Research Matlab CUTE AMPL Graphical User Interface Software Engineering Mathematical Software Optimiza tion Algorithms Nonlinear Least Squares AMS Sub ject Classication C C C 1 Financed by the Malardalen University Research Board pro ject Applied Optimization and Modeling TOM 2 Email hkhmdhse URL httpwwwimamdhsetom The TOMLAB Optimization Environment in Matlab Introduction Many scientists and engineers are using Matlab as a mo deling and analysis to ol but for the solution of optimization problems the supp ort is weak That was one strong motivation for starting the de velopment of TOMLAB a generalpurp ose op en and integrated development environment in Matlab for research and teaching in optimization Another motivation was to provide p owerful to ols for the research on the hardtosolve applied problems our research group are working on by systematic development of a large set of usable optimization to ols This pap er presents the design and contents of TOMLAB To solve optimization problems traditionally the user has b een forced to write a Fortran co de that calls some standard solver written as a Fortran subroutine For nonlinear problems the user must also write subroutines computing the ob jective function value and the vector of constraint function values The needed derivatives are either explicitly co ded computed by using numerical dierences or derived using automatic dierentiation techniques In recent years several mo deling languages are developed like AIMMS AMPL ASCEND GAMS and LINGO The mo deling system acts as a prepro cessor The user describ es the details of his problem in a very verbal language an opp osite to the concise mathematical description of the problem The problem description le is normally mo died in a text editor with help from example les solving the same type of problem Much eort is directed to the development of more user friendly interfaces The mo del system pro cesses the input description le and calls any of the available solvers For a solver to b e accessible in the mo deling system sp ecial types of interfaces are developed The mo deling language approach is suitable for many management and decision problems but may not always b e the b est way for engineering problems which often are nonlinear with a complicated problem description Until recently the supp ort for nonlinear problems in the mo deling languages has b een crude This is now rapidly changing For p eople with a mathematical background mo deling languages often seems to b e a very tedious way to dene an optimization problem There has b een several attempts to nd languages more suitable than Fortran or CC to describ e mathematical problems like the compact and p owerful APL language Nowadays languages like Matlab has a rapid growth of users Matlab was originally developed as a prepro cessor to the standard Fortran subroutine libraries in numerical linear algebra LINPACK and EISPACK much the same idea as the mo deling languages discussed ab ove Matlab of to day is an advanced and p owerful to ol with graphics animation and advanced menu design p ossibilities integrated with the mathematics The Matlab language has made the development of to olb oxes p ossible which serves as a direct extension to the language itself Using Matlab as an environment for solving optimization problems oers much more p ossibilities for analysis than just the pure solution of the problem The concept of TOMLAB is to integrate all dierent systems getting access to the b est of all worlds Furthermore TOMLAB provides wellimplemented solution algorithms for most common optimization problems TOMLAB should b e seen as a complement to existing mo del languages for the user needing more p ower and exibility than given by a mo deling system Much eort has b een put on advanced design utilizing the p ower and features of MatlabThe design principle is dene your problem once optimize using any suitable solver This is p ossible using general gateway and interface routines global variables string evaluations and structure arrays When solving advanced applied problems the design principle is of sp ecial imp ortance as it might b e a huge task to rewrite the function constraint and derivative sp ecications A stack strategy for the global variables makes recursive calls p ossible in eg separable nonlinear least squares algorithms One structure holds all information ab out the problem and one holds the results For the optimization algorithm developer and the applied researcher in need of optimization to ols it is very easy to compare dierent solvers or do test runs on thousands of problems A to ol is provided to automate the tedious work of making computational result tables from test runs directly making LaTeX tables for inclusion in pap ers TOMLAB should b e seen as a prop osal for The TOMLAB Optimization Environment in Matlab a standard for optimization in Matlab In Sweden TOMLAB has b een used for several years in optimization courses It is distributed free of charge for academic purp oses During the rst months since the rst ocial release of TOMLAB December ab out researchers and research groups have downloaded the software All users have b een requested to answer what applications they have in mind for TOMLAB and it is clear that most elds of applied mathematics are represented So there is an obvious need for go o d optimization to ols in the scientic community This pap er is organized as follows In Section we discuss the design of TOMLAB Overviews of the two to olb oxes that are part of TOMLAB are given in Section NLPLIB TB and Section OPERA TB The graphical user interface GUI is further discussed in The MEXle interfaces to several solvers are discussed in Section and the interface to the Matlab Optimization Toolb ox is discussed in Section Currently TOMLAB may run problems dened in CUTE Section and AMPL Section Finally we end with some conclusions in Section The Design of TOMLAB As the scop e of TOMLAB is large and broad there is a clear need of a welldesigned system It is also necessary to use the p ower of the Matlab language to make the system exible and easy to use and maintain We have used the concept of structure arrays and made use of b oth the ability in Matlab to execute Matlab co de dened as string expressions and to execute functions sp ecied by a string To b e able to live up to the basic design principle of TOMLAB dene your problem once optimize using any suitable solver very many dierent interface routines as well as several interface layers was needed It is a dicult task to provide the necessary information for a particular solver esp ecially when the problem class is just a subset of the class of problems the particular solver is able to handle To solve this design problem in a general and easily expandable way we use one structure array that holds all information ab out the problem all input for the solution pro cess In a similar way one structure array holds the all output from the optimization together with the input structure array This makes advanced p ostpro cessing of results easy The thought is that the routines in TOMLAB may b e put together into more advanced hybrid algorithms or b eing subparts in more complex algorithms Therefore it is imp ortant to organize all handling of global information to avoid conicts We use a stack strategy for the global variables that