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.

(condition)?thenExpr : elseExprwhere condition is a ground condition with no decision variable. If condition is true,the condition evaluates to thenExpr ; otherwise, it evaluates to elseExpr.Examplesint value = ...;int signValue = ( value>0 ) ? 1 : ( value=0 ) ? value : -value;See the numeric functions in <strong>OPL</strong> functions in the <strong>Language</strong> Quick <strong>Reference</strong>.Counting expressionsAmong integer expressions, there are also some combinatorial expressions. For example, youcan use the count function to count the number of times a particular value appears in anarray of decision variables. You can use such an expression in modeling constraints only ifthe modeling constraints are part of a model that is solved by the CP Optimizer engine (thatis, starting with the using CP; statement).The constraintcount(x, 2) == 3;states that in the array of variables x, exactly three variables take the value 2.For more information, see count in the <strong>Language</strong> Quick <strong>Reference</strong>.I 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 L93

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

Saved successfully!

Ooh no, something went wrong!