MinRequiredResources

MinRequiredResources(num_days, periods, ...)

Minimizes the weighted number of scheduled resources while ensuring that every period has at least the required number of resources.

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, max_search_time: float = 240.0, num_search_workers: int = 2, *args, **kwargs)[source]

Minimizes the weighted number of scheduled resources while ensuring that every period has at least the required number of resources.

Parameters:
num_days: int,

Number of days to schedule.

periods: int,

Number of working periods in a day.

shifts_coverage: dict,

Dictionary of the form {"shift_name": shift_array}, where each shift_array has length periods and uses 1 when the shift covers a period, otherwise 0.

required_resources: list,

Array of size [days, periods].

max_period_concurrency: int,

Maximum resources allowed in any period and day.

max_shift_concurrency: int,

Maximum resources allowed in the same shift.

cost_dict: dict, default = None

Dictionary of the form {shift: cost_value}. It must contain the same shifts as shifts_coverage.

max_search_time: float, default = 240

Maximum time, in seconds, to search for a solution.

num_search_workers: int, default = 2

Number of workers used 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