-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschedwork.h
39 lines (34 loc) · 1.42 KB
/
schedwork.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef SCHEDWORK_H
#define SCHEDWORK_H
#include <vector>
// type for the ID of a worker
typedef unsigned int Worker_T;
// n-by-k Matrix of each of the k workers' availability over an n-day period
typedef std::vector<std::vector<bool>> AvailabilityMatrix;
// n-by-d matrix with the d worker IDs who are scheduled
// to work on each of the n days
typedef std::vector<std::vector<Worker_T> > DailySchedule;
/**
* @brief Produces a work schedule given worker availability,
* the number of needed workers per day, and the maximum
* shifts any single worker is allowed. Returns true
* and the valid schedule if a solution exists, and false
* otherwise.
*
* @param [in] avail n x k vector of vectors (i.e. matrix) of the availability
* of the k workers for each of the n days
* @param [in] dailyNeed Number of workers needed per day (aka d)
* @param [in] maxShifts Maximum shifts any worker is allowed over
* the n day period (aka m)
* @param [out] sched n x d vector of vectors indicating the d workers
* who are scheduled to work on each of the n days
* @return true if a solution exists; sched contains the solution
* @return false if no solution exists; sched is undefined (can be anything)
*/
bool schedule(
const AvailabilityMatrix& avail,
const size_t dailyNeed,
const size_t maxShifts,
DailySchedule& sched
);
#endif