-
Notifications
You must be signed in to change notification settings - Fork 87
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
[Bridges] fix supports for VariableIndex: Take II #1992
Conversation
I'll take a look |
# 2. It is added as a free variable, followed by a constraint bridge | ||
# 3. It is added by a variable bridge | ||
# To distinguish between {1.} and {2., 3.}, we call `is_bridged`: | ||
if is_bridged(b, S) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suppose you have a solver that supports
- Adding variables constrained on creation in S or T
- Adding a constraint VAF-in-T
You add variables on creation to S
Then you add a constraint on this vector of variables in T. This is bridged into VAF-in-T.
Here, is_bridged(b, T)
is false
with a LazyBridgeOptimizer
.
There are cases in which both might be possible, it depends whether it was constrained on creation or not. In that case, supports
should return true
if one of the two cases is true
because there is a chance that it is supported.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going around in circles. Is there a way to tell if a VectorOfVariables
was added by add_constrained_variables
? Not really just from the type, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I think we actually have a much bigger issue that means we can't get this right.
The SingleBridgeOptimizer
tests are failing for things like flip_sign.jl
, because if you add a VectorOfVariables-in-Nonnegatives
constraint, the solver supports the constraint and the attribute. But if you add constrained variables in Nonnegatives
, the solver force bridges (even though the model supports it) and the bridge doesn't support the attribute.
But, we can't distinguish whether to return true
or false
, because given a constraint index we don't know whether it was added as a constraint or a constrained variable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly, given just the type, you cannot know how all constraint of that type will be dealt with.You need to consider all possible cases and return true
if at least one case supports it
given a constraint index we don't know whether it was added as a constraint or a constrained variable.
Given a constraint index you can know that but not given just the types
Note that, as shown by the |
So I took a look at this, introducing the |
Let's a least keep either an open issue or open PR then |
Okay. I'll merge and open an issue |
A fix for the fix in #1991.
This is actually a super subtle part of the bridging system, and we don't have good test coverage. I think I understand the space of possible outcomes, and I've tested with Ipopt, SCS, and SDPA etc.
So before merging: