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.

Functions over setsFunction Descriptioncardcard(S) returns the size of S, that is, the number of items.ordord(S,item) returns the position of item in S. Positions start at 0 and ord(S,item)produces an execution error if item is not in S.Example: ord(S,6) evaluates to 1 and ord(S,9) to 3.The order of items in an explicit set is by order of appearance in the initialization and isimplementation-dependent when the sets are the results of a set operation.firstitemfirst(S) returns the first item in S, 3 in this example.item(S,n) returns the n-th item in set S. Counting starts from 0. This is equivalent tonext(first(S),n)Example: item(S,1) = 6lastnextlast(S) returns the last item in S, 9 in this example.next(S,item) returns the item in S that comes after item and produces an executionerror if item is the last item.Example: next(S,3) = 6next(S,item,n) returns the n-th next item. next(S,item) is equivalent to next(S,item,1).nextcA circular version of next. nextC(S,item) returns the first item in S if item is thelast item.Example: nextc(S,9) = 3nextc(S,item,n) returns the n-th circular next item. nextc(S,item) is equivalentto nextc(S,item,1).prevprev(S,item) returns the item in S that comes before item and produces an executionerror if item is the first item.Example: prev(S,6) = 3prev(S,item,n) returns the n-th previous item. prev(S,item) is equivalent to prev(S,item,1).prevcA circular version of prev. prevc(S,item) returns the last item in S if item is thefirst item.Example: prev(S,3) = 9prevc(S,item,n) returns the n-th circular previous item. prevc(S,item) is equivalentto prevc(S,item,1).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 L103

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

Saved successfully!

Ooh no, something went wrong!