ki0073

GLPK Shift02

Aug 25th, 2016
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.29 KB | None | 0 0
  1. # version 0.2
  2. # シフト表作成
  3. param firstDate; # 期間の最初の日付
  4. param endDate; # 最後の日付
  5. param dayOfFirstDate symbolic; # 最初の日の曜日
  6. set Date := firstDate..endDate; # 期間内の日付
  7. param dayOfWeek{0..6} symbolic;
  8. param dayIndexOfFirstDate := sum{i in 0..6 : dayOfWeek[i]==dayOfFirstDate}i; # 初日の曜日に相当する曜日index
  9. param timeSlotTypeOfDay{d in 1..max(31, endDate)} symbolic, default dayOfWeek[(d+dayIndexOfFirstDate-1) mod 7]; # 祝日など特別な日はdata領域から読み込む
  10. set InitialSetOfTimeSlots dimen 2; # 曜日ごとの診療時間帯設定を読み込み
  11. set DayOfWeek := setof{(dw, ts) in InitialSetOfTimeSlots}dw; # 曜日を取り出す
  12. set TimeSlotSet; # 列挙した時間帯を読み込む
  13. param workingHoursOfTimeSlot{TimeSlotSet}; # 各時間帯の就業時間数を読み込む
  14.  
  15. set InitialSetOfWorkingPatten dimen 3; # 雇用タイプごとに可能な勤務パターンを読み込む
  16.  
  17. set EmploymentType dimen 2; # スタッフの雇用タイプを読み込む
  18. set Staff := setof{(p,et) in EmploymentType}p; # スタッフ名を取り出す
  19.  
  20. set FullTimeStaff := setof{(p,et) in EmploymentType : et=="常勤"}p; # 常勤スタッフ名
  21. set PartTimeStaff := Staff diff FullTimeStaff; # パートスタッフ名
  22. set OffDayPattern := {"P0"}; # 勤務がない勤務パターン名を設定
  23. set WorkingPatternDefinition dimen 2; # 勤務パターンと勤務時間帯との対応
  24.  
  25. set RequireNStaffs dimen 4; # 必要スタッフ数を読み込む
  26. set DutyType dimen 2; # 事務,リハビリ別区分を読み込む
  27. set DutyTypeName := setof{(dtyp, s) in DutyType}dtyp; # 事務,リハビリ
  28. set Section := setof{(dtyp, s) in DutyType}s; # 部署名を取り出す
  29.  
  30. # 曜日ごとの診療時間帯と曜日ごとの勤務パターンに矛盾がないかチェック
  31. set PatternToTimeSlots := setof{(wp,ts) in WorkingPatternDefinition, (et,dw,wp) in InitialSetOfWorkingPatten}(dw,ts);
  32. # WorkingPatternDefinitionとInitialSetOfWorkingPattenから展開した診療時間帯にInitialSetOfTimeSlotsにないものがあれば次で停止する
  33. check: PatternToTimeSlots within InitialSetOfTimeSlots;
  34. # InitialSetOfTimeSlotsがWorkingPatternDefinitionとInitialSetOfWorkingPattenから展開した診療時間帯にないものがあれば次で停止する
  35. check: InitialSetOfTimeSlots within PatternToTimeSlots;
  36. # 以上でInitialSetOfTimeSlotsがWorkingPatternDefinitionとInitialSetOfWorkingPattenに矛盾がないかチェック
  37.  
  38. set FixWorkingPatternOfStaff dimen 3; # スタッフの休暇、勤務時間帯等の指定を読み込む
  39. set NoWorkTimeSlotOfStaff dimen 3; # スタッフの出勤できない時間帯を読み込む
  40.  
  41. # FixWorkingPatternOfStaffに同じ人が同じ日の設定されていると次で停止
  42. check: card(setof{(d,p,wp) in FixWorkingPatternOfStaff}(d,p))==card(FixWorkingPatternOfStaff);
  43. # FixWorkingPatternOfStaff と NoWorkTimeSlotOfStaffに同じ人が同じ日の設定されていると次で停止
  44. check: card(setof{(d,p,wp) in FixWorkingPatternOfStaff}(d,p) inter setof{(d,p,ts) in NoWorkTimeSlotOfStaff}(d,p))==0;
  45.  
  46. # 日単位で各人の勤務パターンに展開 NoWorkTimeSlotOfStaffを反映
  47. set WorkingPatternOfStaff0 := setof{d in Date, (p,et) in EmploymentType, (et,dw,wp) in InitialSetOfWorkingPatten:
  48. timeSlotTypeOfDay[d]==dw and sum{(wp,ts) in WorkingPatternDefinition : (d,p,ts) in NoWorkTimeSlotOfStaff}1==0}(d,p,wp);
  49. # FixWorkingPatternOfStaffを反映
  50. set WorkingPatternOfStaff2 := {(d,p,wp) in WorkingPatternOfStaff0 : sum{(d,p,wp1) in FixWorkingPatternOfStaff}1==0} union FixWorkingPatternOfStaff;
  51. set WorkingPatternOfStaff := {(d,p,wp) in WorkingPatternOfStaff2 : not(sum{(d,p,wp1) in WorkingPatternOfStaff2}1 == 1 and {wp} within OffDayPattern)}; # 休みの場合は削る
  52. set FixedWorkingPattern:={d in Date, p in Staff : sum{(d,p,wp) in WorkingPatternOfStaff}1==1}; # 勤務パターンが固定されているスタッフ,時間帯
  53.  
  54. # スタッフの出勤の可能性のある時間帯
  55. set WorkableTimeSlot := setof{d in Date, (d,p,wp) in WorkingPatternOfStaff, (wp,ts) in WorkingPatternDefinition}(d,p,ts);
  56.  
  57. # 日別のスタッフが勤務できる部署
  58. set SectionForAssignment0:=setof{(d,p,ts) in WorkableTimeSlot, (dw,ts,s,n) in RequireNStaffs : timeSlotTypeOfDay[d]==dw}(d,p,ts,s);
  59. set FixSection dimen 4; # 部署の指定を読み込む
  60. set SectionForAssignment:={(d,p,ts,s) in SectionForAssignment0 : sum{(d,ts,p,s1) in FixSection}1==0} union
  61. (SectionForAssignment0 inter setof{(d,ts,p,s) in FixSection}(d,p,ts,s));
  62.  
  63. # 日別のスタッフの必要人数
  64. set SectionAtTimeSlot := setof{d in Date, (dw,ts,s,n) in RequireNStaffs : timeSlotTypeOfDay[d]==dw}(d,ts,s);
  65. param requireNStaffs{(d,ts,s) in SectionAtTimeSlot}:= sum{(dw,ts,s,n) in RequireNStaffs : timeSlotTypeOfDay[d]==dw}n; # 部署に必要な人数
  66. set BussinessTimeSlot := setof{(d,ts,s) in SectionAtTimeSlot}(d,ts); # 診療がある時間帯
  67. param requireNStaffsOfTimeSlot{(d,ts) in BussinessTimeSlot}:= sum{(d,ts,s) in SectionAtTimeSlot}requireNStaffs[d,ts,s]; # 時間帯ごとの必要なスタッフの人数
  68.  
  69. set WorkingPetternSet:= setof{(wp,ts) in WorkingPatternDefinition}wp union OffDayPattern; # 勤務パターン列挙、休暇を追加
  70. printf "診療カレンダー\n";
  71. for{d in Date}{
  72. printf "%2d %-4s ", d, timeSlotTypeOfDay[d];
  73. for{(dw, ts) in InitialSetOfTimeSlots: dw==timeSlotTypeOfDay[d]}{
  74. printf " %s ", ts;
  75. printf{(dw,ts,s,n) in RequireNStaffs} " %s %d", s, requireNStaffs[d,ts,s];
  76. }
  77. printf "\n";
  78. }
  79. printf "\n";
  80.  
  81. printf (if card(NoWorkTimeSlotOfStaff) then "スタッフの勤務できない時間帯\n" else "");
  82. for{p in Staff : sum{(d1,p,ts) in NoWorkTimeSlotOfStaff}1>0}{
  83. printf "%-8s ", p;
  84. for{d in Date : sum{(d,p,ts) in NoWorkTimeSlotOfStaff}1>0}{
  85. printf " %d日:",d;
  86. printf{(d,p,ts) in NoWorkTimeSlotOfStaff}" %s", ts;
  87. }
  88. printf "\n";
  89. }
  90. set WorkingPatternDefinitionForPrint := WorkingPatternDefinition union {wp in OffDayPattern, {"休"}}; # 印刷用
  91. printf (if card(FixWorkingPatternOfStaff) then "スタッフの休暇、勤務時間帯指定\n" else "");
  92. for{p in Staff : sum{(d1,p,wp1) in FixWorkingPatternOfStaff}1>0}{
  93. printf "%-8s ", p;
  94. for{d in Date : sum{(d,p,wp1) in FixWorkingPatternOfStaff}1>0}{
  95. printf " %d日:",d;
  96. printf{(d,p,wp) in FixWorkingPatternOfStaff, (wp, ts) in WorkingPatternDefinitionForPrint}" %s", ts;
  97. }
  98. printf "\n";
  99. }
  100. printf (if card(FixWorkingPatternOfStaff) then "\n" else "");
  101.  
  102. set WorkingDayByStaff:=setof{d in Date, (d,p,wp) in WorkingPatternOfStaff : not {wp} within OffDayPattern}(d,p); # スタッフ別の出勤日
  103. set BussinessDay := setof{d in Date, (d,p,wp) in WorkingPatternOfStaff : not {wp} within OffDayPattern}(d); # 診療日
  104.  
  105. printf "日別に集計\n";
  106. for{d in BussinessDay}{
  107. printf "%2d %-4s ", d, timeSlotTypeOfDay[d];
  108. for{p in Staff}{
  109. printf (if sum{(d,p,wp) in FixWorkingPatternOfStaff}1+sum{(d,p,ts) in NoWorkTimeSlotOfStaff}1>0 then " %s:" else "") ,p;
  110. printf{(d,p,wp) in FixWorkingPatternOfStaff} " %s",wp;
  111. printf{(d,p,ts) in NoWorkTimeSlotOfStaff} "-%s", ts;
  112.  
  113. }
  114. printf "\n";
  115. }
  116. printf "\n";
  117.  
  118. printf (if card(FixSection) then "部署指定\n" else "");
  119. for{p in Staff : sum{(d,ts,p,s) in FixSection}1>0}{
  120. printf "%-8s ", p;
  121. for{d in Date : sum{(d,ts,p,s) in FixSection}1>0}{
  122. printf " %d日:",d;
  123. printf{(d,ts,p,s) in FixSection}" %s %s", ts, s;
  124. }
  125. printf "\n";
  126. }
  127. printf (if card(FixSection) then "\n" else "");
  128.  
  129. # パートの勤務時間上限を設定
  130. param workinTimeLimitOfPartTime default 85; # パートの勤務時間上限を設定
  131. param limitOfWorkingHours{PartTimeStaff} default workinTimeLimitOfPartTime; # スタッフごとの勤務時間の上限を読み込む
  132. printf "勤務時間の上限\n";
  133. printf {p in PartTimeStaff} "%s %5.1f 時間\n", p, limitOfWorkingHours[p];
  134. printf "\n";
  135.  
  136. # 勤務時間概要を計算
  137. param totalWorkingTime:=sum{(d,ts,s) in SectionAtTimeSlot}requireNStaffs[d,ts,s]*workingHoursOfTimeSlot[ts]; # 必要な勤務時間合計
  138. param totalWorkingTimeOfDuty{dtn in DutyTypeName}:=sum{(d,ts,s) in SectionAtTimeSlot: (dtn, s) in DutyType}requireNStaffs[d,ts,s]*workingHoursOfTimeSlot[ts]; # 事務、リハビリの時間合計
  139. # 常勤スタッフの勤務時間集計
  140. param workingTimeOfFullTime{p in FullTimeStaff}:=sum{(d,p,ts) in WorkableTimeSlot}workingHoursOfTimeSlot[ts];
  141. param totalWorkingTimeOfPartTime:=totalWorkingTime-sum{p in FullTimeStaff}workingTimeOfFullTime[p];
  142. # 事務リハビリでの目標時間
  143. param targetWorkingTime{p in Staff, dtn in DutyTypeName} := (if {p} within FullTimeStaff then workingTimeOfFullTime[p] else totalWorkingTimeOfPartTime/card(PartTimeStaff))*totalWorkingTimeOfDuty[dtn]/sum{dtn2 in DutyTypeName}totalWorkingTimeOfDuty[dtn2];
  144. printf "勤務時間概要 事務 / リハビリ\n";
  145. printf "必要な勤務時間合計 %8.1f %6.1f /%6.1f\n", totalWorkingTime, totalWorkingTimeOfDuty["事務"],totalWorkingTimeOfDuty["リハビリ"];
  146. printf "\n常勤スタッフ合計 %8.1f\n", sum{p in FullTimeStaff}workingTimeOfFullTime[p];
  147. printf {p in FullTimeStaff} " %s %8.1f\n", p, workingTimeOfFullTime[p];
  148. printf "パート合計 %8.1f 一人平均 %8.1f\n", totalWorkingTimeOfPartTime, totalWorkingTimeOfPartTime/card(PartTimeStaff);
  149.  
  150. set SectionForAssignmentWithDuty:={(dtn, s) in DutyType, (d,p,ts,s) in SectionForAssignment}; # 事務,リハビリ別の部署への割り当て
  151.  
  152. var workingPattern{WorkingPatternOfStaff} binary; # スタッフの勤務パターンの割り当て
  153. var workingHour{WorkableTimeSlot} binary; # スタッフの勤務時間帯への割り当て
  154. var assignToSection{SectionForAssignment} binary; # スタッフの部署への割り当て
  155. var diffFromTargetTime{Staff, DutyTypeName} >=0; # 目標時間からの差の絶対値
  156.  
  157. # 勤務パターンが固定されている時間帯
  158. s.t. fixedWP{(d,p) in FixedWorkingPattern, (d,p,ts) in WorkableTimeSlot}: workingHour[d,p,ts]==1;
  159. s.t. assignSectionForFixedWP{(d,p) in FixedWorkingPattern, (d,p,ts) in WorkableTimeSlot}:
  160. sum{(d,p,ts,s) in SectionForAssignment}assignToSection[d,p,ts,s]==1;
  161. # 勤務パターンを1つ選ぶ
  162. s.t. uniqueWorkingPattern{(d,p) in WorkingDayByStaff}: sum{(d,p,wp) in WorkingPatternOfStaff}workingPattern[d,p,wp]==1;
  163. # 時間帯単位で出勤人数を合わす
  164. s.t. constrainNStaffOfTimeSlot{(d,ts) in BussinessTimeSlot}: sum{(d,p,ts) in WorkableTimeSlot}workingHour[d,p,ts]==requireNStaffsOfTimeSlot[d,ts];
  165. # パートの勤務パターン
  166. # AMとPMは同じ日に勤務しない
  167. s.t. restrictAMPM{d in Date, p in Staff :
  168. not (d,p) in FixedWorkingPattern and sum{(d,p,ts) in WorkableTimeSlot: ts=="AM" or ts=="PM"}1==2}:
  169. workingHour[d,p,"AM"]+workingHour[d,p,"PM"]<=1;
  170. # 中間だけの勤務はない AMかPMも出勤に
  171. s.t. middleTimeSlot{d in Date, p in Staff :
  172. not (d,p) in FixedWorkingPattern and (d,p,"中間") in WorkableTimeSlot}:
  173. workingHour[d,p,"中間"]<=sum{(d,p,ts) in WorkableTimeSlot : ts!="中間"}workingHour[d,p,ts];
  174. # 同じ日に2枠勤務の時は事務とリハビリが1回ずつ
  175. s.t. otherDutiesInSameDay{(d,p) in WorkingDayByStaff, dtyp in DutyTypeName}: sum{(dtyp,s) in DutyType, (d,p,ts,s) in SectionForAssignment}assignToSection[d,p,ts,s]<=1;
  176. # 部署に割り当てる
  177. s.t. assignSection{(d,p,ts) in WorkableTimeSlot}: workingHour[d,p,ts]==sum{(d,p,ts,s) in SectionForAssignment}assignToSection[d,p,ts,s];
  178. # 部署の人数を合わせる
  179. s.t. constrainNStaff{(d,ts,s) in SectionAtTimeSlot}: sum{(d,p,ts,s) in SectionForAssignment}assignToSection[d,p,ts,s]==requireNStaffs[d,ts,s];
  180. # AとBの割当数の差は4時間以内
  181. s.t. diffAB{p in Staff}:
  182. sum{(d,p,ts,s) in SectionForAssignment: s=="A"}assignToSection[d,p,ts,s]*workingHoursOfTimeSlot[ts]-
  183. sum{(d,p,ts,s) in SectionForAssignment: s=="B"}assignToSection[d,p,ts,s]*workingHoursOfTimeSlot[ts]>=-4;
  184. s.t. diffBA{p in Staff}:
  185. sum{(d,p,ts,s) in SectionForAssignment: s=="A"}assignToSection[d,p,ts,s]*workingHoursOfTimeSlot[ts]-
  186. sum{(d,p,ts,s) in SectionForAssignment: s=="B"}assignToSection[d,p,ts,s]*workingHoursOfTimeSlot[ts]<=4;
  187. # パートの勤務総時間制限
  188. s.t. limit{p in PartTimeStaff}: sum{(d,p,ts) in WorkableTimeSlot}workingHour[d,p,ts]*workingHoursOfTimeSlot[ts]<= limitOfWorkingHours[p];
  189. # 事務とリハビリの目標時間からの差の絶対値
  190. s.t. diff1{p in Staff, dtn in DutyTypeName}:
  191. sum{(dtn,s,d,p,ts) in SectionForAssignmentWithDuty}assignToSection[d,p,ts,s]*workingHoursOfTimeSlot[ts]-targetWorkingTime[p,dtn]<=diffFromTargetTime[p,dtn];
  192. s.t. diff2{p in Staff, dtn in DutyTypeName}:
  193. sum{(dtn,s,d,p,ts) in SectionForAssignmentWithDuty}assignToSection[d,p,ts,s]*workingHoursOfTimeSlot[ts]-targetWorkingTime[p,dtn]>=-diffFromTargetTime[p,dtn];
  194. # 目標勤務時間からの差を最小に
  195. minimize sumdiff: sum{p in Staff, dtn in DutyTypeName}diffFromTargetTime[p,dtn];
  196.  
  197. solve;
  198.  
  199. # 結果を出力
  200. printf "勤務時間集計\n";
  201. printf "氏名 勤務時間 合計(AM 中間 PM) ";
  202. printf {s in Section} " %s", s;
  203. printf "\n";
  204. for{p in Staff}{
  205. printf "%s %5.1f(", p, sum{(d,p,ts) in WorkableTimeSlot : workingHour[d,p,ts]==1}workingHoursOfTimeSlot[ts];
  206. printf{ts in TimeSlotSet} "%5.1f ", sum{(d,p,ts) in WorkableTimeSlot: workingHour[d,p,ts]==1}workingHoursOfTimeSlot[ts];
  207. printf ") ";
  208. printf{s in Section} "%5.1f ", sum{(d,p,ts,s) in SectionForAssignment}assignToSection[d,p,ts,s]*workingHoursOfTimeSlot[ts];
  209. printf "\n";
  210. }
  211. printf "\n";
  212. set OffDayOfStaff := {d in BussinessDay, p in Staff : sum{(d,p,ts) in WorkableTimeSlot}workingHour[d,p,ts]==0}; # 休暇日
  213. printf "休暇\n";
  214. for{d in BussinessDay}{
  215. printf "%2d %-3s", d, timeSlotTypeOfDay[d];
  216. printf{(d,p) in OffDayOfStaff} " %s", p;
  217. printf "\n";
  218. }
  219. printf "\n";
  220.  
  221. printf "表計算ソフト用タブ区切りデータ\n";
  222. printf "部署への割り当て\n";
  223. printf "日付\t\t時間帯";
  224. printf{s in Section} "\t%s", s; # 部署名
  225. printf "\n";
  226. for{d in BussinessDay}{
  227. for{(dw, ts) in InitialSetOfTimeSlots: dw==timeSlotTypeOfDay[d]}{
  228. printf "%d\t%s\t%s", d, timeSlotTypeOfDay[d], ts;
  229. for{s in Section}{
  230. printf {(d,p,ts,s) in SectionForAssignment : assignToSection[d,p,ts,s]==1} "\t%s", p;
  231. printf (if sum{(d,p,ts,s) in SectionForAssignment}1==0 then "\t" else "");
  232. }
  233. printf "\n";
  234. }
  235. }
  236. printf "\n";
  237.  
  238. printf "担当部署\n";
  239. printf "\t";
  240. printf {p in Staff}"\t%s", p;
  241. printf "\n";
  242. for{d in BussinessDay}{
  243. printf "%s\t%s\t", d, timeSlotTypeOfDay[d];
  244. for{p in Staff}{
  245. for{ts in TimeSlotSet: not (d,p) in OffDayOfStaff}{
  246. printf{(d,p,ts,s) in SectionForAssignment: assignToSection[d,p,ts,s]==1}"%s",s;
  247. printf (if sum{(d,p,ts,s) in SectionForAssignment: assignToSection[d,p,ts,s]==1}1==0 then "-" else "");
  248. }
  249. printf "\t";
  250. }
  251. printf "\n";
  252. }
  253. printf "\n";
  254.  
  255. data;
  256. param dayOfWeek :=0 "月" 1 "火" 2 "水" 3 "木" 4 "金" 5 "土" 6 "日"; # 曜日の順番 変更しないように
  257. # 曜日ごとの診療時間帯
  258. set InitialSetOfTimeSlots :=
  259. ("月", *) "AM" "PM"
  260. ("火", *) "AM" "中間" "PM"
  261. ("水", *) "AM" "PM"
  262. ("木", *) "AM"
  263. ("金", *) "AM" "中間" "PM"
  264. ("土", *) "AM"
  265. ("日", *)
  266. ("休", *)
  267. ("月r", *) "AM" "PM"
  268. ("火r", *) "AM" "中間" "PM"
  269. ("水r", *) "AM" "PM"
  270. ("木r", *) "AM"
  271. ("金r", *) "AM" "中間" "PM"
  272. ("土r", *) "AM"
  273. ;
  274. # 診療時間帯の勤務時間
  275. param : TimeSlotSet : workingHoursOfTimeSlot :=
  276. "AM" 4
  277. "中間" 2.5
  278. "PM" 4
  279. ;
  280. set DutyType :=
  281. ("事務",*) "A" "B" "C"
  282. ("リハビリ",*) "E"
  283. ;
  284. # 必要スタッフ数
  285. set RequireNStaffs :=
  286. ("月", "AM", *, *) "A" 1 "B" 1 "C" 1 "E" 4
  287. ("月", "PM", *, *) "A" 1 "B" 1 "E" 2
  288. ("火", "AM", *, *) "A" 1 "B" 1 "C" 1 "E" 4
  289. ("火", "中間", *, *) "A" 1 "B" 1 "E" 2
  290. ("火", "PM", *, *) "A" 1 "B" 1 "E" 2
  291. ("水", "AM", *, *) "A" 1 "B" 1 "C" 1 "E" 4
  292. ("水", "PM", *, *) "A" 1 "B" 1 "E" 2
  293. ("木", "AM", *, *) "A" 1 "B" 1 "C" 1 "E" 4
  294. ("金", "AM", *, *) "A" 1 "B" 1 "C" 1 "E" 4
  295. ("金", "中間", *, *) "A" 1 "B" 1 "E" 2
  296. ("金", "PM", *, *) "A" 1 "B" 1 "E" 2
  297. ("土", "AM", *, *) "A" 1 "B" 1 "C" 1 "E" 4
  298. # Eの人数が1人減の場合を定義
  299. ("月r", "AM", *, *) "A" 1 "B" 1 "C" 1 "E" 3
  300. ("月r", "PM", *, *) "A" 1 "B" 1 "E" 2
  301. ("火r", "AM", *, *) "A" 1 "B" 1 "C" 1 "E" 3
  302. ("火r", "中間", *, *) "A" 1 "B" 1 "E" 2
  303. ("火r", "PM", *, *) "A" 1 "B" 1 "E" 2
  304. ("水r", "AM", *, *) "A" 1 "B" 1 "C" 1 "E" 3
  305. ("水r", "PM", *, *) "A" 1 "B" 1 "E" 2
  306. ("木r", "AM", *, *) "A" 1 "B" 1 "C" 1 "E" 3
  307. ("金r", "AM", *, *) "A" 1 "B" 1 "C" 1 "E" 3
  308. ("金r", "中間", *, *) "A" 1 "B" 1 "E" 2
  309. ("金r", "PM", *, *) "A" 1 "B" 1 "E" 2
  310. ("土r", "AM", *, *) "A" 1 "B" 1 "C" 1 "E" 3
  311. ;
  312. # 勤務パターン定義
  313. set WorkingPatternDefinition :=
  314. ("PA",*) "AM"
  315. ("PP",*) "PM"
  316. ("PAP",*) "AM" "PM"
  317. ("PAM",*) "AM" "中間"
  318. ("PMP",*) "中間" "PM"
  319. # 多分使わないが定義
  320. ("PM",*) "中間"
  321. # "AM" "中間" "PMの三連続勤務は今のところ利用できません。
  322. ;
  323. /*
  324. 雇用タイプごとの自動で割り当てられる勤務パターン
  325. パートの場合はAMとPMを同じ日に勤務するパターンと中間だけの勤務パターンは登録できません。下のFixWorkingPatternOfStaffではこのような場合も日を指定して設定できます。またパートの場合は休みの可能性もあるためP0も追加しておくこと
  326. */
  327. set InitialSetOfWorkingPatten :=
  328. ("常勤", "月", *) "PAP"
  329. ("常勤", "火", *) "PAP"
  330. ("常勤", "水", *) "PAP"
  331. ("常勤", "木", *) "PA"
  332. ("常勤", "金", *) "PAP"
  333. ("常勤", "土", *) "PA"
  334. ("常勤", "月r", *) "PAP"
  335. ("常勤", "火r", *) "PAP"
  336. ("常勤", "水r", *) "PAP"
  337. ("常勤", "木r", *) "PA"
  338. ("常勤", "金r", *) "PAP"
  339. ("常勤", "土r", *) "PA"
  340.  
  341. ("パート1", "月", *) "P0" "PA" "PP"
  342. ("パート1", "火", *) "P0" "PAM" "PMP" "PA" "PP"
  343. ("パート1", "水", *) "P0" "PA" "PP"
  344. ("パート1", "木", *) "P0" "PA"
  345. ("パート1", "金", *) "P0" "PAM" "PMP" "PA" "PP"
  346. ("パート1", "土", *) "P0" "PA"
  347. ("パート1", "月r", *) "P0" "PA" "PP"
  348. ("パート1", "火r", *) "P0" "PAM" "PMP" "PA" "PP"
  349. ("パート1", "水r", *) "P0" "PA" "PP"
  350. ("パート1", "木r", *) "P0" "PA"
  351. ("パート1", "金r", *) "P0" "PAM" "PMP" "PA" "PP"
  352. ("パート1", "土r", *) "P0" "PA"
  353.  
  354. ("パート2", "月", *) "P0" "PA"
  355. ("パート2", "火", *) "P0" "PAM"
  356. ("パート2", "水", *) "P0" "PA"
  357. ("パート2", "木", *) "P0" "PA"
  358. ("パート2", "金", *) "P0" "PA"
  359. ("パート2", "月r", *) "P0" "PA"
  360. ("パート2", "火r", *) "P0" "PAM"
  361. ("パート2", "水r", *) "P0" "PA"
  362. ("パート2", "木r", *) "P0" "PA"
  363. ("パート2", "金r", *) "P0" "PA"
  364. ;
  365.  
  366. # ここから下の変更で使えるはずです
  367. # 従業員氏名と雇用タイプ
  368. set EmploymentType :=
  369. "Aさん" "常勤"
  370. "Bさん" "常勤"
  371. "Cさん" "常勤"
  372. "Dさん" "パート1"
  373. "Eさん" "パート1"
  374. "Fさん" "パート1"
  375. "Gさん" "パート1"
  376. "Hさん" "パート1"
  377. "Iさん" "パート1"
  378. "Jさん" "パート2"
  379. ;
  380. param firstDate := 1; # 勤務シフトを作成する開始日
  381. param endDate := 31; # 終了日
  382. param dayOfFirstDate := "木"; # 開始日の曜日
  383. # 祝日など特別な勤務日
  384. # 曜日にrがついてるものはEが3人
  385. param timeSlotTypeOfDay:=
  386. 8 "木r"
  387. 16 "金r"
  388. 17 "土r"
  389. 19 "休"
  390. 22 "休"
  391. 24 "土r"
  392. ;
  393. # パートの勤務時間上限
  394. param workinTimeLimitOfPartTime:=85;
  395. # 個人別に上限を設定
  396. # param limitOfWorkingHours["Eさん"]:=90;
  397. /*
  398. 出勤できない時間帯を設定
  399. 設定の時間帯を避けて割り当てされます
  400. */
  401. set NoWorkTimeSlotOfStaff :=
  402. (2,"Eさん",*) "中間" "PM"
  403. (2,"Dさん",*) "AM"
  404. (6,"Eさん",*) "中間" "PM"
  405. (7,"Eさん",*) "PM"
  406. (9,"Dさん",*) "PM"
  407. (9,"Cさん",*) "PM"
  408. (12,"Jさん",*) "AM"
  409. (13,"Eさん",*) "PM"
  410. (14,"Eさん",*) "PM"
  411. (16,"Dさん",*) "PM"
  412. (16,"Gさん",*) "中間" "PM"
  413. (20,"Eさん",*) "PM"
  414. (21,"Eさん",*) "PM"
  415. (23,"Dさん",*) "PM"
  416. (23,"Eさん",*) "PM"
  417. (27,"Dさん",*) "AM"
  418. (28,"Dさん",*) "PM"
  419. (28,"Eさん",*) "PM"
  420. ;
  421. /*
  422. P0 休み PA AMのみ PP PMのみ PAP AM+PM
  423. PAM AM+中間 PMP 中間+PM PM 中間のみ PAMP AM+中間+PM
  424. 上のNoWorkTimeSlotOfStaffとは指定日が重ならないように
  425. */
  426. # 休暇,勤務時間帯を指定
  427. # 休暇はP0
  428. set FixWorkingPatternOfStaff :=
  429. 2 "Gさん" "PA"
  430. 7 "Dさん" "P0"
  431. 8 "Aさん" "P0"
  432. 8 "Gさん" "P0"
  433. 10 "Bさん" "P0"
  434. 13 "Gさん" "P0"
  435. 14 "Dさん" "P0"
  436. 14 "Fさん" "P0"
  437. 15 "Jさん" "P0"
  438. 15 "Gさん" "P0"
  439. 16 "Eさん" "P0"
  440. 17 "Fさん" "P0"
  441. 17 "Aさん" "P0"
  442. 20 "Hさん" "P0"
  443. 20 "Dさん" "P0"
  444. 21 "Gさん" "P0"
  445. 21 "Dさん" "P0"
  446. 24 "Eさん" "P0"
  447. 24 "Fさん" "P0"
  448. 24 "Iさん" "P0"
  449. 27 "Eさん" "P0"
  450. 6 "Fさん" "P0"
  451. 1 "Hさん" "P0"
  452. 5 "Hさん" "P0"
  453. 31 "Hさん" "P0"
  454. 10 "Jさん" "P0"
  455. 23 "Jさん" "P0"
  456. 12 "Iさん" "P0"
  457. 29 "Jさん" "P0"
  458. 30 "Iさん" "P0"
  459. ;
  460. /*
  461. 部署への割り当て
  462. 指定した時間帯に勤務がなければ無視されます。常勤の方の指定に特に有効です。
  463. */
  464. set FixSection :=
  465. # (*,"PM","Aさん","E") 2 7 9 12 16 23 26
  466. ;
Advertisement
Add Comment
Please, Sign In to add comment