Search code examples
linear-programmingcplexlpsolve

Modeling the shift types in Staff schedulling with linear programming


So i want to solve problem ,that looks like nurse scheduling Problem, the different is that there is 2 type of Workers, who should work minimum 40 hours per week, the other type should work minimum 10 hours per week. In order to solve this problem with simplex , i have to define the shifts(shift types). the shifts in a day should be minimum 3 hours and maximum 9 hours. this photo is what i have tried so farShifts

And total of shift types would be 55. and if i multiply that to the number of workers and days. that would be 15000 variables. is it possible to solve a problem like this, or should i try to do it other way? Has anyone suggestion?


Solution

  • You have a nurse example at CPLEX_Studio129\opl\examples\opl\nurses.

    To do what you need you need to change

    //global max worked time
     forall(n in Nurses)
       ctNurseMaxTimeConstraints: 
         NurseWorkTime[n] <= MaxWorkTime;
    

    into

     forall(n in Nurses)
       ctNurseMaxTimeConstraints: 
         NurseWorkTime[n] <= n.MaxWorkTime;
    

    where maxWorkTime is not global but per nurse. 15000 binary decision variables should be fine.