I am modelling a capacitated facility location problem in
R with the
When I am removing the Capacity constraint, the model is giving me results. But when the constraint is added, it is showing infeasibility. I am trying to understand the implications of this result.
The cumulative capacity of the potential locations is more than the demand. So, there should be feasibility in the solution, right? I would expect more Facility locations than the Uncapacitated Solution and probably a higher solution cost. But why would there be infeasibility?
The code if anyone needs a reference:
model <- MIPModel() %>% # 1 if pin i gets assigned to warehouse j add_variable(x[i, j], i = 1:n, j = 1:m, type = "binary") %>% # 1 if warehouse j is built add_variable(y[j], j = 1:m, type = "binary") %>% # Objective function set_objective(sum_expr(transportcost_matrix[i, j] * x[i, j], i = 1:n, j = 1:m) + sum_expr(fixedcost * y[j], j = 1:m) + sum_expr((demand[i] * x[i, j])* rent_per_sqft[j], i = 1:n, j = 1:m), "min") %>% # Every pin needs to be assigned to a warehouse add_constraint(sum_expr(x[i, j], j = 1:m) == 1, i = 1:n) %>% # If a pin is assigned to a warehouse, then the warehouse must be built add_constraint(x[i,j] <= y[j], i = 1:n, j = 1:m) %>% #The demand of each warehouse shouldn't exceed their capacities add_constraint(sum_expr(demand[i] * x[i, j], i = 1:n) <= capacity[j] * y[j], j = 1:m)