问题
I have an essential problem. I use Cplex in C++ and I try to implement my optimization programs by it; however, I have an essential problem.
I want to find dual of my program. How can I find some constructs in Cplex for C++ that do it?
回答1:
I'm not entirely sure if this is what you're asking for, but the presolve dual setting (quoting the documentation):
Decides whether CPLEX presolve should pass the primal or dual linear programming problem to the linear programming optimization algorithm.
With the C++ API, this can be set, like so:
cplex.setParam(IloCplex::Param::Preprocessing::Dual, 1);
Somewhat related is the DUA file format:
governed by MPS conventions, writes the dual formulation of a problem currently in memory so that the MPS file can later be read back in and the dual formulation can then be optimized explicitly. This file format is largely obsolete now since you can use the command set presolve dual in the Interactive Optimizer to tell CPLEX to solve the dual formulation of an LP automatically. (You no longer have to tell CPLEX to write the dual formulation to a DUA file and then tell CPLEX to read the file back in and solve it.)
If, on the other hand, you want to query dual values after solving a model, you can use the getDuals method.
来源:https://stackoverflow.com/questions/45561059/dual-of-models-by-cplex