# Constraint formulation

 0 Hello, My problem consists to determine the exact period of patient treatment. The duration of period is 30 minutes. Indices: P patients T periods M doctor Parameter: dur[p] : the treatment duration of patient p Decision Variables Occup[m][t] {1: if a doctor is available at period t, 0:else} Trait[p][t]:{1: If patient p is treated at period t, 0:else}  => A patient is treated once on T periods. I have this constraint: At period t, if the sum of patient "p" treatment time with patients' treatment time to come before him does not exceed 30 minutes then Trait[p][t]=1 else Trait[p][t]=0 The formulation of constraint on CPLEX opl is  forall(m in doctors, t in periods) sum(p in 1..P)(dur[p]*Trait[p][t])<=30*Occup[m][t];  My problem when i add another constraint some patients will not treated at the exact period. My question is: how can I force this constraint to determine the exact treatment period. Best regards asked 19 Sep '16, 12:17 lolla 11●2 accept rate: 0% Is there a requirement/assumption that patients will be treated in the order of their indices (p=1 before p=2 before ...)? Otherwise (and I suspect the answer is no), the verbal constraint(specifically the "before him") is ambiguous. In period 1, for example, if there are six patients each with duration 10 minutes, after picking two arbitrarily (10 minutes left), wouldn't all four of the others qualify as "p" in the verbal constraint? (19 Sep '16, 15:49) Paul Rubin ♦♦

 0 If I understand your problem correctly I would suggest to modify the formulation as follows: Treat[p][t]: {1: if patient p is treated during period t} //Introduce one more variable type: StartTreat[p][t]: {1: if the treatment of a patient starts in period t} //For simplicity, instead of using a parameter dur[p] lets use a parameter periods[p] which tells us for how many periods a patient needs to be treated periods[p]: {would correspond to ceil(dur[p]/30)} //A patient is treated exactly once forall(p in 1..P) sum(t in 1..T)(StartTreat[p][t]) == 1; //If the treatment is started it cannot be interrupted forall(p in 1..P, t in 1..T) StartTreat[p][t]*periods[p] <= sum(d in 1..periods[p])(Treat[p][t+d-1]) //Make sure that a sufficient number of doctors is available forall(t in 1..T) sum(p in 1..P)(Treat[p][t]) <= sum(m in 1..M)(Occup[m][t])  Your problem has some characteristics of a flexible job shop scheduling problem with one operation per job. It might worthwhile to have a look at some papers which discuss MILP formulations for this type of problems. answered 20 Sep '16, 03:55 Walter 11●1 accept rate: 0% Hi, Thanks for the proposition. My problem when i add another constraint the period of treatment will change and is not exact (e.g: some patients will be treated in their exact period and others will not) (20 Sep '16, 07:29) lolla What do you mean by "some patients will be treated in their exact period and others will not"? I think I am missing some important information here. (20 Sep '16, 11:40) Walter I explain my problem in answers (21 Sep '16, 06:58) lolla
 0 Constraints :  constraint 1: calculate variable doctor_move forall (m in doctors,t in 2..T)  (Occup[m][t] - Occup[m][t-1])/2 <=doctor_move[m][t];    forall (m in doctors,t in 2..T)      1+(Occup[m][t] - Occup[m][t-1])/2>=doctor_move[m][t]; Constraint 2 :patients are treated according to order (FCFS)    forall(m in doctors, p in patients) sum(t in periods)t*treat[p][t]<=sum(t in periods)t* treat[p+1][t]; Constraint 3 :patient p is treated at most once    forall(m in doctors, p in patients)      sum(t in periods)treat[p][t]==1; Constraint 4 :identifying a patient treatment period  forall(m in doctors, t in 1..T) sum(p in patients)(dur[p]*Treat[p][t])<=30*Occup[m][t]; constraint 5: Calculate the remaining number of patients in each period:   forall(m in doctors, t in periods) nb_rest[m][t]==sum(p in patients,t1 in 1..t)appearance[p][t1]-sum(p in patients, t1 in 1..t)treat[p][t1]; Constraint 6: Doctor moves to service only if patients are available forall (m in doctors, t in 1..T)   doctor_move[m][t]<=nb_rest[m][t];  For example: i have 4 patients: theirs treatment period should be:  patient 1 -> treatment period =2 patient 2 -> treatment period =4 patient 3 -> treatment period =5 patient 4 -> treatment period =8  I obtain these treatment periods when i use only constraint 1 to 5. But when i add constraint 6, i will have :  patient 1 -> treatment period =2 patient 2 -> treatment period =4 patient 3 -> treatment period =8 patient 4 -> treatment period =14  (patient3 and 4 will be treated in others periods => and that is not true) answered 21 Sep '16, 06:56 lolla 11●2 accept rate: 0%
 toggle preview community wiki

### Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "Title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported

Tags:

×231
×191
×37

Asked: 19 Sep '16, 12:17

Seen: 905 times

Last updated: 21 Sep '16, 06:58

### Related questions

OR-Exchange! Your site for questions, answers, and announcements about operations research.