enter image description hereI am currently stuck on writing a linear programming model to describe the process of appointment scheduling for an Oncological Center. I wanted to share it with you guys and see if anyone here could help me. The problem regards the process of scheduling a date and hour for each patient appointment over a week, each patient has to come in do a first visit and then a transfusion, we have N beds for transfusion, thus if they are all occupied at a certain moment we have to consider a certain waiting time for the patient. I am stuck on writing the constraints for my problem. I have as data:

  • P --> List of patients
  • K --> List of pathologies
  • L --> List of laboratories
  • T --> Time horizon in days
  • H --> List of time slots for each day
  • Ms --> Maximum ending time for transfusions
  • Mv --> Maximum ending time for visits
  • N --> Total number of beds for transfusions
  • t^(v)(k) --> time for first visit pathology k
  • t^(s)(k) --> time for transfusion pathology k
  • S(p,k) --> 1 if patient p has pathology k, 0 otherwise (every patient has only one pathology)
  • W(l,k,t) --> 1 if laboratory l is designed for visits of pathology k on day t, 0 otherwise

I was thinking about using as variables:

  • X(p,t,h) --> 1 if patient p begins visit on day t on time slot h, 0 otherwise
  • Y(p,t,h) --> 1 if patient p begins drug transfusion on day t on time slot h, 0 otherwise
  • R(p) --> Waiting time of patient p between visit and infusion
  • U(p) --> 1 if patient p has to wait between visit and infusion, 0 otherwise
  • C(p) --> Total time spent in the hospital for patient p

Do you guys think these variables are enough ? We work under the assumption that nurses are always available, and thus we do not consider that as a constraint. How would you write the model ? I need serious help and would be extremely helpful to anyone wanting to help...

The constraints on top of the question are what I came up with, I am not sure if they are all necessary or not. It may be possible to solve the problem using less constraints. What do you guys think ? Any feedback is appreciated it is one of my first experiences writing such a big model.

  • $\begingroup$ Two quick comments. First, I would avoid using the symbol W for both an indicator of lab setup and a waiting time variable, as it will make some people (like me) cross-eyed. Second, to get "serious help" from most of us, I think you will need to convince us that this is not a homework assignment. $\endgroup$
    – prubin
    Jun 16, 2021 at 22:27
  • $\begingroup$ Yes sorry for that, I changed it to R(p) after seeing that. It isn't an assignment actually, it's more of a project I personally decided to do, I already passed this class last semester. After posting this I ended up writing a model that looks plausible, it's very hard to post it here, I might be able to screenshot the latex file where I wrote the constraints and post it in the original question. $\endgroup$
    – Rio22
    Jun 16, 2021 at 22:39
  • $\begingroup$ Are you working with an actual oncology center? $\endgroup$
    – prubin
    Jun 16, 2021 at 22:49
  • $\begingroup$ Yes, data to implement and test the model in AMPL will be actual data given to me by an Oncological center $\endgroup$
    – Rio22
    Jun 16, 2021 at 22:56
  • $\begingroup$ If by "I need serious help" you mean you are looking for collaboration, I might know one or two places to look for it, depending on specifics of the work. You can start a chat with me (see meta.stackoverflow.com/questions/297562/… for details how) if you want to follow up. $\endgroup$
    – prubin
    Jun 20, 2021 at 16:14

1 Answer 1


Assorted comments in no particular order:

  • Are you using "infusion" and "transfusion" interchangeably?
  • I suspect that, in order to handle the occupancy constraints for transfusion beds, you will need a variable for the time each patient starts transfusion. You may be able to compute that from X(p,t,h) and W(p), but it might be easier to start with an explicit variable for transfusion start time and compute W from that variable and X.
  • It is unclear what role the laboratory index (l, from set L) plays. If there are multiple laboratories set up for different pathologies on a given day, then you need bed capacity N(l) for each lab, not just one total bed capacity N.
  • You are going to need an objective function, which means you need to settle on a criterion for choosing among possible schedules. (By "you" I mean "whoever is commissioning the model".) This could be maximizing the number of patients seen per day, minimizing waiting times for appointments, minimizing cycle times (time from when the patient walks in to when they walk out) or possibly something else. The objective criterion may dictate the need for additional variables. By the same token, depending on the criterion, either or both of U(p) and C(p) may be unnecessary.
  • ADDENDUM (I forgot to include this the first time around): You may need a parameter for the time to "refresh" a bed (change bed linen, change IVs, sterilize anything that can't outrun you) and constraints to enforce that. In scheduling problems that's known as a "setup time" or "changeover time". Similarly, there is probably a capacity limit on "first visits" (perhaps staff need to go over paperwork, or doctors need to examine the patients), and there may be a minimum time gap between first visits (staff require time to regroup between patients, examining rooms need to be sterilized, ...).
  • $\begingroup$ In order: 1)Yes sorry for that, they mean the same thing 2) I ended up deciding to use two different variables, one to indicate visit starting time and one to indicate transfusion starting time 3) Each Laboratory is used to visit one patient at a time, and for each day they are assigned to one pathology. After that patients move on to the trasfusion room, of which we have the total number of beds 4) We already have decided to utilise two different objective functions: first we want to max the number of patients for week, second we want to min the time spent by patients in the hospital $\endgroup$
    – Rio22
    Jun 16, 2021 at 22:43
  • $\begingroup$ We also wanted to have for each patient a starting day,time and when he is ready to leave. This is why I decided to calculate the total time C(p), to be able to have an exit time for each patient $\endgroup$
    – Rio22
    Jun 16, 2021 at 22:47
  • $\begingroup$ Regarding exit time (and possibly other considerations), you want to avoid cluttering the mathematical model with things that are of interest when the solution is put to use but not required to come up with the schedule. So if the model does not need exit time to compute the objective, you can omit it, and then calculate the exit time of each patient from the solution "manually" (which might mean in a spreadsheet or using a simple program). $\endgroup$
    – prubin
    Jun 16, 2021 at 22:52
  • $\begingroup$ Ok thanks for the advice, I can thus delete some constraints and add them later as considerations after solving my problem. $\endgroup$
    – Rio22
    Jun 16, 2021 at 22:58
  • $\begingroup$ Regarding the addendum: To simplify the problem in our first approach we are working in a simplified environment where such parameters can be ignored, even though they would not be of particular difficulty to model, also because of the difficulty to obtain information on such data directly from the hospital. If after this we decide to ampliate our model I will be sure to include everything, for example we are making big assumptions about the constant availability of both medical staff and pharmaceuticals needed for transfusions and visits $\endgroup$
    – Rio22
    Jun 16, 2021 at 23:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.