1

I'm working on a personal project and I need some help getting my ideas straight on a scheduling algorithm.

Imagine you're hosting a conference:

  • Attendees need to be automatically assigned to 6 out of 8 possible workshops, and 2 out of 3 possible lectures throughout the day.
  • Attendees can only attend a workshop or lecture once (no scheduled repeats).
  • Everyone goes to lunch at noon.
  • Attendees should get one break before lunch and one break after.
  • Workshops are 30 minutes long and Lectures are 60 minutes long.
  • Lectures are only available at 9am, 11am, 1pm, and 3pm, otherwise the attendees are in a workshop or on break.

Ideally, the basic schedule will be one of two variants (the only difference is which lecture they attend and when):

  • 9am - noon: 3 workshops, a break, and a lecture (either A or B)
  • 1pm - 4pm: 3 workshops, a break, and a lecture (either B or C)

OR

  • 9am - noon: Lecture (either A or B), a break, 3 workshops
  • 1pm - 4pm: Lecture (either B or C), a break, 3 workshops

I have a list of employees, and I can structure the "session" info tables however I want. But in the end I need to be able to loop through employees, figure out a schedule and then store it so we can print it later.

How would you go about this? I'm more than happy to go into detail about other constraints / requirements.

Adam Stelmaszczyk
  • 19,665
  • 4
  • 70
  • 110
Oranges13
  • 1,084
  • 1
  • 10
  • 33
  • 1
    This is an example of a [constraint satisfaction problem](https://en.wikipedia.org/wiki/Constraint_satisfaction_problem) and, in general, these are NP-Complete. So don't feel bad about not being able to solve them too easily. The most intuitive type of solution is probably a backtracking one. Basically, you make some commitments about how to solve part of the problem. This could be 'committing' one employee to a certain schedule and then trying to fit the next employee in without any problems. If you can do this for all employees you have a solution. – Tony Tuttle Jul 13 '15 at 21:25
  • Is "Make everyone do the first of those 4 options" a valid schedule? If not then you need to give some more constraints. – j_random_hacker Jul 13 '15 at 21:40
  • The concern is that if we just go with the "first four options" it will front load some sessions and leave others in the dearth, especially if we end up with an odd number of attendees. – Oranges13 Jul 14 '15 at 21:19
  • @Oranges13: Right, then you need to explicitly incorporate that into the constraints or optimisation criterion somehow. E.g. by asking for a schedule that minimises the difference in attendance between the least-attended and most-attended events. – j_random_hacker Jul 15 '15 at 20:25

1 Answers1

0

Since our parameters for the type of schedule we wanted were fairly straight-forward:

  • 9am - noon: 3 workshops, a break, and a lecture (either A or B) 1pm
  • 4pm: 3 workshops, a break, and a lecture (either B or C)

OR

  • 9am - noon: Lecture (either A or B), a break, 3 workshops
  • 1pm - 4pm: Lecture (either B or C), a break, 3 workshops

This meant we had a limited amount of permutations that could be generated. The way we solved this was to generate an example schedule for each permutation (in our case, it was about 16 different schedules) and then print enough copies and randomly distribute them as employees arrived.

Oranges13
  • 1,084
  • 1
  • 10
  • 33