Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  cplex callback error

    Posted 01/30/18 08:32 PM

    Originally posted by: gugugu


    Dear all,

     

    I'm using cplex package in Java and got following error when using LazyConstraintCallback:

     

    Exception in thread "main" ilog.concert.IloException: Error in callback
     at ilog.cplex.CpxCallback.checkException(CpxCallback.java:148)
     at ilog.cplex.CplexI.checkCallbacks(CplexI.java:426)
     at ilog.cplex.CplexI$SolveHandle.stop(CplexI.java:2626)
     at ilog.cplex.CplexI.solve(CplexI.java:2648)
     at ilog.cplex.IloCplex.solve(IloCplex.java:10413)
     at cplex.BenderRSP1.solve(BenderRSP1.java:617)
     at main.Main_Solver.solveBenderRSP1(Main_Solver.java:88)
     at main.Main_Solver.main(Main_Solver.java:51)
    Caused by: java.lang.OutOfMemoryError: GC overhead limit exceeded
     at ilog.cplex.CpxQExpr.<init>(CpxQExpr.java:36)
     at ilog.cplex.CpxQuadNumExpr.<init>(CpxQuadNumExpr.java:31)
     at ilog.cplex.CpxQextractor.visitMult(CpxQextractor.java:112)
     at ilog.cplex.CpxMult.accept(CpxMult.java:25)
     at ilog.cplex.CpxQextractor.visitLinkedExpr(CpxQextractor.java:73)
     at ilog.cplex.CpxLinkedExpr.accept(CpxLinkedExpr.java:50)
     at ilog.cplex.CpxQextractor.visitNegative(CpxQextractor.java:51)
     at ilog.cplex.CpxNegative.accept(CpxNegative.java:25)
     at ilog.cplex.CpxQextractor.visitLinkedExpr(CpxQextractor.java:77)
     at ilog.cplex.CpxLinkedExpr.accept(CpxLinkedExpr.java:50)
     at ilog.cplex.CpxRange.<init>(CpxRange.java:1342)
     at ilog.cplex.IloCplexModeler.makeRange(IloCplexModeler.java:4318)
     at ilog.cplex.IloCplexModeler.ge(IloCplexModeler.java:5030)
     at cplex.BenderRSP1$BendersCallback.main(BenderRSP1.java:604)
     at ilog.cplex.CpxCallback.callmain(CpxCallback.java:160)
     at ilog.cplex.CpxLazyConstraintCallbackFunction.callIt(CpxLazyConstraintCallbackFunction.java:45)
     at ilog.cplex.Cplex.CPXmipopt(Native Method)
     at ilog.cplex.CplexI$SolveHandle.start(CplexI.java:2521)
     at ilog.cplex.CplexI.solve(CplexI.java:2647)
     ... 4 more

     

    I thought first the problem might be the insufficient memory. But as I already set up the working directory in case RAM is used up by invoking the method "*.setParam(IloCplex.IntParam.WorkDir, *)" and besides, this problem hasn't occurred with even larger instances/models, I assume there must be some other reason.

     

    Can someone help me? Thanks a lot in advance!

     

    Cheers


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: cplex callback error

    Posted 01/31/18 03:03 AM

    To debug that, wrap your whole callback's main method into a try-catch and print the exception. Like so:

    void main() throws IloException {
      try {
        // your code here
      }
      catch (Throwable t) {
        System.err.println("Exception in callback " + t);
        t.printStackTrace()
        throw t;
      }
    }

    This should give you more information about what is actually going wrong.

    On the other hand, your exception message clearly seems to indicate that you ran out of memory. Parameter WorkDir applies only to the memory required for the search tree. If the your model is already huge you can run out of memory even before the tree search phase starts. Or you can run out of memory if you add a large number or very long constraints and that causes a temporary memory spike. Moreover, setting WorkDir alone will not cause CPLEX to swap out anything. You also have to set NodeFileInd to 2 or 3. Also, depending on the value of parameter WorkMem CPLEX may not even have started to swap out data to disk.

    So my guess is that you are indeed running out of memory.


    #CPLEXOptimizers
    #DecisionOptimization