IBM IBM ILOG CPLEX Optimization Studio OPL Language Reference Manual Version 12 Release 7 Copyright notice Describes general use restrictions and trademarks related to this document and the software described in this document. © Copyright IBM Corp. 1987, 2017 US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. Trademarks IBM, the IBM logo, and ibm.com are trademarks or registered trademarks of International Business Machines Corp., registered in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or other companies. A current list of IBM trademarks is available on the Web at "Copyright and trademark information" at www.ibm.com/legal/copytrade.shtml. Adobe, the Adobe logo, PostScript, and the PostScript logo are either registered trademarks or trademarks of Adobe Systems Incorporated in the United States, and/or other countries. Linux is a registered trademark of Linus Torvalds in the United States, other countries, or both. UNIX is a registered trademark of The Open Group in the United States and other countries. Microsoft, Windows, Windows NT, and the Windows logo are trademarks of Microsoft Corporation in the United States, other countries, or both. Java and all Java-based trademarks and logos are trademarks or registered trademarks of Oracle and/or its affiliates. Other company, product, or service names may be trademarks or service marks of others. © Copyright IBM Corporation 1987, 2017. US Government Users Restricted Rights – Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. Contents Figures ............... v Limitations on constraints ........ 59 Formal parameters ............ 59 Tables ............... vii Basic formal parameters ......... 59 Tuples of parameters .......... 61 Filtering in tuples of parameters ...... 62 Language Reference Manual ..... ix Scheduling .............. 63 Introduction ............. 63 Chapter 1. Why an Optimization Piecewise linear and stepwise functions .... 64 Programming Language? ....... 1 Interval variables ........... 66 Unary constraints on interval variables .... 69 Chapter 2. OPL, the modeling language 3 Precedence constraints between interval variables 70 Constraints on groups of interval variables ... 70 Building a model ............. 3 A logical constraint between interval variables: Data types ............... 4 presenceOf ............. 71 Basic data types ............ 4 Expressions on interval variables ...... 72 Data structures ............ 7 Sequencing of interval variables ...... 73 Data sources .............. 15 Cumulative functions .......... 77 Data initialization ........... 15 State functions ............ 81 Spreadsheet Input/Output ........ 24 Notation .............. 84 Data consistency............ 27 Preprocessing of data .......... 30 Pitfall of lazy initialization of data ...... 31 Chapter 3. IBM ILOG Script for OPL .. 87 Decision types ............. 32 Language structure ............ 87 Decision variables ........... 32 Syntax ............... 87 Expressions of decision variables ...... 34 Expressions in IBM ILOG Script ...... 88 Dynamic collection of elements into arrays ... 34 Statements.............. 94 Expressions .............. 36 Built-in values and functions ........ 99 Usage of expressions .......... 36 Numbers .............. 99 Data and decision variable identifiers..... 36 IBM ILOG Script strings......... 106 Integer and float expressions ....... 37 IBM ILOG Script Booleans ........ 113 Aggregate operators .......... 38 IBM ILOG Script arrays ......... 115 Piecewise-linear functions ........ 39 Objects .............. 120 Discontinuous piecewise-linear functions ... 40 Dates ............... 122 Set expressions ............ 43 The null value ............ 126 Boolean expressions .......... 45 The undefined value .......... 126 Constraints .............. 46 IBM ILOG Script functions ........ 127 Introduction ............. 46 Miscellaneous functions ......... 128 Using constraints ........... 46 Constraint labels............ 48 Index ............... 131 Types of constraints .......... 53 © Copyright IBM Corp. 1987, 2017 iii iv OPL Language Reference Manual Figures 1. A Piecewise-linear function. ....... 39 3. Discontinuous costs .......... 43 2. The discontinuous piecewise-linear function 4. Labeled assert............ 51 sign() .............. 41 © Copyright IBM Corp. 1987, 2017 v vi OPL Language Reference Manual Tables 1. Escape sequences inside literal strings .... 5 23. Escape sequences in strings ....... 106 2. Operations allowed on sets ....... 12 24. Examples of string literals using escape 3. Initializing sets in the model file ..... 22 sequences ............. 107 4. A discontinuous cost function ...... 42 25. String property ........... 108 5. Functions over sets ......... 44 26. String methods ........... 108 6. Reference syntax of script variables .... 89 27. String functions ........... 110 7. Property access syntax ......... 90 28. String operators ........... 112 8. Assignment operator syntax ....... 90 29. Boolean method........... 114 9. Syntactic shorthand .......... 91 30. Logical operators .......... 114 10. Function call syntax.......... 91 31. Array constructor .......... 116 11. Special keyword syntax ........ 92 32. Array properties .......... 117 12. Special operator syntax ........ 92 33. Array methods ........... 118 13. Other operator syntax ......... 94 34. Object constructor .......... 121 14. Conditional statement syntax ...... 95 35. User-defined constructors ....... 121 15. Loop syntax ............ 95 36. Built-in method ........... 121 16. Declaration syntax for script variables.... 97 37. Date constructor .......... 122 17. Function definition syntax ....... 98 38. Date methods ........... 124 18. Default value syntax ......... 99 39. Date functions ........... 125 19. Number method .......... 102 40. Methods of null........... 126 20. Numeric functions .......... 102 41. Methods of undefined ........ 127 21. Numeric constants .......... 103 42. Function methods .......... 127 22. Numeric operators .......... 104 43. Miscellaneous functions ........ 128 © Copyright IBM Corp. 1987, 2017 vii viii OPL Language Reference Manual Language Reference Manual This manual provides reference information about IBM® ILOG® Optimization Programming Language (OPL), the modeling language used in CPLEX® Studio. For details of prerequisites, naming conventions, and other general information, see How to use the documentation in the Starting Kit. © Copyright IBM Corp. 1987, 2017 ix x OPL Language Reference Manual Chapter 1. Why an Optimization Programming Language? OPL is a modeling language for combinatorial optimization that aims at simplifying the solving of optimization problems. Linear programming, integer programming, and combinatorial optimization problems arise in a variety of application areas, which include planning, scheduling, sequencing, resource allocation, design, and configuration. In this context, OPL is a modeling language for combinatorial optimization that aims at simplifying the solving of these optimization problems. As such, it provides support in the form of computer equivalents for modeling linear, quadratic, and integer programs, and provides access to state-of-the-art algorithms for linear programming, mathematical integer programming, and quadratic programming. Within the IBM ILOG OPL product, OPL as a modeling language has been redesigned to better accommodate IBM ILOG Script, its associated script language. © Copyright IBM Corp. 1987, 2017 1 2 OPL Language Reference Manual Chapter 2. OPL, the modeling language Presents the modeling language of IBM ILOG OPL, namely: the overall structure of OPL models; the basic modeling concepts; how data can be initialized internally as it is declared or externally in a .dat file; how to connect to, read from, and write to databases and spreadsheets; expressions and relations; constraints; and formal parameters. Building a model Describes the primary elements of the OPL language and how they are used to build an optimization model. The basic building blocks of OPL are integers, floating-point numbers, identifiers, strings, and the keywords of the language. Identifiers in OPL start with a letter or the underscore character ( _ ) and can contain only letters, digits, and the underscore character. Note that letters in OPL are case-sensitive. Integers are sequences of digits, possibly prefixed by a minus sign. Floats can be described in decimal notation (3.4 or -2.5) or in scientific notation (3.5e-3 or -3.4e10). The OPL reserved words are listed in OPL keywords. Comments in OPL are written in between /* and */ as in: /* This is a multiline comment */ The characters // also start a comment that terminates at the end of the line on which they occur as in: dvar int cost in 0..maxCost; // decision variable An OPL model consists of: v a sequence of declarations v optional preprocessing instructions v the model/problem definition v optional postprocessing instructions v optional flow control (main block) Details about these elements are given in the chapters that follow. A simple model (volsay.mod) A typical model is shown here. dvar float+ Gas; dvar float+ Chloride; maximize 40 * Gas + 50 * Chloride; subject to { ctMaxTotal: Gas + Chloride <= 50; © Copyright IBM Corp. 1987, 2017 3 ctMaxTotal2: 3 * Gas + 4 * Chloride <= 180; ctMaxChloride: Chloride <= 40; } In this example, there is only the declarative initial part and the model definition. There
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages146 Page
-
File Size-