[Coin-discuss] Manual copying of an OSI LP object
Jonathan Eckstein
jeckstei at rutcor.rutgers.edu
Thu Apr 15 13:45:17 EDT 2004
Dear COIN/OSIers:
I need to make a copy of an OsiSolverInterface object (specifically an
OsiClpInterface object). I tried using the "clone" method, and although
it works OK on some systems, it did not work properly on one system, the
weird 9000-processor machine at Sandia that uses the Portland group
cross-compilers. On that system, "clone" seems to damage the object
being copied, so that GetColSolution always returns zero vectors. I
suspect it is some kind of compiler bug or obsoleteness.
I guess I could have tried the copy constructor instead, but I first
tried the following simple kind of workaround:
OsiSolverInterface* copy = new OsiClpInterface;
copy->loadProblem(*(original->getMatrixByRow()),
original->getColLower(),
original->getColUpper(),
original->getObjCoefficients(),
original->getRowLower(),
original->getRowUpper());
I can also imagine this kind of thing would be useful if you wanted ot
copy an LP, but change solvers. It *seemed* to work, but I am curious
if there are any important aspects of the problem description that might
be missed and would still need to be transferred from the original to
the copy. I don't care about the solver's internal state etc., just the
full description of the problem.
Thanks,
Jonathan
More information about the Coin-discuss
mailing list