ebook img

Download LINDO API User's Manual [PDF] PDF

845 Pages·2017·11.26 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Download LINDO API User's Manual [PDF]

LINDO API 13.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 ©2020 by LINDO Systems, Inc. All rights reserved. Printing 1 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 ...................................................................................................................................... ix 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 ........................................................................................................... 11 Array Representation of Models ......................................................................................... 12 Sparse Matrix Representation ........................................................................................ 13 Simple Programming Example ....................................................................................... 16 Chapter 2: ................................................................................................................................ 21 Function Definitions ................................................................................................................. 21 Common Parameter Macro Definitions .............................................................................. 22 Structure Creation and Deletion Routines .......................................................................... 26 License and Version Information Routines ........................................................................ 28 Input-Output Routines ........................................................................................................ 30 Parameter Setting and Retrieving Routines ....................................................................... 49 Available Parameters...................................................................................................... 64 Available Information .................................................................................................... 139 Model Loading Routines ................................................................................................... 160 Solver Initialization Routines ............................................................................................ 192 Optimization Routines ...................................................................................................... 198 Solution Query Routines .................................................................................................. 207 Model Query Routines ...................................................................................................... 227 Model Modification Routines ............................................................................................ 270 Model and Solution Analysis Routines ............................................................................. 293 Error Handling Routines ................................................................................................... 305 Advanced Routines .......................................................................................................... 307 Matrix Operations ......................................................................................................... 316 Callback Management Routines ...................................................................................... 329 Memory Management Routines ....................................................................................... 343 Random Number Generation Routines ............................................................................ 346 Sampling Routines ........................................................................................................... 352 Date and Time Routines ................................................................................................... 367 Tuner Routines ................................................................................................................. 370 Chapter 3: .............................................................................................................................. 383 iv TABLE OF CONTENTS Solving Linear Programs ....................................................................................................... 383 A Programming Example in C .......................................................................................... 383 A Programming Example in Visual Basic ......................................................................... 393 VB and Delphi Specific Issues ......................................................................................... 401 Solving Large Linear Programs using Sprint .................................................................... 402 Solving Linear Programs using the –fileLP option in Runlindo .................................... 403 A Programming Example in C ...................................................................................... 404 Multiobjective Linear Programs and Alternate Optima ..................................................... 410 Chapter 4: Solving Mixed-Integer Programs ......................................................................... 415 Staffing Example Using Visual C++ ................................................................................. 416 Staffing Example Using Visual Basic ............................................................................... 423 Solving MIPs using BNP .................................................................................................. 430 Solving MIPs using the –bnp option in Runlindo .............................................................. 430 A Programming Example in C .......................................................................................... 432 Chapter 5: Solving Quadratic Programs ............................................................................... 435 Setting up Quadratic Programs ........................................................................................ 436 Loading Quadratic Data via Extended MPS Format Files ............................................ 436 Loading Quadratic Data via API Functions .................................................................. 437 Sample Portfolio Selection Problems ............................................................................... 440 Example 1. The Markowitz Model: ............................................................................... 440 Example 2. Portfolio Selection with Restrictions on the Number of Assets Invested: .. 444 Chapter 6: Solving Conic Programs ...................................................................................... 451 Second-Order Cone Programs......................................................................................... 451 Setting up Second-Order Cone Programs ....................................................................... 454 Loading Cones via Extended MPS Format Files .......................................................... 454 Loading Cones via API Functions ................................................................................ 456 Example 3: Minimization of Norms: .............................................................................. 456 Converting Models to SOCP Form ............................................................................... 461 Example 4: Ratios as SOCP Constraints: .................................................................... 463 Quadratic Programs as SOCP ..................................................................................... 467 Semi-Definite Programs ................................................................................................... 468 Loading SDP via SDPA Format Files ........................................................................... 469 Loading SDPs via API Functions .................................................................................. 473 Chapter 7: Solving Nonlinear Programs ................................................................................ 481 Instruction-List/MPI Style Interface .................................................................................. 482 Postfix Notation in Representing Expressions ............................................................. 482 Supported Operators and Functions ............................................................................ 484 Inputting SDP/POSD Constraints via MPI File/Instruction List ..................................... 502 Inputting SDP/POSD Constraints via a C Program ...................................................... 505 Black-Box Style Interface ................................................................................................. 514 Loading Model Data...................................................................................................... 515 Evaluating Nonlinear Terms via Callback Functions .................................................... 517 Grey-Box Style Interface .................................................................................................. 521 Instruction Format ......................................................................................................... 523 Example 1 ..................................................................................................................... 523 Example 2 ..................................................................................................................... 523 Example 3 ..................................................................................................................... 524 Differentiation ................................................................................................................... 524 Solving Non-convex and Non-smooth models ................................................................. 525 Linearization ................................................................................................................. 525 TABLE OF CONTENTS v Multistart Scatter Search for Difficult Nonlinear Models ............................................... 527 Global Optimization of Difficult Nonlinear Models ........................................................ 529 Sample Nonlinear Programming Problems ...................................................................... 530 Example 1: Black-Box Style Interface: ......................................................................... 530 Example 2: Instruction-List Style Interface ................................................................... 536 Example 3: Multistart Solver for Non-Convex Models ................................................. 546 Example 4: Global Solver with MPI Input Format ......................................................... 550 Example 5: Grey-Box Style Interface ........................................................................... 556 Example 6: Nonlinear Least-Square Fitting .................................................................. 563 Chapter 8: .............................................................................................................................. 568 Stochastic Programming ....................................................................................................... 568 Multistage Decision Making Under Uncertainty ............................................................ 568 Multistage Recourse Models ............................................................................................ 570 Scenario Tree ................................................................................................................... 571 Setting up SP Models: ...................................................................................................... 573 Loading Core Model: .................................................................................................... 573 Loading the Time Structure: ......................................................................................... 576 Loading the Stochastic Structure: ................................................................................. 578 Decision Making under Chance-Constraints .................................................................... 585 Individual and Joint Chance-Constraints: ..................................................................... 585 Monte Carlo Sampling ...................................................................................................... 588 Automatic Sampling of Scenario Trees ........................................................................ 592 Limiting Sampling to Continuous Parameters .............................................................. 592 Using Nested Benders Decomposition Method ............................................................ 593 Sample Multistage SP Problems ...................................................................................... 595 An Investment Model to Fund College Education: ....................................................... 595 An American Put-Options Model: ................................................................................. 597 Sample Chance-Constrainted Problems .......................................................................... 599 A Production Planning Problem: ................................................................................... 599 Models with User-defined Distribution: ......................................................................... 600 A Farming Problem: ...................................................................................................... 602 About alternative formulations: ..................................................................................... 605 Appendix 8a: Correlation Specification......................................................................... 605 Appendix 8b: Random Number Generation ................................................................ 609 Appendix 8c: Variance Reduction ............................................................................... 610 Appendix 8d: The Costs of Uncertainty: EVPI and EVMU .......................................... 610 Appendix 8e: Introducing Dependencies between Stages .......................................... 614 Chapter 9: .............................................................................................................................. 617 Using Callback Functions ...................................................................................................... 617 Specifying a Callback Function ........................................................................................ 617 A Callback Example Using C ........................................................................................... 620 A Callback Example Using Visual Basic .......................................................................... 625 Integer Solution Callbacks ................................................................................................ 627 Chapter 10: Analyzing Models and Solutions ....................................................................... 631 Sensitivity and Range Analysis of an LP .......................................................................... 631 Diagnosis of Infeasible or Unbounded Models................................................................. 633 Infeasible Models .......................................................................................................... 633 Workings of the IIS Finder: ........................................................................................... 635 Unbounded Linear Programs ....................................................................................... 636 Infeasible Integer Programs ......................................................................................... 636 vi TABLE OF CONTENTS Infeasible Nonlinear Programs ..................................................................................... 637 An Example for Debugging an Infeasible Linear Program ............................................... 637 Debugging an infeasible model with runlindo................................................................... 643 Block Structured Models .................................................................................................. 644 Determining Total Decomposition Structures ............................................................... 647 Determining Angular Structures ................................................................................... 648 Techniques Used in Determining Block Structures ...................................................... 649 Generalized Assignment Problem ................................................................................ 649 Chapter 11: ............................................................................................................................ 651 Parallel Optimization ............................................................................................................. 651 Thread Parameters .......................................................................................................... 651 Concurrent vs. Parallel Parameters ................................................................................. 652 Solving MIPs Concurrently ............................................................................................... 653 Solvers with built-in Parallel Algorithms ........................................................................... 656 Reproducibility .................................................................................................................. 657 Chapter 12: Parameter Tuning Tool ...................................................................................... 658 Setting up the Tuning Tool ............................................................................................... 658 Tuning with a Configuration File ....................................................................................... 659 Tuning with API Calls Programmatically .......................................................................... 661 Running the Tuning Tool .................................................................................................. 662 Chapter 13: Multiobjective Models and Alternate Optima ..................................................... 664 Setting up Objective Pool ................................................................................................. 665 Accessing Solution Pool ................................................................................................... 666 Example: Bi-objective Linear Assignment Problem ......................................................... 669 Appendix A: Error Codes ...................................................................................................... 673 Appendix B: ........................................................................................................................... 686 MPS File Format ................................................................................................................... 686 Integer Variables .............................................................................................................. 689 Semi-continuous Variables ............................................................................................... 689 SOS Sets .......................................................................................................................... 690 SOS2 Example ................................................................................................................. 691 Quadratic Objective .......................................................................................................... 693 Quadratic Constraints ....................................................................................................... 694 Second-Order Cone Constraints ...................................................................................... 695 Ambiguities in MPS Files .................................................................................................. 698 Appendix C: ........................................................................................................................... 699 LINDO File Format ................................................................................................................ 699 Flow of Control ................................................................................................................. 699 Formatting ........................................................................................................................ 699 Optional Modeling Statements ......................................................................................... 701 FREE Statement ........................................................................................................... 702 GIN Statement .............................................................................................................. 702 INT Statement ............................................................................................................... 702 SUB and SLB Statements ............................................................................................ 703 TITLE Statement ........................................................................................................... 704 Appendix D: ........................................................................................................................... 705 MPI File Format ..................................................................................................................... 705 Appendix E: ........................................................................................................................... 708 SMPS File Format ................................................................................................................. 708 CORE File ..................................................................................................................... 708 TABLE OF CONTENTS vii TIME File ...................................................................................................................... 708 STOCH File .................................................................................................................. 710 Appendix F: ........................................................................................................................... 717 SMPI File Format .................................................................................................................. 717 Appendix G: mxLINDO .......................................................................................................... 721 A MATLAB Interface.............................................................................................................. 721 Introduction ....................................................................................................................... 721 Setting up MATLAB to Interface with LINDO ................................................................... 721 Using the mxLINDO Interface .......................................................................................... 722 Calling Conventions ......................................................................................................... 724 mxLINDO Routines .......................................................................................................... 724 Structure Creation and Deletion Routines .................................................................... 724 License Information Routines ....................................................................................... 727 Input-Output Routines................................................................................................... 728 Error Handling Routines ............................................................................................... 736 Parameter Setting and Retrieving Routines ................................................................. 738 Model Loading Routines ............................................................................................... 745 Solver Initialization Routines ........................................................................................ 758 Optimization Routines................................................................................................... 762 Solution Query Routines ............................................................................................... 763 Model Query Routines .................................................................................................. 770 Model Modification Routines ........................................................................................ 789 Model and Solution Analysis Routines ......................................................................... 806 Advanced Routines....................................................................................................... 813 Callback Management Routines ................................................................................... 818 Auxiliary Routines ......................................................................................................... 824 Sample MATLAB Functions ............................................................................................. 826 M-functions using mxLINDO ......................................................................................... 826 Appendix H: ........................................................................................................................... 829 An Interface to Ox ................................................................................................................. 829 Introduction ....................................................................................................................... 829 Setting up Ox Interface ..................................................................................................... 829 Calling Conventions ......................................................................................................... 830 Example. Portfolio Selection with Restrictions on the Number of Assets Invested ...... 832 Appendix I: ............................................................................................................................ 837 List of Abbreviations in Progress Logs .................................................................................. 837 Appendix J: ............................................................................................................................ 839 An R Interface ....................................................................................................................... 839 Introduction ....................................................................................................................... 839 Installation ........................................................................................................................ 839 Calling Conventions ......................................................................................................... 839 Example. Least Absolution Deviation Estimation ......................................................... 839 Appendix K: ........................................................................................................................... 843 A Python Interface ................................................................................................................. 843 Introduction ....................................................................................................................... 843 Installation ........................................................................................................................ 843 Calling Conventions ......................................................................................................... 843 Example. Solving an LP model with pyLindo ............................................................... 844 References ............................................................................................................................ 847 Acknowledgements ............................................................................................................... 849 viii TABLE OF CONTENTS INDEX ................................................................................................................................... 851 ix Preface LINDO Systems is proud to introduce LINDO API 13.0. The general features include a) stochastic optimization b) global and multistart solvers for global optimization, c) nonlinear solvers for general nonlinear optimization, d) simplex solvers for linear optimization e) barrier solvers for linear, quadratic and second-order-cone optimization f) mixed-integer solvers for linear-integer and nonlinear-integer optimization, g) tools for analysis of infeasible linear, integer and nonlinear models, h) features to exploit parallel processing on multi-core computers, i) interfaces to other systems such as MATLAB, Ox, Java and .NET and j) support of more platforms (see below). The new features are: a) Improved speed and robustness in all solvers; b) Several new functions and constraint types are recognized, e.g., the AllDiff constraint for general integer variables, c) New symmetry detection capabilities have been added to the integer (MIP) solver. This may dramatically reduce the time needed to prove optimality on some models with integer variables. The primary solvers in LINDO API 13.0 are: ❑ Global Solver: The global solver combines a series of range bounding (e.g., interval analysis and convex analysis) and range reduction techniques (e.g., linear programming and constraint propagation) within a branch-and-bound framework to find proven global solutions to non- convex NLPs. Traditional nonlinear solvers can get stuck at suboptimal, local solutions. API 13.0 incorporates substantial improvements in a) finding good feasible solutions quickly and b) constructing bounds on both convex and nonconvex functions so optimality can be proven more quickly. ❑ Mixed Integer Solver: The mixed integer solver of LINDO API 13.0 solves linear, quadratic, and general nonlinear integer models. It contains advanced techniques such as a) cut generation b) tree reordering to reduce tree growth dynamically, c) improved heuristics for finding good solutions quickly, and d) identifying certain model structures and exploiting for much faster solution, d) recognition of the AllDiff (All Different constraint type). ❑ General Nonlinear Solver: LINDO API is the first full-featured solver callable library to offer general nonlinear and nonlinear/integer capabilities. This unique feature allows developers to use a single general purpose solver into custom applications. As with its linear and integer capabilities, LINDO API provides the user with a comprehensive set of routines for formulating, solving, and modifying nonlinear models. API 13.0 supports several dozen additional nonlinear functions, mainly in the area of probability distributions, pdf’s, cdf’s, and their inverses. ❑ Multistart Nonlinear Solver: The multistart solver intelligently generates a sequence of candidate starting points in the solution space of NLP and mixed integer NLPs. A traditional NLP solver is called with each starting point to find a local optimum. For non-convex NLP models, the quality of the best solution found by the multistart solver tends to be superior to that of a single solution from a x PREFACE traditional nonlinear solver. A user adjustable parameter controls the maximum number of multistarts to be performed. See Chapter 7, Solving Nonlinear Models, for more information. ❑ Simplex Solvers: LINDO API 13.0 offers two advanced implementations of the primal and dual simplex methods as the primary means for solving linear programming problems. Its flexible design allows the users to fine tune each method by altering several of the algorithmic parameters. The Sprint method uses the standard simplex solvers efficiently to handle “skinny” LP’s, those having millions of variables, but a modest number of constraints. ❑ Barrier (Interior-Point) Solver: Barrier solver is an alternative way for solving linear and quadratic programming problems. LINDO API’s state-of-the-art barrier solver offers great speed advantages for large scale sparse models. LINDO API 13.0 also includes a special variant of the barrier solver specifically designed to solve Second-Order-Cone (SOC) problems, including Semi-Definite Programs (SDP). See Chapter 6, Solving Second-Order-Cone Models, for more information. API 13.0 includes improved techniques for automatically identifying models than can be solved as SOC. ❑ Stochastic Solver, Multistage and Chance Constrained: LINDO API 13.0 supports decision making under uncertainty. Its powerful stochastic solver offers the ability to solve: a) chance-constrained models, b) multistage stochastic models with recourse. For both types, the user expresses the uncertainty by providing distribution functions, either built-in or user-defined. In multistage models, the stochastic solver optimizes the model to minimize the cost of the initial stage plus the expected value of recourse over all future stages. In chance-constrained models, the solver finds the best solution that satisfies constraints with a specified probability. ❑ Parallel Extensions: LINDO API 13.0 includes multi-cpu optimization extensions to its solvers to take advantage of computers with multicore processors. The multicore extensions are of two types: concurrent optimizers and parallel optimizers (using built-in parallel algorithms). Parallel versions of random number generators and sampling features are also provided. ❑ Statistical Sampling Tools: LINDO API 13.0 offers extensive set of API functions for sampling from various statistical distributions. Sampling error can be reduced by using variance reduction methods such as Latin-Hyper-Square sampling and Antithetic variates. Generation of correlated (dependent) samples based on Pearson, Spearman or Kendall’s correlation measures is provided. A pseudo-random number generation API offers advanced generators with long cycles.

Description:
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
See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.