Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  IloCplex.addMIPStart throws NullPointerException

    Posted 10/18/12 06:10 AM

    Originally posted by: SystemAdmin


    Hi,

    I'm trying to add a mip start to a problem that does not have a solution after 1 hour solving when numbers of rows and columns are too big.
    My "addMIPStart" method works, except in rare cases when calling IloCplex.addMIPStart(IloNumVar], double[) throws following exception.
    java.lang.NullPointerException
    at ilog.cplex.CpxNumVar.getVarIndexValue(CpxNumVar.java:268)
    at ilog.cplex.CplexI.addMIPStart(CplexI.java:2779)
    at ilog.cplex.IloCplex.addMIPStart(IloCplex.java:6845)
    at ilog.cplex.IloCplex.addMIPStart(IloCplex.java:6855)
    at ilog.cplex.IloCplex.addMIPStart(IloCplex.java:6879)
    at myClass...

    after commenting/uncommenting some parts of my code I found the vars that where implied in this exception, but I still do not understand what is the problem :
    • All the vars I instantiate with the addMIPStart where created with the IloCplex object I use
    • None are null (I check every var just before adding them to the IloNumVar[])
    • Values are valid

    I can prevent the exception to be thrown if I add a constraint IloCplex.addGe(myVar, 0) for each var I need to instantiate, knowing that every var in my problem are IloCplex.intVar(0,1) or IloCplex.intVar(0, Integer.MAX_VALUE). If I do that, the problem is solved and my MIP Start is a feasible solution.

    Can someone explain me what is my problem ?

    Thanks,

    Frédéric
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: IloCplex.addMIPStart throws NullPointerException

    Posted 10/18/12 07:07 AM

    Originally posted by: SystemAdmin


    Just creating a variable does not make it part of the model.
    On the other hand, all variables that appear in a MIP start must be part of the model for which the MIP start is registered, otherwise you will get the NullPointerException you observe.
    In order to force a variable into a model (in case it does not appear in the objective function or a constraint) you can just call IloCplex.add() with the variable to be added.
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: IloCplex.addMIPStart throws NullPointerException

    Posted 10/18/12 07:43 AM

    Originally posted by: SystemAdmin


    OK, thanks for your reply

    I thought any created variable was part of the model, with free value (between defined bounds) if no constraint was built about it.

    Frédéric
    #CPLEXOptimizers
    #DecisionOptimization