39 lines
767 B
C
39 lines
767 B
C
#ifndef ROTAGEN_H
|
|
#define ROTAGEN_H
|
|
|
|
#include <stdbool.h>
|
|
|
|
#define MAX_JOBS 8
|
|
|
|
enum constraint_type {
|
|
JOB_EXEMPTION_CONSTRAINT,
|
|
SLOT_EXEMPTION_CONSTRAINT,
|
|
};
|
|
|
|
struct constraint {
|
|
int person;
|
|
enum constraint_type type;
|
|
union {
|
|
int job; /* Job constraints */
|
|
int slot; /* Slot constraints */
|
|
} object;
|
|
};
|
|
|
|
struct allocation {
|
|
int person;
|
|
int job;
|
|
int slot;
|
|
};
|
|
|
|
struct slot_result {
|
|
struct allocation allocations[MAX_JOBS];
|
|
};
|
|
|
|
void generate_rota(struct slot_result *rota_out);
|
|
void generate_allocation(int slot, int job, struct allocation *allocation_out);
|
|
bool satisfies_allocation_constraints(const struct allocation *allocation);
|
|
bool satisfies_slot_constraints(const struct slot_result *slot);
|
|
void print_rota(const struct slot_result *rota);
|
|
|
|
#endif
|