Can someone please help me model this in AMPL?

“The manager of a clinic must ensure a continuous 24-hour service for patients. The 24-hour working day is divided into eight work shifts, each lasting three hours. In each shift, a number of nurses must be present in the clinic between a minimum and a maximum of presences. Nurses can start working only at the beginning of each shift and each nurse can work a maximum of nine hours (so, each worker can work for three consecutive shifts). In addition, the clinic manager has estimated a patient satisfaction rate that is directly proportional to the number of nurses present on duty in the facility. Therefore, the clinic director must determine the number of nurses that must be present in each shift in the clinic in order to guarantee the necessary minimum coverage, respecting the maximum number of nurses that can be present simultaneously in the facility, and maximizing the patient satisfaction rate. CASE WITH 20 NURSES

the problem is that I can’t get the nurses to work consecutive shifts

I am not sure why your are trying to get the nurses to work consecutive shifts. Does every nurse work exactly 3 consecutive shifts in a day? If so, then the modeling is simplified, because

  • if a nurse’s first shift of the day is shift 1, then you know that the nurse also works shifts 2 and 3;
  • if a nurse’s first shift of the day is shift 2, then you know that the nurse also works shifts 3 and 4;

and so forth for other shifts. It only gets more complicated if other shift patterns are allowed.