Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  how to get the mip gap using callable library?

    Posted 01/25/09 05:09 AM

    Originally posted by: SystemAdmin


    [ozaltn said:]

    how to get the mip gap using CPLEX 9.0 callable library?

    thanks
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: how to get the mip gap using callable library?

    Posted 01/26/09 07:28 PM

    Originally posted by: SystemAdmin


    [rocarvaj said:]

    As far as I know, you have to compute it by yourself. I don't know if this works on 9.0 (I use 11.0) but it can help you:


    int rval = 0;
    double best_bound, IP_obj, mip_gap;

    rval = CPXgetbestobjval(env, lp, &best_bound);
    rval = CPXgetobjval(env, lp, &IP_obj);

    if(rval)
        /** In this case, CPLEX didn't find any feasible solution */
        fprintf(stderr, "No feasible solution. Best bound: %f\n", best_bound);
    else
    {
        /** Assuming you're maximizing */
        mip_gap = (best_bound - IP_obj)/(IP_obj + 0.001)*100;
        fprintf(stderr, "MIP gap: %f\n", mip_gap);
    }


    That should be it. If there's any errors or a better way to do it, tell me.

    Greetings from Chile!
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: how to get the mip gap using callable library?

    Posted 01/30/09 08:05 PM

    Originally posted by: SystemAdmin


    [ozaltn said:]

    Thanks so much. I just wanted to make sure that I have to compute it. Although, I think it is meaningless that callable library can't provide such a trivial information. I bet it is because maximization vs minimization conversion issues
    #CPLEXOptimizers
    #DecisionOptimization