Ruby on rails ruby/rails中的预约调度
我正在rails中开发呼叫中心软件,需要为能够为客户处理呼叫的代理安排预约。话虽如此,呼叫中心软件需要确保我尽可能利用整个代理的时间表安排约会,留出最少的洞(代理没有预约的地方) 根据代理人的时间表,例如某一天的上午9:00到下午5:30,下午1:00到1:30之间的午休时间为30分钟,我需要安排不同时间的约会,约60分钟到90分钟 如果出于某种原因,午休时间在日程安排上留下了一些漏洞,我应该可以将午休时间改为30分钟+/-,因此可以将午休时间改为1:30PM-1:30PM,而不是1:30PM-2:00PM或12:30PM-1:00PM 我开始创建午休时间,作为一种约会,它将提供移动开始和结束属性的灵活性。预约时间是60分钟或90分钟,是30分钟的倍数,午餐也是30分钟,我开始把代理人的时间安排分成每个30分钟的时段 因此,对于给定日期的给定代理,查看他的时间表,我实例化了一组插槽,每个插槽的持续时间为30分钟,从开始到结束,属性为9:00AM-9:30AM,9:30AM-10:00AM,等等 我需要一些帮助,以循环通过这一系列的约会时段,并根据60或90分钟的预约时间拉取2个连续的时段或3个连续的时段,记住我应该能够移动午餐+/-30分钟Ruby on rails ruby/rails中的预约调度,ruby-on-rails,ruby,Ruby On Rails,Ruby,我正在rails中开发呼叫中心软件,需要为能够为客户处理呼叫的代理安排预约。话虽如此,呼叫中心软件需要确保我尽可能利用整个代理的时间表安排约会,留出最少的洞(代理没有预约的地方) 根据代理人的时间表,例如某一天的上午9:00到下午5:30,下午1:00到1:30之间的午休时间为30分钟,我需要安排不同时间的约会,约60分钟到90分钟 如果出于某种原因,午休时间在日程安排上留下了一些漏洞,我应该可以将午休时间改为30分钟+/-,因此可以将午休时间改为1:30PM-1:30PM,而不是1:30PM-
非常感谢您的帮助。看看您的问题:
祝你好运:)@vinceh-谢谢你的详细解释和相关部分的链接。直到我查看了您提供的贪婪算法链接,我才意识到这个问题的复杂性。此外,我用最简单的方法提出了这个问题,删除了其他要求,包括某些类型的约会(比如午餐休息,但不包括被视为低优先级的午餐休息),持续时间为30分钟,应该在一天中移动,以适应其他高优先级的约会。我无法想象如果我考虑所有的要求的复杂性。
Let R be the set of all appointments
Let R11 be the set of appointments from R before 12:30 that are compatible with 12:30-1:00 and R12 be the set of appointments from R after 1:00 that are compatible with 12:30-1:00
Let R21 be the set of appointments from R before 1:00 that are compatible with 1:00-1:30 and R22 be the set of appointments from R after 1:30 that are compatible with 1:00-1:30
Let R31 be the set of appointments from R before 1:30 that are compatible with 1:30-2:00 and R32 be the set of appointments from R after 2:00 that are compatible with 1:30-2:00
Let R1Comb = findSet(R11) + 12:30-1:00 + findSet(R12)
Let R2Comb = findSet(R21) + 1:00-1:30 + findSet(R22)
Let R3Comb = findSet(R31) + 1:30-2:00 + findSet(R32)
Function findSet(R)
Let A be the time interval to fill
While R is not empty
Choose a request r in R that has the smallest finishes_at
Add r to A
Remove all appointments in R that are not compatible with r
EndWhile
Return A
EndFunction
Return the R that has the smallest amount of holes in R1Comb, R2Comb, R3Comb