MinRequiredResources

MinRequiredResources(num_days, periods, ...)

The "optimal" criteria is defined as the minimum weighted amount of resources (by optional shift cost), that ensures that there are never fewer resources shifted than the ones required per period

MinRequiredResources.solve()

Runs the optimization solver

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

The “optimal” criteria is defined as the minimum weighted amount of resources (by optional shift cost), that ensures that there are never fewer resources shifted than the ones required per period

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

cost_dict: dict, default = None

dictionary of form {shift: cost_value}, where shift must be the same options listed in the shifts_coverage matrix, and they must be all integers

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