Integer Programming: Formulating Constraints and Solving IPs, Study notes of Computer Science

The importance of integer programs (ips) in optimization, particularly for solving np-hard problems such as knapsack, satisfiability, graph bisection, and traveling salesman. How to translate various problem types into ips, focusing on disjunctions and the use of slack variables. It also introduces the concept of total unimodularity (tu) and its significance in efficiently solving ips.

Typology: Study notes

Pre 2010

Uploaded on 08/18/2009

koofers-user-upw-1
koofers-user-upw-1 🇺🇸

10 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Integer Programs
CS 149 Staff
November 23, 2006
1 Introduction
Formulating a production problem as a linear program could lead to a recommen-
dation of producing 7.5 cars and 1.5 trucks. The customer that gets the front half
of a car and the back half of a truck is unlikely to be happy. To remedy this, it is
natural to add additional constraints to the linear program indicating that certain
variables must take only integer values. This is called an integer program (IP). So
how powerful are integer programs? It turns out that most NP hard optimization
problems can be naturally formulated as integer programs, including the knapsack
problem, satisfibility, graph bisection and traveling salesman problem.
Some problems, such as knapsack, can be translated into integer programs with
barely any work: max pTxsubject to wTxCand x {0,1}n. Many other
problems can be formulated as LPs with some effort. Here are some tricks typically
used when translating problems into integer programs.
1.1 Disjunction
Linear programs translating a conjunction into a linear program is easy, since all
constraints of a linear program must be satisfied. Many problems, such Boolean
satisfibility (SAT), contain disjunctions as well. Consider the constraint x1 ¬x2
is true. This can easily be translated into x1+ (1 x2)1 with xi {0,1}.
What about disjunctions of expressions, such as |x| 10, which is equivalent to
x10 x 10?
The solution here is to introduce a 0/1 slack variable sand rewrite the equations
as x+Ms 10 and x(1 s)M 10, where Mis a very large number. If s= 0,
the first equation is in its original form and the second is trivially satisfied regardless
of the value of x. If s= 1, the first equation is trivially satisfied and the second is
not. Therefore this models disjunction.
1.2 Relying on the force of gravity
Consider the shortest path problem. One natural formulation is as a min cost flow
of 1 unit from sto twhere every edge has a flow of either zero or one. At first
glance this might seem to be insufficient since there could be cyclic flows in addition
to the path we’re looking for. If all edge weights are positive, any optimal solution
1
pf3

Partial preview of the text

Download Integer Programming: Formulating Constraints and Solving IPs and more Study notes Computer Science in PDF only on Docsity!

Integer Programs

CS 149 Staff

November 23, 2006

1 Introduction

Formulating a production problem as a linear program could lead to a recommen- dation of producing 7.5 cars and 1.5 trucks. The customer that gets the front half of a car and the back half of a truck is unlikely to be happy. To remedy this, it is natural to add additional constraints to the linear program indicating that certain variables must take only integer values. This is called an integer program (IP). So how powerful are integer programs? It turns out that most NP hard optimization problems can be naturally formulated as integer programs, including the knapsack problem, satisfibility, graph bisection and traveling salesman problem. Some problems, such as knapsack, can be translated into integer programs with barely any work: max pT^ x subject to wT^ x ≤ C and x ∈ { 0 , 1 }n. Many other problems can be formulated as LPs with some effort. Here are some tricks typically used when translating problems into integer programs.

1.1 Disjunction

Linear programs translating a conjunction into a linear program is easy, since all constraints of a linear program must be satisfied. Many problems, such Boolean satisfibility (SAT), contain disjunctions as well. Consider the constraint x 1 ∨ ¬x 2 is true. This can easily be translated into x 1 + (1 − x 2 ) ≥ 1 with xi ∈ { 0 , 1 }. What about disjunctions of expressions, such as |x| ≥ 10, which is equivalent to x ≥ 10 ∨ x ≤ −10? The solution here is to introduce a 0/1 slack variable s and rewrite the equations as x + M s ≥ 10 and x − (1 − s)M ≤ −10, where M is a very large number. If s = 0, the first equation is in its original form and the second is trivially satisfied regardless of the value of x. If s = 1, the first equation is trivially satisfied and the second is not. Therefore this models disjunction.

1.2 Relying on the force of gravity

Consider the shortest path problem. One natural formulation is as a min cost flow of 1 unit from s to t where every edge has a flow of either zero or one. At first glance this might seem to be insufficient since there could be cyclic flows in addition to the path we’re looking for. If all edge weights are positive, any optimal solution

to the LP must be acyclic and therefore this potential problem won’t come up with the optimal solutions we care about. To show that two problems are equivalent, you need to show that given an optimal solution to one of the problems you can find a feasible solution to the other problem (in polynomial time) that is no worse. If you can show this in both directions, then solving one problem implies solving the other.

2 TU

Certain problems that can be formulated as integer programs, such as shortest path, have polynomial-time algorithms even though we have seen that general integer programming is NP hard. It turns out that there is a condition on the matrix of the integer program that allows us to show that any extreme point is integral and therefore the problem can be solved in polynomial time. This condition is total unimodularity. A matrix is TU if and only if all sub matrices have determinant zero, one or negative one. There are many ways to show that a matrix is TU. One can of course prove it directly from the definition, but that is usually quite hard. The slides give a partition theorem which is often easier than using the definition directly but still requires thought. The following condition gives a more or less thoughtless way that can prove whether or not many matrices are TU. If A is TU then it remains TU if A is modified by:

  1. Deleting one or more rows/columns
  2. Performing a pivot operation
  3. Adding or removing duplicate rows/columns or rows/columns with only one non-zero, which is -1 or 1.
  4. Negating rows/columns
  5. Permuting Rows or columns
  6. Transposed
  7. Inverted (assuming square and invertible)

Note that for all of these operations except the first two are if and only if con- ditions. This implies that given a matrix one wishes to evaluate to see if it is TU, one can repeatedly apply those conditions, simplifying the problem until the answer is obvious. For example, consider the question of determining for what values of X the following matrix is TU:

− 1 − 1 − 1 0 0 1 0 1 1 1 1 0 1 X 1 0