This is an optimization problem. It is known as a planning problem, oddly enough.: - D Depending on the size of the data, you may need metaheuristics, for example, genetic algorithms, optimization of swarm ant, etc., But I would start here by copying my own rule-based heuristic.
In principle, define the rules as associations between things (person A cannot be on vacation and at work at the same time), or scheduled conditions (only three people at any given time). Then create a schedule and insert all your employees one at a time. If the rule is violated during insertion, then do not insert or select another employee.
It should be, if you do it right, come up with a correct, but less optimal schedule, and then you can do cool things, such as defining statements (swap, move, 3-swap), which will give you (all valid graphs that may be reached by operator application). Then you can select the best schedule in the neighborhood and repeat. This is a descent around the neighborhood. But there are many neighborhood-based methods to choose from. I believe that Simulated Annealing is good for scheduling tasks.
Tom macdonald
source share