AIMMS Modeling Guide - Integer Programming Tricks
This file contains only one chapter of the book. For a free download of the complete book in pdf format, please visit www.aimms.com or order your hard- copy at www.lulu.com/aimms.
Aimms 3.12 Copyright c 1993–2011 by Paragon Decision Technology B.V. All rights reserved.
Paragon Decision Technology B.V. Paragon Decision Technology Inc. Paragon Decision Technology Pte. Schipholweg 1 500 108th Avenue NE Ltd. 2034 LS Haarlem Ste. # 1085 80 Raffles Place The Netherlands Bellevue, WA 98004 UOB Plaza 1, Level 36-01 Tel.: +31 23 5511512 USA Singapore 048624 Fax: +31 23 5511517 Tel.: +1 425 458 4024 Tel.: +65 9640 4182 Fax: +1 425 458 4025
Email: [email protected] WWW: www.aimms.com
Aimms is a registered trademark of Paragon Decision Technology B.V. IBM ILOG CPLEX and sc CPLEX is a registered trademark of IBM Corporation. GUROBI is a registered trademark of Gurobi Optimization, Inc. KNITRO is a registered trademark of Ziena Optimization, Inc. XPRESS-MP is a registered trademark of FICO Fair Isaac Corporation. Mosek is a registered trademark of Mosek ApS. Windows and Excel are registered trademarks of Microsoft Corporation. TEX, LATEX, and AMS-LATEX are trademarks of the American Mathematical Society. Lucida is a registered trademark of Bigelow & Holmes Inc. Acrobat is a registered trademark of Adobe Systems Inc. Other brands and their products are trademarks of their respective holders.
Information in this document is subject to change without notice and does not represent a commitment on the part of Paragon Decision Technology B.V. The software described in this document is furnished under a license agreement and may only be used and copied in accordance with the terms of the agreement. The documentation may not, in whole or in part, be copied, photocopied, reproduced, translated, or reduced to any electronic medium or machine-readable form without prior consent, in writing, from Paragon Decision Technology B.V.
Paragon Decision Technology B.V. makes no representation or warranty with respect to the adequacy of this documentation or the programs which it describes for any particular purpose or with respect to its adequacy to produce any particular result. In no event shall Paragon Decision Technology B.V., its employees, its contractors or the authors of this documentation be liable for special, direct, indirect or consequential damages, losses, costs, charges, claims, demands, or claims for lost profits, fees or expenses of any nature or kind.
In addition to the foregoing, users should recognize that all complex software systems and their doc- umentation contain errors and omissions. The authors, Paragon Decision Technology B.V. and its em- ployees, and its contractors shall not be responsible under any circumstances for providing information or corrections to errors and omissions discovered at any time in this book or the software it describes, whether or not they are aware of the errors or omissions. The authors, Paragon Decision Technology B.V. and its employees, and its contractors do not recommend the use of the software described in this book for applications in which errors or omissions could threaten life, injury or significant loss.
This documentation was typeset by Paragon Decision Technology B.V. using LATEXandtheLucida font family. Chapter 7
Integer Linear Programming Tricks
As in the previous chapter “Linear Programming Tricks”, the emphasis is on This chapter abstract mathematical modeling techniques but this time the focus is on inte- ger programming tricks. These are not discussed in any particular reference, but are scattered throughout the literature. Several tricks can be found in [Wi90]. Other tricks are referenced directly.
Only linear integer programming models are considered because of the avail- Limitation to ability of computer codes for this class of problems. It is interesting to note linear integer that several practical problems can be transformed into linear integer pro- programs grams. For example, integer variables can be introduced so that a nonlinear function can be approximated by a “piecewise linear” function. This and other examples are explained in this chapter.
7.1 A variable taking discontinuous values
This section considers an example of a simple situation that cannot be formu- Ajumpinthe lated as a linear programming model. The value of a variable must be either bound zero or between particular positive bounds (see Figure 7.1). In algebraic nota- tion: x = 0orl ≤ x ≤ u This can be interpreted as two constraints that cannot both hold simultane- ously. In linear programming only simultaneous constraints can be modeled.
x 0 l u
Figure 7.1: A discontinuous variable
This situation occurs when a supplier of some item requires that if an item Applications is ordered, then its batch size must be between a particular minimum and maximum value. Another possibility is that there is a set-up cost associated with the manufacture of an item. Chapter 7. Integer Linear Programming Tricks 76
To model discontinuous variables, it is helpful to introduce the concept of an Modeling dis- indicator variable. An indicator variable is a binary variable (0 or 1) that indi- continuous cates a certain state in a model. In the above example, the indicator variable y variables is linked to x in the following way: ⎧ ⎨ 0forx = 0 = y ⎩ 1forl ≤ x ≤ u
The following set of constraints is used to create the desired properties:
x ≤ uy x ≥ ly y binary
It is clear that y = 0impliesx = 0, and that y = 1impliesl ≤ x ≤ u.
7.2 Fixed costs
A fixed cost problem is another application where indicator variables are added The model so that two mutually exclusive situations can be modeled. An example is provided using a single-variable. Consider the following linear programming model (the sign “≷” denotes either “≤”, “=”, or “≥”constraints).
Minimize: C(x)
Subject to: aix + aij wj ≷ bi ∀i ∈ I j∈J x ≥ 0
wj ≥ 0 ∀j ∈ J ⎧ ⎨ 0forx = 0 = Where: C(x) ⎩ k + cx for x>0
As soon as x has a positive value, a fixed cost is incurred. This cost function is not linear and is not continuous. There is a jump at x = 0, as illustrated in Figure 7.2.
In the above formulation, the discontinuous function is the objective, but such Application a function might equally well occur in a constraint. An example of such a fixed-cost problem occurs in the manufacturing industry when set-up costs are charged for new machinery. Chapter 7. Integer Linear Programming Tricks 77
C(x)
c
k
0 x
Figure 7.2: Discontinuous cost function
A sufficiently large upper bound, u,mustbespecifiedforx.Anindicator Modeling fixed variable, y, is also introduced in a similar fashion: costs ⎧ ⎨ 0forx = 0 = y ⎩ 1forx>0
Now the cost function can be specified in both x and y:
∗ C (x, y) = ky + cx
The minimum of this function reflects the same cost figures as the original cost function, except for the case when x>0andy = 0. Therefore, one constraint must be added to ensure that x = 0 whenever y = 0:
x ≤ uy
Now the model can be stated as a mixed integer programming model. The The equivalent formulation given earlier in this section can be transformed as follows. mixed integer program Minimize: ky + cx Subject to: aix + aij wj ≷ bi ∀i ∈ I j∈J x ≤ uy x ≥ 0
wj ≥ 0 ∀j ∈ J y binary
7.3 Either-or constraints
Consider the following linear programming model: The model Minimize: cj xj j∈J Chapter 7. Integer Linear Programming Tricks 78
Subject to: a1jxj ≤ b1 (1) j∈J a2jxj ≤ b2 (2) j∈J
xj ≥ 0 ∀j ∈ J
Where: at least one of the conditions (1) or (2) must hold
The condition that at least one of the constraints must hold cannot be for- mulated in a linear programming model, because in a linear program all con- straints must hold. Again, a binary variable can be used to express the prob- lem. An example of such a situation is a manufacturing process, where two modes of operation are possible.
Consider a binary variable y, and sufficiently large upper bounds M1 and M2, Modeling which are upper bounds on the activity of the constraints. The bounds are either-or chosen such that they are as tight as possible, while still guaranteeing that the constraints
left-hand side ofconstrainti is always smaller than bi + Mi. The constraints can be rewritten as follows: (1) a1j xj ≤ b1 + M1y j∈J (2) a2j xj ≤ b2 + M2(1 − y) j∈J
= When y 0, constraint (1) is imposed, and constraint (2) is weakened to ≤ + j∈J a2jxj b2 M2, which will always be non-binding. Constraint (2) may of course still be satisfied. When y = 1, the situation is reversed. So in all cases one of the constraints is imposed, and the other constraint may also hold. The problem then becomes: