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.

The data shows that the team includes three people whose first name is David, two peoplewhose first name is Greg, and one person whose first name is Kevin.As a consequence, the statementsorted {personKeys} sortedDevTeam = { | in devTeam};lists the David sets before the Greg sets, which itself appear before the Kevin set. Withinthe David set, "David" "Doe" "Skinner" comes before "David" "Smith""Lewis" because a second sorting also takes place on the second field with a key lastname.In contrast, the last field nickname is not taken into account.Sorted sets in piecewise linear functionsIn piecewise linear functions, breakpoints must be strictly increasing. However, in most cases,the data supplied by a database or a .dat file is not sorted in an increasing numeric orlexicographic order. As a consequence, you have to add complex and verbose scriptingstatements to sort the data.To avoid these extra code lines, the sorted property of sets enables you to sort data byspecifying a single keyword, as shown in Piecewise linear function with sorted sets. Writingpiecewise linear functions becomes easier. One code line is sufficient instead of several dozens.Piecewise linear function with sorted setstuple Cost{key int BreakPoint;float Slope;}sorted {Cost} sS = { , , , };float lastSlope = 3.5;dvar float+ x;minimize piecewise(t in sS){t.Slope -> t.BreakPoint; lastSlope} x;See also Piecewise-linear functions.For more informationSee Data sources to learn about data initialization.See Introduction to scripting of the <strong>Language</strong> User’s <strong>Manual</strong> on how to set declarations.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 L35

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

Saved successfully!

Ooh no, something went wrong!