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.

Expressions of decision variablesShows how to declare and use decision variable expressions in the <strong>OPL</strong> language.The keyword dexpr allows you to create reusable decision expressions. Indeed, if anexpression has a particular meaning in terms of the original problem, writing it as a decisionexpression (dexpr) makes the model more readable.For example, the scalableWarehouse.mod example expresses the total fixed costs asa decision expression:dexpr int TotalFixedCost = sum( w in Warehouses ) Fixed * Open[w];dexpr float TotalSupplyCost = sum( w in Warehouses, s in Stores ) SupplyCost[s][w] * Supply[s][w];minimize TotalFixedCost + TotalSupplyCost;This way, the two total cost expressions defined are shown in the Problem Browser alongwith their value.You can also use arrays of decision expressions. For example:dexpr int slack[i in r] = x[i] - y[i];This array is handled efficiently as only the “definition” is kept. Not all expressions for eachvalues of the indexes are created. As a consequence, you cannot change the definition of thedexpr for a particular element of the array.Using decision expressions is particularly useful and recommended if you plan to writeobjectives to be used with <strong>ILOG</strong> ODM. Please refer to the ODM documentation.82I 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!