具有季节性行为的应用程序的时间表
Schedules for applications with seasonal behaviour
I 运行 涵盖一年多的离散事件模拟。所有事件都需要在第二个时间尺度上进行跟踪。
现在,我想根据时间表安排活动,计算加班时间,......最后将其与实际劳动时间进行比较。
我想是否有一种优雅的方法可以在 R 中实现调度,以便可以在一行代码中回答以下 tasks/questions:
- 根据时间表安排工作。
- 给定一个时间表,我们期望每个day/week/month/...需要多少工时计算每个day/week/month/...
的加班时间
- 创建简单的绘图以可视化工作时间、加班时间……并将其与计划的工作量进行比较。
在抽象层面上,假设所有 时间表或多或少按以下方式给出:
Name Days_of_year Available Time
Name1 Jan-07 – Oct-18 Mon, Tues, Wed, Thurs, Fri, Sat, Sun 8:45 - 18:00
Name2 Jan-01 – Dec-31 Mon, Tues, Wed, Thurs, Fri 20:00 - 7:00
我不是在寻找像 "create an arry and somehow you get everything out of that" 这样明显的答案,而是在寻找 :
的实现
- 使计划独立于时间分辨率(天、小时、分钟、秒)。
- Schedules/timetables没有存储冗余信息。
- 任何结果(例如总劳动年数,......)都应该很容易地转移到任何给定的单位。
- 按月、工作日、……轻松过滤可能性
- 理想情况下,可以轻松使用日历功能(假期,...)。
- 可能作为 lubridate 的一部分?
用例视图("schedule functions" 表示为 s_):
- 时间:s_hm(„7:45“),s_md(„1 月 23 日“) 或 s_md(„01-23“)。请注意,那些 "times" 作为日期或日期时间没有意义,但在时间表的框架内它们完全有意义!
- 区间:s_interval。请参阅下面的第一个想法。
- 持续时间:s_interval/dhours(1) => 以小时为单位的持续时间
- 函数:
- Max(), Min() 在任何 s_interval
- %s_in%
- 给定一个日期,某人什么时候工作:
日期 %s_in% s_interval
=> return TRUE/FALSE (数组)
- 给定一个时间表,某个时间段内有人有空:
s_interval%s_in%区间
=> return class 区间 - 区间的子集!
- 给定一个间隔,是否按计划进行?计算空闲时间、超时时间和工作时间:
区间 %s_in%s_interval
=> return class s_interval
- 给定两个时间表,将它们视为一个单元。闲置时间、加班时间和工作时间如何分配:
(s_interval1 %+% s_interval2)
=> return class s_interval
一些想法:
schedule
计划工时:
s_interval $tzone UTC
$daysofyear 286 days (Better alternative: format month-day e.g. Jan-07 – Oct-18)
$wday Mon, Tues, ... Sun (According to the start time of a shift/lecture...)
$time 12 h (Better alternative: format time span* e.g. 8:00 – 18:00. NOT period which results in hours)
$overtime 0 h (A priori, a schedule does not plan overtime)
$idle 0 h (A priori, a schedule only plans labor time)
schedule
当实时数据可用时:
s_interval$tzone UTC
$daysofyear 286 days (Better alternative: format month-day e.g. Jan-07 – Oct-18)
$wday c(Mon, Tues, Wed, ...) (According to the start time of a shift/lecture...)
$time c(12 h, 1 h, 0.5 h, ...) (Better alternative: format time span* e.g. 8:00 – 18:00. NOT period which results in hours)
$overtime c(2 h, 0 h, -1 h, ...) total time = time + overtime. Array of lubridate intervals*?
$idle c(4 h, 8 h, 0h, ...) pure working_time = time – idle + overtime. Array of lubridate intervals*?
* Use intervals not periods such that interval/dhours(1) possible.
如果 tzone 相同,我们可以计算例如
s_interval1 %+% s_interval2 =
s_interval$tzone UTC
$daysofyear 286 days, 123 days
$wday c(Mon, Tues, Wed, ...), c(Sat, Sun)
$time c(12 h, 1 h, 0.5 h, ...), c(-1 h, 2.5 h)
$overtime c(2 h, 0 h, -1 h, ...), c(0 h, 5 h)
$idle c(4 h, 8 h, 0h, ...), c(4 h, 8 h)
有关于此主题的相关帖子visualization of schedules with some interesting answers concerning timeline
and gantt
packages and how to filter dates。
然而,他们并不是很确定。
由于我是 R 的新手,我不知道如何以最好的方式开始这样的任务,并且理解像 lubridate 这样的包的结构是非常先进的...
我开发了一个包,它提供了所需的功能(甚至带有绘图)。目前,该包是私人的,但如果您有兴趣,请告诉我。
I 运行 涵盖一年多的离散事件模拟。所有事件都需要在第二个时间尺度上进行跟踪。
现在,我想根据时间表安排活动,计算加班时间,......最后将其与实际劳动时间进行比较。
我想是否有一种优雅的方法可以在 R 中实现调度,以便可以在一行代码中回答以下 tasks/questions:
- 根据时间表安排工作。
- 给定一个时间表,我们期望每个day/week/month/...需要多少工时计算每个day/week/month/... 的加班时间
- 创建简单的绘图以可视化工作时间、加班时间……并将其与计划的工作量进行比较。
在抽象层面上,假设所有 时间表或多或少按以下方式给出:
Name Days_of_year Available Time
Name1 Jan-07 – Oct-18 Mon, Tues, Wed, Thurs, Fri, Sat, Sun 8:45 - 18:00
Name2 Jan-01 – Dec-31 Mon, Tues, Wed, Thurs, Fri 20:00 - 7:00
我不是在寻找像 "create an arry and somehow you get everything out of that" 这样明显的答案,而是在寻找 :
的实现- 使计划独立于时间分辨率(天、小时、分钟、秒)。
- Schedules/timetables没有存储冗余信息。
- 任何结果(例如总劳动年数,......)都应该很容易地转移到任何给定的单位。
- 按月、工作日、……轻松过滤可能性
- 理想情况下,可以轻松使用日历功能(假期,...)。
- 可能作为 lubridate 的一部分?
用例视图("schedule functions" 表示为 s_):
- 时间:s_hm(„7:45“),s_md(„1 月 23 日“) 或 s_md(„01-23“)。请注意,那些 "times" 作为日期或日期时间没有意义,但在时间表的框架内它们完全有意义!
- 区间:s_interval。请参阅下面的第一个想法。
- 持续时间:s_interval/dhours(1) => 以小时为单位的持续时间
- 函数:
- Max(), Min() 在任何 s_interval
- %s_in%
- 给定一个日期,某人什么时候工作:
日期 %s_in% s_interval
=> return TRUE/FALSE (数组) - 给定一个时间表,某个时间段内有人有空:
s_interval%s_in%区间
=> return class 区间 - 区间的子集! - 给定一个间隔,是否按计划进行?计算空闲时间、超时时间和工作时间:
区间 %s_in%s_interval
=> return class s_interval
- 给定一个日期,某人什么时候工作:
日期 %s_in% s_interval
- 给定两个时间表,将它们视为一个单元。闲置时间、加班时间和工作时间如何分配:
(s_interval1 %+% s_interval2)
=> return class s_interval
一些想法:
schedule
计划工时:
s_interval $tzone UTC
$daysofyear 286 days (Better alternative: format month-day e.g. Jan-07 – Oct-18)
$wday Mon, Tues, ... Sun (According to the start time of a shift/lecture...)
$time 12 h (Better alternative: format time span* e.g. 8:00 – 18:00. NOT period which results in hours)
$overtime 0 h (A priori, a schedule does not plan overtime)
$idle 0 h (A priori, a schedule only plans labor time)
schedule
当实时数据可用时:
s_interval$tzone UTC
$daysofyear 286 days (Better alternative: format month-day e.g. Jan-07 – Oct-18)
$wday c(Mon, Tues, Wed, ...) (According to the start time of a shift/lecture...)
$time c(12 h, 1 h, 0.5 h, ...) (Better alternative: format time span* e.g. 8:00 – 18:00. NOT period which results in hours)
$overtime c(2 h, 0 h, -1 h, ...) total time = time + overtime. Array of lubridate intervals*?
$idle c(4 h, 8 h, 0h, ...) pure working_time = time – idle + overtime. Array of lubridate intervals*?
* Use intervals not periods such that interval/dhours(1) possible.
如果 tzone 相同,我们可以计算例如
s_interval1 %+% s_interval2 =
s_interval$tzone UTC
$daysofyear 286 days, 123 days
$wday c(Mon, Tues, Wed, ...), c(Sat, Sun)
$time c(12 h, 1 h, 0.5 h, ...), c(-1 h, 2.5 h)
$overtime c(2 h, 0 h, -1 h, ...), c(0 h, 5 h)
$idle c(4 h, 8 h, 0h, ...), c(4 h, 8 h)
有关于此主题的相关帖子visualization of schedules with some interesting answers concerning timeline
and gantt
packages and how to filter dates。
然而,他们并不是很确定。
由于我是 R 的新手,我不知道如何以最好的方式开始这样的任务,并且理解像 lubridate 这样的包的结构是非常先进的...
我开发了一个包,它提供了所需的功能(甚至带有绘图)。目前,该包是私人的,但如果您有兴趣,请告诉我。