1

I have to create a PHP script that would generate an optimal schedule for several student assistants. User input is the student assistant's class schedule, and from this information his free time will be extracted. From his free time an optimal schedule will be generated for him and other student assistants.

I'm stumped, as I have no idea how to tackle this problem. A google search didn't help, too. I really would appreciate any help with this.

Gannicus
  • 530
  • 1
  • 7
  • 26

1 Answers1

1

I ran into the same problem where I had to implement it for a coding challenge so I'll try to save you some time: you should start by reading about the Hungarian algorithm (also called: Kuhn–Munkres algorithm). I'd recommend on putting extra attention to the "Matrix interpretation" which describes a step-by-step method to solve the problem. Even though it's being described as assigning "N workers to N tasks" - you can get over the "symmetry" problem by adding as many rows/columns as needed and applying extremely high/low values to those rows/columns (depends if you want to find the maximum vs. the minimum). You can find a code example in C here.

Nir Alfasi
  • 53,191
  • 11
  • 86
  • 129
  • Thanks for the resources! I'll try to read up on these and hope I can finally gain some insight on how to get started. Thanks again! – Gannicus Apr 21 '13 at 17:18