Day 1

The problematique: Our surgical department needs two doctors each day to perform emergency duties from 15:00 do 7:00, while the rest of the team is at home. There are two groups of doctors that are independent of each other which is a great advantage. Changes in Group 1 does not affect Group 2. When i schedule the shifts manually i ask all the doctors to bring in a list of days on which they DONT WANT to have a shift. They also bring information when they WANT to have a shift (if possible). My goal is then to assign a specific doctor to a specific day. There are usually less then 10 doctors for each month, so there are multiple shifts which they have to take. Some specify the exact number like 2 work days and 1 weekend day and the others will get the approximate average, so like 2.66 work days and 1.33 weekend days. These have to be distributed among the doctors who dont specify the exact numbers. The goal is to make them all relatively happy while having a doctor set for every day of the month.

Constraints: each problem reguires a set of constraints to work within limits of. For our case there have to be relatively few HARD constraints which the algorithm should never ignore and SOFT constraints which the algorithm should try to pay attention to. Problem is, that too many HARD constraints will lead to many FAILS or impossible SOLUTIONS. Too many SOFT constraints could lead to optimalization issues and impossibility to create a working Fitness function.

  • HARD:
    • There shall be one doctor per day.
    • There should be no one two days in a row as a result of the algorithm. (Such scenario should be accepted only by a HUMAN user
  • SOFT:
    • Each doctor should have as many shifts as he prefers both in work days and in weekends.
    • Each doctor should have a minimal interval between shifts based on his choice.
    • Each doctor should ideally have similar number of Saturdays, Sundays, Fridays and Thursdays and the rest of the days of a week.
    • There should be no two weekend shifts in two weeks. So No Friday-Friday, Friday-Saturday, Friday-Sunday, Sunday-Saturday etc.

The ideas: each month is made up of weeks and days. Each day is different in the perceived doctor happiness to serve it. Because the doctor goes home in the morning after the shift, he has a day-off after each of the shifts. This makes some days better and some worse to have shifts in. I have assigned indexes to each of the day type to have some relative impact.

  • Mondays Tuesdays and Wednesdays: they are similar, there is no advantage or big disadvantage to have them.
    • Index 1.125
  • Thursdays: come with a day-off on Friday, which means basically a “Three day” Weekend.
    • Index 1.0
  • Fridays: are bad, you are tired on Saturday after the shift and you have no day-off, because Saturday is your home time anyway.
    • Index 1.25
  • Saturdays: are bad. You have a weekend day to work in, and have no day-off because you go home on Sunday, which is your home time anyway.
    • Index 1.35
  • Sundays: are relatively good. You have a weekend day to work in, but can go home Monday morning, which means a day-off.
    • Index 1.3

The basic algorithm: The basic algorithm should load all doctors available and load their reguirements / wishes / special settings. Then it should fill the entire month with doctors who are ABLE to work on the specific day. It should discard all doctors who can not work on the specific day. This should allready fill HARD constraint ONE. Then it should make sure no one has TWO DAYS after each other. Then it should make sure there is a specific number of shifts each doctor has. All of this should be made with the FITNESS FUNCTION.