Professional Documents
Culture Documents
b1 b2
am1 x1 +am2 x2 . . .
Integer (Linear) Programming (IP) The Neos server for Optimization Examples
+amn xn bm xi Z i J {1, 2 . . . , n}
A much more powerful modeling tool than LP: yes/no decisions (xi {0, 1}) integer quantities piece-wise linear functions nonconvexities discontinuities economies of scale
Reading: Hillier & Lieberman, Chapter 13, 13.1 to 13.3 Winston & Venkataramanan, Chapter 9 Winston, Chapter 9
LP and IP
IP is a bit younger than LP, but is the subject of extensive research and can model countless problems in Industry:
Airline crew scheduling Vehicle Routing Financial applications1 Design of Telecommunications networks
max x1
x1 +1.01x2 x1 x2 3.7 + 3 1 x1 , x2 Z+
Require very specialized techniques (some use LP relaxations to nd lower bounds) A good model makes a problem easier (but not easy)
Optimal solution of the LP relaxation: (3.7, 0), obj. f.: 3.7 Optimal solution of the original problem: (0, 3), obj. f.: 3.03
i.e. unlike LP, the way we model an Optimization problem affects the chances to solve it
1 See for example G. Cornu jols, R. Tutuncu, Optimization methods in e nance, Blackwell Publishers
model yes/no decisions: xi {0, 1} xi = 0 if the decision is no, xi = 1 if it is yes can use logical operators: implications, disjunctions, etc.:
Choose a subset S of a set A of elements such that S has certain properties (e.g. not more than K elements, etc.) Each element i A has a cost ca
iS ci
Mario or Luigi will have ice cream, but not both: xMario + xLuigi 1 At least one among Mario and Luigi will have ice cream: xMario + xLuigi 1 If Mario has ice cream, then Giovanni will have one too: xMario xGiovanni Luigi gets ice cream if and only if Paolo does not get any: xLuigi = 1 xPaolo
ci xi xi K
iA
each worth a lot of money, ci for all i A they want to share these objects in a balanced manner SL A contains the objects that Ludwig will get, while SJ = A \ SL are the remaining objects xi =
1 if Ludwig gets the i-th object 0 if Johann gets the i-th object
minimize ci
iSL iSJ
iA ci (1
xi )
i A
Neos http://neos.mcs.anl.gov/neos/solvers/
Online optimization server use state-of-art solvers free Upload the AMPL model/data les and click Solve You will get a job name and a password Get results by email or directly on the browser (if fast)
Linear Programming Integer Linear Programming (Cbc, Scip, Minto) Nonlinear Programming machine2 3 4
Specify a time limit (two hours, ten hours, anyway < +) If you no longer care about a particular submission, access it (through jobname and password) and kill it!
Edge covering
In a graph G = (V, E) as in the gure, choose a subset S of edges such that all nodes are covered by at least one edge in S. Minimize the number of edges used 6 2 7
min
+x14 +x14
+x15 +x15
+x24 x24
+x25 +x25
+x26 +x26
+x34
+x36
+x57 1 1 1 1 1 1 1 {0, 1}
x14 x15
+x34 +x34
3 4 1 5
x13 , x14 , x15 , x24 , x25 ,
x26 ,
x34 ,
x36 ,
Edge covering
min
i V {i, j} E
minimize numEdges: sum {(i,j) in E} x [i,j]; covering {i in V}: sum {j in V: (i,j) in E} x[i,j] + sum {j in V: (j,i) in E} x[j,i] >= 1; data; param n := 7; set E := (1,3) (1,4) (1,5) (2,4) (2,5) (2,6) (3,4) (3,6) (5,7);
3 4 1 5
3 4 1 5
Node packing
Node packing
max
x1 x1 x1 x1
+x2
+x3 +x3
+x4 +x4
+x5
+x6
+x7 1 1 1 1 1 1 1 1 1
max
xi xi + xj 1 xi {0, 1}
iV
{i, j} E i V
xed transaction costs in nancial optimization xed costs for using a facility/plant/service
Example: Every truck in the eet costs $25,000/year for maintenance plus $1.26 per mile. Determine the trucks to be used and the distance they will travel. 1 if truck i is used 0 otherwise . . . and a continuous variable yi = miles traveled by truck i Use a binary variable xi = The objective function will look like $25, 000xi + $1.26yi . (Implicit) constraint: if truck i travels half a mile, it has to be bought: yi > 0 xi = 1, or yi Mxi where M is an adequate constant.
At the beginning of the year, it knows exactly the demand di of plastic for every month i. It also has a maximum production capacity of P and an inventory capacity of C. The inventory is empty on 01/01 and has to be empty again on 12/31 production has a monthly per-unit cost ci
How much to produce each month i: xi , i = 1, 2 . . . , 12 The inventory level at the end of each month (demand is satised by part of production and part of inventory): yi , i = 0, 1, 2 . . . , 12 Why 0? Because we need to know (actually we need to constrain!) the inventory on 01/01 and on 12/31. 1 if machine started in month i 0 otherwise
+ a monthly xed cost fi if the machinery for producing plastic is started in month i What do we produce at each month to minimize total production cost while satisfying demand?
+ a binary variable zi =
Production capacity constraint: xi P i = 1, 2 . . . , 12 Beginning/end of year: y0 = 0, y12 = 0 What goes in must go out . . .
+ production in month i only occurs3 when the machine is used in i, i.e. xi > 0 zi = 1: xi Pzi xi yi1 i di
3
min
yi
xi + yi1 = di + yi i = 1, 2 . . . , 12
conservation {i in Months}: production [i] + inventory [i-1] = demand [i] + inventory [i]; startMachine {i in Months}: production [i] <= Capacity * use [i]; Jan1Inv: inventory [0] = 0; Dec31Inv: inventory [12] = 0;
var production {Months} >= 0; var inventory {MonthsPlus} >= 0; var use {Months} binary; minimize prodCost: sum {i in Months} (cost [i] * production [i] + fixed_cost [i] * use [i]);
Problem data
param Capacity = 120; param cost := 1 14 2 19 5 10 6 7 9 7 10 10 param demand := 1 110 2 70 5 140 6 90 9 100 10 105 param fixed_cost := 1 435 2 470 5 340 6 290 9 300 10 345
An adequate constant???
3 15 7 4 11 11
4 11 8 5 12 13;
Constraints such as yi Mxi are formally correct, but they are horrible for an MILP solver. The bigger M, the uglier. We still must ensure that yi can take any feasible value. Physical constraint: for a truck traveling at 65mph, 24 hours a day, 365 days, M = 569, 400mi (very ugly) The company only works on weekdays 9am-5pm, drivers have an hour lunch break. Loading and unloading a truck takes 30 minutes
3 85 7 40 11 140
4 90 8 80 12 80;
3 7 11