值班时间表 [英] duty shift monthly scheduler

查看:168
本文介绍了值班时间表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想制作一个计划在15个人或多或少之间进行一个月轮班的程序.每天必须有2人值班(一次主要替换一位),两次轮换之间的最短时间为3天.一个人可以选择自己不想工作的几天(日期).当然,我必须合理安排轮班时间(例如,一个人不能进行4个周末轮班,而另一个人每天有4个轮班).这个想法是代表每个人有一个权重,并根据该权重(升序)对人列表进行排序.从月初开始,我将选择列表中的第一个人(如果可以的话)转移并增加体重,比如说1(周​​末应该更多),然后对列表进行排序.根据第二次转移,依此类推..
我只是想在开始实施该解决方案之前了解您对上述解决方案的想法(或者当然是一个更好的想法).

解决方案

你想做的,那很好.继续进行编码.如果您对某些代码有疑问,请回到这里.
一个建议:选择人员并指定班次后,您无需完成完整的列表,而只需将该人员向下移到列表中即可,就像一次气泡排序一样.

i want to make a program that schedules fairly day shifts for a month between 15 people more or less.Every day 2 people have to be on duty(one primary and one substitute).the minimum time between 2 shifts is 3 days.a person has the option to choose a few days(give dates) for which he does not want to be on duty.of course i must schedule the shifts fairly(e.g a person cannot take 4 weekend shifts where another has 4 daily). The idea is to represent each person with a weight and sort the list of people according to that weight(ascending).starting from the beginning of the month i will choose the first person on the list(if the restrictions are ok) for the first shift and increase his weight by lets say 1(for weekends it should be more) and sort the list.accordingly for the second shift and so on..
i just want to know your thoughts for the above solution(or a better idea of course) before i start implementing it.

解决方案

It looks like you have thought about what you want to do, and that is good. Go ahead and code it. Come back here if you have problems with bits of code.
A suggestion: When you have chosen your person and assigned the shift, you don''t need to do a full sort of the list, but just move that person down the list, just like one pass of a bubble sort.


这篇关于值班时间表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆