实例介绍
Lingo API手册 LINDO API User’s Manual
TABLE OF CONTENTS TABLE OF CONTENTS Prefa Chapter 1: Introduction What s lInDo aPi? Linear solvers Mixed-Integer Solver Nonlinear solver Global solver Installation Windows platforms Unix-Like platforms ting up License Key Solving Models from a File Sample Applications 33346799 Array representation of models Sparse Matrix Representation 10 Simple Programming Example Chapter 2: Function Definitions Common parameter macro definitions 18 Structure creation and deletion routines License and version information routines 23 Input-Output Routines 24 Parameter Setting and Retrieving Routines ..32 Available parameters Model loading routines Solver Initialization routines 83 Optimization Routines .88 Solution Query Routines Model query routine 107 Model modification routines 128 Model and Solution Analysis Routines 142 Error Handling Routines 151 Advanced routines 153 Callback Management Routines 159 Memory Management routines 170 Chapter3: Solving Linear Programs....….… 173 A Programming Example in C 173 a Programming example in visual basic 183 VB and delphi specific Issues: .191 Chapter 4: Solving Mixed-Integer Programs 193 Staffing Example Using Visual C++ 194 Staffing Example Using visual Basic 201 Chapter 5: Solving Quadratic Programs ∴209 Setting up Quadratic Programs 210 Loading Quadratic Data via Extended MPS Format Files 210 iV TABLE OF CONTENTS oading Quadratic Data via API Functions 211 Sample Portfolio selection Problems 214 Example 1. The Markowitz Model 214 EXample 2. Portfolio selection with Restrictions on the Number of Assets Invested: . 218 Chapter 6: Solving Second-Order Cone Programs 225 Setting up Second-Order Cone Programs 228 oading cones via extended mps format Files 228 oading cones via api Functions 230 EXample 3: Minimization of Norms: 230 Converting Models to SOCP Form 235 Example 4: Ratios as SoCP Constraints 236 Quadratic Programs as SOCP 240 Chapter 7: Solving Nonlinear Programs 243 Black-Box Style Interface 244 oading Model Data.…… 245 Evaluating Nonlinear Terms via Callback Functions 247 Instruction- List Style Interface.…… 251 Postfix Notation in Representing Expressions 251 Supported Operators and Functions 253 Example 1 260 Example 2 .260 Example 3................... 260 Differentiation 261 Solving Non-convex and Non-smooth models 261 Linearization 262 Multistart scatter search for difficult nonlinear models wwwwwww 264 Global Optimization of Difficult Nonlinear Models 265 Sample nonlinear programming problems .267 Example 1: Black-Box Style Interface 267 Example 2: Instruction -List Style Interface 273 Example 3: Multistart Solver for Non-Convex Models 283 Example 4: Global Solver with MPl Input Format 287 Chapter 8: Using Callback Functions 293 Specifying a Callback Function………… 293 A Callback Example Using C 296 A Callback Example UsingⅥ /isual basic.…. 301 Integer Solution Callbacks Chapter9: Analyzing Models and Solutions…… 305 Sensitivity and Range Analysis of an LP ,305 Diagnosis of Infeasible or Unbounded models 307 feasible models… 307 Unbounded Linear Programs 308 Infeasible Integer Programs 309 feasible Nonlinear Programs 309 An Example for debugging an Infeasible Linear Program 309 Block structured models 315 Determining Total Decomposition Structures .317 Determining angular Structures 318 Chapter 10: mXLINDO A MATLAB Interface 319 Introduction 319 TABLE OF CONTENTS V Setting up matlab to Interface with LINDO............................319 Calling Conventions .320 mxLINDO Routines 320 Structure creation and deletion routines 320 icense Information Routines 323 Input-Output Routines 324 Error Handling routines 330 Parameter Setting and Retrieving Routines 332 Model Loading Routines .339 Solver nitialization routines 348 Optimization routines 352 Solution Query Routines 353 Model Query Routines 360 Model modification routines 379 Model and Solution Analysis Routines 394 Advanced routines 401 Callback Management Routines 406 Auxiliary Routines 412 Sample MATLAB Functions 414 M-functions using mXLINDO 414 Chapter 11: An Interface to Ox 419 ntroduction..….……………………………419 Setting up Ox Interface 419 Calling Conventions 420 Example Portfolio Selection with Restrictions on the Number of assets Invested... 422 Appendix A: Error Codes 427 Appendix B: MPS File Format 431 Integer variables 433 Semi-continuous Variables 434 SOS Sets 435 SOS2 Example...... Quadratic objective 437 Quadratic Constraints 438 Second order cone constraints 439 Appendix C: LINDO File Format 443 Flow of control B国面 443 Formatting… 443 Optional Modeling Statements 445 FREE Statement 445 G| N Statement.… 446 iNT Statement 446 SUB and slb statements 447 TITLE Statement 447 Appendix D: MPI File format......….… 449 INDEX 451 Preface LINDO Systems is proud to introduce LINDO API. The general features include a) global and multistart solvers for global optimization, b) nonlinear solvers for general nonlinear optimization, c) simplex solvers for linear optimization d) barrier solvers for linear, quadratic and second-order-cone optimization e)mixed-integer solvers for linear-integer and nonlinear-integer optimization, f) tools for analysis of infeasible linear, integer and nonlinear models, g) interfaces to other systems such as MATLAB, Ox, Java and. NET and h)support of more platforms(see below ) The primary features in LINDO API are Q General Nonlinear Solver LINDO API is the first full-featured solver callable library to offer general nonlinear and nonlincar/integer capabilities. This unique feature allows developers to incorporate a single general purpose solver into their 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. The Nonlinear license option is required in order to use the nonlinear capabilities with LINdO API 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 nonlincar solvers can gct stuck at suboptimal, local solutions. This is no longer the case when using the global solver. a Multistart 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 traditional nonlinear solver. A user adjustable parameter controls the maximum number of multistart to be performed. See Chapter 7, Solving Nonlinear Models, for more information u Barrier(Interior-Point) Solver Barrier solver is an alternative way for for solving linear and quadratic programming problems. LINDO APIs state-of-the-art implementation of the barrier method offers great speed advantages for large scale sparse models. LINDO API also includes a special variant of the barrier solver specifically designed to solve Second-Order -Cone problems. Sce Chapter 6, Solving Second-Order -Cone Models, for more information 日 Simplex solvers: LINDO API 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 VI Preface 日 Mixed Integer Solver The mixed integer solvers capabilities of LINDO API extend to linear, quadratic, and general nonlinear integer models. It contains several advanced solution techniques such as a)cut generation b) tree reordering to reduce tree growth dynamically, and c)advanced heuristic and presolve strategies U Model and Solution Analysis Tools: LINDO API includes a comprehensive set of analysis tools for a) debugging of infeasible linear integer and nonlinear programs using series of advanced techniques to isolate the source of infeasibilities to smaller subset of the original constraints, b) performing sensitivity analysis to determine the sensitivity of the optimal basis to changes in certain data components(e.g. objective vector, right-hand-size values etc.) u Quadratic Recognition Tools The QP recognition tool is a useful algebraic pre-processor that automatically determines if an arbitrary nLP is actually a quadratic model QP models may then be passed to the faster quadratic solver, which is available as part of the barrier solver option a Linearization Tools Linearization is a comprehensive reformulation tool that automatically converts many non smooth functions and opcrators(c g,, max and absolute valuc) to a scrics of linear mathematically equivalent expressions. Many non-smooth models may be entirely linearized This allows the linear solver to quickly find a global solution to what would have otherwise been an intractable nonlinear problem u Decomposition Tools Many large scale linear and mixed integer problems have constraint matrices that are totally decomposable into a series of independent block structures. A user adjustable parameter can be set, so the solver checks if a model can be broken into smaller independent models. If total decomposition is possible, it will solve the independent problems sequentially to reach a solution for the original model. This may result in dramatic speed improvements. Refer to the Block Structured Models section in Chapter 9, Analyzing Models and Solutions, for more information a Java Native Interface LINDO API includes Java Native Interface (JND support for Windows, Solaris, and linux platforms. This new feature allows users to call LiNdO API from Java applications, such as applets running from a browser 口 MATLAB Interface: The Matlab interfacc allow using LINDO API functions from within MATLAB. USing MATLABs modeling and programming environment, you can build and solve linear, nonlinear, quadratic, and integer models and create custom algorithms based upon LINDO APl,s routines and solvers 口 NET Interface: LINDO API includes C# and vB. net interfaces that allow it to be used from within. Net's distributed computing environment(including Windows Forms, ADO. NET, and ASP. NET) The interfaces are in the form of classes that allow managed net code to interact with unmanaged LINDO API code via the"System. Runtime Interop Services"namespace PREFACEⅸ 口 Ox Interface This interface provides users of the Ox statistical package, the ability to call LINDO API functions the same way they call native Ox functions. This offers greater flexibility in developing higher-level Ox routines that can set up and solve different kinds of large-scale optimization problems, testing new algorithmic ideas or expressing new solution techniques 日 Platforn With this new release, existing support for solaris, Windows 32-bit for Intel, and Linux 32-bit for Intel, has been extended to: a)Windows 64-bit for Itanium 2, b)Linux 64-bit for Itanium 2, c)Windows 64-bit for AMD/EM64T and d) Linux 64-bit for AMD/EM64T LINDO Systems, Inc 1415N. Dayton Chicago. Illinois (312)9889421 info(lindo. com hlip://www.lindo.com March 2006 【实例截图】
【核心代码】
标签:
小贴士
感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。
- 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
- 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
- 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
- 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
关于好例子网
本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明
网友评论
我要评论