The AIMMS Language Reference
Total Page:16
File Type:pdf, Size:1020Kb
AIMMS The Language Reference AIMMS 3.1 May 31, 2000 AIMMS The Language Reference Paragon Decision Technology Johannes Bisschop Marcel Roelofs Copyright c 1999 by Paragon Decision Technology B.V. All rights reserved. Paragon Decision Technology B.V. P.O. Box 3277 2001 DG Haarlem The Netherlands Tel.: +31(0)23-5511512 Fax: +31(0)23-5511517 Email: [email protected] WWW: http://www.aimms.com ISBN 90–801516–3–7 Aimms is a trademark of Paragon Decision Technology B.V. Other brands and their products are trademarks of their respective holders. Windows and MS-dos are registered trademarks of Microsoft Corporation. TEX, LATEX, and AMS-LATEXare trademarks of the American Mathematical Society. Lucida is a registered trademark of Bigelow & Holmes Inc. Acrobat is a registered trademark of Adobe Systems Inc. Information in this document is subject to change without notice and does not represent a commitment on the part of Paragon Decision Technology B.V. The software described in this document is furnished under a license agreement and may only be used and copied in accordance with the terms of the agreement. The documentation may not, in whole or in part, be copied, photocopied, reproduced, translated, or reduced to any electronic medium or machine-readable form without prior consent, in writing, from Paragon Decision Technology B.V. Paragon Decision Technology B.V. makes no representation or warranty with respect to the adequacy of this documentation or the programs which it describes for any particular purpose or with respect to the adequacy to produce any particular result. In no event shall Paragon Decision Technology B.V., its employees, its contractors or the authors of this documentation be liable for special, direct, indirect or consequential damages, losses, costs, charges, claims, demands, or claims for lost profits, fees or expenses of any nature or kind. In addition to the foregoing, users should recognize that all complex software systems and their doc- umentation contain errors and omissions. The authors, Paragon Decision Technology B.V. and its em- ployees, and its contractors shall not be responsible under any circumstances for providing information or corrections to errors and omissions discovered at any time in this book or the software it describes, whether or not they are aware of the errors or omissions. The authors, Paragon Decision Technology B.V. and its employees, and its contractors do not recommend the use of the software described in this book for applications in which errors or omissions could threaten life, injury or significant loss. This documentation was typeset by Paragon Decision Technology B.V. using LATEXandtheLucida font family. About Paragon During the eighties it became apparent that the available algebraic modeling systems did not meet modern standards for openness and ease-of-use as re- quired by industry and government. There was a clear need for new advanced facilities to generate model-based decision support systems. Against this back- ground, Paragon Decision Technology B.V. was formed. Its goal is to produce general purpose and powerful tools for modelers and decision makers. The founder, Johannes J. Bisschop, was at this time a research mathematician at Shell Research in Amsterdam, and a professor of computational optimiza- tion and modeling at the University of Twente, The Netherlands. Today he combines his part-time position at the University of Twente with managing Paragon Decision Technology B.V. and the continuing development of Aimms. The first commercial Aimms system was introduced onto the market at the end of 1993, since which time Aimms has established itself as a solid professional tool for model-based decision support systems. Several major customers with international reputations have contracted Paragon Decision Technology B.V. to implement important additions to the functionality of Aimms which they felt were important to their particular project requirements. This has resulted in generic improvements adding to the maturity of Aimms as it stands today. As well as customizing Aimms Paragon Decision Technology B.V. also executes projects centered around model building and end-user GUI design. Today, Aimms is used on nearly every continent by companies, government agencies and universities. It is mostly used for scheduling and planning ap- plications in such areas as production, distribution, finance, forestry, and en- ergy. Amongst Aimms users are to be found such household names as Amoco, Heineken and Shell. Contents Preface xii What is in the Aimms documentation ............... xii What is in the Language Reference ................. xiv Acknowledgements .......................... xvii The authors ............................... xvii Contributors to Aimms ........................ xviii List of Modifications xx Part I Preliminaries 1 1 Introduction to the Aimms language 2 1.1 The depot location problem ..................... 2 1.2 Formulation of the mathematical program ............ 5 1.3 Data initialization ........................... 8 1.4 An advanced model extension ................... 10 1.5 General modeling tips ........................ 13 2 Language Preliminaries 16 2.1 Managing your model ......................... 16 2.2 Identifier declarations ........................ 18 2.3 Lexical conventions .......................... 20 2.4 Expressions and statements ..................... 24 2.5 Data initialization ........................... 25 Part II Non-Procedural Language Components 27 3 Set Declaration 28 3.1 Sets and indices ............................ 28 3.2 SET declaration and attributes .................... 30 3.2.1 Simple sets .......................... 30 Contents vii 3.2.2 Integer sets .......................... 34 3.2.3 Compound sets ........................ 35 3.2.4 Indexed sets .......................... 37 3.3 INDEX declaration and attributes .................. 38 4 Parameter Declaration 39 4.1 PARAMETER declaration and attributes ................ 40 5 Set, Set Element and String Expressions 45 5.1 Set expressions ............................. 45 5.1.1 Enumerated sets ....................... 46 5.1.2 Constructed sets ....................... 50 5.1.3 Set operators ......................... 51 5.1.4 Set functions ......................... 52 5.1.5 Iterative set operators ................... 53 5.1.6 Set element expressions as singleton sets ....... 55 5.2 Set element expressions ....................... 56 5.2.1 Element references ..................... 57 5.2.2 Intrinsic functions for sets and set elements ..... 57 5.2.3 Element-valued iterative expressions .......... 59 5.2.4 Lag and lead operators ................... 60 5.3 String expressions ........................... 61 5.3.1 String concatenation, subtraction and repetition ... 62 5.3.2 Formatting strings ...................... 63 5.3.3 String manipulation ..................... 65 5.3.4 Converting strings to set elements ............ 66 6 Numerical and Logical Expressions 69 6.1 Numerical expressions ........................ 69 6.1.1 Real values and arithmetic extensions ......... 70 6.1.2 List expressions ....................... 71 6.1.3 References ........................... 72 6.1.4 Arithmetic functions .................... 74 6.1.5 Numerical operators .................... 74 6.1.6 Numerical iterative operators ............... 76 6.1.7 Statistical functions and operators ............ 77 6.1.8 Financial functions ..................... 80 6.1.9 Conditional expressions .................. 80 6.2 Logical expressions .......................... 82 6.2.1 Logical operator expressions ............... 83 6.2.2 Numerical comparison ................... 84 6.2.3 Set and element comparison ............... 85 6.2.4 String comparison ...................... 87 6.2.5 Logical iterative expressions ................ 87 6.3 Operator precedence ......................... 88 6.4 MACRO declaration and attributes .................. 88 Contents viii 7 Execution of Nonprocedural Components 91 7.1 Dependency structure of definitions ............... 91 7.2 Expressions and statements allowed in definitions ....... 93 7.3 Nonprocedural execution ...................... 96 Part III Procedural Language Components 98 8 Execution Statements 99 8.1 Procedural and nonprocedural execution ............. 99 8.2 Assignment statements ....................... 100 8.3 Flow control statements ....................... 104 8.3.1 The IF-THEN-ELSE statement ................ 105 8.3.2 The WHILE and REPEAT statements ............. 106 8.3.3 Advanced use of WHILE and REPEAT ............ 108 8.3.4 The FOR statement ...................... 109 8.3.5 The SWITCH statement .................... 111 8.3.6 The HALT statement ..................... 113 8.4 The OPTION and PROPERTY statements ................ 114 9 Index Binding 116 9.1 Binding rules .............................. 116 10 Procedures and Functions 120 10.1 Internal procedures .......................... 120 10.2 Internal functions ........................... 125 10.2.1 Derivative computation ................... 127 10.3 Calls to procedures and functions ................. 130 10.3.1 The APPLY operator ..................... 135 11 External Procedures and Functions 138 11.1 Introduction .............................. 138 11.2 Declaration of external procedures and functions ....... 140 11.3 Win32 calling conventions ...................... 148 11.4 External functions in constraints .................. 150 11.5 C versus Fortran conventions ................... 151 Part IV Sparse Execution 154 12 Semantics of Sparse Execution 155