Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Out of Memory Error!

    Posted 01/07/17 10:39 AM

    Originally posted by: BhavnaJha


    The following is my .mod file in opl. I'm using IBM ILOG OPTIMIZATION STUDIO 12.7 Version. 

    And when I run this file I get the ERROR:

    MIP starts could not be constructed. CPLEX 1001 : OUT OF MEMORY. 

    I tried changing the cplex parameters, but even then the result was the same. 

    Can some one please suggest how to solve this error and make this program work? 

    Should I change the algorithm or have I coded the program incorrectly? If, yes then how to fix it? 

    Also, can someone please tell , if I'm changing the parameters correctly in the script? 

     

    I'm using a system with 4GB RAM and 878 GB free disk space. According to calculations suggested to estimate the memory required by a model, my model has around 19,000 constraints dividing it by 1000, 19. So it should require around 19 MB for a relaxed LP. But even for the relaxed problem it shows OUT OF MEMORY. Can someone please tell what's happening?

    I need a response ASAP. 

    Thanks, in advance. 

     

    execute PARAMS
    {
    cplex.nodefileind = 3;
    cplex.workmem = 500;
    }
     
    range locations = 1..612;
    range states = 1..34;
    range JK = 1..11;
    range HP = 12..23;
    range P = 24..42;
    range U = 43..57;
    range H = 58..77;
    range Del = 78..84;
    range UP = 117..186;
    range Bihar = 187..224;
    range Sikkim = 225..228;
    range ArP = 229..244;
    range Naga = 245..255;
    range Mani = 256..264;
    range Mizo = 265..272;
    range TP = 273..276;
    range Megh = 277..283;
    range Assam = 284..310;
    range wb = 311..329;
    range raj = 85..116;
    range guj = 446..470;
    range dnd = 471..472;
    range dadar = 473..473;
    range maha = 474..507;
    range krntka = 531..557;
    range goa = 558..559;
    range laksh = 560..560;
    range kerala = 561..574; 
    range jhkd = 330..351;
    range orr = 352..381;
    range chatt = 382..397;
    range mp = 398..445;
    range ap = 508..530;
    range tn = 575..605;
    range pondi = 606..609;
    range andmn = 610..612;
    {string} grains = ...;
    {string} hh = ...;

    int fp = 300000000;
    int ff = 0;
    int M[grains] = ...;
    float F[grains] = ...;
    float PC[locations][grains] = ...; // Govt. Disposable quantity of each grain in each district
    float D[locations][grains] = ...; // Demand of each grain in each district;
    float W[locations][grains] = ...; // Price of grains to consumer in open market;
    float tt[locations][locations] = ...; // Cost of transportation from locations to procurement centres
    float b[hh] = ...;
    float no_of_hh[locations][hh] = ...;

    dvar float+ Z[locations][grains];
    dvar float+ Q[locations][grains];
    dvar float+ eta[locations][locations][grains] ;
    dvar float+ q1[states][grains][hh] ;
    dvar float+ T[locations][locations][grains];
    dvar float+ Y[locations];
    dvar float+ S[locations][locations][grains] ;
    dvar float+ de[locations][grains];

    //MODEL

    minimize
       
         sum(proc in locations, j in grains) 
             (F[j]*sum(i in locations) eta[i][proc][j]*PC[i][j] + ff*Z[proc][j])
     + sum ( store in locations) fp * Y[store] 
     + sum(i in locations, proc in locations, j in grains) (2 * eta[i][proc][j] * PC[i][j] * tt[i][proc] )
     + sum(proc in locations, store in locations, j in grains) T[proc][store][j] 
     + sum(store in locations , distri in locations, j in grains) S[store][distri][j]
     + sum(i in locations, proc in locations, j in grains) eta[i][proc][j]*PC[i][j]*M[j]
     + sum(i in locations, j in grains) W[i][j]*de[i][j] 
    ;
     
    subject to {

    forall ( i in locations, j in grains) 
        ct1: sum (proc in locations) eta[i][proc][j] <= 1;
        
    forall (proc in locations, j in grains) 
        ct2: sum ( i in locations) eta[i][proc][j] <= 612*Z[proc][j];
        
    forall (k in states, h in hh)
      ct3: sum(j in grains) q1[k][j][h] == b[h] ;
      
    forall ( distri in JK, j in grains) 
        ct4: sum(store in locations) S[store][distri][j] == minl ( (sum (h in hh) q1[1][j][h]*no_of_hh[distri][h]) , D[distri][j]) ;
        
    forall ( distri in HP, j in grains) 
        ct5: sum(store in locations) S[store][distri][j] == minl ( (sum (h in hh) q1[2][j][h]*no_of_hh[distri][h]) , D[distri][j]) ;
        
    forall ( distri in P, j in grains) 
        ct6: sum(store in locations) S[store][distri][j] == minl ( (sum (h in hh) q1[3][j][h]*no_of_hh[distri][h]) , D[distri][j]) ;

    forall ( distri in H, j in grains) 
        ct7: sum(store in locations) S[store][distri][j] == minl ( (sum (h in hh) q1[4][j][h]*no_of_hh[distri][h]) , D[distri][j]) ;

    forall ( distri in U, j in grains) 
        ct8: sum(store in locations) S[store][distri][j] == minl ( (sum (h in hh) q1[5][j][h]*no_of_hh[distri][h]) , D[distri][j]) ;

    forall ( distri in Del, j in grains) 
        ct9: sum(store in locations) S[store][distri][j] == minl ( (sum (h in hh) q1[6][j][h]*no_of_hh[distri][h]) , D[distri][j]) ;

    forall ( distri in UP, j in grains) 
        ct10: sum(store in locations) S[store][distri][j] == minl ( (sum (h in hh) q1[7][j][h]*no_of_hh[distri][h]) , D[distri][j]) ;

    forall ( distri in Bihar, j in grains) 
        ct11: sum(store in locations) S[store][distri][j] == minl ( (sum (h in hh) q1[8][j][h]*no_of_hh[distri][h]) , D[distri][j]) ;

    forall ( distri in Sikkim, j in grains) 
        ct12: sum(store in locations) S[store][distri][j] == minl ( (sum (h in hh) q1[9][j][h]*no_of_hh[distri][h]) , D[distri][j]) ;

    forall ( distri in ArP, j in grains) 
        ct13: sum(store in locations) S[store][distri][j] == minl ( (sum (h in hh) q1[10][j][h]*no_of_hh[distri][h]) , D[distri][j]) ;

    forall ( distri in Naga, j in grains) 
        ct14: sum(store in locations) S[store][distri][j] == minl ( (sum (h in hh) q1[11][j][h]*no_of_hh[distri][h]) , D[distri][j]) ;

    forall ( distri in Mani, j in grains) 
        ct15: sum(store in locations) S[store][distri][j] == minl ( (sum (h in hh) q1[12][j][h]*no_of_hh[distri][h]) , D[distri][j]) ;

    forall ( distri in Mizo, j in grains) 
        ct16: sum(store in locations) S[store][distri][j] == minl ( (sum (h in hh) q1[13][j][h]*no_of_hh[distri][h]) , D[distri][j]) ;

    forall ( distri in TP, j in grains) 
        ct17: sum(store in locations) S[store][distri][j] == minl ( (sum (h in hh) q1[14][j][h]*no_of_hh[distri][h]) , D[distri][j]) ;

    forall ( distri in Megh, j in grains) 
        ct18: sum(store in locations) S[store][distri][j] == minl ( (sum (h in hh) q1[15][j][h]*no_of_hh[distri][h]) , D[distri][j]) ;

    forall ( distri in Assam, j in grains) 
        ct19: sum(store in locations) S[store][distri][j] == minl ( (sum (h in hh) q1[16][j][h]*no_of_hh[distri][h]) , D[distri][j]) ;

    forall ( distri in wb, j in grains) 
        ct20: sum(store in locations) S[store][distri][j] == minl ( (sum (h in hh) q1[17][j][h]*no_of_hh[distri][h]) , D[distri][j]) ;

    forall ( distri in raj, j in grains) 
        ct21: sum(store in locations) S[store][distri][j] == minl ( (sum (h in hh) q1[18][j][h]*no_of_hh[distri][h]) , D[distri][j]) ;

    /*forall ( distri in guj, j in grains) 
        ct22: sum(store in locations) S[store][distri][j] == minl ( (sum (h in hh) q1[19][j][h]*no_of_hh[distri][h]) , D[distri][j]) ;

    forall ( distri in dnd, j in grains) 
        ct23: sum(store in locations) S[store][distri][j] == minl ( (sum (h in hh) q1[20][j][h]*no_of_hh[distri][h]) , D[distri][j]) ;

    forall ( distri in dadar, j in grains) 
        ct24: sum(store in locations) S[store][distri][j] == minl ( (sum (h in hh) q1[21][j][h]*no_of_hh[distri][h]) , D[distri][j]) ;

    forall ( distri in maha, j in grains) 
        ct25: sum(store in locations) S[store][distri][j] == minl ( (sum (h in hh) q1[22][j][h]*no_of_hh[distri][h]) , D[distri][j]) ;

    forall ( distri in krntka, j in grains) 
        ct26: sum(store in locations) S[store][distri][j] == minl ( (sum (h in hh) q1[23][j][h]*no_of_hh[distri][h]) , D[distri][j]) ;

    forall ( distri in goa, j in grains) 
        ct27: sum(store in locations) S[store][distri][j] == minl ( (sum (h in hh) q1[24][j][h]*no_of_hh[distri][h]) , D[distri][j]) ;

    forall ( distri in laksh, j in grains) 
        ct28: sum(store in locations) S[store][distri][j] == minl ( (sum (h in hh) q1[25][j][h]*no_of_hh[distri][h]) , D[distri][j]) ;

    forall ( distri in kerala, j in grains) 
        ct29: sum(store in locations) S[store][distri][j] == minl ( (sum (h in hh) q1[26][j][h]*no_of_hh[distri][h]) , D[distri][j]) ;
    */
    forall ( distri in jhkd, j in grains) 
        ct30: sum(store in locations) S[store][distri][j] == minl ( (sum (h in hh) q1[27][j][h]*no_of_hh[distri][h]) , D[distri][j]) ;

    forall ( distri in orr, j in grains) 
        ct31: sum(store in locations) S[store][distri][j] == minl ( (sum (h in hh) q1[28][j][h]*no_of_hh[distri][h]) , D[distri][j]) ;

    forall ( distri in chatt, j in grains) 
        ct32: sum(store in locations) S[store][distri][j] == minl ( (sum (h in hh) q1[29][j][h]*no_of_hh[distri][h]) , D[distri][j]) ;

    /*forall ( distri in mp, j in grains) 
        ct33: sum(store in locations) S[store][distri][j] == minl ( (sum (h in hh) q1[30][j][h]*no_of_hh[distri][h]) , D[distri][j]) ;

    forall ( distri in ap, j in grains) 
        ct34: sum(store in locations) S[store][distri][j] == minl ( (sum (h in hh) q1[31][j][h]*no_of_hh[distri][h]) , D[distri][j]) ;

    forall ( distri in tn, j in grains) 
        ct35: sum(store in locations) S[store][distri][j] == minl ( (sum (h in hh) q1[32][j][h]*no_of_hh[distri][h]) , D[distri][j]) ;

    forall ( distri in pondi, j in grains) 
        ct36: sum(store in locations) S[store][distri][j] == minl ( (sum (h in hh) q1[33][j][h]*no_of_hh[distri][h]) , D[distri][j]) ;

    forall ( distri in andmn, j in grains) 
        ct37: sum(store in locations) S[store][distri][j] == minl ( (sum (h in hh) q1[34][j][h]*no_of_hh[distri][h]) , D[distri][j]) ;
    */
    forall ( distri in locations , j in grains) 
        ct38: de[distri][j] == D[distri][j] - sum( store in locations) S[store][distri][j];
        
    forall ( proc in locations, j in grains) 
        ct39: sum ( store in locations) T[proc][store][j] == sum (i in locations) eta[i][proc][j]*PC[i][j] ;

    // Capacity constraint for storage centres 
    //forall ( store in locations) 
    //    ct40: sum ( proc  in locations, j in grains) T[proc][store][j] <= L[store]*Y[store] ;

    forall ( store in locations, j in grains) 
        ct40: sum ( distri in locations) S[store][distri][j] == sum ( proc in locations) T[proc][store][j];    

    }

     

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: Out of Memory Error!

    Posted 01/07/17 11:37 AM

    Hi,

    can you attach the .dat so that other users Could try ?

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: Out of Memory Error!

    Posted 01/07/17 12:13 PM

    Originally posted by: BhavnaJha


    SheetConnection sheet("C:/Users/30979/Google Drive/Decentralized PDS/DPDS_Data_Sheet.xlsx");
    grains from SheetRead(sheet,"'MSP'!A2:A9");
    hh from SheetRead(sheet,"'State_Basket'!A2:A4");
    M from SheetRead(sheet,"'MSP'!B2:B9");
    F from SheetRead(sheet,"'Procurement Cost'!B2:B9");
    PC from SheetRead(sheet,"'PC'!B2:I613");
    D from SheetRead(sheet,"'Demand'!B2:6137");
    W from SheetRead(sheet,"'Open_Mkt_price'!B2:I613");
    tt from SheetRead(sheet,"'Transportation_Cost'!B2:WO613");
    b from SheetRead(sheet,"'State_Basket'!B2:B4");
    no_of_hh from SheetRead(sheet,"'no_of_hh'!B2:D613");

    Z to SheetWrite(sheet,"RESULT_Z!B2:I613");
    Q to SheetWrite(sheet,"RESULT_Q!B2:I613");
    eta to SheetWrite(sheet,"'RESULT_eta'!");
    q1 to SheetWrite(sheet,"'RESULT_q1'");
    T to SheetWrite(sheet,"'RESULT_T'");
    Y to SheetWrite(sheet,"'RESULT_Y'!A2:A613");
    S to SheetWrite(sheet,"'RESULT_S'");
    de to SheetWrite(sheet,"'RESULT_de'!B2:I613");


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 4.  Re: Out of Memory Error!

    Posted 01/07/17 12:16 PM

    Originally posted by: BhavnaJha


    This is the Data File. 


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 5.  Re: Out of Memory Error!

    Posted 01/11/17 08:02 AM

    Originally posted by: BhavnaJha


    Hi, 

    Any luck on how to solve this? 

    Thanks. 

    Bhavna


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 6.  Re: Out of Memory Error!

    Posted 01/12/17 02:32 AM

    Originally posted by: BhavnaJha


    Is my problem actually too large for cplex to solve it or have I done some modeling mistake??? :/ 


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 7.  Re: Out of Memory Error!

    Posted 01/12/17 03:24 AM

    Hi,

    your model requires a lot of memory and when I see full Euclidian products like

    [locations][locations]

    I wonder whether you should not try to remove arcs that won t be used because too long distance.

    or you may also try to solve in the cloud in order to use machines with a lot of RAM : https://onboarding-oaas.docloud.ibmcloud.com/

    Regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 8.  Re: Out of Memory Error!

    Posted 01/12/17 07:06 AM

    Originally posted by: BhavnaJha


    You mean I should remove the arcs that won't be used? 

    Also, after giving an initial solution it's again giving the same error. This is what the log file looks like. 

    <<< setup

    Setting initial solution
    Presolve has eliminated 0 rows and 0 columns...
    Reduced MIP has 83334 rows, 9059028 columns, and 22733360 nonzeros.
    Reduced MIP has 15300 binaries, 0 generals, 0 SOSs, and 19584 indicators.
    Presolve time = 245.89 sec. (213278.56 ticks)

    Root node processing (before b&c):
      Real time             =  290.03 sec. (214040.30 ticks)
    Parallel b&c, 4 threads:
      Real time             =    0.00 sec. (0.00 ticks)
      Sync time (average)   =    0.00 sec.
      Wait time (average)   =    0.00 sec.
                              ------------
    Total (root+branch&cut) =  290.03 sec. (214040.30 ticks)
    Warning: MIP starts not constructed because of out-of-memory status.
    *** ERROR[ENGINE_002] at 272:0 C:\Users\30979\opl\DPDS\DPDS_200.mod: Exception from IBM ILOG CPLEX: CPLEX Error  1001: Out of memory.
    *** ERROR[ENGINE_002] at 272:0 C:\Users\30979\opl\DPDS\DPDS_200.mod: Exception from IBM ILOG CPLEX: CPLEX status = 1001.
    main returns -2

    <<< main


    <<< done

     

    Why is it still saying MIP starts not constructed when I gave a MIP start? 

    Please help me solve this problem. 

    Thanks, 

    Bhavna. 


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 9.  Re: Out of Memory Error!

    Posted 01/12/17 08:15 AM

    Hi,

    You mean I should remove the arcs that won't be used?   ==> Yes

    Instead of doing forall location 1 and forall location 2 why not iterating only on the arcs that make sense ?

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 10.  Re: Out of Memory Error!

    Posted 01/12/17 10:07 AM

    Originally posted by: BhavnaJha


    Hi, 

    while giving the model to solve it in the cloud, I get the following error:  

    Processing - Error during execution of main script (6:90-6:91 DPDS_200D.dat: Sheet operation is not supported on the Cloud: sheetConnection.).

     

    So,  what is another way to include my data set in the model, instead of sheetConnection? 

     

    Thanks, 

    Bhavna


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 11.  Re: Out of Memory Error!

    Posted 01/12/17 10:14 AM


  • 12.  Re: Out of Memory Error!

    Posted 01/12/17 01:08 PM

    Originally posted by: BhavnaJha


    Thank you for your time and help! :) 


    #DecisionOptimization
    #OPLusingCPLEXOptimizer