This repository contains C code implementations for solving the Uncapacitated Facility Location Problem (UFLP) using three approaches:
- ๐งฎ MIP model with CPLEX
- ๐ง Heuristic approach (constructive + local search)
- ๐ Lagrangian relaxation using the subgradient method
cap72.txt
: Example input instance with facility data, customer demands, and transportation costs.
def.h
: Function declarations and constants.main.c
(originallyHeuristic.c
): Executes all solving methods and prints results.ReadData.c
: Reads the input data and allocates/deallocates memory.solve_MIP_model.c
: Builds and solves the MIP formulation using IBM CPLEX.Heuristic.c
: Heuristic procedure for constructing a feasible solution and refining it via local search.Lagrange_relaxationv2.c
: Lagrangian relaxation with subgradient optimization.
Given:
- A set of potential facilities ( N )
- A set of customers ( M )
- Fixed cost ( f_i ) to open facility ( i )
- Transportation cost ( c_{ij} ) from facility ( i ) to customer ( j )
- Demand ( d_j ) for each customer
Minimize the sum of facility opening costs and customer servicing costs by:
- Deciding which facilities to open
- Assigning each customer to one open facility
You can compile with:
gcc -o uflp_solver src/*.c -lcplex -lm