12.07.2015 Views

ILOG CPLEX 11.0 User's Manual

ILOG CPLEX 11.0 User's Manual

ILOG CPLEX 11.0 User's 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.

functions frequently represent situations where costs vary with respect to quantity or gainsvary over time.Syntax of Piecewise Linear FunctionsTo define a piecewise linear function in Concert Technology, you need these components:◆◆◆the independent variable of the piecewise linear function;the breakpoints of the piecewise linear function;the slope of each segment (that is, the rate of increase or decrease of the functionbetween two breakpoints);◆ the geometric coordinates of at least one point of the function.In other words, for a piecewise linear function of n breakpoints, you need to know n+1slopes.Typically, the breakpoints of a piecewise linear function are specified as an array of numericvalues. For example, the breakpoints of the function f(x) as it appears in Figure 18.1 arespecified in this way, where the first argument, env, specifies the environment, the secondargument specifies the number of breakpoints under consideration, and the remainingarguments specify the x-coordinate of the breakpoints:IloNumArray (env, 3, 4., 5., 7.)The slopes of its segments are indicated as an array of numeric values as well. For example,the slopes of f(x) are specified in this way, where the first argument again specifies theenvironment, the second argument specifies the number of slopes given, and the remainingarguments specify the slope of the segments:IloNumArray (env, 4, -0.5, 1., -1., 2.)The geometric coordinates of at least one point of the function, (x, f(x)) must also bespecified; for example, (4, 2). Then in Concert Technology, those elements are broughttogether in an instance of the class IloPiecewiseLinear in this way:IloPiecewiseLinear(x,IloNumArray(env, 3, 4., 5., 7.),IloNumArray(env, 4, -0.5, 1., -1., 2.),4, 2)Another way to specify a piecewise linear function is to give the slope of the first segment,two arrays for the coordinates of the breakpoints, and the slope of the last segment. In thisapproach, the example f(x) from Figure 18.1 looks like this:IloPiecewiseLinear(x, -0.5, IloNumArray(env, 3, 4., 5., 7.),IloNumArray(env, 3, 2., 3., 1.), 2);<strong>ILOG</strong> <strong>CPLEX</strong> <strong>11.0</strong> — USER’ S MANUAL 339

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

Saved successfully!

Ooh no, something went wrong!