Is there a scheduling algorithm that optimizes for “maker's schedules”?

前端 未结 4 433
猫巷女王i
猫巷女王i 2021-01-30 23:26

You may be familiar with Paul Graham\'s essay, \"Maker\'s Schedule, Manager\'s Schedule\". The crux of the essay is that for creative and technical professional

相关标签:
4条回答
  • 2021-01-30 23:47

    This problem looks hard enough to be NP, but I think it admits some decent approximations.

    In particular, I think you can probably manage reasonably well with a meeting size optimization, where you optimally place the largest meeting (in terms of the number of makers who must attend, since they are the ones you're trying not to disrupt), and then do so successively with smaller meetings. To break ties in smaller meetings of the same length, you could weight the meetings by the meeting-load of the makers asked to participate (so that you will get a chance to optimize over them and not make their lives too much worse).

    Now you've broken the problem down to schedule a single meeting, since any already-scheduled meeting will effectively just reduce a person's schedule to shorter. And the solution is pretty straightforward: the optimal solution is the one aligned with a maximal number of edges of schedules of makers such that everyone can make that time. You should be able to solve this problem even with brute force in something like O((k+g)*k*n) where k is the number of makers, g the number of managers, and n the typical number of intervals in a maker's schedule.

    The only problem would be if this straightforward approach would lead to meetings that couldn't be satisfied. In this case, you could boost the priority of that meeting by one or more slots and try again.

    0 讨论(0)
  • 2021-01-30 23:58

    I remember implementing something very similar to your problem with A* search algorithm. You will easily find several implementation of the algorithm available but in order to apply it to the scheduling problem you will have to construct distance and heuristic functions based on your model and split continuous time into chunks.

    0 讨论(0)
  • 2021-01-31 00:05

    Try taking a look at Simulated Annealing. It's similar to Genetic Algorithms as Jeremy E describes, but instead of randomly generating your starting set of schedules you start with some valid but non optimal schedule. The idea is to generate some "neighbor" of the original schedule by randomly shuffling around some meeting times, then testing fitness before iterating.

    S' = Starting Schedule
    S = S'    
    while( Fitness( S ) < Minimum Fitness ) 
    {
        NS = Neighbor( S )
        if( Fitness( NS ) > Fitness( F ) )
        {
             S = NS
        }
    }
    Return( S )
    

    Instead of testing against some minimum fitness level, you could also specify a set number of iterations so you could deterministically tell when the program would finish executing.

    The thing about this algorithm is the final result tends to look like the starting state, so if you wanted to weight say a large meeting (in terms of size of makers) early in the day, you could do so.

    0 讨论(0)
  • 2021-01-31 00:11

    A good approximation for this can be had by the use of a Genetic algorithm.

    Write a function to create 1000 sample random schedules assigning makers and managers randomly.

    Write another function (fitness function) that assigns demerits to schedules with problems (people working at the same time, not enough makers, not enough managers, someone not worked enough, someone worked too much).

    foreach schedule assign calculate fitness keeping a reference to the lowest scoring (best) schedule.
    
    while (best schedule > minimum fitness value)
        foreach schedule s in population of schedules
            foreach time slot
               if (random < .5)
                   choose value from best schedule
               else
                   choose value from schedule s
               end if
           end foreach
           score schedule s with fitness function
        end foreach
    end while
    

    While this method will not produce an optimal schedule and has the possibility of finding local minimums. It will always produce a schedule and you can always add more constraints to the fitness function for any conditions you don't want to see. This type of algorithm can handle many different types of constraint satisifaction problems.

    I have personally used a similar algorithm to schedule my Wifes Co-Op preschool for the entire year in about two hours on my laptop.

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