Repository navigation
LinearSolver: could an INFEASIBLE result come with a certificate (Farkas / dual ray)?
#702
Replies: 4 comments
|
It is not currently available. The multipliers and reduced gradient that come with an INFEASIBLE result today are just the values at the basis where the solver stopped. They are not a certificate. It should be possible to add. The dual simplex has the necessary information when it concludes infeasibility. But making it something you can rely on takes more than exposing it: sign conventions and mapping back to the original problem My thought is to reuse getDualSolution() / getReducedGradient() (and the corresponding solver accessors), with an additional meaning when the state is INFEASIBLE, rather than adding new methods. |
|
Thanks. Reusing What I would rely on, to help with the points you list:
No urgency. When there is a snapshot to try, I will run it on my benchmark and report how often a certificate is available, how often it passes the check, and how much it shortens the explanations. |
|
This is now implemented, on the When the dual simplex concludes
They are also on the Without a certificate both methods return The certificate is an extreme ray, so it blames a minimal set of bounds, though not necessarily the smallest. Its scale is arbitrary and it is only as exact as the solver's tolerances, so your check against the current ranges is worth keeping. |
|
Thanks, this works very well. I built the farkas branch (8897664) and used it in choco-solver's linear relaxation with clause learning: when the LP is infeasible, the conflict is now explained by the bounds the certificate relies on instead of all the bounds. I do not use your g as is: I read the row multipliers with getDualMultiplier(i), recompute g = yA and yb from my own copy of the rows, and accept the certificate only if y >= 0 on the inequalities and min g.x over the current ranges exceeds yb (with a relative tolerance). So a wrong certificate would only cost me a weaker explanation, never a wrong one. On my benchmark (105 instances, linear relaxation + clause learning, same jar, certificates used or ignored):
For comparison, with 57.4.0 the values returned after an INFEASIBLE solve sometimes pass the check by chance, but when I skip the check they lead to wrong explanations, so the check is worth keeping as you said. Looking forward to seeing it in a release. |
Uh oh!
There was an error while loading. Please reload this page.
This is a question / feature request, not a bug.
Context
I use
LinearSolver(dual simplex, built withLinearSolver.newBuilder(...), ranges updated withupdateRange) as the linear relaxation inside a constraint-programming solver (choco-solver), with clause learning. Every deduction made from the LP has to be explained: which variable bounds does it rely on? The smaller the set, the stronger the learnt clause.When the LP is solved to optimality this works well today.
getReducedGradient(j)gives the reduced cost of each variable, and by weak duality the optimal value only relies on the bounds of the variables whose reduced cost is non-zero, and on one bound each (lower or upper, depending on the sign).When the LP is
INFEASIBLE, I have nothing equivalent, so I have to blame both bounds of all the variables. On my benchmark this is the weakest explanation by far.What would help
A proof of infeasibility, in whichever form is the most natural for the solver:
y(one per constraint) such that the aggregated rowyᵀA x (<= or =) yᵀbcannot be satisfied within the variable ranges; ord_j = (yᵀA)_jof that aggregated row, which is the counterpart of the reduced cost:d_j = 0means that the bounds ofx_jplay no role in the infeasibility, and the sign ofd_jtells which of its two bounds does.The second form is all I need, and it would mirror
getReducedGradient(j). The first one is more general, sincedcan be recomputed fromy.As far as I understand, the dual simplex has this at hand when it stops: it concludes
INFEASIBLEwhen a primal-infeasible basic variable has no entering candidate in the ratio test, and the corresponding row of the basis inverse is the multiplier vectory(the dual ray).Questions
Result.getMultipliers()orgetReducedGradient(j)meaningful after anINFEASIBLEsolve?INFEASIBLEresult, or as an accessor on the solver next togetReducedGradient?No need for it to be available in all cases: "no certificate" (for instance when infeasibility is detected in presolve or by another path) is fine, I would simply fall back to blaming all the bounds.
I can test a snapshot on my benchmark: each certificate is easy to check on my side (the aggregated row must be violated by the current ranges), and I can report how often it is available and how much it shortens the explanations.
All reactions