Teacher time schedule algorithm

前端 未结 8 706
灰色年华
灰色年华 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:46

    I've tackled similar planning/scheduling problems in the past and the AI technique that is often best suited for this class of problem is "Constraint Based Reasoning".

    It's basically a brute force method like Laurenty suggested, but the approach involves applying constraints in an efficient order to cause the infeasible solutions to fail fast - to minimise the computation required.

    Googling "Constraint Based Reasoning" brings up a lot of resources on the technique and its application to scheduling problems.

    0 讨论(0)
  • 2021-01-30 00:49

    I'm not sure if this covers the same ground as @Stringent Software's answer (as the name is slightly different), but I have a couple of very good friends who are researching the area of Constraint Programming. Creating timetables is one application of their research.

    Dr Chris Jefferson created a program called Minion that you can download from SourceForge, and is a very fast brute force constraint problem solver written in C++

    0 讨论(0)
  • 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.

    0 讨论(0)
  • 2021-01-30 00:50

    This reminds me of this blog post about scheduling a conference, with a video explanation here.

    How I would do it:

    Have the population include two things:

    • Who teaches what class (I expect the teachers to teach one subject).
    • What a class takes on a specific time slot.

    This way we can't have conflicts (a teacher in 2 places, or a class having two subjects at the same time).

    The fitness function would include:

    • How many time slots each teacher gives per week.
    • How many time slots a teacher has on the same day (They can't have a full day of teaching, this too must be balanced).
    • How many time slots of the same subject a class has on the same day (They can't have a full day of math!).

    Maybe take the standard deviation for all of them since they should be balanced.

    0 讨论(0)
  • 2021-01-30 00:50

    I think you might be missing some constraints.

    One would prefer where possible to have teachers scheduled to classes for which they are certified.

    One would suspect that the classes that are requested, and the expected headcount in each would be significant.

    I think the place to start would be to list all of your constraints, figure out a data structure to represent them.

    Then create some sort of engine to that builds a trial solution, then evaluates it for fitness according to the constraints.

    You could then throw the fun genetic algorithms part at it, and see if you can get the fitness to increase over time as the genes mix.

    Start with a small set of constraints, and increase them as you see success (if you see success)

    There might be a way to take the constraints and shoehorn them together with something like a linear programming algorithm.

    I agree. It sounds like a fun challenge

    0 讨论(0)
  • 2021-01-30 00:51

    Answering my own question:

    The FET project mentioned by gnud uses this algorithm:

    Some words about the algorithm: FET uses a heuristical algorithm, placing the activities in turn, starting with the most difficult ones. If it cannot find a solution it points you to the potential impossible activities, so you can correct errors. The algorithm swaps activities recursively if that is possible in order to make space for a new activity, or, in extreme cases, backtracks and switches order of evaluation. The important code is in src/engine/generate.cpp. Please e-mail me for details or join the mailing list. The algorithm mimics the operation of a human timetabler, I think.

    Link


    Following up the "Constraint Based Reasoning" lead by Stringent Software on Wikipedia lead me to these pages which have an interesting paragraph:

    Solving a constraint satisfaction problem on a finite domain is an NP-complete problem in general. Research has shown a number of polynomial-time subcases, mostly obtained by restricting either the allowed domains or constraints or the way constraints can be placed over the variables. Research has also established relationship of the constraint satisfaction problem with problems in other areas such as finite model theory and databases.

    0 讨论(0)
提交回复
热议问题