|
OR/MS Today - December 2002 Software Review LINDO API Linear, quadratic, MIP callable library is a useful tool for OR/MS practitioners who write their own computer code. By Andy Felt The average optimization software reviewed in OR/MS Today has two parts: the graphical user interface (GUI) and the mathematical engine. LINDO Application Programming Interface (API) is solely an engine that has been purposely separated from the GUI. This makes LINDO API a useful tool to a very focused set of OR/MS practitioners namely, those who write their own computer code. (In this article, we use the word programming in its classical sense to mean the act of planning activities for a large organization using mathematical optimization. A program is a mathematical model of such a situation. Code is used to describe instructions to a computer in any of the common compiled languages: C, C++, Fortran, Java, etc.) LINDO API, from Chicago-based LINDO Systems, Inc., is a library of functions that may be called from within many coding environments. It offers well-organized data structures and powerful linear, mixed integer and quadratic solvers in a linked library. But LINDO API was not intended for those who want to point and click their way through a model to a solution. The intended users of LINDO API are those who wish to access from within their own application the same linear, mixed integer, and quadratic solver engines that are available from other LINDO software. Such users might have their own proprietary modeling environment, or they might be coding a large algorithm that has need for such solvers within, or they might need greater control of the solvers than they have in the other LINDO software. LINDO API is supported on Windows, Linux and Solaris operating systems. In addition to standard hardware requirements (see Product Information box), one needs a coding environment that can link to external libraries. Most C, C++, Fortran, Java and Visual Basic environments fit this need. Alternatively, LINDO API can be called from MATLAB. My own experience with LINDO API has been positive. For two years, LINDO Systems has allowed my research group to use LINDO API inside our own software, CPA. This software implements a generalized cutting plane algorithm for two stage stochastic linear programs. You can try out CPA at the NEOS site: www-neos.mcs.anl.gov. Solvers With LINDO API, what's under the hood is all you get. Three solvers are available: a primal simplex solver, a dual simplex solver and a barrier solver. These solvers are simply the engine from the software LINDO, which offers a graphical front end as well. The barrier solver can handle quadratic objective and constraint functions, while the others are limited to linear functions. The model input data type for each solver is the same, so changing from one solver to another is a simple matter of changing the function call. Each solver can operate within a branch and bound solver for solving mixed integer programs. Data Structures and Input Formats The basic data structures used within LINDO API are flexible, easy to interface and intuitive. The topmost structure is a modeling environment, called LSenv. The environment contains one or more model structures, called LSmodel. Each model is a single linear or quadratic program, complete with model options, data and eventually solutions. The macro-data structure is well thought out and implemented, so that many options may be set globally in the environment wrapper, or superceded at the model level. Model data (the actual LP or QP coefficients) may be placed directly into memory by the calling code, or specified in a file in MPS or LINDO format. Direct entry involves placing your data into a sparse matrix and vector representation that is easy to use and well explained in the documentation. The internal structures appear to make efficient use of computer memory. The software can also write LP (primal or dual) data out in MPS or LINDO format. Users of MATLAB will be glad to know that all LINDO API functions may be called from within MATLAB by using the MATLAB executable MXLINDO. Unfortunately, LINDO API cannot currently interface with mathematical modeling languages like AMPL or GAMS. Examples of function calls The user of LINDO API has many functions that may be called from within a coding environment. The housekeeping routines license handling, allocation, error handling are numerous and well organized. It is easy to use quality coding techniques when using LINDO API. Figure 1 shows a minimal coding example, where the environment is created, the data is loaded, and the LP is solved. In addition to these basic calls, LINDO API provides a group of functions for modifying the model. One may add, delete or modify any of the model features: constraints, variables, quadratic data, integer data, right hand side coefficients, etc. Warm starts can be implemented by specification of a starting basis.
For those working on very large codes, the callback feature may be useful. If this feature is set, the solver periodically checks in with the calling function, at which time the current status may be probed, adjustments made or the solver terminated. Installation and technical support The installation of LINDO API is straightforward on one hand and tricky on the other. On a Windows system, an install wizard makes installation easy. In Linux, a README file takes the user through an easy three-step installation process. LINDO has certainly done their part to make the setup of LINDO API easy. However, there is a certain level of difficulty inherent in the use of callable libraries in general. The problems usually arise during the linking phase, when the compiler tries to find and use the LINDO libraries. Here, the user must wade through the swamp of compiler settings, environment variables and standard library version compatibility to try to find the magic setup that works. This can be daunting for the inexperienced code warrior. The good news is that LINDO Systems provides excellent technical support. There is a real phone number that is answered by a real person (do I sound jaded?), and in a single transfer the caller finds that he/she is talking to a real developer of LINDO API. The service is prompt and effective. The developers even listen to suggestions. Last spring, I suggested a small change in the format of one of the function calls. It was implemented in the next few months. Documentation The documentation that accompanies LINDO API is extensive and well written. Each callable function and parameter is described, and several examples of calling code are given. The examples show a variety of calling languages (C, C++, Java, Visual Basic and MATLAB). The examples given in the documentation are supposed to match files that are distributed with the library. However, some of these (probably the accompanying files) have been changed, so that the user should treat the accompanying files as additional examples, rather than exact implementations of the examples in the documentation. In addition, appendices on MPS and LINDO file formats are provided. Conclusion LINDO Systems has put forward a solid competitor in the callable optimization library market. LINDO API does not have as many features as some of its competitors (e.g. stochastic optimization solver and parallel computing), but if you only want a basic LP, MIP or QP solver, you can get a great value with LINDO API.
Andy Felt (afelt@uwsp.edu) is an assistant professor of Mathematics and Computing at the University of Wisconsin-Stevens Point. He has developed software for the pulp and paper industry, as well as for his own research in stochastic linear programming. In addition, Felt has five years experience as a chemical engineer. OR/MS Today copyright © 2003 by the Institute for Operations Research and the Management Sciences. All rights reserved. Lionheart Publishing, Inc. 506 Roswell Rd., Suite 220, Marietta, GA 30060 USA Phone: 770-431-0867 | Fax: 770-432-6969 E-mail: lpi@lionhrtpub.com URL: http://www.lionhrtpub.com Web Site © Copyright 2003 by Lionheart Publishing, Inc. All rights reserved. |