Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
Expand all | Collapse all

Strange memory problem in flow script

  • 1.  Strange memory problem in flow script

    Posted 06/08/16 08:51 AM

    Originally posted by: ozgur_u


    Dear developerWorks community,

    I am having a strange memory problem on my recent project.

    I am applying benders decomposition and iteratively solving master (MIP) and subproblem (CP) for multiple run configurations (to test with different data).   To understand the cause of the problem I've deleted adding cuts (updating model) so currently I am solving master and subproblem once and then going to next dataset. However, once I finish running first run configuration, total memory usage goes up to %50 and it did not release for the next run and it increases more and more until flow script terminates with not enough memory error.

    If I just try first 2 run configurations, flow script terminates without a memory error. But memory is not freed even after algorithm ends and memory shows %80, that is the memory usage at the end of the algorithm. 

    I am using .end() for almost all objects and tried using 12.5, 12.5.1 and 12.6 to see whether this is caused by a bug or something.

    Can you please check my flow script to tell me what's wrong with the model???

     

    Regards,

    Ozgur

     main
     {
      
            writeln("logic based Benders decomposition");
            
             thisOplModel.settings.mainEndEnabled = true;
        thisOplModel.generate();
            
    
       
                       for(var rty=1;rty<3;rty++)
                       {
                       
                                    var proj= new IloOplProject("../2222");
                       
                                    var rc= proj.makeRunConfiguration("run"+rty+"");
                                    rc.settings.mainEndEnabled="true";
                                    
                                    rc.oplModel.generate();
                                    
                                    var itt_= rc.oplModel.dataElements.itt;
                                   ...and defining other data 
    
                                    var stop=0;
                                    
                                    while(stop==0)
                                    {     
                                    //solve master
                                    
                                    var masterSrc = new IloOplModelSource("model.mod");
                                    var masterDef = new IloOplModelDefinition(masterSrc);
                                    var master = new IloOplModel(masterDef,cplex);
                                    var masterData = new IloOplDataElements();
                                   
                                    masterData.itt = itt_;
                                    ...and copying other data
    
                                    master.addDataSource(masterData);
                                    master.generate();
                                    
                                              if (cplex.solve()) {
                                               var obj = cplex.getObjValue();
                                               currentbest=cplex.getObjValue();
                                               master.postProcess();
                                                writeln("final solution for scn =",obj); 
                                                      }
                                                      else{
                                                      writeln("infeasible");
                                                      stop=1;
                                                      }    
                                    
    
                                     var subData2= new IloOplDataElements();
       
                                            var subb = new IloOplRunConfiguration("sub.mod");
                                               subb.cp=new IloCP(); 
                                               
                                               subData2.nbReclaimer   =masterData.nbReclaimer;
    
                                                    subData2.nbTask   =masterData.nbTask;
                                                    ...and copying other data
                                                    
                                                    master.end();
                                                    
                                                      subb.oplModel.addDataSource(subData2);   
                                                      
                                                            subb.cp.param.ConflictRefinerTimeLimit = 300;
                                                      subb.cp.param.workers = 1;
                                                      subb.cp.param.preSolve = 0;
                                                        subb.cp.param.nooverlapinferencelevel = "Low";
                                                            subb.cp.param.defaultinferencelevel = "Low";
                                                        subb.cp.param.intervalsequenceinferencelevel = "Low";
                                                      
                                                      subb.oplModel.generate();
                                                      
                                                      
                                                            if(subb.cp.solve())
                                                      {
                                                        writeln("solved!!!=",subb.cp.getObjValue());
                                                      abc=1;  
                                                        stop=1;
                                                      
                                                        
                                                      }    
                                                      
                                                      else
                                                      {
                                                       writeln("infeasible"); 
                                                      
                                                      }    
    
                                                            subb.cp.clearModel();
                                                            subb.end();
    
                                                             stop=1;
                                    }
                    
                    
                                    rc.end();
                                      proj.end();
                                      
                    
                            }
                            
                            
                            thisOplModel.end();
    
     }
    

    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: Strange memory problem in flow script

    Posted 06/08/16 09:53 AM

    Originally posted by: ozgur_u


    Well, it seems like I solve the problem. 

    I've changed the calling method of the subproblem since I provide all of its data from the data file master run configuration. I've replaced it with calling just .mod file and also defining other required objects. Otherwise it never frees up memory, even after algorithm terminates.

    Regards,

    Ozgur
                                              


    #DecisionOptimization
    #OPLusingCPLEXOptimizer