I am trying to configure my PuLP problem to ensure an employee does not have more than 10 hours per day.
The employee variable I have set up is:
cost = []
vars_by_shift = defaultdict(list)
for employee, info in employees.iterrows():
for shift in info['availability']:
employee_var = pl.LpVariable("%s_%s" % (employee, shift), 0, 1, pl.LpInteger)
vars_by_shift[shift].append(employee_var)
cost.append(employee_var * info['base_rate'])
My objective is to minimize cost:
prob = pl.LpProblem("scheduling", pl.LpMinimize)
prob += sum(cost)
An example of my shift data is:
"76749": {
"start_date": "2019-08-14",
"start_time": "08:00",
"end_date": "2019-08-14",
"end_time": "12:00",
"duration": 4,
"number_positions": 1
},
"76750": {
"start_date": "2019-08-14",
"start_time": "13:00",
"end_date": "2019-08-14",
"end_time": "20:00",
"duration": 7,
"number_positions": 1
}
An employee sometimes can be assign two short shifts on the same day. I want to ensure the total hours an employee is rostered any given day does not exceed 10 hours. How would model that constraint?