Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  how to remove conflicts in my model

    Posted 08/28/16 09:15 AM

    Originally posted by: khadeejah


    Dear All,

     Cplex displayed a feasible relaxed sum of infeasibilities solution, and the output doesnot make sense at all. I read the nurse example and i understand why conflicts and relaxations apeared but i didnt get the point where i can relate the changes made in relaxation to my input data , i don't understand the displayed conflicts, because the refered to constraints are correct!  I want to get a feasible solution , and my model is a simple MILP.

    can anyone help me out?

    I can attach here the model.


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: how to remove conflicts in my model

    Posted 08/29/16 05:40 AM

    Hi,

    well maybe you should attach your model.

    Is that research or do you deal with a real business problem ?

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: how to remove conflicts in my model

    Posted 08/29/16 11:39 AM

    Originally posted by: khadeejah


    A research

    The mod. and data files attached


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 4.  Re: how to remove conflicts in my model

    Posted 08/30/16 04:55 AM

    Hi,

    your model is not feasible.

    Take

    forall (t in periods, j in MTSprod : t-1>=1)
         ctinv3: IMjt[j][t-1]+Mjt[j][t]-MQj[j]==IMjt[j][t];

    IMjt and Mjt are integer but in MQi you have the value 0.75 so you state here that an integer should be a sum of integer + 0.75 which is not possible

    You should comment all your constraints and then add one by one and double check them

    regards

    PS:

    If you do research in the clothes business I recommend

    https://www.ibm.com/developerworks/community/blogs/jfp/entry/zara?lang=en

    and

    https://twitter.com/AlexFleischer1/status/732548386684035072

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 5.  Re: how to remove conflicts in my model

    Posted 08/30/16 07:42 AM

    Originally posted by: khadeejah


    Thank you very much for your quick notice of the error and reply. the URL was very useful too.


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 6.  Re: how to remove conflicts in my model

    Posted 08/30/16 08:43 AM

    Originally posted by: khadeejah


    that means all my input data has to be all integers?, in that case the solution will not be accurate. Any suggestions.

    another question how i'll use the relaxed numbers if the originals are not in my data, can you please clarify this part?

    thanks


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 7.  Re: how to remove conflicts in my model

    Posted 08/30/16 09:20 AM

    Hi,

    some of your data could be float but if you state that an int decision variable should be 0.75 then you do not get any solution.

    So to fix this ctinv3 issue you may change your data into

    MQj   =[1, 1]; 

    Then you should analyze your relaxations and conflicts.

    For example you get a conflict between


    ctinv5[2]["suit"]
    ctinv8[2]["suit"]

    and relaxations


    [50,50]    [0,50]    ctinv8[2]["suit"]
    [50,50]    [0,50]    ctinv8[3]["suit"]
    [50,50]    [0,50]    ctinv8[4]["suit"]

    [1000,1000]    [0,1000]    ctinv8[4]["2p.O"]

    you may see in the attached screenshot that you have a problem: ct5 and ct8 cannot be true simultaneously unless 0==50

    So you get a conflict between the constraints and a relaxation telling you that for 2 and "suit" you should relax the constraint with the value 50

    regards

     

     

     

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 8.  Re: how to remove conflicts in my model

    Posted 08/31/16 05:55 AM

    Originally posted by: khadeejah


    dear ALex,

                     I did it.

    But why i dont have values for the amount of production per product at each t, when i should have!!!

    that was very confusing to have apparently all inventory and production decision variables ==0 in the solution??any idea!

    values, for RQ, IQ, IM..are zeroes!!

    I changed the sales output values to be less than the demand and same answer, or that because of the demand satisfaction constraint?

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 9.  Re: how to remove conflicts in my model

    Posted 09/01/16 02:33 AM

    Hi,

    with

     

    {string} MTOprod = ...;
    {string} MTSprod = ...;

    int   Nbperiods = ...;
    range periods   = 1..Nbperiods;
    float MCi     [MTOprod]= ...;
    float MCj     [MTSprod]= ...;
    float ICi     [MTOprod]= ...;
    float ICj     [MTSprod]= ...;
    float ICMi    [MTOprod]= ...;
    float ICMj    [MTSprod]= ...;
    float RCi     [MTOprod]= ...;
    float RCj     [MTSprod]= ...;
    float MQi     [MTOprod]= ...;
    float MQj     [MTSprod]= ...;

    float hi     [MTOprod]= ...;
    float hj     [MTSprod]= ...;
    float Htmax   =...;
    float wi      [MTOprod]= ...;
    float wj      [MTSprod]= ...;
    float Wtmax   =...;
    float vi      [MTOprod]= ...;
    float vj      [MTSprod]= ...;
    float Vtmax   =...;
    float Dit     [MTOprod][periods]= ...;
    float Bjt     [MTSprod][periods]= ...;
    float xi      [MTOprod]= ...;
    float yj      [MTSprod]= ...;
    float Sit     [MTOprod][periods]= ...;
    float Sjt     [MTSprod][periods]= ...;

    float initialinv = ...;
    float initialctin =...;

    dvar int+ Mit  [MTOprod][periods];
    dvar int+ Mjt  [MTSprod][periods];
    dvar int+ IQit [MTOprod][periods];
    dvar int+ IQjt [MTSprod][periods];
    dvar int+ IMit [MTOprod][periods];
    dvar int+ IMjt [MTSprod][periods];
    dvar int+ RQit [MTOprod][periods];
    dvar int+ RQjt [MTSprod][periods];


    dvar int+ ctin  [periods];
    dvar int+ ctout [periods];


    maximize
         sum (t in periods, i in MTOprod, j in MTSprod) (xi[i]*Sit[i][t]+yj[j]*Sjt[j][t])-sum (t in periods, i in MTOprod)RCi[i]*RQit[i][t]-sum (t in periods, j in MTSprod)RCj[j]*RQjt[j][t]-sum (t in periods, i in MTOprod)MCi[i]*Mit[i][t]-sum (t in periods, j in MTSprod)MCj[j]*Mjt[j][t]- sum (t in periods, i in MTOprod)IQit[i][t]*ICi[i]-sum (t in periods, i in MTOprod)IMit[i][t]*ICMi[i]- sum (t in periods, j in MTSprod)IQjt[j][t]*ICj[j]- sum (t in periods, j in MTSprod)IMjt[j][t]*ICMj[j];
         
                         subject to {
    //constraints:
                 //raw material inventory constraints:
        forall (t in periods, i in MTOprod : t-1==1)
         ctinv0: IMit[i][t-1]== initialinv;
        
        //forall (t in periods, i in MTOprod : t-1>=1)
         //ctinv1: IMit[i][t-1]+Mit[i][t]-MQi[i]==IMit[i][t];
         
          forall (t in periods, j in MTSprod : t-1==1)
         ctinv2: IMjt[j][t-1]== initialinv;
         
       forall (t in periods, j in MTSprod : t-1>=1)
         ctinv3: IMjt[j][t-1]+Mjt[j][t]-MQj[j]==IMjt[j][t];
         
              //Inventory balance constraints:
       //forall (t in periods, i in MTOprod : t-1==1)
        // ctinv4: IQit[i][t-1]== initialinv;
       
        //forall (t in periods, i in MTOprod : t-1>=1)
         //ctinv5: RQit[i][t]+IQit[i][t-1]==IQit[i][t];
         
        forall (t in periods, j in MTSprod : t-1==1)
         ctinv6: IQjt[j][t-1]== initialinv;
        
        forall (t in periods, j in MTSprod : t-1>=1)
         ctinv7: RQjt[j][t]+IQjt[j][t-1]==IQjt[j][t];
         
         //Demand/Order satisfaction constraint:
         
        forall (t in periods, i in MTOprod : t-1>=1)
         ctinv8:
         RQit[i][t]+IQit[i][t-1]-IQit[i][t]==Dit[i][t];
           
    //    forall (t in periods, j in MTSprod : t-1>=1)
    //    ctinv9: RQjt[j][t]+IQjt[j][t-1]-IQjt[j][t]==Bjt[j][t];
         
         //capacity constraints:
         
          forall (t in periods)
          ctinv10:  sum (i in MTOprod) hi[i] * RQit[i][t] + sum (j in MTSprod) hj[j] * RQjt[j][t]<= Htmax;
           
                       
    //   //storage (Raw material inventory) area capacity constraint:
    //   
       forall (t in periods)
          ctinv11: sum (i in MTOprod) IMit[i][t] * wi[i] + sum (j in MTSprod) IMjt[j][t] * wj[j]<= Wtmax;
                         
         //storage (Finished MTO, MTS products) area capacity constraint:  
          
         forall (t in periods)
         ctinv12: sum (i in MTOprod) IQit[i][t] * vi[i] + sum (j in MTSprod) IQjt[j][t] * vj[j]<= Vtmax;
                         
          // Cash Constraint:
          forall (t in periods : t-1>=1)  
          ctinv13: ctin[t]+ctin[t-1]-sum (i in MTOprod)MCi[i]-sum (j in MTSprod)MCj[j]-sum (i in MTOprod)RCi[i]-sum (j in MTSprod)RCj[j]
                                
                                +sum (i in MTOprod)Sit[i][t] * xi[i] + sum (j in MTSprod)Sjt[j][t] * yj[j]>=0;
                                
          forall (t in periods : t-1==4)
          ctinv14: ctin[t-1]>= initialctin;              
                                
          //Non-negative constraints for all decision variables:
                                
          forall (t in periods, i in MTOprod)
         ctinv15:  Mit[i][t]  >= 0;
          forall (t in periods, i in MTOprod)
         ctinv16:  IQit[i][t] >= 0;
          forall (t in periods, i in MTOprod)
         ctinv17:IMit[i][t] >= 0;
          forall (t in periods, i in MTOprod)
         ctinv18:RQit[i][t] >= 0;
    //     
    //          
          forall (t in periods, j in MTSprod)  
          ctinv19: Mjt[j][t] >= 0;
          forall (t in periods, j in MTSprod)
           ctinv20:IQjt[j][t] >= 0;
          forall (t in periods, j in MTSprod)
           ctinv21:IMjt[j][t] >= 0;
          forall (t in periods, j in MTSprod)
           ctinv22:RQjt[j][t] >= 0;
         
          forall (t in periods : t-1==1)
           ctinv23:ctcash: ctin[t]== initialctin;
          forall (t in periods)
           ctinv24:ctin[t] >= 0;
          forall (t in periods)
           ctinv25:ctout[t] >= 0;
    }       
      execute DISPLAY {
                        for (var i in MTOprod)
                           for (var j in MTSprod)
                               for (var t in periods)
                                           {
                                   writeln ("Mit[",i,"][",t,"]=",Mit[i][t]);
                                   writeln ("Mjt[",j,"][",t,"]=",Mjt[j][t]);
                                   
                                   writeln ("IQit[",i,"][",t,"]=",IQit[i][t]);
                                   writeln ("IQjt[",j,"][",t,"]=",IQjt[j][t]);
                                   
                                   writeln ("IMit[",i,"][",t,"]=",IMit[i][t]);
                                   writeln ("IMjt[",j,"][",t,"]=",IMjt[j][t]);
                                   
                                   writeln ("RQit[",i,"][",t,"]=",RQit[i][t]);
                                   writeln ("RQjt[",j,"][",t,"]=",RQjt[j][t]);
                                   
                                 
                                   writeln ("ctin[",t,"]=",ctin[t]);
                                   writeln ("ctout[",t,"]=",ctout[t]);
                    } }
                                         
                                         


                                     

     
     

    you get a feasible solution, you may start from there and try to see why adding the other constraints make your problem unfeasible

    Regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 10.  Re: how to remove conflicts in my model

    Posted 09/01/16 06:35 AM

    Originally posted by: khadeejah


    Hi Alex, why you select some of the constraints together to disable , or i just go constraint by constraint disable and check and so on. 

    when i did the latter i still have zero inventories, the conflicts i used to have was due to the demands satisfaction constraints! but i still cant figure out whats missing or incorrect so that i can have inventories.

    I tried putting data for some of the periods greater than the capacity so that i force inventory and i still have no solution!!

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer