I am trying to write hospital schedule for my wife. Such a schedule is often referred to as a “nurse scheduling problem” in operations research / constraint programming. The constraint program either needs to be written in python using Google OR ([url removed, login to view]) or minizinc ([url removed, login to view] ).
Be aware that I started with the model in minizinc [minizinc is able to communicate with different solvers], but my underlying solvers (Geocode, Chuffed, Google OR) cannot handle my code (too complex and / or too poorly written). I did not try to write the problem in Google OR but I did use the Google OR solver and it could not handle my minizinc code either!
I assume that minizinc is the better way to write this code, but you can of course convince me otherwise.
The aim is to develop a working schedule program which will be hosted on a website at a later stage. I prefer if you use either minizinc or Google OR.
o All data/parameters will be stored in a separate data file
amount of days (e.g. 180), people (e.g. Chris + 12 others), shifts (e.g. evening + 10 others)
a starting day (date) defines on which day name the schedule starts (e.g. Tuesday)
days relate to a day name (related to starting day)
shifts require working hours
people have contractual working time / hours
people may have overtime from previous schedule
hard constraint & soft constraint data
• Hard constraints
o shifts defined per day (e.g. every Monday two evening shifts)
o shifts defined per specific day (e.g. Tuesday the 30th four evening shifts)
o shifts defined per day per person (e.g. Chris every Monday two day shifts)
o shifts defined per specific day per person (e.g. Chris on Friday the 31st is off)
o within 5 consecutive days at least 1 day is off
o sum of working hours per schedule <= contractual working time + overtime
o Total amount of night shifts equally distributed
o Total amount of weekend shifts equally distributed
o Shifts depending on other shifts during per day (e.g. if there is a morning shift on Sunday, there needs to be an evening shift)
o Shifts depending on other shifts on previous days (e.g. if Chris had a nightshift yesterday, today he may only either be off or have another nightshift)
• Soft constraints
o Each shift per day has a “penalty” (e.g. Monday evening shift = 10, Monday day = 0)
o Sum of penalty to be as equal as possible within all people
o If specific shifts are scheduled on specific days (e.g. every Tuesday, every second Saturday, the 30th of Ocotober), there is a specific “benefit” allocated (e.g. 20)
o Utility = sum of benefit – sum of penalty
o Solve maximize utility
o Schedule (days horizontal, people vertical)
o Time accounting
How many hours available per contract per person
How many hours worked per person
How many shifts worked on which days per person
o Shift accounting:
How many shifts scheduled?
How many shifts scheduled per day?