从会员的谷歌文档生成时间表可用性

发布于 2024-11-01 06:59:18 字数 987 浏览 4 评论 0原文

我有一个谷歌文档电子表格,其中包含有关群组中每个成员是否可以在一周的特定时间见面的信息。一周内需要召开多次会议,小组的不同成员需要参加某些会议。我需要一种方法来生成一个基于此的时间表,以便大多数成员可以参加每次会议。所有会议都不能在同一时间段举行。

该表包含一行代表发生的每个会议。每列代表一个可以举行会议的时间段(例如,周一下午 6:30 至晚上 8:00)。与特定会议和特定时间段对应的单元格包含代表可以参加每个会议的人数的数字。如果单元格包含与注册参加会议的成员数量相同的数字,则 Google 文档会自动突出显示该单元格。

我试图通过使用谷歌文档的脚本功能来解决这个问题,但我在弄清楚算法时遇到了困难。我真正需要的只是一些伪代码,我可以编写它。

假设在我的脚本中,我有一个单元格的二维数组,以及一个与单元格是否突出显示相对应的二维布尔数组(意味着可以出席的最大成员数),

这是表格外观的示例喜欢:

|Meeting    |Mon 6:30-8:30pm |Mon 8:30-10:30pm |Tue 6:30-8:30pm |Tue 8:30-10:30pm |
|-----------|----------------|-----------------|----------------|-----------------|
|Meeting 1  |7               |9                |8               |6                |
|Meeting 2  |3               |5                |1               |4                |
|Meeting 3  |10              |15               |12              |8                |
|-----------|----------------|-----------------|----------------|-----------------|

谢谢你的帮助!

I have a google doc spreadsheet that contains information on every member of a group's availability to meet at certain times of the week. There are multiple meetings that need to take place during the week, with different members of the group needing to be at certain meetings. I need a way to generate a schedule based on this such that the most members can attend each meeting. None of the meetings can take place during the same time slot.

The table contains a row for each meeting that takes place. Each column represents a time slot (eg. Mon 6:30pm-8:00pm) that the meetings can take place. The cells corresponding to a certain meeting and a certain time slot contain a number representing the number of people that can attend each meeting. If the cell contains the same number as the number of members signed up for the meeting, then the cell gets highlighted automatically by google docs.

I am trying to solve this problem through the use of google docs' scripting capabilities to do this, but I am having trouble figuring out the algorithm. All I really need is some pseudocode and I can write it.

Assume in my script I have a two-dimensional array of the cells, as well as a two-dimensional boolean array corresponding to whether the cell is highlighted (meaning the maximum members can be in attendance)

Here is an example of what the table looks like:

|Meeting    |Mon 6:30-8:30pm |Mon 8:30-10:30pm |Tue 6:30-8:30pm |Tue 8:30-10:30pm |
|-----------|----------------|-----------------|----------------|-----------------|
|Meeting 1  |7               |9                |8               |6                |
|Meeting 2  |3               |5                |1               |4                |
|Meeting 3  |10              |15               |12              |8                |
|-----------|----------------|-----------------|----------------|-----------------|

Thanks for the help!

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

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

发布评论

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

评论(1

一口甜 2024-11-08 06:59:18

假设我明白您在说什么,您将必须首先选择安排会议的顺序。我能想到的最好的方法是,考虑到其他一切听起来都是平等的,首先简单地选择最多人可以参加的会议:

firstScheduled = max(max(meeting1), max(meeting2), max(meeting3));

之后,查看剩余的会议,看看哪一个会议的出席率最高在当前未安排的日期:

foreach meeting as m
    foreach day as d
        if d is currently scheduled
            m = 0  // set all attendees to 0; no one can come, since the'll be
                   // at the other meeting
        end if
    end for

    highestAttendanceDate = max(meeting1)
end for

然后迭代,直到所有会议都安排完毕。

Assuming I understand what you're saying, you're going to have to start by choosing the order to schedule the meetings. The best way I can think of, given that it sounds like all else is equal, is to begin by simply choose the meeting which the most people can attend:

firstScheduled = max(max(meeting1), max(meeting2), max(meeting3));

After that, look at the remaining meetings and see which one has the highest possible attendance on the currently unscheduled days:

foreach meeting as m
    foreach day as d
        if d is currently scheduled
            m = 0  // set all attendees to 0; no one can come, since the'll be
                   // at the other meeting
        end if
    end for

    highestAttendanceDate = max(meeting1)
end for

Then just iterate that through until all meetings are scheduled.

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