Decision Optimization

Decision Optimization

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

 View Only
  • 1.  Question about BranchCallBack

    Posted Wed August 17, 2011 11:27 PM

    Originally posted by: gtli


    Hi, I am writing my own branchcallback with c++ concert. I tried to access the objective value of the LP relaxation of the current node, where I use IloNum obj=getObjValue();, however it does not seem to give me the values I want(as I tested separately). Also as I want to get the values of the current LP solution using node getValues(sol, var);, where sol is my IloNumArray and var is my IloIntVarArray, the values I got are all integral, which should not be correct(I use isIntegerFeasible() first to detect integral solutions).

    My question is that did I use the getObjValue() and getValues correctly? How can I get the correct LP relaxation values? Thanks!
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Question about BranchCallBack

    Posted Fri August 19, 2011 04:05 AM

    Originally posted by: SystemAdmin


    I don't see a problem with your usage of getObjValue() or getValues(). They should return the objective function value and the values of the relaxation at the current node.
    When isIntegerFeasible() returns false and all your variables are integer, could you check out what branches CPLEX would create at this very node? This can be done by code like this:
    IloInt n = getNbranches();
    for (i = 0; i < n; ++i) {
       IloNumVarArray vars(getEnv());
       IloNumArray bounds(getEnv());
       IloCplex::BranchDirectionArray dirs(getEnv());
     
       IloNum estimate = getBranch(vars, bounds, dirs, i);
       std::cout << "Branch i" << std::endl
                 << " estimate = " << estimate << std::endl
                 ... // print out vars, bounds and dirs
                 << std::endl;
     
       dirs.end();
       bounds.end();
       vars.end();
    }
    

    Also, what do functions like isSOSFeasible() return in this case? Is it possible that the node has all variables integer but is not SOS feasible?
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Question about BranchCallBack

    Posted Sun August 21, 2011 03:20 PM

    Originally posted by: gtli


    Thank you Daniel, it finally worked out.
    Thanks for your information!
    #CPLEXOptimizers
    #DecisionOptimization