JE
Jeevesh28/Facility-Location-Problem
Facility Location Problem solved using GurobiPy. Uncapacitated Facility Location Problem (UFLP) with and without Disruptions. Capacitated Facility Location Problem (CFLP).
Facility Location Problem ๐ญ
Problem Statement ๐
The Uncapacitated Facility Location Problem (UFLP) is the problem of finding the optimal placement of facilities of unrestricted capacities among potential facility (m) locations such that the cost of satisfying demands of all the customers (n) is minimized. Here, cost is of two types:
- (c): the service or connection cost to provide service to a customer by a facility
- (f): the opening cost to open a facility
UFLP is also known as the Simple Plant Location Problem (SPLP) or the Warehouse Location Problem (WLP). UFLP is known to be an NP-hard problem.
Initialising Customers and Facility with Random Coordinates ๐
Undisrupted Uncapacitated Facility Location Problem โฉ
Cost Function:
- Customer:
I = [i for i in range(0, n)] - Facility:
J = [i for i in range(0, m)] - Demand of Customer:
h = {i: rnd.randint(1, 10) for i in I} - 2-D cartesian product:
A = [(i, j) for i in I for j in J] - Fixed setup cost of Facility:
f = {j: 100 for j in J} - Cost to reach customer from Facility:
c = {(i, j): 1*np.hypot(xc[i]-xf[j], yc[i]-yf[j]) for (i, j) in A}
Result:
Disrupted Uncapacitated Facility Location Problem โถ๏ธ
Cost Function:
- High penalty for disrupted facility:
max_disruption = 10000 - Customer:
I = [i for i in range(0, n)] - Facility:
J = [i for i in range(0, m)] - Demand of Customer:
h = {i: rnd.randint(1, 10) for i in I} - 2-D cartesian product:
A = [(i, j) for i in I for j in J] - Fixed setup cost of Facility:
f = {j: 100 for j in J} - Cost to reach customer from Facility:
c = {(i, j): 1*np.hypot(xc[i]-xf[j], yc[i]-yf[j]) for (i, j) in A} - Penalty due to disruptions:
p = {j: rnd.choice(np.array((0, max_disruption // 4, max_disruption // 2, max_disruption)), p=[0.5, 0.25, 0.15, 0.1])
Result:
On this page
Languages
Jupyter Notebook96.3%Python3.7%
Contributors
Created August 31, 2021
Updated October 21, 2025


