Modeling problems with Integer Linear Programming (ILP) Name: Chuan Huang
Use of ILP Solution to network or graph problems. Traveling salesman problem Shortest path Minimum spanning tree Knapsack
Definition of ILP minimize c T x subject to Ax b Linear programming (LP) : mathematical method for determining a way to achieve the best outcome in a given mathematical model for some list of requirements represented as linear equations. Integer linear programming(ILP) : LP with some or all of the variables are restricted to be integers. Canonical form :
Modeling with ILP Problem description Input Output: Identify the decision variable which is binary; Objective function: Minimize/Maximize a function under the constraints. Constraints: Rules that the feasible solutions will satisfy. Formulation Solution
Solution to ILP Package AMPL: A modeling language for Mathematical programming developed by BELL Laboratories. GNU Linear Programming Kit (GLPK) Cplex: mathematical optimizer Gusek - LP IDE in Windows
Example 1 - Vertex Cover Minimum vertex cover: Find a smallest vertex cover in a given graph. A BCD EF A BCD EF Vertex cover: Is there a vertex cover of size K or less for G(V, E) such that for each edge {u, v} E at least one of u and v belongs to V.
Example 1 - Input and Output (1) Set of vertexes V; (2) Set of edges E; (3) Costs of each vertex, c(i) = 1, where i V; Objective: Input: Minimum costs,. Output:The set of the vertexes; x(i) = 1 if i th vertex belongs to the set; otherwise x(i) = 0; Minimum vertex cover A BCD EF
Example 1 – Input and Output(Cont) var x{i in V}, binary, >=0; /*Decision*/ Output /* Number of blocks */ param m, integer, > 0; /* Set of basic blocks */ set V, default {1..m}; /* Set of edges */ set E, within V cross V; /*Cost of vertex*/ param c{i in V}, default 0; Input Vertex_cover.mod param m:=6; param : V : c := 1 1, 2 1, 3 1, 4 1, 5 1, 6 1; param : E : a := 1 2 1, 1 5 1, 2 3 1, 2 5 1, 3 4 1, 6 3 1, 6 5 1; Vertex_cover.dat
Example 1 – Objective and Constraints minimize obj: sum{i in V} x[i]*c[i]; s.t. phi{(i,j) in E}: x[i]+x[j] >= 1; Solve; Minimize c(v)x v ( Minimize the total cost) x u +x v ≥ 1 for all {u, v} E (Cover every edge of the graph) x v {0, 1} for all v E (Vertex is either in the vertex cover or not) Objective: Constraint: AMPL:Mathematic description: Vertex_cover.mod
Example 2 - Vertex Cover with non-linear Costs A BCD EF Cost of each vertex: Assume input, output and objective are same except Objective : Minimize X 2 ! Not Linear! Decided by output x(i)
Example 2 - Vertex Cover with non-linear Costs Linearise the equations by using new variable Define variable cost(i), i B which represents the final cost of ith node. Cost of each vertex: Cost of each vertex when x(i) is decided: Equivalent objective : Minimize Linear!
Example 2 - Vertex Cover with non-linear Costs A BCD EF x = [1, 1, 0, 1, 0, 1]; cost = [1, 1, 0, 0, 0, 0]; Total cost = 2 Output: