I know that we can export the model formulation from cplex in java using exportmodel. But can we do the same for dual formulation?
Thanks.
Using the interactive, you can export to the DUA file format (Note that this is not possible using the exportModel
method in the Java API). Here is the pertinent information:
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.)
So, you can export to one of the supported file formats in the Java API (e.g., .sav, .mps, .lp), and then use the interactive to generate the .dua file, like so:
CPLEX> read file.lp
CPLEX> write file.dua
As mentioned above, you can also use the presolve dual setting to "pass the primal or dual linear programming problem to the linear programming optimization algorithm."