MinAbsDifference

MinAbsDifference(num_days, periods, ...[, ...])

The "optimal" criteria is defined as the number of resources per shift that minimize the total absolute difference between the required resources per period and the actual scheduling found by the solver

MinAbsDifference.solve()

Runs the optimization solver

class pyworkforce.scheduling.MinAbsDifference(num_days: int, periods: int, shifts_coverage: dict, required_resources: list, max_period_concurrency: int, max_shift_concurrency: int, max_search_time: float = 120.0, num_search_workers=2, *args, **kwargs)[source]

The “optimal” criteria is defined as the number of resources per shift that minimize the total absolute difference between the required resources per period and the actual scheduling found by the solver

Parameters:
num_days: int,

Number of days needed to schedule

periods: int,

Number of working periods in a day

shifts_coverage: dict,

dict with structure {“shift_name”: “shift_array”} where “shift_array” is an array of size [periods] (p), 1 if shift covers period p, 0 otherwise

required_resources: list,

Array of size [days, periods]

max_period_concurrency: int,

Maximum resources that are allowed to shift in any period and day

max_shift_concurrency: int,

Number of maximum allowed resources in the same shift

max_search_time: float, default = 240

Maximum time in seconds to search for a solution

num_search_workers: int, default = 2

Number of workers to search for a solution

solve()[source]

Runs the optimization solver

Returns:
solution: dict,

Dictionary with the status on the optimization, the resources to schedule per day and the final value of the cost function