English 中文(简体)
有效时间表
原标题:Effective Timetabling Algorithm
  • 时间:2010-09-24 07:07:46
  •  标签:
  • algorithm

我接受我所要求做的工作,其中涉及起草一项方案,以确定哪些人将在某一天工作。

For example the input may be:
4-6pm, Site A
1-2pm, Site B
9-11am & 2-4pm Site A

基本上可以有许多地点,人们可以在多个区段工作。 我感觉到,这种问题早就得到解决了,而不是重新发明了我所怀念的轮.,有些人希望我能够把我们引向一个棘手的解决办法。

Edit:阅读类似问题 我感到这个问题可能已经解决。 我不需要最高效的解决办法,而只有能够奏效并且能够合理地ok。

第2号:为了澄清,产出应当是一个时间表,配给人,因此差距(如果没有人工作的情况)尽可能小。

最佳回答

看像你那样试图解决一个非常专业化的软件应用问题。 如果你的问题太小,你可以尝试采取像以下那样的淡化武力做法:

  • Determine the granularity of your problem. E.g. if this is for a school time table, your granularity can be 1 hour.
  • Make instances for every time slot divided by the granularity. So for Site B there will be one instance (1-2pm), for size A there will be many instances (4-5pm, 5-6pm, 9-10am, 10-11am, ...).
  • Make instances for all the persons you want to assign
  • Then iteratively assign a person to a free time slot taking all of your constraints into account (like holiday, lunch break, only being able to do one thing at a time, maximum number of people per site, ...) until:
    • you have a valid solution (fine, print it out and exit the application)
    • you enter a situation where you still need to place persons but there is no valid time slot anymore. Then backtrack (undo the last action and try to find an alternative for it).

如果你的问题不是太大,你就可以在合理的时间内找到解决办法。

然而,如果问题开始变得大,则寻找更多的专用软件。 有待考虑的事项是“以制约为基础的优化”和“制约性方案拟订”。

例如,ECLIPSe工具是一种开放源的制约方案规划环境。 http://eclipseclp.org/examples/index.html 你可以发现的一个 example例子是SEND+MORE=MONEY。 在这个问题上,你有以下平衡:

    S E N D
+   M O R E
-----------
= M O N E Y

Replace every letter by a digit so that the sum is correct. This also illustrates that although you can solve this brute-force, there are more intelligent ways to solve this (see http://eclipseclp.org/examples/sendmore.pl.txt).

问题回答

暂无回答




相关问题
How to add/merge several Big O s into one

If I have an algorithm which is comprised of (let s say) three sub-algorithms, all with different O() characteristics, e.g.: algorithm A: O(n) algorithm B: O(log(n)) algorithm C: O(n log(n)) How do ...

Grokking Timsort

There s a (relatively) new sort on the block called Timsort. It s been used as Python s list.sort, and is now going to be the new Array.sort in Java 7. There s some documentation and a tiny Wikipedia ...

Manually implementing high performance algorithms in .NET

As a learning experience I recently tried implementing Quicksort with 3 way partitioning in C#. Apart from needing to add an extra range check on the left/right variables before the recursive call, ...

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

Enumerating All Minimal Directed Cycles Of A Directed Graph

I have a directed graph and my problem is to enumerate all the minimal (cycles that cannot be constructed as the union of other cycles) directed cycles of this graph. This is different from what the ...

Quick padding of a string in Delphi

I was trying to speed up a certain routine in an application, and my profiler, AQTime, identified one method in particular as a bottleneck. The method has been with us for years, and is part of a "...

热门标签