Test ConstraintDual for bridges
I always thought it a bit silly to only define the setter for ConstraintDualStart and not with ConstraintDual. I sometimes want to test things mixing a MockOptimizer and a bridge and I can't because bridges don't define the setters for ConstraintDual.
I suggest the following non-breaking change: We should now encourage bridges to supports ConstraintDual. When they do, a new test will be enabled that will do an important consistency check. So the new test will not be run for existing bridge which is nice since it could be breaking but after the transition, it will be run for all bridges that don't disable it by doing dual = nothing.
This would have caught the bug in https://github.com/jump-dev/MathOptInterface.jl/pull/2809 as the CI should show
I'm still against this. Bridges could/should write better tests regardless. Testing the dual is tricky. And even our Start is a bad test because it checks only get/set doesn't error. It doesn't really have a way to test that the logic is correct.
Yes, we just check that get and set are inverse of each other and that's precisely what this PR is fixing. Now it also checks that it is the adjoint of the bridge transformation so it's starting to get difficult to get the test passing with an incorrect dual
Let me take over from here and split it up.
So you added ZeroOne to the fallback for dual objective value because some tests tried to call constant(::ZeroOne)? Why is IndicatorSOS1Bridge even attempting to test the duals?
This design feels wrong. Could dual tests be opt-in?
Is a separate bug that we don't have a generic fallback for constant? The test error violates the MethodError principle.
#2826 removes the use of constant.