I have room, which is opened some days in week, in different hours each day.
I have multiple students, each has time some days in week, in different hours.
Each student have to visit the room exactly once in the week, for exactly 50 minutes.
Room is unusable for 20 minutes after 2nd student the day, it means, that after the 2nd student have to be at least 20 minute break before 3rd. So something like this:
7:00-7:50
7:50-8:40
(20 mimutes break)
9:00-9:50
There is no break after 4th, 6th, ... student. Only after 2nd one.
How can I find best solution to this? I want to position all (or the most I can) students.
I've thought of using flow in network (see image). Groups (G1, G2, ...) group times (7:00, 7:05, ...) that are within 50 minutes of each other. Pairing student (S1, S2) with time would instantly disable any groups, that contains the time. But that would require to flow going IN->Student->Time-> to split into multiple groups ->Group1+Group2->OUT. How can I achieve this? How should I modify maximum flow search algorithms to do so?
Or is there better way how to do what I'm trying to accomplish?