-
Notifications
You must be signed in to change notification settings - Fork 92
Add (R)SOCtoNonConvexQuad Bridge #1046
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1046 +/- ##
==========================================
+ Coverage 95.26% 95.28% +0.01%
==========================================
Files 100 101 +1
Lines 11436 11484 +48
==========================================
+ Hits 10895 10943 +48
Misses 541 541
Continue to review full report at Codecov.
|
fq = MOI.ScalarQuadraticFunction(a_terms, q_terms, zero(T)) | ||
quad = MOI.add_constraint(model, fq, MOI.LessThan(zero(T))) | ||
fp = MOI.ScalarAffineFunction([MOI.ScalarAffineTerm(one(T),t)], zero(T)) | ||
var_pos = MOI.add_constraint(model, fp, MOI.GreaterThan(zero(T))) |
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.
Ooooo. This is a nice way to avoid the double bound issue. Don't know why I didn't think of that for Gurobi et al. Nice job.
Bump, @mlubin can you take a quick look? |
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.
Oops, sorry for missing this review.
`ScalarAffineFunction`-in-`GreaterThan`. Indeed, the definition of the | ||
second-order cone | ||
```math | ||
t \\ge || x ||_2 \\ (1) |
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.
Do the (1), (2), (3) labels display in the REPL? (Is it correct markdown?)
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.
Will check the best way to do so.
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.
it is not proper markdown, but it renders as:
help?> MathOptInterface.Bridges.Constraint.RSOCtoNonConvexQuadBridge
RSOCtoNonConvexQuadBridge{T}
Constraints of the form VectorOfVariables-in-SecondOrderCone can be transformed into a
ScalarQuadraticFunction-in-LessThan and a ScalarAffineFunction-in-GreaterThan. Indeed, the definition of the
second-order cone
2tu \ge \lVert x \rVert_2^2, t,u \ge 0 (1)
is equivalent to
\sum x_i^2 \le 2tu (2)
with t,u \ge 0. (3)
WARNING This transformation starts from a convex constraint (1) and creates a non-convex constraint (2), because the
Q matrix associated with the constraint 2 has two negative eigenvalues. This might be wrongly interpreted by a
solver. Some solvers can look at (2) and understand that it is a rotated second order cone, but this is not a
general rule. For these reasons this bridge is not automatically added to the LazyBridgeOptimizer. Care is
recommended when adding this bridge to a optimizer.
Which is not bad in my opinion.
docs/src/apireference.md
Outdated
[`Bridges.Constraint.SOCtoNonConvexQuadBridge`](@ref). | ||
|
||
The first option is to add the specific bridges to a | ||
`bridged_model` optimizer, with coefficient type `T`, using |
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.
You need to specify that it is a LazyBridgeOptimizer
I added docstring with ref to full_bridge, but there are doc errors: ┌ Warning: unable to get the binding for '[`Bridges.full_bridge_optimizer`](@ref)' in src/apireference.md from expression ':(Bridges.full_bridge_optimizer)' in module MathOptInterface.Bridges.Constraint
│ exception = UndefVarError: Bridges not defined
└ @ Documenter.CrossReferences ~/.julia/packages/Documenter/PLD7m/src/CrossReferences.jl:137 you know how to reference functions from outside? |
Tests passed, there is som communication issue with travis |
Simpler version of: #478
Bridge not included by default in Lazy bridge optimizer, but can be used by advanced users.
Tried to include caveats in the doc strings.