实例介绍
【实例简介】LINGO的API
【实例截图】
【核心代码】
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | Contents Contents................................................................................................................................................ iii Preface ................................................................................................................................................. vii New Features ........................................................................................................................................ xi for LINGO 18.0 ...................................................................................................................................... xi 1 Getting Started with LINGO............................................................................................................ 1 Getting Started on Windows............................................................................................................. 1 Getting Started on a Mac ................................................................................................................. 9 Getting Started on Linux................................................................................................................. 20 Creating and Solving a Model in LINGO ........................................................................................ 32 Examining the Solution Report....................................................................................................... 46 Intro to LINGO’s Modeling Language............................................................................................. 48 Additional Modeling Language Features........................................................................................ 60 Indicating Convexity and Concavity ............................................................................................... 64 Maximum Problem Dimensions...................................................................................................... 65 How to Contact LINDO Systems .................................................................................................... 66 2 Using Sets...................................................................................................................................... 67 Why Use Sets?............................................................................................................................... 67 What Are Sets? .............................................................................................................................. 67 The Sets Section of a Model .......................................................................................................... 68 The DATA Section.......................................................................................................................... 74 Set Looping Functions.................................................................................................................... 75 Set-Based Modeling Examples ...................................................................................................... 82 Summary.......................................................................................................................................101 3 Using Variable Domain Functions ..............................................................................................103 Integer Variables ...........................................................................................................................103 Free Variables...............................................................................................................................124 Bounded Variables ........................................................................................................................129 SOS Variables...............................................................................................................................130 Cardinality .....................................................................................................................................134 Semicontinuous Variables.............................................................................................................134 Positive Semi-Definite Matrices.....................................................................................................136 4 Data, Init and Calc Sections ........................................................................................................141 The DATA Section of a Model.......................................................................................................141 The INIT Section of a Model..........................................................................................................146 The CALC Section of a Model.......................................................................................................147 Summary.......................................................................................................................................153 iv CONTENTS 5 Menu Commands..........................................................................................................................155 Accessing Menu Commands.........................................................................................................155 Menu Commands In Brief..............................................................................................................158 Menu Commands In Depth ...........................................................................................................162 1. File Menu...................................................................................................................................162 2. Edit Menu ..................................................................................................................................180 3. Solver Menu ..............................................................................................................................193 4. Window Menu............................................................................................................................316 5. Help Menu.................................................................................................................................320 6 Command-Line Commands.........................................................................................................326 The Commands In Brief ................................................................................................................326 The Commands In Depth ..............................................................................................................328 7 LINGO’s Operators and Functions..............................................................................................429 Standard Operators.......................................................................................................................429 Mathematical Functions ................................................................................................................433 Financial Functions .......................................................................................................................436 Probability Functions .....................................................................................................................436 Variable Domain Functions ...........................................................................................................439 Set Handling Functions .................................................................................................................440 Set Looping Functions...................................................................................................................445 Interface Functions........................................................................................................................447 Distributions...................................................................................................................................448 Report Functions ...........................................................................................................................454 Date, Time and Calendar Functions..............................................................................................465 Matrix Functions............................................................................................................................469 Miscellaneous Functions ...............................................................................................................483 8 Interfacing with External Files.....................................................................................................487 Cut and Paste Transfers ...............................................................................................................487 Text File Interface Functions .........................................................................................................489 LINGO Command Scripts..............................................................................................................497 Specifying Files in the Command-line ...........................................................................................500 RunLingo.......................................................................................................................................502 Redirecting Input and Output ........................................................................................................505 Managing LINGO Files..................................................................................................................505 9 Interfacing With Spreadsheets....................................................................................................507 Importing Data from Spreadsheets................................................................................................507 Exporting Solutions to Spreadsheets ............................................................................................512 OLE Automation Links from Excel.................................................................................................520 Embedding LINGO Models in Excel..............................................................................................524 Embedding Excel Sheets in LINGO ..............................................................................................530 Summary.......................................................................................................................................534 CONTENTS v 10 Interfacing with Databases ..........................................................................................................535 ODBC Data Sources .....................................................................................................................536 Importing Data from Databases with @ODBC..............................................................................543 Importing Data with ODBC in a PERT Model................................................................................545 Exporting Data with @ODBC ........................................................................................................547 Exporting Data with ODBC in a PERT Model................................................................................550 11 Interfacing with Other Applications............................................................................................555 The LINGO Dynamic Link Library..................................................................................................555 User Defined Functions.................................................................................................................599 12 Developing More Advanced Models ...........................................................................................603 Production Management Models...................................................................................................604 Logistics Models............................................................................................................................620 Financial Models ...........................................................................................................................627 Queuing Models ............................................................................................................................644 Marketing Models ..........................................................................................................................652 13 Programming LINGO....................................................................................................................661 Programming Features..................................................................................................................661 Programming Example: Binary Search .........................................................................................708 Programming Example: Markowitz Efficient Frontier.....................................................................712 Programming Example: Cutting Stock...........................................................................................719 Programming Example: Accessing Excel......................................................................................725 Summary.......................................................................................................................................732 14 Stochastic Programming...........................................................................................................733 Multistage Decision Making Under Uncertainty.............................................................................733 Recourse Models ..........................................................................................................................735 Scenario Tree................................................................................................................................737 Monte Carlo Sampling...................................................................................................................739 Setting up SP Models....................................................................................................................740 Language Features for SP Models................................................................................................741 Declaring Distributions ..................................................................................................................743 Gas Buying Example.....................................................................................................................750 Stock Option Example...................................................................................................................761 Investing Under Uncertainty Example ...........................................................................................770 Chance-Constrained Programs (CCPs) ........................................................................................777 15 On Mathematical Modeling..........................................................................................................791 Solvers Used Internally by LINGO.................................................................................................791 Type of Constraints .......................................................................................................................792 Local Optima vs. Global Optima....................................................................................................794 Smooth vs. Nonsmooth Functions.................................................................................................800 Guidelines for Nonlinear Modeling ................................................................................................801 vi CONTENTS Appendix A: Additional Examples of LINGO Modeling..................................................................803 Appendix B: Error Messages .........................................................................................................893 Appendix C: Bibliography and Suggested Reading.....................................................................949 Acknowledgements............................................................................................................................951 Index....................................................................................................................................................953 |
好例子网口号:伸出你的我的手 — 分享!
小贴士
感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。
- 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
- 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
- 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
- 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
关于好例子网
本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明
网友评论
我要评论