Patient Scheduling Problem (Day & Slot Constraint - Infeasible Error)
AnsweredI have a patient scheduling problem. I am getting an infeasible error due to day and slot capacities. There is no problem when the number of days is 1, but it becomes infeasible when I increase it to 2. I'm sharing my parameters and the relevant constraints of the model. Could you help me resolve this error?"
day_capacities = {}
for f in physiotherapists:
if f in ft_AC:
for d in days:
day_capacities[(f, d)] = 24
elif f in ft_B:
for d in days:
day_capacities[(f, d)] = 16
elif f in ft_D:
for d in days:
day_capacities[(f, d)] = 36
elif f in ft_Dummy:
for d in days:
day_capacities[(f, d)] = 1
slot_capacities = {}
for f in physiotherapists:
if f in ft_AC:
for s in slots:
slot_capacities[(f, s)] = 3
elif f in ft_B:
for s in slots:
slot_capacities[(f, s)] = 2
elif f in ft_D:
for s in slots:
slot_capacities[(f, s)] = 4
elif f in ft_Dummy:
for s in slots:
slot_capacities[(f, s)] = 5
demand = {}
sessions_per_day = 15
...
m.addConstrs((gp.quicksum(x[f, p, s, d] * demand[(p, d)] for p in patients for s in slots) <= day_capacities[f, d] for f in physiotherapists for d in days), name="cons_day_capacities")
# The total number of patients assigned to ft f in the day d of the planning horizon cannot exceed ft capacity in slot s. (slot (hourly) treatment capacity)
m.addConstrs((gp.quicksum(x[f, p, s, d] for p in patients for d in days) <= slot_capacities[(f, s)] for f in physiotherapists for s in slots), name="cons_slot_capacities")
0
-
Official comment
This post is more than two years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum, or try Gurobot, our chatbot interface offering instant, expert-level support. -
Have you tried to run the Model.ComputeIIS() method on the infeasible model? It will let you know the smallest set of variables and constraints that make your model infeasible. To this end, the following articles will be helpful:
0
Post is closed for comments.
Comments
2 comments