Decision Optimization

Expand all | Collapse all

CPLEX ClearModel() vs EndModel()

  • 1.  CPLEX ClearModel() vs EndModel()

    Posted 21 days ago
    I have a very large model with 10-15M of variables and 10-15M of constraints and I need to run few iterations with some minimal changes in the model. I cache old variables and constraints so I can use in the next iteration. After each iteration finish I used to clear model by Cplex.ClearModel() function, but Cplex.ClearModel() has performance penalty in term of time taken So I want to use Cplex.EndModel(). But in some instances, in the next iteration Cplex throwing below errors when i use Cplex.EndModel() and application is terminated immediately.

    "System.AccessViolationException: 'Attempted to read or write protected memory. This is often an indication that other memory is corrupt.' "
    "Description: The process was terminated due to an unhandled exception. Exception Info: System.AccessViolationException"

    I use Cplex 12.6 .NET Conert technology.

    Is there any way i can use Cplex.EndModel() to clear my model objects instead of Cplex.ClearModel() as it is taking few minutes which i can't afford.

    I found below document in IBM site:


  • 2.  RE: CPLEX ClearModel() vs EndModel()

    Posted 12 days ago
    You have to upgrade your CPLEX Studio version: 12.6 is so old and not supported anymore.
    Many bug fixes went into the releases: there may very well be a bug in the .NET for 12.6.x release.

    Vincent Beraudier

  • 3.  RE: CPLEX ClearModel() vs EndModel()

    Posted 11 days ago
    Note that EndModel is ending all the CPLEX content, that is also the variables.

    Vincent Beraudier