Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  memory issue

    Posted 01/16/11 08:36 AM

    Originally posted by: victortkl


    Hi, i come across a problem about not enough memory. what can i do?
    i used optmodel.end() and cplex.end() to free memory, but it seems still consuming much memory while iterating. what else can i do?

    here is my main code, even iterate one time in the outer loop. it still lack of memory.
    
    main 
    { var big_sce=1000; 
    //    var theta=0.38; 
    
    for (var theta=0.3;theta>=0.3;theta=theta-0.01) 
    { var source = 
    
    new IloOplModelSource(
    "ite_inventory_base.mod"); var cplex = 
    
    new IloCplex(); var def = 
    
    new IloOplModelDefinition(source); var optmodel = 
    
    new IloOplModel(def,cplex); var datafile= 
    
    new IloOplDataSource(
    "ite_inventory_base.dat"); var datatheta = 
    
    new IloOplDataElements(); datatheta.thetainv = theta; optmodel.addDataSource(datatheta); optmodel.addDataSource(datafile); optmodel.settings.mainEndEnabled = 
    
    true; optmodel.generate(); optmodel.settings.mainEndEnabled = 
    
    true; var isok=0; 
    
    if (cplex.solve()) 
    { optmodel.postProcess(); writeln(
    "theta = "+theta+
    "\tget solution:\t"+cplex.getObjValue()); isok=1; optmodel.end(); cplex.end(); 
    } 
    
    else 
    { writeln(
    "theta = "+theta+
    "\tno solution"); optmodel.end(); cplex.end(); 
    } 
    
    if (isok==1) 
    { 
    
    for (var simite=1;simite<=big_sce;simite++) 
    { source = 
    
    new IloOplModelSource(
    "sim_inventory_base.mod"); cplex = 
    
    new IloCplex(); def = 
    
    new IloOplModelDefinition(source); var simmodel = 
    
    new IloOplModel(def,cplex); datafile= 
    
    new IloOplDataSource(
    "sim_inventory_base.dat"); var datasce = 
    
    new IloOplDataElements(); datasce.numm = simite; datasce.thetainv=theta; 
    //                datatheta.thetademand=theta; simmodel.addDataSource(datasce); simmodel.addDataSource(datafile); simmodel.settings.mainEndEnabled = 
    
    true; simmodel.generate(); simmodel.settings.mainEndEnabled = 
    
    true; 
    //                simmodel.settings.mainEndEnabled = true;            
    
    if (cplex.solve()) 
    { 
    //                    //get the original data 
    ////                    if (simite mod 10==0) 
    ////                    { writeln(
    "ite:"+simite+
    ":\t"+cplex.getObjValue()); 
    ////                    } simmodel.postProcess(); simmodel.end(); cplex.end(); 
    } 
    
    else 
    { writeln(
    "ite:"+simite+
    ":\t"+
    "no solution"); 
    }   
    } 
    } 
    } 
    }
    

    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: memory issue

    Posted 06/16/11 09:23 AM

    Originally posted by: SystemAdmin


    you only end the IloOplModel and the IloCplex.
    You should also end the data sources, data elements, ... in the reverse order of creation to avoid memory mismatch freeing.
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: memory issue

    Posted 06/21/11 09:07 AM

    Originally posted by: UDOPS


    Can you expand on that advice. You say in the reverse order of creation. That is interesting, and something I have not considered.
    #DecisionOptimization
    #OPLusingCPLEXOptimizer