Decision Optimization

Decision Optimization

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

 View Only
  • 1.  Extracting constraints expressions problem .

    Posted Tue May 13, 2014 06:31 AM

    Originally posted by: azaeronet


    Hi, I'm a beginner in IBM ILOG CPLEX , I have some troubles running my program . Well I'm trying to found an optimal solution to the 3 smoothing factors in Holt Winter's forcasting .Here is what i've done so far .

     
    int Nbreperiodes=...;
    range Periodes=0..Nbreperiodes;
    float X[Periodes]=...;
    int p=...;
    float M=...;
    float x[t in 15..Nbreperiodes];
    float A0[Periodes];
    float A1[Periodes];
    float S[Periodes];
    dvar float+ a;
    dvar float+ b;
    dvar float+ g;
    minimize
      sum(t in 15..Nbreperiodes)
        (X[t]-x[t])^2;
     
        
    subject to{
             
        ct1:
         0<=a<=1;
         
        ct2:
         0<=b<=1; 
         
        ct3:
         0<=g<=1;
         
      forall (t in 0..14)
        ct3a:
          S[t]==X[t]/M;  
          
      forall (t in 15..Nbreperiodes) 
        ct6:
          A0[t]==a*(X[t]/S[t-p])+(1-a)*(A0[t-1]+A1[t-1]); 
          
      forall (t in 15..Nbreperiodes)
        ct5:
          A1[t]==b*(A0[t]-A0[t-1])+(1-b)*A1[t-1];    
         
          
      forall (t in 15..Nbreperiodes)
        ct4:
          S[t]==g*(X[t]/A0[t])+(1-g)*S[t-p];
          
        ct4a:
          A1[14]==0;
          
        ct4b:
          A0[14]==M;
      
         
      forall (t in 15..Nbreperiodes)
        ct7:
          x[t]==(A0[t]+A1[t])*S[t-p+1];
        }      

     

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: Extracting constraints expressions problem .

    Posted Tue May 13, 2014 08:28 AM

    Hi,

    and can you attach your .dat ?

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: Extracting constraints expressions problem .

    Posted Tue May 13, 2014 09:07 AM

    Originally posted by: azaeronet


    thank you for your help , here is my data file.

    SheetConnection
    sheet("PrévisionSheet.xlsx");
    p=15;
    M=2850;
    Nbreperiodes=74;
    X from SheetRead (sheet,"Sheet1!B2:BX2");

    // example of the data in the spreadsheet . 

    Périodes 0 1 2 3 4
    Série 927,54 2006,99 2591,46 1817,48 3483,69

    i think that the problem here lies in constraints containing the "/" operator .


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 4.  Re: Extracting constraints expressions problem .

    Posted Tue May 13, 2014 09:47 AM

    Hi,

    because you try to divide by 0

    Can you try with

    float A0[i in Periodes]=2;
    float A1[i in Periodes]=2;
    float S[i in Periodes]=2;

    ?

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 5.  Re: Extracting constraints expressions problem .

    Posted Tue May 13, 2014 10:39 AM

    Originally posted by: azaeronet


    Thanks AlexFleischer it did work , can you enlighten me more please .

    Regards.


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 6.  Re: Extracting constraints expressions problem .

    Posted Tue May 13, 2014 12:04 PM

    Hi,

     

    well you use divided by A and S but did not initialize those values so their values was 0 which led to divided by 0

    If you initialize those values (with non zero) then you get rid of divided by 0

    Regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer