5 INTEGER LINEAR PROGRAMMING (ILP) E. Amaldi Fondamenti di R.O. Politecnico di Milano 1
General Integer Linear Program: (ILP) min c T x Ax b x 0 integer Assumption: A, b integer The integrality condition is non linear: sin (π x j ) = 0 j If x j {0, 1} j, binary LP If not all variables x j are integer, mixed ILP E. Amaldi Fondamenti di R.O. Politecnico di Milano 2
Example: max z = 21x 1 + 11x 2 7x 1 + 4x 2 13 x 1, x 2 0 integer 3 x 2 optimal LP solution with z LP = 35.75 optimal ILP solution with z ILP = 33 Deleting integrality constraints LP with optimal value z LP 2 1 7x 1 + 4x 2 =13 1 Region of the feasible solutions ILP = lattice (finite or infinite points) 2 3 x 1 E. Amaldi Fondamenti di R.O. Politecnico di Milano 3
Def.: Given z ILP max c T x (ILP) Ax b x 0 intero X ILP The problem (LP) z LP max c T x Ax b x 0 X LP X ILP is the linear (continuous) relaxation. Property: For each ILP with max we have z ILP z LP, i.e., z LP is an upper bound on the optimal value of ILP. NB: If ILP with min, then z ILP z LP E. Amaldi Fondamenti di R.O. Politecnico di Milano 4
Idea: relax the integrality constraints of ILP and round up/down the optimal solution of the linear relaxation LP. If an optimal solution of LP is integer then it is also an optimal solution of ILP. Often the rounded solutions are: - infeasible for ILP - useless (very different from the optimal solution of the ILP) E. Amaldi Fondamenti di R.O. Politecnico di Milano 5
- infeasible rounded solutions c LP optimum infeasible! ILP optimum - useless rounded solutions When the variables take small values at optimality (a few units) e.g. binary assignment variables (job to machine) or activation variables (plants) E. Amaldi Fondamenti di R.O. Politecnico di Milano 6
- Usefull rounded solutions When the variables take large values at optimality e.g. number of pieces to produce NB: it also depends on the unit costs (coefficients of the objective functions) E. Amaldi Fondamenti di R.O. Politecnico di Milano 7
Knapsack problem n objects j = 1,, n p j v j b profit (value) of object j volume (weight) of object j knapsack capacity Select a subset of objects so as to maximize the total profit while respecting the knapsack capacity. Variables: x j = 1 j-th object is selected 0 otherwise E. Amaldi Fondamenti di R.O. Politecnico di Milano 8
n max j= 1 n j=1 p j x j v j x j b x j {0,1} j Wide range of direct or indirect applications: - loading (containers, vehicles, CDs, ) - investements (p j = expected return, v j = amount to invest, b = available capital) - as a subproblem E. Amaldi Fondamenti di R.O. Politecnico di Milano 9
Assignment problem m machines i = 1,, m n jobs j = 1,, n c ij cost of assigning job j to machine i Assumption: n > m Determine an assignment of the jobs to the machines so as to minimize the total cost while assigning at least one job per machine and making sure at. E. Amaldi Fondamenti di R.O. Politecnico di Milano 10
Variables: x ij = 1 job j is executed on machine i 0 otherwise m n min i=1 j=1 c ij x ij m i=1 x ij 1 j = 1,, n each job is executed on at most one machine n x ij 1 i = 1,, m j=1 x ij {0,1} i, j at least one job per machine E. Amaldi Fondamenti di R.O. Politecnico di Milano 11
Transportation problem (single product) m production plants i = 1,, m n clients j = 1,, n c ij p i d j q ij transportation cost of 1 unit of product from plant i to client j production capacity of plant i demand client j maximum amount to be transported from i to j Determine a transportation plan that minimizes total costs while satisfying plant capacities and client demands. E. Amaldi Fondamenti di R.O. Politecnico di Milano 12
min m n j=1 i=1 n j=1 m Assumption: c ij x ij x ij p i x ij d j m i=1 i = 1,, m j = 1,, n n p i j=1 Variables: x ij = amount transported from plant i to client j plant capacity client demand i=1 0 x ij q ij i, j integer transportation capacity d j E. Amaldi Fondamenti di R.O. Politecnico di Milano 13
Property of transportation and assignment problems: Optimal solution of the linear relaxation optimal solution of ILP! Property: If right hand side constants are integer, all basic feasible solutions (vertices) of the linear relaxation are integer. In transportation problem, special (mn+n+m) (mn) integer matrix A of the constraints: a ij {-1, 0, 1} with exactly three nonzero coefficients per column. Right hand side vector b has all integer components E. Amaldi Fondamenti di R.O. Politecnico di Milano 14
Optimal solution of linear relaxation: x * = B 1b 0 B 1 = 1 det B ( ) α... α 11 m1......... α α 1, m... mm T where α ij = (-1) i+j det(m ij ) with M ij sub-matrix obtained from B by deleting row i and column j B integer α ij integer If det(b) = ±1 B -1 integer x * integer In fact A is totally unimodular, that is det(q) = {-1,0,1} square sub-matrix of A E. Amaldi Fondamenti di R.O. Politecnico di Milano 15
Scheduling problem m machines k = 1,, m n jobs j = 1,, n For each job j, deadline d j p jk = processing time of job j on machine k (may be = 0) Assumption: each job must be processed once on each machine, following the order of the machine indices 1, 2,, m Determine an optimal sequence in which to process the jobs so as to minimize the completion time (makespan) while satisfying the deadlines. E. Amaldi Fondamenti di R.O. Politecnico di Milano 16
Variables: t jk = time at which the proceesing of job j starts on machine k t = upper bound on the completion time of all jobs y ijk = 1 if job i preceeds job j on machine k 0 otherwise and we set M n j=1 d j E. Amaldi Fondamenti di R.O. Politecnico di Milano 17
min t t jm + p jm t j t is upper bound on completion timeof all jobs t jm + p jm d j j respect deadlines t ik + p ik t jk + M (1-y ijk ) i,j,k i < j (*) t jk + p jk t ik + M y ijk i,j,k i < j (**) t jk + p jk t j,k+1 j,k = 1,, m-1 job processed in the given order t 0, t jk 0 j,k y ijk {0,1} i,j,k mixed ILP E. Amaldi Fondamenti di R.O. Politecnico di Milano 18
(*) and (**) make sure that 2 jobs are not simultaneously processed on the same machine (*) active when y ijk = 1 (i preceeds j on machine k) and ensures that i is completed before j starts (on k) (**) active when y ijk = 0 (j preceeds i on machine k) and ensures that j is completed before i starts (on k) The formulation can be easily extended to the case where each job j must be processed on the m machines (or on a subset of them) according to a different order. E. Amaldi Fondamenti di R.O. Politecnico di Milano 19
Most ILP problems are NP-hard efficient algorithms to solve them The existence of a polynomial algorithm would imply that P = NP! Type of methods extremely unlikely implicit enumeration cutting planes heuristic algorithms ( greedy, local serach, ) approximate solutions exact methods (global optimum) E. Amaldi Fondamenti di R.O. Politecnico di Milano 20
Implicit enumeration methods explore all feasible solutions explicitly or implicitly. Branch and Bound method Dynamic programming (see optimal paths in acyclic graphs) E. Amaldi Fondamenti di R.O. Politecnico di Milano 21