12.07.2015 Views

ILOG OPL Development Studio Language Reference Manual

ILOG OPL Development Studio Language Reference Manual

ILOG OPL Development Studio Language Reference Manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Integer and float expressionsInteger expressionsInteger expressions are constructed from integer constants, integer data, integer decisionvariables, and the traditional integer operators such as +, -, *, div, mod (or%). The operatordiv represents the integer division (for example, 8 div 3 == 2) and the operator modor % represents the integer remainder. <strong>OPL</strong> also supports the function abs, which returns theabsolute value of its argument, and the built-in constant maxint, which represents the largestinteger representable in <strong>OPL</strong>. Note that expressions involving large integers may produceoverflow.Example for intNote the result:int a=maxint+2;float b=infinity+2;execute{writeln(a);writeln(b);}gives-2147483647InfinityMost of these expressions (such as % or div) are not available for constraints defined inCPLEX models but are available for CP models. See also Constraints available in constraintprogramming.Float expressionsFloat expressions are constructed from floats, float data and variables, as well as operatorssuch as +, -, /, *. In addition, <strong>OPL</strong> contains a float constant infinity to represent [replacewith sign “infinity”] and a variety of float functions, depicted in <strong>OPL</strong> functions in the <strong>Language</strong>Quick <strong>Reference</strong>.Conditional expressionsConditional expressions are expressed like this:92I L O G O P L D E V E L O P M E N T S T U D I O L A N G U A G ER E F E R E N C E M A N U A L

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!