Integer Linear Programming: ILP Milp Bilp
Integer Linear Programming: ILP Milp Bilp
1
Formulating IPL, MILP, BILP problems
Integer variables (a.k.a. general integer variables) without any
other restrictions can take the values of 0, 1, 2, 3, …
Binary integer variables (a.k.a binary variables) can only
be 0 or 1.
Typically, stating that some or all variables must be
integer or binary is rather easy.
MAX: 350X1 + 300X2
S.T.: 1X1 + 1X2 <= 200
9X1 + 6X2 <= 1566
12X1 + 16X2 <= 2880
X1, X2>= 0 and must be integer
2
Solving ILPs
With ILPs there are no more corners to jump to, in
search of the best (optimum) corner!
Rounding or truncating the optimal solution does not
guarantee optimality and feasibility.
Branch & bound based algorithms are widely used.
Consider:
Max 5x1 + 8x2
st
x1 + x2 <= 6
5x1 + 9x2 <= 45
x1, x2 >= 0 and integer
3
o.f.v.=
x1 =
x2 =
o.f.v.= o.f.v.=
x1 = x1 =
x2 = x2 =
o.f.v.= o.f.v.=
x1 = x1 =
x2 = x2 =
o.f.v.= o.f.v.=
x1 = x1 =
x2 = x2 =
4
B & B Example
7
X2
6X <= 1 X1 >=2
1
X2 >=4
4
3
X2 <=3
2
0
0 1 2 3 4 5 6 7 8 9 10
X1
5
An Employee Scheduling Problem: Air-Express
Air- Express is an express shipping service that guarantees overnight
delivery of packages anywhere in the continental United States. The
company has various operations centers, called hubs, at airports in
major cities across the country. Packages are received at hubs from
other locations and then shipped to intermediate hubs or to their final
destinations. The manager of the Air- Express hub in Baltimore,
Maryland, is concerned about labor costs at the hub and is interested in
determining the most effective way to schedule workers. The hub
operates seven days a week, and the number of packages it handles
each day varies from one day to the next. Using historical data on the
average number of packages received each day, the manager estimates
the number of workers needed to handle the packages as:
Day of Week Workers Needed
Sunday 18
Monday 27
Tuesday 22
Wednesday 26
Thursday 25
Friday 21
Saturday 19
6
Air-Express Cont’d
The package handlers working for Air- Express are unionized and are
guaranteed a five- day work week with two consecutive days off. The base
wage for the handlers is $ 655 per week. Because most workers prefer to
have Saturday or Sunday off, the union has negotiated bonuses of $ 25 per
day for its members who work on these days. The possible shifts and
salaries for package handlers are:
Shift Days Off Wage
1 Sun & Mon $680
2 Mon & Tue $705
3 Tue & Wed $705
4 Wed & Thr $705
5 Thr & Fri $705
6 Fri & Sat $680
7 Sat & Sun $655
The manager wants to keep the total wage expense for the hub as low as
possible. With this in mind, how many package handlers should be
assigned to each shift if the manager wants to have a sufficient number of
workers available each day?
Objective? Decision variables? Model, setup in Excel, solve via solver.
7
An Employee Scheduling Problem:
Air-Express - Summary Facts
Day of Week Workers Needed Shift Days Off Wage
Sunday 18 1 Sun & Mon $680
Monday 27 2 Mon & Tue $705
Tuesday 22 3 Tue & Wed $705
Wednesday 26 4 Wed & Thr $705
Thursday 25 5 Thr & Fri $705
Friday 21 6 Fri & Sat $680
Saturday 19 7 Sat & Sun $655
8
Formulation
Xi = the number of workers assigned to shift i, i=1 ,7
9
Binary integer variables
Example 6.11 Capital Budgeting Problem
10
Formulation
Let Xi = 1 if project i selected, 0 otherwise
max ROI as measured by NPV
Max 14X1 + 187X2 + … + 127X6
ST
YEAR 1) 75X1 + 90X2 + … + 50X6 <= 250
YEAR 2) 25X1 + … + 20X6 <= 75
…
YEAR 5) 10X1 + … + 40X6 <= 50
11
Binary Variables & Logical Conditions
Binary variables are also useful in modeling a number of logical
conditions. For example:
Of projects 1, 3 & 6, no more than one may be selected
X1 + X3 + X6 <= 1
12
Health Care Systems of Florida
Health Care Systems of Florida ( HCSF) is planning to build a number
of new emergency- care clinics in central Florida. HCSF management
has divided a map of the area into seven regions. They want to locate
the emergency centers so that all seven regions will be conveniently
served by at least one facility. Five possible sites are available for
constructing the new facilities. The regions that can be served
conveniently by each site are indicated by X in the following table:
a. Formulate as an ILP.
b. Implement the formulation on Excel to solve using solver.
13
The Fixed-Charge Problem
Remington Manufacturing
1, if X i 0
Yi i 1,2,3
0, if X i 0
14
Potential Pitfall
Do not use IF( ) functions to model the relationship between
the Xi and Yi.
Suppose cell A5 represents X
Suppose cell A6 represents Y
You’ll want to let A6 = IF(A5>0,,0)
This will make the model nonlinear and may not work with
Standard Solver. However, ASPE will attempt to linearize
the model if it can it will then use a simplex (like) algorithm
to solve it (much faster and optimality guaranteed as long as
a solution exists).
It is best to treat the Yi variables just like any other variable.
Make them changing cells.
Use the linking constraints to enforce the proper relationship
between the Xi and Yi
15
Rem. Man. Formulation
Max 48x1 + 55x2 +50x3 –1000y1 – 800y2 – 900y3
ST
2x1 + 3x2 + 6x3 <= 600
6x1 + 3x2 + 4x3 <= 300
5x1 + 6x2 + 2x3 <= 400
!x1 <= My1 (“M” a large number, e.g., 999)
x2 <= 999y2
x3 <= 999y3
xi >= 0 (and integer, if desired/needed)
How large (or small) should (could) “M” be?
Carefully study chap. 6 section: Determining Values for “Big M”
And my recorded explanation too.
16
Radford Castings…
17
Useful tricks with binary variables
Either-or-constraints: where a choice can be made between two
constraints, so that only one must hold.
either 3x1 + 2x2 <= 18 (1)
or x1 + 4x2 <= 16 (2)
Let y = 0 if constraint (1) must hold, 1 if constraint (2) must hold,
re-write the two constraints as:
3x1 + 2x2 <= 18 + (a large number)y
x1 + 4x2 <= 16 + (a large number)(1 -y)
18
K out of N constraints must hold
Suppose we have three assembly lines for a product
but only one can be used at a given time.
19
Two Formulation Exercises
#23 The Clampett Oil Co. has a tanker truck….
Group Exercises:
The Carolinian Textiles -Part (b)
Case 6.2 Power Dispatching
20
The Clampett Oil Co. has a tanker truck…
The Clampett Oil Company has a tanker truck that it uses to deliver
fuel to customers. The tanker has five different storage
compartments with capacities to hold 2,500, 2,000, 1,500, 1,800 and
2,300 gallons, respectively. The company has an order to deliver
2,700 gallons of diesel fuel; 3,500 gallons of regular unleaded
gasoline; and 4,200 gallons of premium unleaded gasoline. If each
storage compartment can hold only one type of fuel, how should
Clampett Oil load the tanker? If it is impossible to load the truck
with the full order, the company wants to minimize the total number
of gallons by which the order is short. (Hint: Consider using slack
variables to represent shortage amounts.)
a) Formulate an ILP model for this problem.
b) Implement this model in a spreadsheet and solve it.
c) What is the optimal solution?
21
Howie’s Carpet World…
Howie’s Carpet World has just received an order for carpets for a
new office building. The order is for 4,000 yards of carpet 4 feet
wide, 20,000 yards of carpet 9 feet wide, and 9,000 yards of carpet
12 feet wide. Howie can order two kinds of carpet rolls, which he
will then have to cut to fill this order. One type of roll is 14 feet
wide, 100 yards long, and costs $ 1,000 per roll; the other is 18 feet
wide, 100 yards long, and costs $ 1,400 per roll. Howie needs to
determine how many of the two types of carpet rolls to order and
how they should be cut. He wants to do this in the least costly way
possible.
a) Formulate an LP model for this problem.
b) Create a spreadsheet model for this problem and solve it using
Solver.
c) What is the optimal solution?
d) Suppose Howie wants to minimize waste. Would the solution
change?
22