Originally posted by: EdKlotz
>
> >As far as I understand, you compare the C++ API cplex.solve() call to the interactive CPLEX "optimize" command and >observe that in the interactive the model solves much faster.
>
> Actually I am comparing p.lp_solver->resolve() to the interactive CPLEX "populate" command
>
> >I guess you are generating the model in C++ through the typical model building facilities of Concert.
>
> No, I have been using a C++ code based on the code Cbc found at COIN-OR repisitory and OSIcplex that interfaces the Cplex LP solver with Cbc.
OK, that adds another layer that could somehow create some sort of deviation
in behavior.
>
> >But how do you get the problem into the interactive? Are you using cplex.exportModel()? If so, then you should >definitely use the .sav file format in order to get a bit-wise equivalent representation of what is stored in >memory.
>
> The code I am using has its own format for inputing problems and I am using that format. However, I was told by the author of the code that the order of the variables and the order of the constraints are preserved when the problem is loaded in memory and Cbc starts working on it.
>
> Also, I have been using the .mps format to input the same problem to interactive CPLEX. I was wondering whether the order of the constraints is preserved if a problem is loaded into Cplex from a .mps file. If not, is there a random or a consistent change in the order of the constraints? (I know that the order of the variables are preserved if the .mps file format is used.)
>
> If the differnces in the order of the constraints is causing the speed up these differences can not be random, because I have been observing this speed up over a large number of Integer programs.
>
> Dursun
MPS format will preserve the ordering of both variables and constraints. However,
it can differ from the representation of the model in your program because its text
format can truncate numeric values at the lower order decimal places. That in turn
can change the path CPLEX takes, which in turn can change the iteration count.
However, I wouldn't expect such differences in the lower order decimal places to
have such a consistent, profound impact on simplex method iteration counts. If that
were true, however, I would expect to see that the additional iteration counts in your
program all occurred at the end of the optimization, i.e. that the optimizer got close
to optimal at the node LPs quite quickly, then spent a huge amount of time trying
to finish up. If the MPS format truncated those low order value that contributed
to the long tail of iterations, then I suppose this profound difference in iteration
counts is possible. But, I must say I haven't seen anything like this in the past.
With this as background, I recommend the following additional tests.
1) Run both interactive CPLEX and your C++ program with feasibility and optimality
tolerances of 1e-3 instead of the defaults of 1e-6. If the issue really involves
truncation in MPS format, then I think the difference in iteration counts will
disappear or diminish significantly with these larger tolerances.
2) Run both your program and interactive CPLEX with the MIP display parameter set
to 5, so we can see the simplex iteration logs of the various node LP solves. Maybe
that will shed some light on the difference.
3) Run the ilomipex2.cpp program that we provide with your MPS file. If you can
reproduce the difference in iteration counts with that program, then you've taken
the OSI API out of the picture. On the other hand, if the difference disappears,
then additional investigation of how OSI operates is in order. In particular, check
whether it quietly sets some CPLEX parameters to non default values, and check whether
it quietly uses some CPLEX callbacks that force CPLEX to restrict presolve reductions,
change the MIP search, or do something else to cause CPLEX to use different parameter
settings in your program as compared to in interactive CPLEX.
4) Compare the presolved model sizes in your program in iteractive CPLEX. Are they
the same? If not, do they differ dramatically, or just by a little bit.
If these don't help you resolve this, please include some node log info for both
your program and interactive CPLEX in your next post.
#CPLEXOptimizers#DecisionOptimization