1

I have a MILP model regarding nurse rostering. The cost function is the objective function. I'm minimising cost. There are 3 shifts per day. One shift has a cost of 1€, two shifts in one day have a cost of 1.5€. (It is cheaper to have two shifts assigned in one day than only one for two nurses.)

All other constraints and concerns are already dealt with. The model is implemented in GAMS, but it is the mathmatical formulation I'm struggling.

How can I consider the cost structure this way?

I've tried creating a new variable to identify double shifts but with no sucess.

updated with the GAMS formulation, although any minor/major changes are possible.

SETS

I nurses /i1*i22/  fulltime(i) Subset of fulltime nurses /i1*i18/ liberalnurses(i) j days of the month /j1*j30/
*Example for the month of june  sundays(j) sundays in the month /j4,j11,j18,j25/  notsundays(j)  k shifts /k1*k3/ w number of weeks /w1*w5/  Dweek(j,w) /(j1*j4).w1, (j5*j11).w2, (j12*j18).w3, (j19*j25).w4, (j26*j30).w5/ ;

notsundays(j) = j(j) - sundays(j);

liberalnurses(i)=I(i) - fulltime(i); display liberalnurses;

notsundays(j) = j(j) - sundays(j);

liberalnurses(i)=I(i) - fulltime(i); display liberalnurses;

Table ddemand(k,j)
    j1  j2  j3  j4  j5  j6  j7  j8  j9  j10 j11 j12 j13 j14 j15 j16 j17 j18 j19 j20 j21 j22 j23 j24 j25 j26 j27 j28 j29 j30 k1  3   4   4  5   3   2   3   3   3   4   5   3   3   3   5   2   3   2   3   4   3  3   4   4   4   3   4   4   3   3 k2  2   2   3   4   2   4   4   3   5   3   5   2   3   3   3   3   3   4   3   3   3   4   3   3   4   3  2   5   2   4 k3  5   3   4   3   2   5   4   4   4   4   5   5   4   4   4   4   4   5   3   3   3   4   4   3   3   4   3   4   3   5 ; display ddemand;

Parameter nursefull(i); nursefull(i)$fulltime(i)=1;

Parameter nurseliberal(i); nurseliberal(i) =  1 - nursefull(i);

display nursefull, nurseliberal;

parameter nurseavailability(i,j,k); nurseavailability(i,j,k)$fulltime(i) = 1; display nurseavailability;

nurseavailability('i8','j4','k2')=1; display nurseavailability;

Parameter lastmonth(i) /i4 7/;

Parameter Preference(i,j,k); preference('i3','j2',k)=1; preference('i5',j,'k3')=1;

Variables z objective variable x(i,j,k) Binary variable indicating whether nurse i is assigned to shift k on day j turnsweek(i,w)  ;

Binary variable x ;

Equations Obj The objective is to minimize the total deviation from the nurse demand across all shifts and days Eq1(j,k)  Each shift should be covered by the appropriate number of nurses Eq2_1(i,w) Number of shifts per week Eq2_2(i,w) Full-time nurses should work 8 shifts per week Eq2_3(i,w) Number of shifts for the first week Eq3_1(i,j,k) Nurses cannot work night mornings Eq3_2(i,j,k) Nurses must work consecutive shifts in a day _ also ensures two shifts per day Eq4(i,j,k) Liberal nurses should only be assigned based on their availability  Eq5(j)   No work on Sundays ;


obj.. z =e= sum((i,j,k), x(i,j,k)) Eq1(j,k)$notsundays(j).. sum(i,x[i,j,k]) =e= dDemand[k,j];  Eq2_1(i,w)$ fulltime(i).. sum((j,k), x(i,j,k) $ dweek(j,w)) =e= turnsweek(i,w); Eq2_2(i,w)$(fulltime(i)).. turnsweek(i,w) =l= 8;  Eq2_3(i,w)$(fulltime(i) and ord(w)=1).. turnsweek(i,w) + lastmonth(i) =l= 8; Eq3_1(i,j,k)$fulltime(i).. x(i,j,'k1')+x(i,j-1,'k3') =l= 1;  Eq3_2(i,j,k)$fulltime(i).. x(i,j,'k1')+x(i,j,'k3') =l= 1;  Eq4(i,j,k)$liberalnurses(i).. x[i,j,k] =l= nurseAvailability[i,j,k]; Eq5(j)$sundays(j).. sum((i,k), x[i,j,k]) =e= 0; 

Model A /all/; Solve A using mip minimizing z;
Reinderien
  • 11,755
  • 5
  • 49
  • 77
Jonix
  • 21
  • 2
  • Non reproducible. You need to include your code. – Reinderien May 29 '23 at 12:09
  • 1
    Especially: with no idea what your other decision variables look like it's impossible to guess how to represent this cost. – Reinderien May 29 '23 at 12:11
  • @Reinderien I've updated the post with the model. Nothing fancy but basically i only have a decision variable of assigning the shift in each day to each nurse. – Jonix May 29 '23 at 16:32

0 Answers0