[Osi] Proposal: delete OsiSimplex::setObjectiveAndRefresh (August 27th deadline)

Lou Hafer lou at cs.sfu.ca
Fri Aug 20 12:29:17 EDT 2010


Folks,

        I've been working my way through the OsiSimplex API, writing an
implementation for OsiDylp.  I'm going to propose that the method
setObjectiveAndRefresh be deleted.  Here's some explanation.

        The method signature is setObjectiveAndRefresh (double *c).  The
explanation says `Set a new objective and apply the old basis so that the
reduced costs are properly updated.'  What does this mean?  Clearly, I need to
update the solver interface object.  Should I talk to the solver, and ask it to
do a resolve?  After all, a new objective in general means that the existing
solution is no longer optimal.  Minor gripe:  why is the parameter not const?

        I haven't seen any code that actually uses setObjectiveAndRefresh.

        Now, what do I do with basisIsAvailable().  The current comment says
`returns true if an optimal basis is available', and there's an alias,
optimalBasisIsAvailable, just to drive home the optimal part.  Unless I can do a
resolve as part of setObjectiveAndRefresh, I'll most likely have to return
false, even though there's a perfectly useable basis available.  If the client
actually needs an optimal basis, they will need to do a resolve at this point.
I note that the original comment says only `basis is available' (change in
OsiSolverInterface at r603; note OsiSimplex folded into OsiSolverInterface at
r574,575).  Presumably this change in semantics was made for a reason and things
will break if it's undone.  (Parts of Cgl, in particular.)

        Also, there's another method, getReducedGradient, with signature
getReducedGradient(double *columnReducedCosts, double *duals, const double *c)
which does exactly the same thing as setObjectiveAndRefresh but doesn't update
the solver, thus avoiding the issues above.  The question of whether to update
the solver and/or do a resolve is left to the client. Minor gripe: Why is 
getReducedGradient not const? All the getBInv* are const.

        So ... I propose to simply delete setObjectiveAndRefresh, unless
someone speaks up in its defense within the next week. I'll consider making 
getReducedGradient const while I'm at it.

        I'll grudgingly consider the idea that setObjectiveAndRefresh be
redefined to be { setObjective() ; resolve() ; } but I'll want a good reason to
keep it.

							Lou




More information about the Osi mailing list