我一直想知道是否有已知的创建学校时间表的算法解决方案。基本上,它是关于优化给定班级-学科-教师协会的“时间分散”(在教师和班级情况下)。我们可以假设我们有一组在输入时相互关联的课程、课程科目和教师,并且时间表应适合上午 8 点到下午 4 点之间。
我想可能没有准确的算法,但也许有人知道一个很好的近似值或开发它的提示。
I've been wondering if there are known solutions for algorithm of creating a school timetable. Basically, it's about optimizing "hour-dispersion" (both in teachers and classes case) for given class-subject-teacher associations. We can assume that we have sets of classes, lesson subjects and teachers associated with each other at the input and that timetable should fit between 8AM and 4PM.
I guess that there is probably no accurate algorithm for that, but maybe someone knows a good approximation or hints for developing it.
发布评论
评论(17)
这个问题是NP完全问题!
简而言之,我们需要探索所有可能的组合,以找到可接受的解决方案列表。由于不同学校出现问题的情况有所不同(例如:教室是否有限制?、某些班级是否有时会分成小组?、这是每周的时间表吗?)等)不存在与所有调度问题相对应的众所周知的问题类别。也许,背包问题与这些问题有许多相似之处大的。
要确认这既是一个难题,又是人们不断寻求解决方案的问题,请检查此(长)(主要是商业)软件调度工具列表
由于涉及大量变量,其中最大的来源通常是教师成员的愿望;-)...,考虑枚举所有可能的组合通常是不切实际的。相反,我们需要选择一种访问问题/解决方案空间子集的方法。
- 另一个答案中引用的遗传算法(或者,恕我直言,似乎)能够很好地执行这种半引导搜索(问题是找到一个好的评估为下一代保留候选人的功能)
- 图重写方法也可用于此类组合优化问题。
我不想专注于自动计划生成器程序的特定实现,而是想建议一些可以在问题定义层面应用的策略 .
一般的理由是,在大多数现实世界的调度问题中,需要一些妥协,而不是所有明示和暗示的约束:都将得到完全满足。因此,我们通过以下方式帮助自己:
这可能看起来违反直觉,但例如通过提供初始值,部分填充的时间表(例如大约 30% 的时隙),以完全满足所有约束的方式,并且通过考虑此部分时间表不可变,我们显着减少了生成候选解决方案所需的时间/空间。
另一个额外约束的帮助方式是例如“人为”添加一个约束,阻止在一周的某些日子教授某些科目(如果这是每周的时间表......);这种类型的约束会导致问题/解决方案空间的减少,并且通常不会排除大量好的候选者。
在校对这个答案时,我意识到它很羞于提供一个明确的答复,但仍然充满了实际的建议,我希望这对解决“难题”有所帮助。
This problem is NP-Complete!
In a nutshell one needs to explore all possible combinations to find the list of acceptable solutions. Because of the variations in the circumstances in which the problem appears at various schools (for example: Are there constraints with regards to classrooms?, Are some of the classes split in sub-groups some of the time?, Is this a weekly schedule? etc.) there isn't a well known problem class which corresponds to all the scheduling problems. Maybe, the Knapsack problem has many elements of similarity with these problems at large.
A confirmation that this is both a hard problem and one for which people perennially seek a solution, is to check this (long) list of (mostly commercial) software scheduling tools
Because of the big number of variables involved, the biggest source of which are, typically, the faculty member's desires ;-)..., it is typically impractical to consider enumerating all possible combinations. Instead we need to choose an approach which visits a subset of the problem/solution spaces.
- Genetic Algorithms, cited in another answer is (or, IMHO, seems) well equipped to perform this kind of semi-guided search (The problem being to find a good evaluation function for the candidates to be kept for the next generation)
- Graph Rewriting approaches are also of use with this type of combinatorial optimization problems.
Rather than focusing on particular implementations of an automatic schedule generator program, I'd like to suggest a few strategies which can be applied, at the level of the definition of the problem.
The general rationale is that in most real world scheduling problems, some compromises will be required, not all constraints, expressed and implied: will be satisfied fully. Therefore we help ourselves by:
This may seem counter-intuitive but for example by providing an initial, partially filled schedule (say roughly 30% of the time-slots), in a way that fully satisfies all constraints, and by considering this partial schedule immutable, we significantly reduce the time/space needed to produce candidate solutions.
Another way additional constraints help is for example "artificially" adding a constraint which prevent teaching some subjects on some days of the week (if this is a weekly schedule...); this type of constraints results in reducing the problem/solution spaces, without, typically, excluding a significant number of good candidates.
In proof-reading this answer , I realize it is quite shy of providing a definite response, but it none the less full of practical suggestions. I hope this help, with what is, after all, a "hard problem".
真是一团糟。皇家混乱。为了补充已经非常完整的答案,我想指出我的家庭经历。我的母亲是一名教师,曾经参与过这个过程。
事实证明,让计算机这样做不仅本身很难编码,而且还很困难,因为有些条件很难指定给预先烘焙的计算机程序。示例:
正如你所看到的,这个问题不是 NP 完全问题,而是 NP 疯狂问题。
所以他们所做的就是有一张大桌子,上面有小塑料镶嵌物,然后移动这些镶嵌物,直到获得满意的结果。他们从不从头开始:他们通常从上一年的时间表开始并进行调整。
It's a mess. a royal mess. To add to the answers, already very complete, I want to point out my family experience. My mother was a teacher and used to be involved in the process.
Turns out that having a computer to do so is not only difficult to code per-se, it is also difficult because there are conditions that are difficult to specify to a pre-baked computer program. Examples:
As you can see, the problem is not NP-complete, it's NP-insane.
So what they do is that they have a large table with small plastic insets, and they move the insets around until a satisfying result is obtained. They never start from scratch: they normally start from the previous year timetable and make adjustments.
2007 年国际时间表竞赛有一个课程安排轨道和考试安排轨道。许多研究人员参加了那次比赛。人们尝试了很多启发式算法和元启发式算法,但最终局部搜索元启发式算法(例如禁忌搜索和模拟退火)明显击败了其他算法(例如遗传算法)。
看看一些决赛入围者使用的 2 个开源框架:
The International Timetabling Competition 2007 had a lesson scheduling track and exam scheduling track. Many researchers participated in that competition. Lots of heuristics and metaheuristics were tried, but in the end the local search metaheuristics (such as Tabu Search and Simulated Annealing) clearly beat other algorithms (such as genetic algorithms).
Take a look at the 2 open source frameworks used by some of the finalists:
我的期中作业之一是遗传算法学校表格生成。
整张桌子就是一个“有机体”。通用遗传算法方法有一些变化和警告:
针对“非法表格”制定了规则:同一教室里有两个班级,一名教师同时教授两个小组等。这些突变被立即视为致命的,并且一个新的“有机体”立即在“死者”的位置上萌芽。最初的一个是通过一系列随机尝试生成的,以获得合法的(如果毫无意义的话)。致命突变不计入迭代突变计数。
“交换”突变比“修改”突变更常见。变化只发生在基因中有意义的部分之间——不能用教室代替老师。
将某些 2 小时捆绑在一起、为同一组按顺序分配相同的通用教室、保持教师的工作时间和班级负荷连续,会获得小额奖金。如果为特定科目提供正确的教室、将上课时间控制在一定范围内(上午或下午)等,则会获得适度的奖金。大奖金是分配给定科目的正确数量、给定教师的工作量等。
教师可以创建“然后想工作”,“然后可以工作”,“然后不喜欢工作”的工作量计划”、“那么无法工作”,并分配了适当的权重。整个 24 小时都是合法的工作时间,除了晚上的时间是非常不受欢迎的。
权重函数...哦是的。权重函数是分配给选定特征和属性的权重的巨大且巨大的乘积(如乘法)。它非常陡峭,一种属性很容易就能将其向上或向下改变一个数量级——而且一个有机体中有数百或数千种属性。这导致权重的数字绝对巨大,并且直接结果是需要使用 bignum 库 (gmp) 来执行计算。对于大约 10 个小组、10 名教师和 10 个教室的小型测试用例,初始集以 10^-200something 的音符开始,以 10^+300something 的音符结束。当它更平坦时,它的效率完全低下。此外,随着“学校”规模的扩大,这些值的距离也会变得更宽。
就计算时间而言,长时间的小群体(100)和少代的大群体(10k+)之间几乎没有区别。相同时间的计算产生了大致相同的质量。
对于上述 10x10x10 测试用例,计算(在某些 1GHz CPU 上)需要大约 1 小时才能稳定在 10^+300 附近,生成看起来相当不错的时间表。
通过提供在运行计算的计算机之间交换最佳样本的网络设施,该问题可以轻松并行化。
通过提供在运行计算的计算机之间交换最佳样本的网络设施,该问题
最终的项目从未让我在这个学期取得好成绩。它显示出了一些希望,但我从未有足够的动力来添加任何 GUI 并使其可供公众使用。
One of my half-term assignments was an genetic-algorithm school table generation.
Whole table is one "organism". There were some changes and caveats to the generic genetic algorithms approach:
Rules were made for "illegal tables": two classes in the same classroom, one teacher teaching two groups at the same time etc. These mutations were deemed lethal immediately and a new "organism" was sprouted in place of the "deceased" immediately. The initial one was generated by a series of random tries to get a legal (if senseless) one. Lethal mutation wasn't counted towards count of mutations in iteration.
"Exchange" mutations were much more common than "Modify" mutations. Changes were only between parts of the gene that made sense - no substituting a teacher with a classroom.
Small bonuses were assigned for bundling certain 2 hours together, for assigning same generic classroom in sequence for the same group, for keeping teacher's work hours and class' load continuous. Moderate bonuses were assigned for giving correct classrooms for given subject, keeping class hours within bonds (morning or afternoon), and such. Big bonuses were for assigning correct number of given subject, given workload for a teacher etc.
Teachers could create their workload schedules of "want to work then", "okay to work then", "doesn't like to work then", "can't work then", with proper weights assigned. Whole 24h were legal work hours except night time was very undesired.
The weight function... oh yeah. The weight function was huge, monstrous product (as in multiplication) of weights assigned to selected features and properties. It was extremely steep, one property easily able to change it by an order of magnitude up or down - and there were hundreds or thousands of properties in one organism. This resulted in absolutely HUGE numbers as the weights, and as a direct result, need to use a bignum library (gmp) to perform the calculations. For a small testcase of some 10 groups, 10 teachers and 10 classrooms, the initial set started with note of 10^-200something and finished with 10^+300something. It was totally inefficient when it was more flat. Also, the values grew a lot wider distance with bigger "schools".
Computation time wise, there was little difference between a small population (100) over a long time and a big population (10k+) over less generations. The computation over the same time produced about the same quality.
The calculation (on some 1GHz CPU) would take some 1h to stabilize near 10^+300, generating schedules that looked quite nice, for said 10x10x10 test case.
The problem is easily paralellizable by providing networking facility that would exchange best specimens between computers running the computation.
The resulting program never saw daylight outside getting me a good grade for the semester. It showed some promise but I never got enough motivation to add any GUI and make it usable to general public.
我的时间表算法,在 FET 中实现(免费时间表软件,http://lalescu.ro/liviu/fet/ ,成功的应用):
该算法是启发式的。我将其命名为“递归交换”。
输入:一组活动 A_1...A_n 和约束。
输出:一组时间 TA_1...TA_n(每个活动的时间段。为简单起见,此处不包括房间)。该算法必须将每个活动放在一个时间段,并遵守约束。每个TA_i在0(T_1)和max_time_slots-1(T_m)之间。
约束:
C1) 基本:一系列不能同时进行的活动(例如,A_1 和 A_2,因为它们有相同的老师或相同的学生);
C2) 许多其他约束(为简单起见,此处排除)。
时间表算法(我将其命名为“递归交换”):
尝试将每个活动 (A_i) 放置在允许的时间段中,按照上述顺序,一次一个。搜索 A_i 的可用槽 (T_j),可以在其中放置此活动并遵守约束。如果有更多可用插槽,请随机选择一个。如果没有可用的,则进行递归交换:
一个。对于每个时隙 T_j,考虑如果将 A_i 放入 T_j 中会发生什么。将会有一系列与此移动不相符的其他活动(例如,活动 A_k 位于同一槽 T_j 上,并且与 A_i 具有相同的老师或相同的学生)。保留每个时间段 T_j 的冲突活动列表。
b。选择冲突活动数量最少的槽 (T_j)。假设此槽中的活动列表包含 3 个活动:A_p、A_q、A_r。
c。将 A_i 放置在 T_j 处,并使 A_p、A_q、A_r 未分配。
d。递归地尝试将A_p、A_q、A_r(如果递归级别不是太大,比如14,并且如果从步骤2开始计算的递归调用总数)放在A_i开始的位置不是太大,比如2*n),如步骤 2) 所示。
e。如果成功放置A_p、A_q、A_r,则成功返回,否则尝试其他时间段(转到步骤2 b)并选择下一个最佳时间段)。
f。如果所有(或合理数量的)时间段均尝试失败,则返回但不成功。
g。如果我们处于级别 0,并且我们没有成功放置 A_i,则像步骤 2 b) 和 2 c) 那样放置它,但不使用递归。我们现在还有 3 - 1 = 2 项活动要开展。转到步骤 2)(这里使用了一些避免循环的方法)。
My timetabling algorithm, implemented in FET (Free Timetabling Software, http://lalescu.ro/liviu/fet/ , a successful application):
The algorithm is heuristic. I named it "recursive swapping".
Input: a set of activities A_1...A_n and the constraints.
Output: a set of times TA_1...TA_n (the time slot of each activity. Rooms are excluded here, for simplicity). The algorithm must put each activity at a time slot, respecting constraints. Each TA_i is between 0 (T_1) and max_time_slots-1 (T_m).
Constraints:
C1) Basic: a list of pairs of activities which cannot be simultaneous (for instance, A_1 and A_2, because they have the same teacher or the same students);
C2) Lots of other constraints (excluded here, for simplicity).
The timetabling algorithm (which I named "recursive swapping"):
Try to place each activity (A_i) in an allowed time slot, following the above order, one at a time. Search for an available slot (T_j) for A_i, in which this activity can be placed respecting the constraints. If more slots are available, choose a random one. If none is available, do recursive swapping:
a. For each time slot T_j, consider what happens if you put A_i into T_j. There will be a list of other activities which don't agree with this move (for instance, activity A_k is on the same slot T_j and has the same teacher or same students as A_i). Keep a list of conflicting activities for each time slot T_j.
b. Choose a slot (T_j) with lowest number of conflicting activities. Say the list of activities in this slot contains 3 activities: A_p, A_q, A_r.
c. Place A_i at T_j and make A_p, A_q, A_r unallocated.
d. Recursively try to place A_p, A_q, A_r (if the level of recursion is not too large, say 14, and if the total number of recursive calls counted since step 2) on A_i began is not too large, say 2*n), as in step 2).
e. If successfully placed A_p, A_q, A_r, return with success, otherwise try other time slots (go to step 2 b) and choose the next best time slot).
f. If all (or a reasonable number of) time slots were tried unsuccessfully, return without success.
g. If we are at level 0, and we had no success in placing A_i, place it like in steps 2 b) and 2 c), but without recursion. We have now 3 - 1 = 2 more activities to place. Go to step 2) (some methods to avoid cycling are used here).
这个问题比看起来更难。
正如其他人提到的,这是一个 NP 完全问题,但让我们分析一下这意味着什么。
基本上,这意味着您必须考虑所有可能的组合。
但“看看”并不能告诉你需要做什么。
生成所有可能的组合很容易。它可能会产生大量数据,但是理解这部分问题的概念应该不会有太大问题。
第二个问题是判断给定的可能组合是好、坏还是比先前的“好”解决方案更好。
为此,您需要的不仅仅是“这是否是一个可能的解决方案”。
例如,同一位老师是否连续 X 周每周工作 5 天?即使这是一个可行的解决方案,也可能不是比两个人轮流让每个老师各做一周更好的解决方案。哦,你没想过吗?请记住,这是你要面对的人,而不仅仅是资源分配问题。
即使一名教师可以连续全职工作 16 周,与尝试在教师之间轮流的解决方案相比,这可能不是一个次优的解决方案,而且这种平衡很难构建到软件中。
总而言之,对于很多人来说,为这个问题找到一个好的解决方案是非常有价值的。因此,这不是一个容易分解和解决的问题。准备好制定一些不是 100% 的目标,并称它们“足够好”。
This problem is tougher than it seems.
As others have alluded to, this is a NP-complete problem, but let's analyse what that means.
Basically, it means you have to look at all possible combinations.
But "look at" doesn't tell you much what you need to do.
Generating all possible combinations is easy. It might produce a huge amount of data, but you shouldn't have much problems understanding the concepts of this part of the problem.
The second problem is the one of judging whether a given possible combination is good, bad, or better than the previous "good" solution.
For this you need more than just "is it a possible solution".
For instance, is the same teacher working 5 days a week for X weeks straight? Even if that is a working solution, it might not be a better solution than alternating between two people so that each teacher does one week each. Oh, you didn't think about that? Remember, this is people you're dealing with, not just a resource allocation problem.
Even if one teacher could work full-time for 16 weeks straight, that might be a sub-optimal solution compared to a solution where you try to alternate between teachers, and this kind of balancing is very hard to build into software.
To summarize, producing a good solution to this problem will be worth a lot, to many many people. Hence, it's not an easy problem to break down and solve. Be prepared to stake out some goals that aren't 100% and calling them "good enough".
更新:从评论中......也应该有启发式!
我会选择 Prolog ...然后使用 Ruby 或 Perl 或其他东西将您的解决方案清理成更漂亮的形式。
我(仍然)正在做与这个问题类似的事情,但使用与我刚才提到的相同的路径。 Prolog(作为一种函数式语言)确实使解决 NP-Hard 问题变得更加容易。
UPDATE: from comments ... should have heuristics too!
I'd go with Prolog ... then use Ruby or Perl or something to cleanup your solution into a prettier form.
I am (still) in the process of doing something similar to this problem but using the same path as I just mentioned. Prolog (as a functional language) really makes solving NP-Hard problems easier.
遗传算法通常用于此类调度。
发现这个例子(使用遗传算法制作课程表)非常符合您的要求。
Genetic algorithms are often used for such scheduling.
Found this example (Making Class Schedule Using Genetic Algorithm) which matches your requirement pretty well.
以下是我找到的一些链接:
学校时间表 - 列出了涉及的一些问题
学校时间表的混合遗传算法
日程安排实用程序和工具
Here are a few links I found:
School timetable - Lists some problems involved
A Hybrid Genetic Algorithm for School Timetabling
Scheduling Utilities and Tools
本文很好地描述了学校时间表问题及其算法方法:“SYLLABUS 的开发——面向学校和学院的交互式、基于约束的调度程序。"[PDF]
作者告诉我 SYLLABUS 软件仍在使用/开发中:http://www.scientia.com/uk/
This paper describes the school timetable problem and their approach to the algorithm pretty well: "The Development of SYLLABUS—An Interactive, Constraint-Based Scheduler for Schools and Colleges."[PDF]
The author informs me the SYLLABUS software is still being used/developed here: http://www.scientia.com/uk/
我正在研究一个广泛使用的调度引擎,它正是这样做的。是的,它是 NP 完全的;最好的方法寻求近似最佳解决方案。当然,有很多不同的方法可以说哪一种是“最佳”解决方案 - 例如,您的老师对他们的日程安排感到满意,还是学生进入所有课程更重要?
您需要尽早解决的绝对最重要的问题是是什么让一种调度该系统的方法比另一种更好?也就是说,如果我有一个时间表,琼斯夫人在 8 点教数学,史密斯先生在 9 点教数学,那么这比他们两人在 10 点教数学的时间表更好还是更差?这比琼斯夫人在 8 点教课、琼斯先生在 2 点教课更好还是更差?为什么?
我在这里给出的主要建议是尽可能地划分问题——也许是一个课程一个课程,也许一个一个老师,一个一个房间——然后首先解决子问题。在那里,您最终应该有多种解决方案可供选择,并且需要选择一个作为最可能的最佳解决方案。然后,努力使“早期”子问题在对其潜在解决方案进行评分时考虑到后期子问题的需求。然后,当您进入“无有效解决方案”状态时,也许可以研究如何使自己摆脱陷入困境的情况(假设您无法在早期子问题中预见到这些情况)。
本地搜索优化过程通常用于“打磨”最终答案以获得更好的结果。
请注意,我们通常在学校调度中处理资源高度受限的系统。学校全年不会有很多空房间,或者老师一天 75% 的时间都坐在休息室里。在解决方案丰富的环境中最有效的方法不一定适用于学校安排。
I work on a widely-used scheduling engine which does exactly this. Yes, it is NP-Complete; the best approaches seek to approximate an optimal solution. And, of course there are a lot of different ways to say which one is the "best" solution - is it more important that your teachers are happy with their schedules, or that students get into all their classes, for instance?
The absolute most important question you need to resolve early on is what makes one way of scheduling this system better than another? That is, if I have a schedule with Mrs Jones teaching Math at 8 and Mr Smith teaching Math at 9, is that better or worse than one with both of them teaching Math at 10? Is it better or worse than one with Mrs Jones teaching at 8 and Mr Jones teaching at 2? Why?
The main advice I'd give here is to divide the problem up as much as possible - maybe course by course, maybe teacher by teacher, maybe room by room - and work on solving the sub-problem first. There you should end up with multiple solutions to choose from, and need to pick one as the most likely optimal. Then, work on making the "earlier" sub-problems take into account the needs of later sub-problems in scoring their potential solutions. Then, maybe work on how to get yourself out of painted-into-the-corner situations (assuming you can't anticipate those situations in earlier sub-problems) when you get to a "no valid solutions" state.
A local-search optimization pass is often used to "polish" the end answer for better results.
Note that typically we are dealing with highly resource-constrained systems in school scheduling. Schools don't go through the year with a lot of empty rooms or teachers sitting in the lounge 75% of the day. Approaches which work best in solution-rich environments aren't necessarily applicable in school scheduling.
一般来说,约束规划是解决此类调度问题的好方法。在 Stack Overflow 和 Google 上搜索“约束编程”和调度或“基于约束的调度”将产生一些很好的参考。这并非不可能——只是在使用线性或整数优化等传统优化方法时有点难以思考。一个输出是 - 是否存在满足所有要求的时间表?这本身显然是有帮助的。
祝你好运 !
Generally, constraint programming is a good approach to this type of scheduling problem. A search on "constraint programming" and scheduling or "constraint based scheduling" both within stack overflow and on Google will generate some good references. It's not impossible - it's just a little hard to think about when using traditional optimization methods like linear or integer optimization. One output would be - does a schedule exist that satisfies all the requirements? That, in itself, is obviously helpful.
Good luck !
我为课程时间表和考试时间表设计了商业算法。第一次我使用整数规划;对于第二个,基于通过选择槽交换来最大化目标函数的启发式,与已经发展的原始手动过程非常相似。让此类解决方案被接受的主要因素是能够代表所有现实世界的约束;并且人类时间表人员无法找到改进解决方案的方法。最后,与数据库的准备、用户界面、报告房间利用率、用户教育等统计数据的能力相比,算法部分非常简单且易于实现。
I have designed commercial algorithms for both class timetabling and examination timetabling. For the first I used integer programming; for the second a heuristic based on maximizing an objective function by choosing slot swaps, very similar to the original manual process that had been evolved. They main things in getting such solutions accepted are the ability to represent all the real-world constraints; and for human timetablers to not be able to see ways to improve the solution. In the end the algorithmic part was quite straightforward and easy to implement compared with the preparation of the databases, the user interface, ability to report on statistics like room utilization, user education and so on.
是的,你可以用遗传算法来解决它。但你不应该:)。它可能太慢,参数调整可能太耗时等等。
还有其他成功的方法。全部在开源项目中实现:
请参阅此处时间表软件列表
You can takle it with genetic algorithms, yes. But you shouldn't :). It can be too slow and parameter tuning can be too timeconsuming etc.
There are successful other approaches. All implemented in open source projects:
See here for a timetabling software list
在我工作的地方,这个问题非常严重 - 想象一下,有 1800 个科目/模块,350 000 名学生,每个学生做 5 到 10 个模块,并且您希望在 10 周内完成一次考试,其中试卷长度为 1 小时到 3 天……加分点-所有考试都是在线的,但又不好,不能超过系统最大5k并发负载。所以,是的,我们现在正在云中的扩展服务器上执行此操作。
我们使用的“解决方案”只是根据模块与降序“冲突”的其他模块数量进行排序(学生两者都做),并“打包”它们,允许这些长论文实际上重叠,否则它根本无法完成吧。
因此,当事情变得太大时,我发现这种“启发式”是实用的……至少是这样。
This problem is MASSIVE where I work - imagine 1800 subjects/modules, and 350 000 students, each doing 5 to 10 modules, and you want to build an exam in 10 weeks, where papers are 1 hour to 3 days long... one plus point - all exams are online, but bad again, cannot exceed the system's load of max 5k concurrent. So yes we are doing this now in cloud on scaling servers.
The "solution" we used was simply to order modules on how many other modules they "clash" with descending (where a student does both), and to "backpack" them, allowing for these long papers to actually overlap, else it simply cannot be done.
So when things get too large, I found this "heuristic" to be practical... at least.
我不知道有人会同意这段代码,但我在自己的算法的帮助下开发了这段代码,并在 ruby 中为我工作。希望它能帮助那些正在寻找它的人
在下面的代码中,periodflag,dayflag subjectflag和teacherflag是具有相应id和布尔值的标志值的散列。
有任何问题请联系我......(-_-)
periodflag.each do |k2,v2|
I don't know any one will agree with this code but i developed this code with the help of my own algorithm and is working for me in ruby.Hope it will help them who are searching for it
in the following code the periodflag ,dayflag subjectflag and the teacherflag are the hash with the corresponding id and the flag value which is Boolean.
Any issue contact me.......(-_-)
periodflag.each do |k2,v2|
我尝试使用两阶段最大流并巧妙地构建图表来创建一个
您可以在这里看到它: https://github .com/Kemsekov/SchoolScheduleCreator
它允许
I tried to create one using two-staged max flow and cleverly building graph
You can see it here: https://github.com/Kemsekov/SchoolScheduleCreator
It allows to