Topic
4 replies Latest Post - ‏2013-01-29T01:12:25Z by SystemAdmin
SystemAdmin
SystemAdmin
554 Posts
ACCEPTED ANSWER

Pinned topic Empty handle

‏2013-01-25T14:43:01Z |
Hello everyone,

I'm coding a problem in CP Optimizer, and it returns the error: "empty handle"!:

IloCP: empty handle
testCplex: /opt/ibm/ILOG/CPLEX_Studio125/cpoptimizer/include/ilcp/cpext.h:852: void IlcCPORevInt::setValue(IloCP, IlcInt): Assertion `(cp.getImpl() != 0) || (IlcBacktrace(), std:: cerr << ("IloCP: empty handle") << std:: endl, ilc_stop_assert())' failed.

I debugged the code, and it returned me this error http://at if (cp.solve()) :
Single stepping until exit from function siglongjmp,
which has no line number information.
Warning:
Cannot insert breakpoint 0.
Error accessing memory address 0x55a6f7f7: Input/output error.

and in the next line:

IloCP: empty handle
testCplex: /opt/ibm/ILOG/CPLEX_Studio125/cpoptimizer/include/ilcp/cpext.h:852: void IlcCPORevInt::setValue(IloCP, IlcInt): Assertion `(cp.getImpl() != 0) || (IlcBacktrace(), std:: cerr << ("IloCP: empty handle") << std:: endl, ilc_stop_assert())' failed.

IloCP: empty handle
testCplex: /opt/ibm/ILOG/CPLEX_Studio125/cpoptimizer/include/ilcp/cpext.h:852: void IlcCPORevInt::setValue(IloCP, IlcInt): Assertion `(cp.getImpl() != 0) || (IlcBacktrace(), std:: cerr << ("IloCP: empty handle") << std:: endl, ilc_stop_assert())' failed.
Could you help me figure out what this error means and how I can correct it?

Thank you.
Updated on 2013-01-29T01:12:25Z at 2013-01-29T01:12:25Z by SystemAdmin
  • ChrisBr
    ChrisBr
    57 Posts
    ACCEPTED ANSWER

    Re: Empty handle

    ‏2013-01-25T17:03:56Z  in response to SystemAdmin
    Hello,

    The "empty handle" error means that you are trying to use a handle with no implementation.

    see: http://pic.dhe.ibm.com/infocenter/cosinfoc/v12r5/index.jsp
    CP Optimizer > CP Optimizer C++ API Reference Manual > Concepts > Handle class

    For example:
    
    IloCP cp;
    

    declares a empty IloCP handle

    whereas
    
    IloCP cp(env);
    

    creates the right implementation attached to the cp handle.
    Nevertheless, if you don't use any feature of CP Optimizer extensions (CP Optimizer > CP Optimizer C++ API Reference Manual > optim.cpoptimizer.extensions) it wouldn't be so obvious for you to find the guilty call (because the error message mentions IlcCPORevInt which is one of these extensions).
    In this case, it could help if you post your model, as we would be able to help you better.

    Regards,

    Chris.
  • SystemAdmin
    SystemAdmin
    554 Posts
    ACCEPTED ANSWER

    Re: Empty handle

    ‏2013-01-25T19:04:52Z  in response to SystemAdmin
    Thanks for the reply.

    I do use IloCP cp as an object's argument, and

    In the code, I had defined some constant to which no value had been assigned. I corrected this mistake, and now I returns no empty class error. However, it reports infeasible! Surprisingly, it says "0 Variables", while I do have some variables.

    Please see what it returns in the console:

    !
    ! Satisfiability problem - 0 variables, 20 constraints
    ! Problem found infeasible at the root node
    !
    ! Search terminated normally, model has no solution.
    ! Number of branches : 0
    ! Number of fails : 3
    ! Total memory usage : 327.2 kB (316.4 kB CP Optimizer + 10.8 kB Concert)
    ! Time spent in solve : 0.00s (0.00s engine + 0.00s extraction)
    ! Search speed (br. / s) : 0
    Please also see the propagate() as a public member function of the constraint class NoSubtour, where I use the empty handle IloCP cp:

    void NoSubtourI::propagate(){
    IloInt FirstNode;
    IloInt EndNode;
    IloCP cp;
    for (IloInt i=0; i < successor.getSize()-2; i++){

    if (successor[i].isFixed()){
    FirstNode=first[i];
    first[successorhttp://i].getValue().setValue(cp, FirstNode);

    EndNode=end[successorhttp://i].getValue();
    end[i].setValue(cp, EndNode);

    successorEndNode.removeValue(FirstNode);

    }
    }

    }

    Well, I had to use IloCP cp there because otherwise it could not identify getValue() and setValue().

    Thanks.
    • ChrisBr
      ChrisBr
      57 Posts
      ACCEPTED ANSWER

      Re: Empty handle

      ‏2013-01-28T14:21:43Z  in response to SystemAdmin
      Hello,

      I'm not sure of what you want to do...

      Nevertheless, I'll try to fix the problem in your "propagate" method.
      Assuming that "first" and "end" are 2 arrays of IlcRevInt (is this right?), I think your code should look like:
      
      
      
      void NoSubtourI::propagate()
      { IloInt FirstNode; IloInt EndNode; 
      
      for (IloInt i=0; i < successor.getSize()-2; i++)
      { 
      
      if (successor[i].isFixed())
      { FirstNode=first[i].getValue(); first[successor[i].getValue()].setValue(getCP(), FirstNode); EndNode=end[successor[i].getValue()].getValue(); end[i].setValue(getCP(), EndNode); successor[EndNode].removeValue(FirstNode); 
      } 
      } 
      }
      


      The message

      ! Satisfiability problem - 0 variables, 20 constraints
      ! Problem found infeasible at the root node

      indicates that the infeasibility has been found during the presolve
      (don't worry about the "0 variables" report in this case).

      The fact that your model has been found infeasible might be related to other mistakes.

      I hope this helps,

      Chris.
  • SystemAdmin
    SystemAdmin
    554 Posts
    ACCEPTED ANSWER

    Re: Empty handle

    ‏2013-01-29T01:12:25Z  in response to SystemAdmin
    Thanks a lot.

    I did as you said. Also, Id' made some mistakes in data extraction which made the problem infeasible. Vow it perfectly works! ;)