integer programming (ip) - andrew david joseph · pdf file1 integer programming (ip) ......

26
January 8, 2002 FOMGT 353 Introduction to Management Science 1 Integer Programming (IP) An Introduction

Upload: hoangdung

Post on 13-Mar-2018

224 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Integer Programming (IP) - Andrew David Joseph · PDF file1 Integer Programming (IP) ... integer values but the range of ... with Binary Decision Variables “To Open (1) or Not (0)

January 8, 2002 FOMGT 353 Introduction to Management Science

1

Integer Programming (IP)

An Introduction

Page 2: Integer Programming (IP) - Andrew David Joseph · PDF file1 Integer Programming (IP) ... integer values but the range of ... with Binary Decision Variables “To Open (1) or Not (0)

January 8, 2002 FOMGT 353 Introduction to Management Science

2

27.57689 Pancakes• In the Transport Problem from Lecture 11

we used Linear Programming (having assumed that the variables were continuous).

• As it happened the solution was in round numbers of pancakes, and it probably wouldn’t have mattered if we had a solution involving fractional pancakes. (As we would have rounded the numbers down with little practical effect on the answers!)

• Rounding to a solution is called the “LP Relaxation. Care should be taken as we will see in the next slides!

Page 3: Integer Programming (IP) - Andrew David Joseph · PDF file1 Integer Programming (IP) ... integer values but the range of ... with Binary Decision Variables “To Open (1) or Not (0)

January 8, 2002 FOMGT 353 Introduction to Management Science

3

Take 2 Examples• Min 78 x1 + 1050 x2

s.t.x1 <= 8- x1 + 10 x2 <= 19.711.72 x1 + 1.23 x2 => 9x1 + 10 x2 => 9.9x1 – x2 <= 7.5

x1, x2 => 0 and Integer

• Max –78 x1 + 1050 x2

s.t.x1 <= 8- x1 + 10 x2 <= 19.711.72 x1 + 1.23 x2 => 9x1 + 10 x2 => 9.9x1 – x2 <= 7.5

x1, x2 => 0 and Integer

Page 4: Integer Programming (IP) - Andrew David Joseph · PDF file1 Integer Programming (IP) ... integer values but the range of ... with Binary Decision Variables “To Open (1) or Not (0)

January 8, 2002 FOMGT 353 Introduction to Management Science

4

The Feasible Points

−1 1 2 3 4 5 6 7 8 9

11

23

4

x1

x2

x1 = 1 x2 = 2

x1 = 2 x2 = 2

x1 = 3 x2 = 2

x1 = 4 x2 = 2

x1 = 5 x2 = 2 x1 = 6

x2 = 2 x1 =7 x2 = 2 x1 = 8

x2 = 2

x1 = 8 x2 = 1

x1 = 7 x2 = 1

x1 = 6 x2 = 1

x1 = 5 x2 = 1

x1 = 4 x2 = 1

x1 = 3 x2 = 1

x1 = 2 x2 = 1

x1 = 1 x2 = 1

Page 5: Integer Programming (IP) - Andrew David Joseph · PDF file1 Integer Programming (IP) ... integer values but the range of ... with Binary Decision Variables “To Open (1) or Not (0)

January 8, 2002 FOMGT 353 Introduction to Management Science

5

Graphical Solutions

−1 1 2 3 4 5 6 7 8 9

11

23

4

x1

x2

The Solution to the IP

Maximization problem is x1 = 1 and

x2 = 2!!

The Solution to the LP

Maximization problem is x1 = 8 and x2 = 2.77!!

Objective Function: max -78 x1 + 1050 x2

The Solution to the IP

Relaxation to the

Maximization problem is x1 = 8 and

x2 = 2!!

Page 6: Integer Programming (IP) - Andrew David Joseph · PDF file1 Integer Programming (IP) ... integer values but the range of ... with Binary Decision Variables “To Open (1) or Not (0)

January 8, 2002 FOMGT 353 Introduction to Management Science

6

Graphical Solutions

−1 1 2 3 4 5 6 7 8 9

11

23

4

x1

x2

The Solution to the IP

Minimization problem is x1 = 1 and

x2 = 1!!

The Solution to the LP

Minimization problem is

x1 = 7.718 & x2 = 0.218!!

Objective Function: min 78 x1 + 1050 x2

The Solution to the IP

Relaxation to the Minimization

problem is x1 = 7 and

x2 = 1!!

Page 7: Integer Programming (IP) - Andrew David Joseph · PDF file1 Integer Programming (IP) ... integer values but the range of ... with Binary Decision Variables “To Open (1) or Not (0)

January 8, 2002 FOMGT 353 Introduction to Management Science

7

Issues With LP Relaxation

• Completely wrong answers, as in the examples.

• Which way do you round? Up or Down?• Sensitivity Analysis from LP is

probably more or less useless in the LP Relaxation.

• Would work well for the pancake problem!

Page 8: Integer Programming (IP) - Andrew David Joseph · PDF file1 Integer Programming (IP) ... integer values but the range of ... with Binary Decision Variables “To Open (1) or Not (0)

January 8, 2002 FOMGT 353 Introduction to Management Science

8

LP Relaxation to put Bounds on the Problem

• An LP Relaxation of an IP will allow us to place Bounds on the values of the Decision Variables.

• In our maximization example, from the LP solution we knew that x1 <= 8 and that x2 <= 2.77 and z <= (-78) * 8 + 1050 * 2.77.

• In our minimization example, from the LP solution we knew that x1 => 1 and x2 => 1 z => 78 * 1 + 1050 * 1.

Page 9: Integer Programming (IP) - Andrew David Joseph · PDF file1 Integer Programming (IP) ... integer values but the range of ... with Binary Decision Variables “To Open (1) or Not (0)

January 8, 2002 FOMGT 353 Introduction to Management Science

9

Binary Variables

• Binary or “0-1” variables are a special case of Integer variables in that not only must they take on integer values but the range of values is restricted to either zero or one.

Page 10: Integer Programming (IP) - Andrew David Joseph · PDF file1 Integer Programming (IP) ... integer values but the range of ... with Binary Decision Variables “To Open (1) or Not (0)

January 8, 2002 FOMGT 353 Introduction to Management Science

10

Mixed LP/IP Problems

• There is no reason not to specify some continuous decision variables and some integer decision variables in the same problem, for example:

Max x1 + x2s.t.• x1 <= 3.2• x2 <= 0.9• x1 => 0 and integer, x2 => 0

Page 11: Integer Programming (IP) - Andrew David Joseph · PDF file1 Integer Programming (IP) ... integer values but the range of ... with Binary Decision Variables “To Open (1) or Not (0)

January 8, 2002 FOMGT 353 Introduction to Management Science

11

Computational Aspects of Mixed LP/IP Problems

• Integer Programs are computationally harder to solve than Linear Programs!

• When we solve our example as an LP we only have to look at 5 corners and we have an algorithm which allows us to do so

systematically, improvingthe objective Functionvalue at each step!

−1 1 2 3 4 5 6 7 8 9

11

23

4

x1

x21 2

344

Page 12: Integer Programming (IP) - Andrew David Joseph · PDF file1 Integer Programming (IP) ... integer values but the range of ... with Binary Decision Variables “To Open (1) or Not (0)

January 8, 2002 FOMGT 353 Introduction to Management Science

12

Computational Aspects of Mixed LP/IP Problems

• As an IP, our example gives us 16 points that are feasible and which have to be evaluated against one another.

• If the top constraint were one further up the graph, we would have 24 feasible points!!

−1 1 2 3 4 5 6 7 8 9

11

23

4

x1

x2

−1 1 2 3 4 5 6 7 8 9

11

23

4

x1

x2

Page 13: Integer Programming (IP) - Andrew David Joseph · PDF file1 Integer Programming (IP) ... integer values but the range of ... with Binary Decision Variables “To Open (1) or Not (0)

January 8, 2002 FOMGT 353 Introduction to Management Science

13

Computational Aspects of Mixed LP/IP Problems

• IP Problems become hard to solve with relatively few Decision Variables.

• Mixed LP/IP problems are easier to solve than IP problems with the same number of Decision Variables.

• Mixed LP/IP (0-1) problems are very useful, as we will see!

Page 14: Integer Programming (IP) - Andrew David Joseph · PDF file1 Integer Programming (IP) ... integer values but the range of ... with Binary Decision Variables “To Open (1) or Not (0)

January 8, 2002 FOMGT 353 Introduction to Management Science

14

Product Distribution

• UMass Ventures has employed you to help with their logistics.

• They are looking to expand into China and have identified 4 potential sites for warehouses.

• Management have decided to have at least two warehouses.

• How are you going to model this?

Page 15: Integer Programming (IP) - Andrew David Joseph · PDF file1 Integer Programming (IP) ... integer values but the range of ... with Binary Decision Variables “To Open (1) or Not (0)

January 8, 2002 FOMGT 353 Introduction to Management Science

15

Enumeration!!• One approach would be to formulate

(4Choose2 + 4Choose3 + 4Choose4) models that will allow us to look at all the possible combinations of two warehouses from four possible warehouses.

• 4Choose2 = 6, 4Choose3 = 4 and 4Choose4 = 1 so in this case we would have to set up and solve 11 models and then select the “best” solution.

• 5 sites 2 or more !!! 6, 7 !!!

Page 16: Integer Programming (IP) - Andrew David Joseph · PDF file1 Integer Programming (IP) ... integer values but the range of ... with Binary Decision Variables “To Open (1) or Not (0)

January 8, 2002 FOMGT 353 Introduction to Management Science

16

A Little Math - Shreek !• k ! = k * (k-1) * (k-2) * … * (1)• 0 ! = 1 by definition• Examples

3 ! = 3 * (3-1) * (3-2)= 3 * 2 * 1 = 6

4 ! = 4 * (4-1) * (4-2) * (4-3)= 4 * 3 * 2 * 1 = 24

Page 17: Integer Programming (IP) - Andrew David Joseph · PDF file1 Integer Programming (IP) ... integer values but the range of ... with Binary Decision Variables “To Open (1) or Not (0)

January 8, 2002 FOMGT 353 Introduction to Management Science

17

Combinations (Order Unimportant!!)

• The number of subsets is called the number of Combinations of r symbols taken k at a time, which is denoted:-

rCk or said r choose k

• Example… r = 4; k = 2

kr

)!(!!rCkkrk

rkr

−=

=

613*2

1*23*4

)!2)(1*2(1*2*3*4

)!24(!2!4

2424C ====

−=

=

Page 18: Integer Programming (IP) - Andrew David Joseph · PDF file1 Integer Programming (IP) ... integer values but the range of ... with Binary Decision Variables “To Open (1) or Not (0)

January 8, 2002 FOMGT 353 Introduction to Management Science

18

A Single Modelk out of n Alternatives Constraint

• Another alternative is to set up a single model with Binary Decision Variables “To Open (1) or Not (0) Warehouse #”,

Say W1, W2, W3 and W4.• Then we need a constraint to force at least 2 of

the 4 to equal one.W1 + W2 + W3 + W4 >= 2 satisfies the requirement!

• If we wanted to choose exactly 2!W1 + W2 + W3 + W4 = 2

– Less than or equal to 2! W1 + W2 + W3 + W4 <= 2

Page 19: Integer Programming (IP) - Andrew David Joseph · PDF file1 Integer Programming (IP) ... integer values but the range of ... with Binary Decision Variables “To Open (1) or Not (0)

January 8, 2002 FOMGT 353 Introduction to Management Science

19

A Single ModelConditional or Co-requisite Constraints

• We have set up a constraint to force two or more warehouses into the solution, but this has no effect on the flows into and out of the warehouses!!

• We need to make flows into and out of each warehouse “Conditional” on whether or not the warehouse is opened!

F1 <= 20 W1 (F1 – 20 W1 <= 0)!!!• Makes F1 conditional on W1, if W1 = 0 then F1 <= 0

else F1 <= 20.

Page 20: Integer Programming (IP) - Andrew David Joseph · PDF file1 Integer Programming (IP) ... integer values but the range of ... with Binary Decision Variables “To Open (1) or Not (0)

January 8, 2002 FOMGT 353 Introduction to Management Science

20

A Single ModelConditional or Co-requisite Constraints

• Political considerations may require us to open the Warehouse in Beijing if we open one in Shanghai, but not vice versa.

Wb >= Ws will model this co-requisite.

• Wb can equal 1 when Ws is 0, but Wb cannot equal 0 when Ws is 1.

Wb = Ws would force them to be open at the same time or closed at the same time.

• As before we need to express the constraints in the proper form:

Wb – Ws >= 0. AndWb – Ws = 0.

Page 21: Integer Programming (IP) - Andrew David Joseph · PDF file1 Integer Programming (IP) ... integer values but the range of ... with Binary Decision Variables “To Open (1) or Not (0)

January 8, 2002 FOMGT 353 Introduction to Management Science

21

Simple Example

• A factory, in Holyoke, capable of making 45,000 widgets a day, has the choice between two sites for warehouses, one in Chicopee and the other in Palmer.

• The CFO says that the daily capital cost of the Chicopee warehouse will be $124 and the Palmer warehouse will be $98.

• There are 3 outlets with demands of 12,000 each.

Page 22: Integer Programming (IP) - Andrew David Joseph · PDF file1 Integer Programming (IP) ... integer values but the range of ... with Binary Decision Variables “To Open (1) or Not (0)

January 8, 2002 FOMGT 353 Introduction to Management Science

22

ChicopeeWarehouse 1

Cost $124

HolyokeFactory

Capacity 45,000 per day

PalmerWarehouse 2

Cost $98

Outlet 1Demand12,000

Outlet 2Demand12,000

Outlet 3Demand12,000

F1 (0.35)

F2 (0.45)

W12 (0.12)

W11 (0.25)

W13 (0.21)

W21 (0.14)

W22 (0.27)

W23 (0.18)

W1

W2

Key to FlowsName (Cost in $ per piece)

Simple Example cont…

Page 23: Integer Programming (IP) - Andrew David Joseph · PDF file1 Integer Programming (IP) ... integer values but the range of ... with Binary Decision Variables “To Open (1) or Not (0)

January 8, 2002 FOMGT 353 Introduction to Management Science

23

ChicopeeWarehouse 1

Cost $124

HolyokeFactory

Capacity 45,000 per day

PalmerWarehouse 2

Cost $98

Outlet 1Demand12,000

Outlet 2Demand12,000

Outlet 3Demand12,000

F1 (0.35)

F2 (0.45)

W12 (0.12)

W11 (0.25)

W13 (0.21)

W21 (0.14)

W22 (0.27)

W23 (0.18)

W1

W2

Key to FlowsName (Cost in $ per piece)

Simple Example cont…Objective : Min 0.25W11 + 0.12W12 + 0.21W13 + 0.14W21 + 0.27W22 + 0.18W23 + 0.35F1 + 0.45F2 + 124W1 + 98W2

Only 1 Warehouse:

W1 + W2 = 1

W1, W2 Binary Variables

Factory Capacity:

45,000 W1 – F1 => 0

45,000 W2 – F2 => 0

Conservation of Flow:

F1 - W11 - W12 - W13 = 0

F2 - W21 - W22 - W23 = 0

Demand:

W11+ W21 =

12,000

W11+ W21 =

12,000

W11+ W21 =

12,000

Page 24: Integer Programming (IP) - Andrew David Joseph · PDF file1 Integer Programming (IP) ... integer values but the range of ... with Binary Decision Variables “To Open (1) or Not (0)

January 8, 2002 FOMGT 353 Introduction to Management Science

24

Write Out The Model!

Page 25: Integer Programming (IP) - Andrew David Joseph · PDF file1 Integer Programming (IP) ... integer values but the range of ... with Binary Decision Variables “To Open (1) or Not (0)

January 8, 2002 FOMGT 353 Introduction to Management Science

25

Simple Example cont…• Min 0.25W11 + 0.12W12 + 0.21W13 + 0.14W21 + 0.27W22 + 0.18W23 +

0.35F1 + 0.45F2 + 124W1 + 98W2

s.t.

• Factory Capacity:45,000 W1 – F1 => 045,000 W2 – F2 => 0

• Conservation of Flow:F1 - W11 - W12 - W13 = 0F2 - W21 - W22 - W23 = 0

• Demand:W11+ W21 = 12,000W11+ W21 = 12,000W11+ W21 = 12,000

• Only 1 Warehouse:W1 + W2 = 1

W1, W2 Binary Variables and W11, W12, W13, W21, W22, W33, F1, F2 =>0

Page 26: Integer Programming (IP) - Andrew David Joseph · PDF file1 Integer Programming (IP) ... integer values but the range of ... with Binary Decision Variables “To Open (1) or Not (0)

January 8, 2002 FOMGT 353 Introduction to Management Science

26

Reading and Homework.

• Read Chapter 2, Section 2.9.