-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Objective value from dual feasible solution mismatch getObjValue() in dual simplex #291
Comments
si.getObjValue() gives the primal objective value i.e. using column values and objective. This is what people expect and is more intuitive. It would be possible to add a getDualObjvalue - but then you have. The other point is more interesting. Although the code asks for the dual algorithm, it does not demand it and Clp makes a decision to swap to primal. If you add then your example succeeds as that stops the code swapping. However setting that option is not totally safe as you can see if you look at comment in ClpSimplex.hpp. I will change code in master so that 8192 will have same effect at the relevant place in dual code as 8192 has correct meaning. |
Thanks for the clarification, @johnjforrest. Yes, when calling Clp simplex, we understood that asking for dual simplex is only a "hint," but when a dual-feasible advanced basis is loaded, I'm having trouble seeing why primal would be chosen. The bug came up partly because there is one variant of strong branching in SYMPHONY that calls What's a bit confusing is that when pre-solving in branching, SYMPHONY has always called If there is an iteration limit set and dual simplex is chosen, so that the final basis is dual feasible (and primal infeasible), I would assume that the objective value would correctly correspond to the dual objective value and be a valid dual bound? Is thee any way to verify whether dual was actually used after the fact? I assume that because SYMPHONY always loads a dual feasible basis and typically calls |
Part of the problem comes from Osi. When using Clp directly you are much more likely just to call dual or primal. Osi thinks of initialSolve as being done once and it gets worried when the problem looks infeasible and so tries harder to try and get feasible. The modification in master should stop that happening. I can not add getDualObjvalue or getPrimalObjValue to Osi, but I can add them to OsiClp if you want. |
Yes, dropping into the Clp model class and just directly calling I know you said that The attached driver shows an example using Clp master, where we are start solving with initial solve, then change bounds on a variable and re-solve with an iteration limit, then change bounds again and re-solve one more time. In that third solve (after the output
I think we must be missing something. What is it? |
Will look into it. One thing that came to mind is to think more about using some values of Clp specialOptions_ . |
By default Clp is not very interested in solution on max iterations. For strong branching it needs objective which it can get easily without bothering about scaling etc. Also using OsiClp the code does a quick reduction of problem as often some variables have been fixed - this makes the code slightly faster. This also makes it more difficult to get good values in some situations. So to be safe - switch this off I have added a new option so that the user can ask for more to be done on max iterations |
Ah yes, we were suspecting something like this, thanks for the fix! We are testing now. |
Thanks for your precious help John.
By focusing on the lines starting with
In my tests, in most of the cases, the ray is obtained by the dual algorithm and it seems that the Farkas proof works whenever the ray is obtained this way. In principle, we are fine with CLP switching to primal in this specific case, however we need a ray generated by the dual algorithm as this seems what fit our purposes. Is there a way to fix this? To run the driver, run |
Seems to be bug in ClpSimplexPrimal - hopefully fixed now in master. |
Thanks for the update John. Unfortunately, it seems that it does not fix the issue. The ray returned have components with high magnitude (order of Sorry for the inconvenience and thanks again for your time |
Dear John, The last update you made on Clp on master regarding this issue made the ray vector to have "nice" components (only ones and zeros) but the Farkas proof on that ray fails in my SYMPHONY code. Unfortunately I'm not able to replicate this behavior in a driver. Would you be down to have a look at the issue in SYMPHONY? Here's how you can replicate the issue:
The command to run the example is |
Hi all,
Here I have a small example (a
.cpp
with some.mps
files) in which I'm using CLP viaOsiClpSolverInterface
to replicate some unexpected behaviors. Here I'm callinginitialSolve()
but CLP has been set to always go for the dual simplex. Shouldn't this suggest that no matter the state of CLP, the dual solution should be feasible and the objective value should match?This example is replicating the following behavior:
When iteration limit is reached or the LP is proven primal infeasible, the objective value from
si.getObjValue()
and the one computed fromsi.getRowPrices(), si.getReducedCosts()
doesn't match;To run the example I would do
./it_limit_bug lp_it_0.mps
Thanks in advance for the support,
Federico
it_limit_bug.zip
The text was updated successfully, but these errors were encountered: