Professional Documents
Culture Documents
Hiba EL HOUDI
Haitam Dhaibi
Basma BOUHOUAR
Hajar El MAATAOUI
CAPACITATED FACILITY LOCATION MODEL (CFL)
Consider a company with three potential sites for installing its warehouses and five
demand points to serve.
Which one(s) of the warehouses should be opened to minimize total fixed opening and
shipping costs such that the demands of all customers are assigned?
Assume that each site i has a yearly fixed cost fi =2000 and capacity=500.
Additionally, there is a transportation cost of 𝑐𝑖𝑗 per unit serviced from facility i to the
demand point j
The base data is given in the Table below.
Customer
1 2 3 4 5
(Demand node) j
Annual Demand j 80 270 250 160 180
Facility i
1 4 5 6 8 10
2 6 4 3 5 8
3 9 7 4 3 4
3
Subject to: ∑ xij = Dj for j= 1,2,3,4,5
i=1
The objective of the problem is to total fixed opening and shipping costs such that the
demands of all customers are assigned.
The first constraints require that each customer’s demand must be satisfied
The capacity of each facility i is limited by the second constraints: if facility i is activated, its
capacity restriction is observed; if it is not activated, the demand satisfied by i is zero.
Third constraints provide variable upper bounds.
# Desicion Variables
y = LpVariable.dicts("Use_Facility",I, 0, 1, LpBinary)
x = LpVariable.dicts("Service", [(i,j) for j in J for i in I], 0)
# Objective Function
prob += lpSum(f[i]*y[i] for i in I) + lpSum(c[i][j]*x[(i,j)] for i in I for j
in J)
# Costraints
for j in J:
prob += lpSum(x[(i,j)] for i in I) == D[j]
for i in I:
prob += lpSum(x[(i,j)] for j in J) <= A[i]*y[i]
for j in J:
for i in I:
prob += x[(i,j)] <= D[j]*y[i]
prob.solve()
# Total Cost
print("Total Cost = ", value(prob.objective))
The optimal solution obtained suggests establishing the facilities at Sites 2 and 3 only.
This solution incurs minimum total cost of 7610 for servicing all the demands.
4. Sensitivity analysis
Code :
o = [{'Name':name,'Constraint':c,'shadow price':c.pi,'slack': c.slack,} for
name, c in prob.constraints.items()]
analysis = pd.DataFrame(o)
analysis
Results :
Nam shadow
Constraint slack
e price
-
{Service_(1,_1): 1, Service_(2,_1): 1,
0 _C1 7.0 0.000000e+
Service...
00
00
-
{Service_(1,_3): 1, Service_(2,_3): 1,
2 _C3 4.0 0.000000e+
Service...
00
-
{Service_(1,_4): 1, Service_(2,_4): 1,
3 _C4 3.0 0.000000e+
Service...
00
-
{Service_(1,_5): 1, Service_(2,_5): 1,
4 _C5 4.0 0.000000e+
Service...
00
-
{Service_(1,_1): 1, Service_(1,_2): 1,
5 _C6 -3.0 0.000000e+
Service...
00
-
{Service_(2,_1): 1, Service_(2,_2): 1,
6 _C7 -1.0 0.000000e+
Service...
00
-
8 _C9 {Service_(1,_1): 1, Use_Facility_1: -80} 0.0 0.000000e+
00
-
9 _C10 {Service_(2,_1): 1, Use_Facility_2: -80} 0.0 0.000000e+
00
1 8.000000e+
_C11 {Service_(3,_1): 1, Use_Facility_3: -80} 0.0
0 01
-
1 {Service_(1,_2): 1, Use_Facility_1: -
_C12 0.0 0.000000e+
1 270}
00
0.000000e+
2 270}
00
-
1 {Service_(1,_3): 1, Use_Facility_1: -
_C15 0.0 0.000000e+
4 250}
00
-
1 {Service_(1,_4): 1, Use_Facility_1: -
_C18 0.0 0.000000e+
7 160}
00
-
1 {Service_(3,_4): 1, Use_Facility_3: -
_C20 0.0 0.000000e+
9 160}
00
-
2 {Service_(1,_5): 1, Use_Facility_1: -
_C21 0.0 0.000000e+
0 180}
00
For C1,C2,C3,C4,C5,C6,C7 and C13 are with a non null values of shadow price ,there fore a
change in the right hand value of the constraint by an unit with increase or decrease the
objective with the shadow price value.
The slack value gives the range within any change on the right hand value of the constraint
will not affect the objective.