integer programming

36
1 15.053/8 February 27, 2014 Introduction to Integer Programming Integer programming models

Upload: missmit

Post on 11-May-2017

223 views

Category:

Documents


0 download

TRANSCRIPT

Monday, January 20th

115.053/8 February 27, 2014Introduction to Integer Programming Integer programming models

2Quotes of the DaySomebody who thinks logically is a nice contrast to the real world.-- The Law of Thumb

Take some more tea, the March Hare said to Alice, very earnestly. Ive had nothing yet, Alice replied in an offended tone, so I cant take more.You mean you cant take less, said the Hatter. Its very easy to take more than nothing.-- Lewis Carroll in Alice in Wonderland

Integer programmingINPUT: a set of variables x1, , xn and a set of linear inequalities and equalities, and a subset of variables that is required to be integer.FEASIBLE SOLUTION: a solution x that satisfies all of the inequalities and equalities as well as the integrality requirements. OBJECTIVE: maximize i ci xi3Example: maximize 3x + 4y subject to 5x + 8y 24 x, y 0 and integer

Overview of LectureInteger programs vs linear programs

Some modeling tricks and techniques with integer programmingLogical constraints4

5Why integer programs?Rule of thumb: integer programming can model any of the variables and constraints that you really want to put into an LP, but cant.More realisticMore flexibility

DisadvantagesMore difficult to model Can be much more difficult to solve

In practice, most problems have at least some features that prevent linear programming from being a good enough model. For this reason, integer programming models are much more practical. They can model logical constraints, nonlinear functions, and much more.

While it is a robust and excellent modeling tool, it is much harder to solve than linear programs.

On computation for IPsMuch, much harder than solving LPs

Some very large IPs can be solvede.g., 50,000 columns 2 million non-zeros

Very unpredictable!6

7Running time to optimality (CPLEX)number of rowsnumber of columnsInstances are taken from MIP LibRunning time for solving IPs using CPLEX

Types of Integer Programs80-1 (binary) Integer ProgramsPure Integer ProgramsMixed integer linear programs(MILPs or MIPs)xj {0,1} for every j.xj 0 and integer for every j.xj 0 and integer for some or all j.0 xj 1 and xj integer.

9Trading for ProfitNooz is a contestant on Trading for Profits. Its main slogan is I Trading for ProfitNooz has just won 14 IHTFP points. We now join the quiz show to see what the 14 points are worth.

We illustrate integer programming on a contestant choosing prizes in a game show.

5 pointsiPad10

3 points

6 points15.053

4 points6.041

4 points

7 points

7 points

I got a bit carried away last year in developing these voiceovers. I hope they play on your computer.

In any case, the products areAn iPod plus speakerA server for holding vast amounts of dataA brass ratA $500 gift certificate to Au Bon PanTutoring in 6.041.Dinner with Professor Orlin and the TAs of 15.053.

11Nooz determines what each prize is worth to him. He measure everything in utils on a scale from 1 to 25.

4 points6.041

6 points15.05311 utils19 utils

4 points

3 points7 points5 points16 utils12 utils22 utils8 utils

Nooz converts each product into Utils. You may note that each IHTFP point is worth approximately 3 utils, but the actual numbers vary from product to product.

12

Write Noozs problem as an integer program.

Budget: 14 IHTFP points.PrizePoints574346Utility16221281119

123456

1322

Noozs problem is to maximize the total utility subject to using at most 14 IHTFP points.

The first step is choosing decision variables. The rule of thumb in integer programming is as follows: whenever it makes sense at all, try to use binary decision variables. Binary decision variables are great for modeling decisions where one of two choices can be made. As we shall see in the next lecture, they are also useful when one needs to make a decision of one of many choices.

In this case, we let xj = 1 or 0 according as prize j is selected or is not selected.

13Integer Programming FormulationMax 16x1+ 22x2+ 12x3+ 8x4+ 11x5+ 19x6

5x1+ 7x2+ 4x3+ 3x4+ 4x5+ 6x6 14 xj {0,1} for each j = 1 to 6Objective and Constraints?

The objective and constraints show up in slideshow mode.

14Knapsack or Capital BudgetingYou have n items to choose from to put into your knapsack.Item i has weight wi, and it has value ci. The maximum weight your knapsack (or you) can hold is b.Formulate the knapsack problem.

The structure of this problem is as follows:a linear objectivea single linear contrainteach variable is binary.

This problem arises so frequently that it is given a name. The most common name is the knapsack problem, because it can be used to model the following problem: what is the choice of items to put in your knapsack so as to maximize the total value and so that the weight in the knapsack is at most some specified number b?

It is often referred to as capital budgeting. In this case, it models the following problem: Given: a budget b, and a number of different projects, where the j-th project requires a budget of wj and gives a net present value return of cj. What is the choice of projects that maximizes the net present revenue without exceeding the budget b?

On formulating integer programsWe often have constraints and objectives that are not expressed as linear constraints plus integrality constraints. (That is, it is not currently an IP)

Examples:If you select the iPad, you cannot select 6.041If Prize 1 is selected then Prize 2 must be selected.You must select Prize 1 or Prize 2 or bothe.g. y1 7 or y2 9 or both.e.g., f(y3) = 0 if y3 = 0, and it is 10 + 5 y3 if y3 > 0.

15

On formulating integer programsWe can figure out what is feasible and what is not feasible.

When we form the integer program (IP), we want the following:The feasible region for our problem and for the integer program is the same. Sometimes, we need to create new variables in order to make this happen.

16

17Logical Constraints 1x1 = 1 if iPadx5 = 1 if 6.041

Constraint 1. If you select the iPad, you cannot select 6.041

x1x5

MIP Constraint: x1 + x5 1

Which of the following is equivalent to the constraint: if x1 = 1, then x5 = 0? 2x1 + 2x5 3x1 + x5 1x1 + x5 1Either A or B?

19Logical Constraints 2x1 = 1 if iPadx2 = 1 if server

Constraint 2. If Prize 1 is selected then Prize 2 must be selected.

x1x2

MIP Constraint: x1 x2

Once the feasible region is drawn, it is easy to see that there are an infinite number of constraints that separate the three feasible points from the infeasible point (1, 0). The simplest and best of these is x1 x2 .

Which of the following is equivalent to the constraint: x1 = 0 or x2 = 1 (or both)? x1 x2

x1 x2

(1 x1) + x2 1

Either A or C?

21Logical Constraints 3x1 = 1 if iPadx2 = 1 if server

Constraint 3. You must select Prize 1 or Prize 2 or both

x2

MIP Constraint: x1 + x2 1

The answer is revealed in Slide Show mode. But you may want to figure out the constraint first.

Logical constraints and the big M method22

y2Constraint 4. Suppose that y1 and y2 are integer variables.0 y1 50 y2 5y1, y2 integer.

How can we model:y1 3 or y2 4 or both

y1

012354012354Can we do it be adding linear constraints to this diagram?

How can we model y1 3 or y2 4 or both? It cant be done.Of course it can be done, and we shall soon see how.

On taking a problem and creating and verifying an IP formulation.Typically, we create an IP such that the set of feasible solutions for the IP is the same as the set of feasible solutions for the original problem.

Verification: often done in two steps.Step 1. If a solution is feasible for the original problem, it is also feasible for the IP.Step 2. If a solution is feasible for the IP, then it is also feasible for the original problem.

24

On modeling using integer programmingThe techniques look odd at first.

Similar techniques can be used for lots of different types of constraints.25

y1 3 or y2 4 or both26

y2 0 y1 5 0 y2 5 y1 3 3w y2 4 4 (1-w). y1, y2 integer. w {0, 1}.

y1

The feasible set if w = 0.012354012354Note: if w = 0, then y1 3 y2 0.

y1 3 or y2 4 or both27

y2 0 y1 5 0 y2 5 y1 3 3w y2 4 4 (1-w). y1, y2 integer. w {0, 1}.

y1

The feasible set if w = 1.012354012354Note: If w = 1, then y1 0 y2 4.

y1 3 or y2 4 or both28

y20 y1 50 y2 5y1, y2 integer.y1 3 3wy2 4 4 (1-w). w {0, 1}.The set of y1 and y2 that are feasible for some choice of w.

y1

012354012354

One can choose larger coefficients for w and 1-w.29The following is also a valid formulation of 0 y1 5 0 y2 5 y1 3 or y2 4 or both.

If w = 1, then y1 -997 redundant constraint y2 4. 0 y1 50 y2 5y1 3 1000wy2 4 457(1-w). w {0, 1}.If w = 0, then y1 3 y2 -453 redundant constraint

Generalizing to other or constraints30Constraint. Suppose that y1 and y2 are integer variables.0 y1 10000 y2 2000y1, y2 integer.

Model:y1 30 or y2 45 or both

Create a new binary variable w. y1 30 30wy2 45 45(1-w). w {0, 1}.Also valid:y1 30 1000wy2 45 500(1-w). w {0, 1}.

Generalizing to other or constraints31Constraint. Suppose that y1 and y2 are integer variables.0 y1 10000 y2 2000y1, y2 integer.

Model:y1 60 or y2 75 or both

Create a new binary variable w.y1 60 + 1000wy2 75 + 2000(1-w). w {0, 1}.

320 y1 10000 y2 2000y1, y2 integer.

y1 60 + 1000wy2 75 + 2000(1-w). w {0, 1}.If w = 0, then0 y1 10000 y2 2000y1 60y2 20750 y1 600 y2 2000

If w = 1, then0 y1 10000 y2 2000y1 1060y2 750 y1 10000 y2 75

The big M method: an effective, but lazy approach to modeling or constraints.33Constraint. Suppose that y1 and y2 are integer variables and that y1 and y2 are bounded from above (by 1,000 or 10,000 or something.)

Model:y1 200 or y2 125 or bothCreate a new binary variable w.Choose a very large integer M.

y1 200 - Mwy2 125 + M(1-w). w {0, 1}.

Modeling or constraintsIf w = 1, then x1 + 2x2 12If w = 0, then 4x2 10x3 1 Therefore, the logical constraints are satisfied.Suppose that (x, w) is feasible, for the IP.To show: The logical constraints are equivalent to the IP constraints.Suppose that xi is bounded for all i.x1 + 2x2 12 or 4x2 10x3 1. Logical constraints.x1 + 2x2 12 M(1-w)4x2 10x3 1 + Mw. IP constraints.Suppose that M is very large.

Suppose that x satisfies the logical constraints.Suppose that xi is bounded for all i.x1 + 2x2 12 or 4x2 10x3 1. Logical constraints.x1 + 2x2 12 M(1-w)4x2 10x3 1 + Mw. IP constraints.Suppose that M is very large.If x1 + 2x2 12, then let w = 1

x1 + 2x2 12the other constraint is redundantElse 4x2 10x3 1 then let w = 0

4x2 10x3 1.the other constraint is redundant

In both cases, the IP constraints are satisfied.

36Some Comments on IP modelsThere are often multiple ways of modeling the same integer program.

Solvers for integer programs are extremely sensitive to the formulation. (not true for LPs)

Next lecture: More IP models.