0% found this document useful (0 votes)
12 views17 pages

ENGR 3157-Operations Research-Lecture 09-IntegerProgramming

Uploaded by

dashtonmoy349
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views17 pages

ENGR 3157-Operations Research-Lecture 09-IntegerProgramming

Uploaded by

dashtonmoy349
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

Operations Research

ENGR 3157
Lecture 09 – Integer Programming

Eugene Ben-Awuah, PhD, PEng


Bharti School of Engineering
Laurentian University

Office: F220
Tel: 705-675-1151 ext. 2195
Email: [email protected]

2
Recall: Types of Mathematical Programming

• Linear Programs (LP): the objective and constraint


functions are linear and the decision variables are
continuous.

• Integer Linear Programs (ILP): one or more of the decision


variables are restricted to integer values only and the
functions are linear.
– Pure IP: all decision variables are integer.
– Mixed IP (MIP): some decision variables are integer, others are
continuous.
– 1/0 MIP: some or all decision variables are further restricted to be
valued either “1” or “0”.

1
3
MILP – Mine Production Scheduling
• Objective function: Maximize Net Present Value
T N
Max   v nt × x nt - q nt × y nt 
t=1 n=1

Block value (includes Cost of mining all


extra cost of mining ore) material as waste

• Constraints N
– Mining Tl     on  wn   ynt  Tut
t

n 1
N
– Processing Tl    on  xnt   Tut
t

n=1
– Blocks extraction precedence

4
A Simple LP Problem1

– A steel company must decide how to allocate production time on a


rolling mill. The mill takes unfinished slabs of steel as input and can
produce either of two products: bands and coils. The products come
off the mill at different rates and have different profitability:
Tons/ Profit/
hour ton
Bands 200 $25
Coils 140 $30
– The weekly production that can be justified based on current and
forecast orders are:
Maximum tons: Bands 6,000
Coils 4,000
– If 40 hours of production time are available, how many tons of bands
and coils should be produced to bring the greatest profit?

2 from, R. Fourer, D. Gay, B. Kernighan, AMPL, Boyd & Fraser, 1993, pp. 2-10.

2
5
A Simple LP Problem – Solution

• Define the decision variables:


– xB number of tons of bands produced.
– xC number of tons of coils produced.

• Formulation:

Maximize: 25 xB  30 xC

Subject to: 1 200  xB  1 140  xC  40

0  xB  6000

0  xC  4000

6
A Simple LP Problem – Solution (2)

Coils
Coils

Constraints Profit
6000 6000
Hours
192K

4000 4000
Optimal solution

2000 Feasible region 2000

Bands 0 Bands
0
0 2000 4000 6000 8000 0 2000 4000 6000 8000

Optimal Solution:
Bands = 6000
Coils = 1400

3
7
Expressed as an ILP Problem

• Assume that orders for bands and coils are placed (and
filled) in truckloads of 1,000s of tons only

• New symbolic model


– Let the new decision variables be the number of 1000 ton “units” or
orders of bands and coils.

Maximize: 25000 xB  30000 xC

Subject to: 1000 200  xB  1000 140  xC  40


0  xB  6 integer

0  xC  4 integer

8
Expressed as an ILP Problem (2)

• Solving graphically:

Coils

6 $185K

4 Optimal integer solution ($185K)

2
Feasible integer solutions
0 Bands
0 2 4 6 8

4
9
Fixed-Charge ILP Problems

• A fixed-charge ILP problem is one in which a 0/1 variable, y,


represents a cost that is incurred if some other activity, x, is
undertaken at a non-zero level.
– e.g., if you produce any widgets, you also need to incur the cost of
installing the equipment to do so
– in other words: if x > 0 then y = 1, and if x = 0 then y = 0
– commonly used to formulate production and/or location problems

• It is implemented by adding a new constraint:


x ≤ M·y

• Can you see why this works?

10
In-Class Problem – Fixed-Charge ILP Problem

• Your factory can manufacture shirts, shorts, and pants for


profits of $6, $4, and $7, respectively. The machinery to
produce shirts costs $200 per week, for shorts is $150 per
week, and for pants is $100 per week. You have 150 hours
of labour and 160 m2 of cloth available per week. Labour
and cloth requirements for each product are as follows:
Labour (hrs) Cloth (m2)
shirt 3 4
shorts 2 3
pants 6 4

• Formulate an ILP that will maximize your profit.

5
11
1/0 ILP Problems with Logical Constraints

• Many ILP problems will include economic indivisibilities,


where a project is either selected or not, and there is no
possibility of selecting a fraction of a project.
– These types of problems are called 1/0 ILP problems, and include at
least one variable whose feasible value is only 0 or 1.

• 1/0 ILP problems often have logical constraints, including:


– Either one particular project or another particular project can be
selected, but not both.
– The number of projects selected must be ≤, ≥, or = to some number
n.
– If a particular project is selected, then some other particular project
must also be selected.
– If a particular project is selected, then some other particular project
cannot also be selected.

12
Formulating Logical Constraints

• Either one particular project or another particular project


must be selected, but not both.
– If exactly one of two projects represented by variables x1 and x2 must
be selected, we add the following constraint:
x 1 + x2 = 1

• The number of projects selected must be ≤, ≥, or = to some


number n.
– If exactly n out of m projects must be selected, we add:
x1 + x2 + x3 + … + xm-1 + xm = n
– If no more than n out of m projects must be selected, we add:
x1 + x2 + x3 + … + xm-1 + xm ≤ n
– If at least n out of m projects must be selected, we add:
x1 + x2 + x3 + … + xm-1 + xm ≥ n

6
13
Formulating Logical Constraints (2)

• If a particular project is selected, then some other particular


project must also be selected.
– If a project represented by variable x1 can only be selected if a
project represented by x2 is also selected, we add:
x1 ≤ x2
– If two projects represented by variables x1 and x2 must be selected
together or not at all, we add:
x 1 = x2

• If a particular project is selected, then some other particular


project cannot also be selected.
– If two projects represented by variables x1 and x2 are mutually
exclusive (we select one or neither, but not both), we add:
x 1 + x2 ≤ 1

14
In-Class Problem – Logical Constraints

• You have $18 000 available for investing in 6 different


projects. Each project has a cost and profit as follows:
1 2 3 4 5 6
Cost $5 $7 $4 $3 $4 $3
Profit $16 $22 $12 $8 $10 $15

• A project is either invested in at its full cost or not at all.


Formulate the ILP model that will maximize your profit if:
1. You must invest in either project 2 or 4, but not both.
2. You can only invest in either project 2 or 4, but not both.
3. You must invest in at least 3 different projects.
4. You can invest in no more than 3 different projects.
5. You must invest in exactly 3 different projects.
6. If you invest in project 2, you also need to invest in project 5.
7. If you invest in either project 1 or 2, you must invest in them both.

7
15
Formulating Either-Or Constraints

• In some ILP problems, we might have a pair of constraints


where only one or the other needs to be satisfied.
– For example, either the total number of widgets and gadgets
produced weekly in factory A must be at least 5000 or the total
number produced weekly in factory B must be at least 7000.

• If only one of the following needs to be satisfied:


f(x1,x2,…,xn) ≤ 0
g(x1,x2,…,xn) ≤ 0

– we replace those constraints with:


f(x1,x2,…,xn) ≤ M·y
g(x1,x2,…,xn) ≤ M·(1-y)

– where y is a 1/0 variable (it either equals 1 or it equals 0)

16
Formulating If-Then Constraints

• Many applications require the use of an if-then type of


constraint system where:
– If f(x1, x2, …, xn) > 0 is satisfied, then g(x1, x2, …, xn) ≥ 0 must also be
satisfied.
– Or said another way, if f(x1, x2, …, xn) ≤ 0 is not satisfied, then g(x1,
x2, …, xn) ≥ 0 must be satisfied.

• To implement that system of constraints, we use:


-g(x1,x2,…,xn) ≤ M·y
f(x1,x2,…,xn) ≤ M·(1-y)

– where y is a 1/0 variable

8
17
In-Class Problem – Either-Or and If-Then

• Referring back to the previous in-class problem (dealing with


logical constraints), formulate the model if:
– You must either invest in at least one of projects 1 and 2 or no more
than two of projects 3, 4, 5, and 6.
– If you invest in more than one of projects 1 and 2, then you can
invest in no more than one of projects 3, 4, 5, and 6.

18
Formulating Piecewise Linear Costs

• A piecewise linear function consists of several linear


segments, where the slope of the overall function changes
at break points throughout its range.
– For example, you will often get quantity discounts on goods or
supplies you purchase.

0
0 2 4 6 8 10 12

9
19
Formulating Piecewise Linear Costs (2)

• Consider that quantities of x ≤ b1 cost c1 per unit, quantities


of b1 < x ≤ b2 cost c2 each, quantities of b2 < x ≤ b3 cost c3
each, and quantities of b3 < x ≤ b4 cost c4 each.

• These costs can be modelled by defining new variables:


0 ≤ x 1 ≤ b1
where each variable xi represents the
0 ≤ x2 ≤ w1 (b2 – b1)
number of units purchased at cost ci, and
0 ≤ x3 ≤ w2 (b3 – b2) wi is a 1/0 variable that represents whether
0 ≤ x4 ≤ w3 (b4 – b3) or not you purchase the full quantity at ci.

– and using an if-then type of constraints systems so that:


0 ≤ w1 (b1) ≤ x1
0 ≤ w2 (b2 – b1) ≤ x2
0 ≤ w3 (b3 – b2) ≤ x3

20
In-Class Problem – Piecewise Linear Costs

• Suppose you need to purchase computers whose costs are


as follows:
– $2,000 each if you buy 1 to 10
– $1,800 each if you buy 11 to 25
– $1,700 each if you buy 26 to 50
– Note that no more than 50 are available.

• Formulate the relevant part of the model to minimize the


total cost of purchasing the computers.

10
21
Solving ILP Problems: Branch-and-Bound

• The LP relaxation of an ILP problem is where all integer


variables are relaxed (i.e., allowed to be real or fractional).

• The LP relaxation of an ILP problem will give one of two


results
– an integer solution (i.e., all decision variables that need to be
integer do in fact take on inter values)
– a fractional solution (i.e., some decision variables that need to be
integer take on non-integer values)

• The branch-and-bound method of solving an ILP starts by


solving its LP relaxation (say, via the simplex method).
– If the result is an integer solution, stop (it’s an optimal solution).
– If the result is a fractional solution, select one of the real-valued
integer decision variables for branching.

22
Solving ILP Problems: Branch-and-Bound (2)

• Branching generates two new LP sub-problems by:


– selecting one of the integer decisions variables, xi, whose value, c, is
non-integer, and
– adding constraints that will restrict that particular value from re-
occurring in subsequent sub-problems.

• The two new sub-problems take the form of:


– the current sub-problem plus the constraint xi ≤ floor(c)
– the current sub-problem plus the constraint xi ≥ ceiling(c)

• Solving each of the new sub-problems (say, with simplex)


will result in an integer solution, an infeasibility, or another
fractional solution.
– If the solution is fractional, the process is repeated.

11
23
Solving ILP Problems: Branch-and-Bound (3)

• We continue branching on each new sub-problem until all


branches are fathomed, which means:
– the sub-problem is infeasible,
– the optimal solution of the sub-problem is worse than the current best
integer solution, or
– the sub-problem gives an integer solution.

• This creates a branch-and-bound solution space that


consists of a tree of LP sub-problems, where:
– the root node of the tree is the LP relaxation of the original ILP
problem (i.e., all integer variables are relaxed),
– integer variables become progressively more restricted in value
(potentially to the point where their values are fixed), and
– all integrality constraints of subsequent sub-problems are relaxed.

24
Example – Branch and Bound
Solution Bounds
LP relaxation of 1
Obj. = 151 0  x1  10
original problem x1 = 3.4 0  x2  10
x2 = 6.8
1
Bounds x1
0  x1  3 Bounds
0  x2  10 4  x1  10 10
2 3
0  x2  10 9
8
7
6
5
4
3
2
1 x2
0
0 1 2 3 4 5 6 7 8 9 10

Source: J. Doucette, Ph.D. Thesis, UofA, 2004

12
25
Example – Branch and Bound (2)
Solution Bounds
1
Obj. = 151 0  x1  10
x1 = 3.4 0  x2  10
1 x2 = 6.8
2
Solution Bounds x1
Obj. = 156 0  x1  3 Bounds
x1 = 2.4 0  x2  10 4  x1  10 10
2 3
x2 = 7.6 0  x2  10 9
8
7
Bounds 6
Bounds 0  x1  3 5
0  x1  3 8  x2  10
0  x2  7 4 5 4
3
2
1 x2
0
0 1 2 3 4 5 6 7 8 9 10

Source: J. Doucette, Ph.D. Thesis, UofA, 2004

26
Example – Branch and Bound (3)
Solution Bounds
1
Obj. = 151 0  x1  10
x1 = 3.4 0  x2  10
1 x2 = 6.8
4
Solution Bounds x1
Obj. = 156 0  x1  3 Bounds
x1 = 2.4 0  x2  10 4  x1  10 10
2 3
x2 = 7.6 0  x2  10 9
8
2 7
Bounds 6
Solution Bounds 0  x1  3 5
Obj. = 169 0  x1  3 8  x2  10
x1 = 3.0 0  x2  7 4 5 4
x2 = 6.0 3
Integer Solution 2
1 x2
0
0 1 2 3 4 5 6 7 8 9 10

Source: J. Doucette, Ph.D. Thesis, UofA, 2004

13
27
Example – Branch and Bound (4)
Solution Bounds
1
Obj. = 151 0  x1  10
x1 = 3.4 0  x2  10
1 x2 = 6.8
5
Solution Bounds x1
Obj. = 156 0  x1  3 Bounds
x1 = 2.4 0  x2  10 4  x1  10 10
2 3
x2 = 7.6 0  x2  10 9
8
2 7
3 4 Solution Bounds 6
Solution Bounds Obj. = 162 0  x1  3 5
Obj. = 169 0  x1  3 x1 = 2.9 8  x2  10
x1 = 3.0 0  x2  7 4 5 4
x2 = 8.0
x2 = 6.0 3
Integer Solution 2
1 x2
0
0 1 2 3 4 5 6 7 8 9 10

Source: J. Doucette, Ph.D. Thesis, UofA, 2004

28
Example – Branch and Bound (5)
Solution Bounds
1
Obj. = 151 0  x1  10
x1 = 3.4 0  x2  10
1 x2 = 6.8
6
Solution Bounds x1
Obj. = 156 0  x1  3 Bounds
x1 = 2.4 0  x2  10 4  x1  10 10
2 3
x2 = 7.6 0  x2  10 9
8
2 7
3 4 Solution Bounds 6
Solution Bounds Obj. = 162 0  x1  3 5
Obj. = 169 0  x1  3 x1 = 2.9 8  x2  10
x1 = 3.0 0  x2  7 4 5 4
x2 = 8.0
x2 = 6.0 3
Integer Solution
5
2
1 x2
Solution Bounds Bounds 0
Obj. = 164 0  x1  2 3  x1  3 0 1 2 3 4 5 6 7 8 9 10
x1 = 1.9 8  x2  10 6 7 8  x2  10
x2 = 8.4

Source: J. Doucette, Ph.D. Thesis, UofA, 2004

14
29
Example – Branch and Bound (6)
Solution Bounds
1
Obj. = 151 0  x1  10
x1 = 3.4 0  x2  10
1 x2 = 6.8
8
Solution Bounds x1
Obj. = 156 0  x1  3 Bounds
x1 = 2.4 0  x2  10 4  x1  10 10
2 3
x2 = 7.6 0  x2  10 9
8
2 7
3 4 Solution Bounds 6
Solution Bounds Obj. = 162 0  x1  3 5
Obj. = 169 0  x1  3 x1 = 2.9 8  x2  10
x1 = 3.0 0  x2  7 4 5 4
x2 = 8.0
x2 = 6.0 3
Integer Solution
5
2
1 x2
Solution Bounds Bounds 0
Obj. = 164 0  x1  2 3  x1  3 0 1 2 3 4 5 6 7 8 9 10
x1 = 1.9 8  x2  10 6 7 8  x2  10
x2 = 8.4

6
Solution Bounds
Obj. = 166 0  x1  2
x1 = 2.0 8  x2  8 Bounds
x2 = 8.0 0  x1  2
8 9
Integer Solution 9  x2  10 Source: J. Doucette, Ph.D. Thesis, UofA, 2004

30
Example – Branch and Bound (7)
Solution Bounds
1
Obj. = 151 0  x1  10
x1 = 3.4 0  x2  10
1 x2 = 6.8

Solution Bounds x1
Obj. = 156 0  x1  3 Bounds
x1 = 2.4 0  x2  10 4  x1  10 10
2 3
x2 = 7.6 0  x2  10 9
8
2 7
3 4 Solution Bounds 6
Solution Bounds Obj. = 162 0  x1  3 5
Obj. = 169 0  x1  3 x1 = 2.9 8  x2  10
x1 = 3.0 0  x2  7 4 5 4
x2 = 8.0
x2 = 6.0 3
Integer Solution
5
2
1 x2
Solution Bounds 0
Obj. = 164 0  x1  2 0 1 2 3 4 5 6 7 8 9 10
x1 = 1.9 8  x2  10 6 7
x2 = 8.4

6
Solution Bounds
Obj. = 166 0  x1  2 7 8
x1 = 2.0 8  x2  8 Solution Bounds
x2 = 8.0 infeasible 0  x1  2
8 9
Integer Solution 9  x2  10 Source: J. Doucette, Ph.D. Thesis, UofA, 2004

15
31
Example – Branch and Bound (8)
Solution Bounds
1
Obj. = 151 0  x1  10
x1 = 3.4 0  x2  10
1 x2 = 6.8
7
Solution Bounds x1
Obj. = 156 0  x1  3 Bounds
x1 = 2.4 0  x2  10 4  x1  10 10
2 3
x2 = 7.6 0  x2  10 9
8
2 7
3 4 Solution Bounds 6
Solution Bounds Obj. = 162 0  x1  3 5
Obj. = 169 0  x1  3 x1 = 2.9 8  x2  10
x1 = 3.0 0  x2  7 4 5 4
x2 = 8.0
x2 = 6.0 3
Integer Solution
5
2
1 x2
Solution Bounds 10 11
Solution Bounds 0
Obj. = 164 0  x1  2 Obj. = 168 3  x1  3 0 1 2 3 4 5 6 7 8 9 10
x1 = 1.9 8  x2  10 6 7 x1 = 3.0 8  x2  10
x2 = 8.4 x2 = 9.0
Integer Solution
6 9
Solution Bounds
Obj. = 166 0  x1  2 7 8
x1 = 2.0 8  x2  8 Solution Bounds
x2 = 8.0 infeasible 0  x1  2
8 9
Integer Solution 9  x2  10 Source: J. Doucette, Ph.D. Thesis, UofA, 2004

32
Example – Branch and Bound (9)
Solution Bounds
1
Obj. = 151 0  x1  10
x1 = 3.4 0  x2  10
1 x2 = 6.8
3
Solution Bounds 14 15 x1
Obj. = 156 0  x1  3 Solution Bounds
x1 = 2.4 0  x2  10 Obj. = 167 4  x1  10 10
2 3
x2 = 7.6 x1 = 4.0 0  x2  10 9
x2 = 7.4 8
2 13 7
3 4 Solution Bounds 6
Solution Bounds Obj. = 162 0  x1  3 5
Obj. = 169 0  x1  3 x1 = 2.9 8  x2  10
x1 = 3.0 0  x2  7 4 5 4
x2 = 8.0
x2 = 6.0 3
Integer Solution
5 12
2
1 x2
Solution Bounds 10 11
Solution Bounds 0
Obj. = 164 0  x1  2 Obj. = 168 3  x1  3 0 1 2 3 4 5 6 7 8 9 10
x1 = 1.9 8  x2  10 6 7 x1 = 3.0 8  x2  10
x2 = 8.4 x2 = 9.0
Integer Solution
6 9
Solution Bounds
Obj. = 166 0  x1  2 7 8
x1 = 2.0 8  x2  8 Solution Bounds
x2 = 8.0 infeasible 0  x1  2
8 9
Integer Solution 9  x2  10 Source: J. Doucette, Ph.D. Thesis, UofA, 2004

16
33
Example – Branch and Bound (10)
Solution Bounds
1
Obj. = 151 0  x1  10
x1 = 3.4 0  x2  10
1 x2 = 6.8

Solution Bounds 14 15 x1
Obj. = 156 0  x1  3 Solution Bounds
x1 = 2.4 0  x2  10 Obj. = 167 4  x1  10 10
2 3
x2 = 7.6 x1 = 4.0 0  x2  10 9
x2 = 7.4 8
2 13 7
3 4 Solution Bounds 6
Solution Bounds Obj. = 162 0  x1  3 5
Obj. = 169 0  x1  3 x1 = 2.9 8  x2  10
x1 = 3.0 0  x2  7 4 5 4
x2 = 8.0
x2 = 6.0 3
Integer Solution
5 12
2
1 x2
Solution Bounds 10 11
Solution Bounds 0
Obj. = 164 0  x1  2 Obj. = 168 3  x1  3 0 1 2 3 4 5 6 7 8 9 10
x1 = 1.9 8  x2  10 6 7 x1 = 3.0 8  x2  10
x2 = 8.4 x2 = 9.0
Integer Solution
Solution Bounds
6 9 Overall best solution:
Obj. = 166 0  x1  2 7 8
x1 = 2.0 8  x2  8 Solution Bounds
x1 = 2 and x2 = 8
x2 = 8.0 infeasible 0  x1  2
8 9
Integer Solution 9  x2  10 Source: J. Doucette, Ph.D. Thesis, UofA, 2004

34
Branch and Bound Take Home

Max Z = 2x1  x2
Subject to: 5 x1  2 x2  8
x1  x2  3
x1, x2  0; x1 integer

17

You might also like