Lindo Api User Manual
Total Page:16
File Type:pdf, Size:1020Kb
LINDO API 6.0 User Manual LINDO Systems, Inc. 1415 North Dayton Street, Chicago, Illinois 60642 Phone: (312)988-7422 Fax: (312)988-9065 E-mail: [email protected] COPYRIGHT LINDO API and its related documentation are copyrighted. You may not copy the LINDO API software or related documentation except in the manner authorized in the related documentation or with the written permission of LINDO Systems, Inc. TRADEMARKS LINDO is a registered trademark of LINDO Systems, Inc. Other product and company names mentioned herein are the property of their respective owners. DISCLAIMER LINDO Systems, Inc. warrants that on the date of receipt of your payment, the disk enclosed in the disk envelope contains an accurate reproduction of LINDO API and that the copy of the related documentation is accurately reproduced. Due to the inherent complexity of computer programs and computer models, the LINDO API software may not be completely free of errors. You are advised to verify your answers before basing decisions on them. NEITHER LINDO SYSTEMS INC. NOR ANYONE ELSE ASSOCIATED IN THE CREATION, PRODUCTION, OR DISTRIBUTION OF THE LINDO SOFTWARE MAKES ANY OTHER EXPRESSED WARRANTIES REGARDING THE DISKS OR DOCUMENTATION AND MAKES NO WARRANTIES AT ALL, EITHER EXPRESSED OR IMPLIED, REGARDING THE LINDO API SOFTWARE, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR OTHERWISE. Further, LINDO Systems, Inc. reserves the right to revise this software and related documentation and make changes to the content hereof without obligation to notify any person of such revisions or changes. Copyright ©2009 by LINDO Systems, Inc. All rights reserved. Published by 1415 North Dayton Street Chicago, Illinois 60642 Technical Support: (312) 988-9421 E-mail: [email protected] http://www.lindo.com iii TABLE OF CONTENTS TABLE OF CONTENTS ............................................................................................................ iii Preface ..................................................................................................................................... vii Chapter 1:.................................................................................................................................. 1 Introduction................................................................................................................................1 What Is LINDO API? ............................................................................................................ 1 Linear Solvers................................................................................................................... 2 Mixed-Integer Solver......................................................................................................... 2 Nonlinear Solver ............................................................................................................... 3 Global Solver .................................................................................................................... 3 Stochastic Solver.............................................................................................................. 3 Installation ............................................................................................................................ 3 Windows Platforms........................................................................................................... 4 Unix-Like Platforms........................................................................................................... 4 Updating License Keys......................................................................................................... 6 Solving Models from a File using Runlindo .......................................................................... 7 Sample Applications............................................................................................................. 9 Array Representation of Models........................................................................................... 9 Sparse Matrix Representation ........................................................................................ 10 Simple Programming Example ....................................................................................... 13 Chapter 2:................................................................................................................................17 Function Definitions................................................................................................................. 17 Common Parameter Macro Definitions .............................................................................. 18 Structure Creation and Deletion Routines.......................................................................... 21 License and Version Information Routines ........................................................................ 23 Input-Output Routines ........................................................................................................ 25 Parameter Setting and Retrieving Routines....................................................................... 42 Available Parameters...................................................................................................... 53 Available Information ...................................................................................................... 99 Model Loading Routines................................................................................................... 114 Solver Initialization Routines ............................................................................................ 135 Optimization Routines ...................................................................................................... 139 Solution Query Routines .................................................................................................. 144 Model Query Routines...................................................................................................... 160 Model Modification Routines ............................................................................................ 191 Model and Solution Analysis Routines............................................................................. 210 Error Handling Routines................................................................................................... 219 Advanced Routines .......................................................................................................... 221 Callback Management Routines ...................................................................................... 227 Memory Management Routines ....................................................................................... 238 Random Number Generation Routines............................................................................ 241 Sampling Routines ........................................................................................................... 245 Chapter 3:.............................................................................................................................. 259 Solving Linear Programs....................................................................................................... 259 A Programming Example in C.......................................................................................... 259 A Programming Example in Visual Basic......................................................................... 269 iv TABLE OF CONTENTS VB and Delphi Specific Issues: ........................................................................................ 277 Chapter 4: Solving................................................................................................................. 279 Mixed-Integer Programs........................................................................................................ 279 Staffing Example Using Visual C++ ................................................................................. 280 Staffing Example Using Visual Basic ............................................................................... 287 Chapter 5: Solving Quadratic Programs ............................................................................... 295 Setting up Quadratic Programs........................................................................................ 296 Loading Quadratic Data via Extended MPS Format Files............................................ 296 Loading Quadratic Data via API Functions .................................................................. 297 Sample Portfolio Selection Problems............................................................................... 300 Example 1. The Markowitz Model: ............................................................................... 300 Example 2. Portfolio Selection with Restrictions on the Number of Assets Invested:.. 304 Chapter 6: Solving Second-Order Cone Programs............................................................... 311 Setting up Second-Order Cone Programs ....................................................................... 314 Loading Cones via Extended MPS Format Files.......................................................... 314 Loading Cones via API Functions ................................................................................ 316 Example 3: Minimization of Norms:.............................................................................. 316 Converting Models to SOCP