Teacher time schedule algorithm

前端 未结 8 710
灰色年华
灰色年华 2021-01-30 00:20

This is a problem I\'ve had on my mind for a long time. Being the son of a teacher and a programmer, it occurred to me early on... but I still haven\'t found a solution for it.<

8条回答
  •  北恋
    北恋 (楼主)
    2021-01-30 00:49

    This is a mapping problem: you need to map to every hour in a week and every teacher an activity (teach to a certain class or free hour ).

    Split the problem:

    1. Create the list of teachers, classes and preferences then let the user populate some of the preferences on a map to have as a starting point.
    2. Randomly take one element from the list and put it at a random free position on the map if it doesn't cross any sanity checks until the list is empty. If at any certain iteration you can't place an element on the map without crossing a sanity check shift two positions on the map and try again.
    3. When the map is filled, try shifting positions on the map to optimize the result.

    In steps 2 and 3 show each iteration to the user: items left in the list, positions on the map and the next computed move and let the user intervene.

    I did not try this, but this would be my initial approach.

提交回复
热议问题