Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Terminating IloModel

    Posted 03/09/18 09:04 AM

    Originally posted by: jawadomari


    Hello,

    I am solving multiple instances of a scheduling problem. I loop through the instance files, read the data files, and create an instance of IloModel and IloCplex for each instance to model and solve the mathematical program. When a solution is found, I call the .end() method for each of the IloModel and IloCplex instances to clear them from the solved problem instance data and move on to the next one.

    The problem is that the .end() method takes a very long time, almost as long as it takes to build the model (about 30 minutes). Is there a reason why termination takes that long? Or, is there another way to clear the both cplex and the model instances after solving a problem instance?

    Thanks. 


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Terminating IloModel

    Posted 03/09/18 09:29 AM

    In which order to you call end()? Does it help to end() the IloCplex instance before the IloModel instance? Alternatively, call IloCplex::clearModel() before calling any of the end() functions.

    If you call IloModel::end() before IloCplex::end() then the following happens:

    • Constraints and variables are removed from IloModel one by one or in small chunks (this happens anyway, even if you reverse the calls).
    • Each removal operation is a modification of the model. Hence any IloAlgorithm (superclass of IloCplex) that has the model extracted is notified about this removal and will update its internal data structures.
    • These updates are of course a pure waste of time if you are dropping the whole model and/or are deleting the IloCplex instance anyway.

    The trick to avoid these useless notifications is to "disconnect" the IloCplex and IloModel instance before deleting or to delete the IloCplex instance first.


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Terminating IloModel

    Posted 03/12/18 05:13 AM

    Originally posted by: jawadomari


    I terminate the model first, the the cplex instance. 

    I changed it to this order: IloCplex.clearModel(); IloCplex.end(); IloModel.end(); and observed major reductions in the termination time. 

    Thank you. 


    #CPLEXOptimizers
    #DecisionOptimization