Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  boolean constraint in master problem

    Posted 07/19/19 11:28 AM

    Originally posted by: Sultan_Niz7755


    Hi everybody,

    Let me share you with problem. I have to rewrite a column oriented formulation of original problem. The scheduling problem can be considered as a problem of selecting N columns, one for each patient, that's why I have typed range K = 1..N. Let y(k) for k€Omega be a binary decision variable that takes 1 if the feasible column k is  selected and 0 otherwise. Accordingly there is also  a constraint that it says whether column selected or not like this ( y(k) € {0,1}, forall k€ Omega. And I have typed it accordingly so:

    int  N = ...;// Number of Patients
      int j = ...; // Number of tasks
      range Patient = 1..N;
      range Task = 1..j;
      int P = ...; // Number of Porters
      range Porter = 1..P;
      int R = ...; // Number of Operating rooms
      range Room = 1..R;
      int B = ...; // Number of recovery beds
      range Bed = 1..B;
      int Period = ...;
      range H = 0..Period-1; // discrete Time horizon of H Periods, The discrete Time unit is set equal to 10 Minutes
      range K = 1..N;
       
      
      int p[Patient, Task] = ...;
      dvar int+ c[K];
      dvar boolean x[Patient, K];//1,if column k is related to patient i
      dvar int+ s[K,Task];//starting time of the task j according to column k
      dvar boolean y[K];//let y(k) for k€K be a binary decision variable that takes 1 if the feasible column k is selected and 0 otherwise
      dvar boolean u[H,K];
      dvar boolean v[H,K];
      dvar boolean w[H,K];
      dvar boolean result[Patient, K];
     
      
      minimize sum (k in K)c[k]*y[k];
      
      subject to  {
      
      forall (k in K) c[k] == s[k,4] + (sum (i in Patient) x[i,k]*p[i,4]);
      
      forall (k in K, i in Patient)(x[i,k] == 1) => x[i,k] * p[i,4] == p[i,4];
      
      forall (k in K, i in Patient)(x[i,k] == 0) =>  x[i,k] * p[i,4] == 0;
      
      forall (i in Patient, k in K, t in H) u[t,k] == (((s[k, 1] <= t)  && (s[k, 1] + p[i, 1] - 1) >= t) + ((s[k, 4] <= t)  && (s[k, 4] + p[i, 4] - 1) >= t));
      
      forall (i in Patient, k in K, t in H) v[t,k] == ((s[k, 2] <= t)  && (s[k, 2] + p[i, 2] + p[i,5] - 1) >= t);
      
      forall (i in Patient, k in K, t in H) u[t,k] == ((s[k, 4] <= t)  && (s[k, 4] + p[i, 4] - 1) >= t);
      
      forall (i in Patient) sum (k in K) (result[i, k]) == 1;
      
      forall (i in Patient, k in K) x[i,k] + y[k] <= 1 + result[i, k];
      
      forall (i in Patient, k in K) result[i, k] <= y[k];
      
      forall (i in Patient, k in K) result[i, k] <= x[i,k];
      
      forall (t in H, pi in Porter) sum (k in K) u[t,k]*y[k] <= pi;
      
      forall (t in H, r in Room) sum (k in K) v[t,k]*y[k] <= r;
      
      forall (t in H, b in Bed) sum (k in K) w[t,k]*y[k] <= b;
      
      forall (k in K) y[k] == 1;
      
        
      }

     

    and it gives just y[1111111111] which is not feasible.

    I will be very thankful from any advice.

     

     

    regards, Sherzod


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: boolean constraint in master problem

    Posted 07/22/19 10:55 AM

    Your constraint

    forall(k in K) y[k] == 1;

    states that all the y[k] variables must be set to 1. Is that intended? I guess not but I am not sure what you are trying to model with this constraint. If you want to say that each y[k] is in {0, 1} then there is no need to state this explicitly.: this is already implied by y[k] being boolean.


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: boolean constraint in master problem

    Posted 07/23/19 03:49 PM

    Originally posted by: Sultan_Niz7755


    Hi Daniel,

     

    thank you very much for your reply. After deleting the constraint, I let the model run again. But I got this error: CPLEX Error 5002: 'q1' is not convex. what can it depend on?

     

    regards


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: boolean constraint in master problem

    Posted 07/25/19 04:50 AM

    Originally posted by: Sultan_Niz7755


    Hi everybody,

     

    could someone help to know?

     

    regards,

    Sherzod


    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: boolean constraint in master problem

    Posted 07/25/19 05:40 AM

    Please note that this is a free of charge forum. People contribute when they find the time, so please don't push.

    Moreover, your original question is answered and marked as such. Thus people may skip this thread.

    Since your new question is unrelated to the previous one, you should have created a new thread instead.

    The error message

    CPLEX Error 5002: 'q1' is not convex. what can it depend on?

    indicates that you have some constraints that involve products of variables and these constraints are not convex (see here). You will have to check all your constraints. Or label them so that you get a more descriptive error message.
    Also, the error message you receive has been discussed many times on this forum. Searching for it may get you some help.


    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: boolean constraint in master problem

    Posted 07/25/19 09:48 AM

    Originally posted by: Sultan_Niz7755


    Hi Daniel,

    I'm sorry.
    thank you very much for your instruction and answer. I'll take care of it then.
    many greetings


    #CPLEXOptimizers
    #DecisionOptimization