Day scheduling problem with hour-weights using ortools

Viewed 98

Following this great answer to a previous question of mine, I'm now wondering if it is possible to give weights to each one of the hours so as to force shifts to gravitate towards high-weighted hours, i.e. rush hours.

The cost of an assignment is given arbitrarily by a number of weights; one for each hour. fyr @Anatolii

@Laurent Perron: What I tried to do is the following: Assuming that each driver has a capacity of 2, then total capacity per shift cannot exceed the max capacity. How's that sound?

for shift_id in range(num_shifts):
    model.Add(
        sum(driver_shifts[(driver_id, shift_id)] for driver_id in range(num_drivers)) * 2 <=
        weights[shift_id])
1 Answers

Can you describe the cost of an assignment?

Something min(6 - start_hour, 0) * early_penalty + max(end_hour - 21) * late_penalty ?

First, write it down and add an objective to the model

Related