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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

SetsDefinitionSets are non-indexed collections of elements without duplicates.<strong>OPL</strong> supports sets of arbitrary types to model data in applications. If T is a type, then {T},or alternatively setof(T), denotes the type “set of T”. For example, the declaration:{int} setInt = ...;setof(Precedence) precedences = ...;declares a set of integers and a set of precedences.Sets may be ordered, sorted, or reversed. By default, sets are ordered, which means that:♦Their elements are considered in the order in which they have been created.♦Functions and operations applied to ordered sets preserve the order.See Sorted and ordered sets for details.Operations on setsThe following operations are allowed on sets. See <strong>OPL</strong> functions in <strong>Language</strong> Quick <strong>Reference</strong>for more information about functions. For the functions on sets, the index starts at 0.Operations allowed on setsOperationsunion, intersection, diff, symdiffsubset, intersection, equalityelement of, not element ofaddition, subtractionfirst, lastnext, prevnextc, prevcitemordSyntaxset = function(set1,set2)boolean = function(set1,set2)boolean = function(set,elt)function(set,elt)elt = function(set)elt = function(set,elt)elt = function(set,elt,int)elt = function(set,int)int = function(set,elt)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 L31

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

Saved successfully!

Ooh no, something went wrong!