这就是最优调度任务NPC吗?

发布于 2024-09-15 04:19:18 字数 414 浏览 3 评论 0原文

我自愿编写一个程序来安排家​​长会。校长希望家长选择 3 个可能的约会时间(同时)拜访他们的英语和数学老师。

一旦所有家长都选择了 3 个日期时间,我就应该找出安排家长教师会议的最佳方式,以便最多数量的家长可以与两位老师会面。

(如果时间冲突,数学老师不能参加会议,家长只会和英语老师见面)

我对NP类型的问题了解不多,但是当我听到“最优”这个词时“安排”在一起,我开始怀疑......

我已经告诉校长我不能这样做,但我想知道它是否是 NP 完全的。如果是的话,假设有:

  • 500 位家长
  • 15 名英语老师
  • 5 名数学老师
  • 25 个可供选择的日期时间

可以在你奶奶的电脑上在几秒钟、几分钟或几小时内正确解决这个问题吗?

I volunteered to write a program to schedule parent-teacher conferences. The principal wants parents to select 3 possible datetimes to visit their english and math teacher (at the same time).

Once all the parents have selected 3 datetimes, I'm supposed to figure out the optimal way to schedule the parent-teacher conferences so the greatest number of parents can meet with both teachers.

(If there is a time conflict and the math teacher can't be at the conference, a parent will only meet with the english teacher)

I don't know much about NP type problems, but when I hear the word "optimal" and "schedule" together, I start to wonder...

I already told the principal I couldn't do that, but I wanted to know if it was NP complete. And if it is, assuming there are:

  • 500 parents
  • 15 english teachers
  • 5 math teachers
  • 25 datetimes to pick from

could this be solved correctly in a few seconds, minutes or hours on your grandma's computer?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

沙与沫 2024-09-22 04:19:18

好吧,我对你的问题有部分答案,并且有一个模拟,可以让我尝试不同的场景。以下是我的工作(但可变)假设:

  • 参数如您列出的那样
  • 家长对会议时间的选择遵循幂律(本福德分布),因为此模型模拟了预期的偏好不均匀性。
  • 根据运行情况,大约有 20 位家长“不妥协”,只能参加一次会议。
  • 每个英语老师都有一位且只有一位对应的数学老师,因为他们的相关性被认为很高,但我不知道有多高。该代码可以处理从 0 到 1 的任何相关系数。
  • 从生成合理的模拟父母(“史密斯”..“阿特金斯”)、教师、时间选择到令人满意的结果,整个过程在中型机器上花费了 300 毫秒(5300 BogoMIPS)。

我的第二阶优化甚至没有启动,因为第一次允许每个家长的第一选择在一次会话中最多容纳 11 名家长。对于必须参加大约一半时间段且平均家长人数约为 3 人的教师来说,这一结果并不是最优的。

如果有任何表达的兴趣,我可以提供代码,因为它大约有 125 行。

Well I have a partial answer to your question and a simulation that allows me to attempt different scenarios. Here are my working (but mutable) assumptions:

  • The parameters are as you list them
  • The choices of session times by parents follow a power law (Benford's Distribution) as this models the expected non-uniformity of preferrences
  • Depending upon the run, there were ~20 parents who were 'intransigent' and could only come at one session.
  • Each English teacher has one and only one corresponding Math teacher, as their correlation is presumed high but I don't know how high. The code can handle any correlation coefficient from 0 to 1.
  • The whole shebang from generating plausible simulated parents ('smith' .. 'atkins'), teachers, time selections, and satisfying results took 300 milliseconds on a midling machine (5300 BogoMIPS).

My second order optimizations didn't even kick in as the first pass allowed every parent's first choice to be accommodated with a maximum of 11 parents in one session. This result was sub-optimal for the teachers who had to attend about half the time slots with a mean parent group of ~3.

Given any expressed interest I can make the code available, as it is about 125 lines.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文