Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  getDual for a Matrix constraint

    Posted 05/23/18 12:26 PM

    Originally posted by: hefsou_


    Hello everyone, 

    I am modeling a multicommodity network design problem with column generation on C++ using Cplex .I have then to extract the dual variables for a matrix constraints and double matrix constraints.

    But unfortunately the getDual method does not work.
    Here is my code and the file.dat for reading data . Hope isomeone can help me solve this problem

     

     

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: getDual for a Matrix constraint

    Posted 05/24/18 08:39 AM

    Compiling your program I get this error message:

    test_dual.cpp:516:48: error: no matching function for call to 'IloCplex::getDual(IloIntVar&)'
           lambda[i][j]= PMRSolver.getDual(adj[i][j]);

    This is expected. Duals are not available in MIPs, hence you cannot get the dual value for an IloIntVar.

    It seems you got something wrong since you are trying to query duals for a MIP. Duals are only available for continuous problems. What you can do for MIP is the solveFixed() function: It fixes all integer variables to the current solution and solves the resulting continuous problem. After that you can query duals. I am however not sure that this is what you want to do.


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  回复:Re: getDual for a Matrix constraint

    Posted 06/05/18 10:03 PM

    Originally posted by: HM62_Xingquan_Zuo


    When I use the column to generate the solution to the main problem, the solveFixed() is used before the getDual() is called. However, the value of the dual variable corresponding to all the constraint variables is zero. The solution to the original problem is correct. Why does this happen?

     

    void MasterProblem::printDuals() {
     
    for (int i = 0; i<lambda.getSize(); i++)
    cout << "Lambda[" << i << "] = " << cplex.getDual(lambda[i]) << endl;
     
    for (int i = 0; i<mu.getSize(); i++)
    cout << "mu[" << i << "] = " << cplex.getDual(mu[i]) << endl;
     
     
    }

    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  回复:Re: getDual for a Matrix constraint

    Posted 06/08/18 04:06 AM

    The discussion is continued here.


    #CPLEXOptimizers
    #DecisionOptimization