Decision Optimization

Decision Optimization

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

 View Only
  • 1.  "getDual" for MIP problem

    Posted Sat March 23, 2013 11:15 AM

    Originally posted by: SystemAdmin


    Hello guys!
    I am using CPLEX12.4(Concert Tech. for C++).

    I run my program and it returns “CPLEX Error 1017: Not available for mixed-integer programs.” just before the line w "getDual" function.
    Is there any other method to get dual values of a MIP model?

    Sincerely,
    Tracy
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: "getDual" for MIP problem

    Posted Sat March 23, 2013 12:10 PM

    Originally posted by: T_O


    Duality theory for MIP is much more difficult than for LP. You cannot obtain some simple meaningful dual variables. So I guess this is not what you want to do.

    You can change the problem type to LP or to fixed MILP. Then you can obtain the corresponding duals.

    Best regards,
    Thomas
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: "getDual" for MIP problem

    Posted Sun March 24, 2013 01:49 AM

    Originally posted by: SystemAdmin


    Thanks Thomas!

    What do you mean by "change the problem type to LP or to fixed MILP"?
    Re-formulate my problem or any function in CPLEX can change the model type?

    Sincerely,
    Tracy
    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: "getDual" for MIP problem

    Posted Sun March 24, 2013 05:54 AM

    Originally posted by: T_O


    See http://pic.dhe.ibm.com/infocenter/cosinfoc/v12r5/topic/ilog.odms.cplex.help/refcallablelibrary/html/functions/CPXXchgprobtype.html

    The name of the funtion is depending on the API you are using.

    Best regards,
    Thomas
    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: "getDual" for MIP problem

    Posted Sun March 24, 2013 11:03 PM

    Originally posted by: SystemAdmin


    Hi Thomas!
    I changed the problem type from lp to MILP. However, it still returns the same error when program try to access "getDual".

    I guess it is because of my coding problem. Could you please help me to check it?
    int status = 1;
    CPXCENVptr Cppenv = CPXopenCPLEX (&status);
    CPXLPptr lp = CPXcreateprob (Cppenv, &status, "TOPOpt");
    status = CPXchgprobtype (Cppenv, lp, 1);//CPXPROB_MILP

    if(status)
    break;
    else
    TOPSolver.solve();

    TOPSolver.getStatus();

    cout<<"Pro "<<argv[1]<<"is "<<TOPSolver.getObjValue()<<"--------"<<endl;

    /// FIND AND ADD A NEW Route ///

    for (i = 0; i <effcount-1; i++)
    {
    price[i] = TOPSolver.getDual(Fill[i]);

    }
    Sincerely,
    Tracy
    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: "getDual" for MIP problem

    Posted Mon March 25, 2013 01:30 AM

    Originally posted by: SystemAdmin


    Problem solved!

    Thank you so much Thomas!
    Tracy
    #CPLEXOptimizers
    #DecisionOptimization


  • 7.  Re: "getDual" for MIP problem

    Posted Wed April 03, 2013 07:56 AM

    Originally posted by: SystemAdmin


    Just in case you did not use that function: In the object oriented APIs (C++, Java, C#) the IloCplex class has a function solveFixed(). This function fixes the integer variables to the current solution and resolves the problem as LP. After that you can query the dual values for the LP solve. This should be much simpler than changing the problem type.
    #CPLEXOptimizers
    #DecisionOptimization