60 likes | 154 Views
IP modeling techniques III. In this handout, Modeling techniques: Making choices with non-binary variables Piecewise linear functions. Making choices with non-binary variables. Recall the furniture manufacturer problem.
E N D
IP modeling techniques III In this handout, Modeling techniques: Making choices with non-binary variables Piecewise linear functions
Making choices with non-binary variables • Recall the furniture manufacturer problem. • Extra requirement: From the 3 possible products (tables, chairs, desks), at most two should be chosen to be produced. That is, at most two of xt , xc , xdcan be non-zero. • How to achieve this in the model? • Introduce new binary variables. For i=t,c,d, • To enforce the requirement, need the following constraint: yt + yc + yd 2 • Need also to relate xi’s and yi’s. Add constraints: xi Myi for i=t,c,d and large positive M
Piecewise linear functions • So far all our functions were linear. • In many situations, it might not be the case. • Example: Production cost. • c1= $11/unit for first 5 items • c2=$8/unit for next 4 items • c3=$5/unit for next 7 items • c4=$7/unit for next 10 items • The cost of producing x items is an example of so-called piecewise linear function:
Piecewise linear functions • How to include piecewise linear cost functions in an objective function of IP? • Idea: Introduce a new variable for each cost segment. For i=1,2,3,4 yi = number of items produced at cost ci Then the total number of items is x =y1+y2+y3+y4 . We need constraints 0 y1 5, 0 y2 4, 0 y3 7, 0 y4 10 , (*) and the production cost in the objective function is 11y1 + 8y2 + 5y3 + 7y4 • What is the shortcoming of this model?
Piecewise linear functions • We should require that • y2>0 implies that y1=5(1) • y3>0 implies that y2=4(2) • y4>0 implies that y3=7(3) • Introduce new variables to translate these requirements into linear constraints. For i=1,2,3,4, • Proper constraints relating wi and yi will provide that requirements (1)-(3) are satisfied. y2 4w1and 5w1 y1provide (1) y3 7w2 and 4w2 y2provide (2) y4 10w3and 7w3 y3provide (3)
Piecewise linear functions • Summarizing, the bound constraints in (*) should be substituted with 5w1 y1 5, 4w2 y2 4w1 , 7w3 y3 7w2 , 0 y4 10w3 . • Generalizing, suppose we have k segments with lengths L1, L2, …, Lk . Then the necessary constraints: L1w1 y1 L1 , Liwi yi Liwi-1for i = 2, …, k-1 0 yk Lkwk-1