after add slot Model is infeasible
Awaiting user inputHow to arrange the same task to start at the same time? – Gurobi Help Center
After I've added the slot to the calendar, when I try to add it to the constrain it turns out that the result is infeasible, which I'm not sure where I went wrong.
I've tried integrating the time slot into the calendar, but it doesn't work. Since there will be a problem that constrains gapworktime since it has dairy requirment which makes schedule inconsistency. Which now I still can't find a solution. If you can help that would be great.
# CONSTRAINTS # Number of manpowers should be less than or equal to the capacity
model.addConstrs(gp_manpower_status.sum(date, slot, "*", order) <= capacity_manpowers[(order)]
for date in calendar_list for slot in timeslot_list for order in order_list)
# Order Status should be 1 if any manpower working on that order
model.addConstrs(gp_order_status.sum("*", "*", order) == 1 for order in order_list)
model.addConstrs(gp_manpower_status[(date, slot, manpower, order)] <= gp_order_status[(date, slot, order)]
for date in calendar_list for slot in timeslot_list for manpower in manpower_list for order in order_list)
# Work Time Balance for any order is calculated by cycle time / summing up all manpowers status working on that order
model.addConstrs(gp_balance_worktime[(slot, order)] * gp_manpower_status.sum("*", slot, "*", order) == order_requirements[(order)]
for slot in timeslot_list for order in order_list)
# Work Time for each manpower should be equal to the balance work timebut considered with manpower status
model.addConstrs(gp_manpower_worktime[(date, slot, manpower, order)] == gp_manpower_status[(date, slot, manpower, order)] *gp_balance_worktime[(slot, order)] for date in calendar_list for slot in timeslot_list for manpower in manpower_list for order in order_list)
# Total work time of all orders for each of manpower in each day shouldnot exceed the regular work time
model.addConstrs(gp_manpower_worktime.sum(date, "*", manpower, "*") <= regular_work_mins for date in calendar_list for manpower in manpower_list)
# Free Time for each manpower should be equal to the regular work time minus the work time
model.addConstrs(gp_manpower_freetime[(date, manpower)] == regular_work_mins - gp_manpower_worktime.sum(date, "*", manpower, "*")
for date in calendar_list for manpower in manpower_list)
# Total work time = all required work time model.addConstr(gp.quicksum(gp_manpower_worktime[(date, slot, manpower, order)]
for date in calendar_list for slot in timeslot_list for manpower in manpower_list for order in order_list) ==
(gp.quicksum(daily_requirements[(date, order)] for date in calendar_list for order in order_list)))
# The same order should be done in the same day
model.addConstrs(gp_manpower_worktime.sum(date, slot, "*", order) == order_requirements[(order)] * gp_order_status[(date, slot, order)]
for date in calendar_list for slot in timeslot_list for order in order_list)
# Average working hours per day
model.addConstrs(gp_manpower_worktime.sum(date, "*", manpower, "*") <= gp_manpower_worktime.sum(date, "*", "*", "*") / max_manpower_possible + different_work_mins
for date in calendar_list for manpower in manpower_list)
model.addConstrs(gp_manpower_worktime.sum(date, "*", manpower, "*") >= gp_manpower_worktime.sum(date, "*", "*", "*") / max_manpower_possible - different_work_mins
for date in calendar_list for manpower in manpower_list)
# Set the value of gap worktime (positive for early, negative for late)
for l in range(len(calendar_list)):
model.addConstrs(gp_gap_worktime[(calendar_list[l], order)] == gp.quicksum(gp_manpower_worktime[(date, slot, manpower, order)]
for date in calendar_list[: l + 1] for slot in timeslot_list for manpower in manpower_list) - (gp.quicksum(daily_requirements[(date, order)]
for date in calendar_list[: l + 1])) for order in order_list)
# Set the value of ABS(gap worktime)
model.addConstrs(abs_gp_gap_worktime[(date, order)] == gp.abs_(gp_gap_worktime[(date, order)]) for date in calendar_list for order in order_list)
# Set the value of early worktime
model.addConstrs(early_worktime[(date, order)] ==
(gp_gap_worktime[(date, order)] + abs_gp_gap_worktime[(date, order)]) / 2
for date in calendar_list for order in order_list)
# Set the value of early benefits
model.addConstrs(early_benefit[(date, order)] == early_worktime[(date, order)] * priority_scores[order]
for date in calendar_list for order in order_list)
# Set the value of late worktime
model.addConstrs(late_worktime[(date, order)] == (abs_gp_gap_worktime[(date, order)] - gp_gap_worktime[(date, order)]) / 2
for date in calendar_list for order in order_list)
# Set the value of late costs
model.addConstrs(late_costs[(date, order)] == late_worktime[(date, order)] * priority_scores[order]
for date in calendar_list for order in order_list)
0
-
Please note that the model you posted in not reproducible, cf. minimal reproducible example. Usually, if you provide larger pieces of code, it is best to upload a file. Note that uploading files in the Community Forum is not possible but we discuss an alternative in Posting to the Community Forum.
Regarding the infeasibility, did you try to compute an IIS as discussed in the Knowledge Base article How do I determine why my model is infeasible?
0
Please sign in to leave a comment.
Comments
1 comment