[Coin-discuss] writing out a maximising MPS/LP problem in OsiClpSolver
Kish Shen
kish.shen at crosscoreop.com
Fri Aug 11 00:04:45 EDT 2006
Hi,
I am unable to write out a maximising problem correctly in LP (with writeLp()) or MPS
(with writeMps()) format in OsiClpSolverInterface -- the written file always seems to be
written out as the minimising problem, e.g. for the problem
Maximize
obj: x0
Subject To
cons0: x0 - x1 = 0
cons1: x0 + x1 <= 3
Bounds
x0 Free
x1 Free
End
is written as:
Minimize
obj: x0
Subject To
cons0: x0 - x1 = 0
cons1: x0 + x1 <= 3
Bounds
x0 Free
x1 Free
End
to write this problem, I call writeLp() as follows:
lp->Solver->writeLp(file, "", 1e-5, 10, 10, lp->Solver->getObjSense());
where lp->Solver is a OsiClpSolverInterface, and I have checked that lp->Solver->getObjSense()
is -1.0, i.e. maximising. In fact the same lp file is written if lp->Solver->getObjSense() is 1.0.
In OsiSymSolverInterface, the same call writes out the problem as a minimising problem, but
the sign of the objective is reversed, so it is correct:
Minimize
obj: -x0
Am I calling writeLp (and similarly for writeMps) correctly?
Thanks in advance for any information and help!
Kish Shen
More information about the Coin-discuss
mailing list