Skip to content

Add Bridges.ListOfNonstandardBridges attribute #666

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

Merged
merged 6 commits into from
Aug 17, 2021
Merged

Conversation

blegat
Copy link
Member

@blegat blegat commented Feb 7, 2019

This attributes allow an optimizer to list a few bridges that should automatically be used by JuMP.
Here are a few use cases:

  • Solvers that requires SOC constraint to be provided as ScalarQuadraticFunction-in-LessThan can add the SOCtoQuad bridge in this list in the prefered form (either supporting VectorOfVariables-in-SOC or VectorAffineFunction-in-SOC, since for some solver, the quadratic function obtained is recognized only if it is computated from the correct one, and we can go from one form to another with the Slack and VectorOfVariables bridges), see Add SOCtoQuad bridge #478 (comment) (@ccoffrin this would resolve the issue we discussed with @mlubin )
  • Solvers that use non-standard form for a set can create a custom set and a bridge inside the wrapper:
  • Needs tests

@codecov-io
Copy link

codecov-io commented Feb 7, 2019

Codecov Report

Merging #666 into master will decrease coverage by 0.01%.
The diff coverage is 83.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #666      +/-   ##
==========================================
- Coverage   94.96%   94.95%   -0.02%     
==========================================
  Files          50       50              
  Lines        5346     5351       +5     
==========================================
+ Hits         5077     5081       +4     
- Misses        269      270       +1
Impacted Files Coverage Δ
src/attributes.jl 95.83% <100%> (+0.11%) ⬆️
src/Bridges/lazybridgeoptimizer.jl 97.61% <75%> (-2.39%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 66d3754...5d19010. Read the comment docs.

"""
RequiredBridges()

A list of bridges that are required when using the optimizer. For instance, if
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does "required" mean? Required to pass tests? What does this imply for direct mode?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does "required" mean? Required to pass tests?

I was hesitant for the naming, may be recommended (and RecommendedBridges) is better ?

What does this imply for direct mode?

If the user uses a LazyBridgeOptimizer in direct mode then the bridges will be automatically added. The bridges are added in the LazyBridgeOptimizer constructor, not just in the full_bridge_optimizer function.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think RecommendedBridges is any clearer. Recommended for what? How is someone looking at this description supposed to know how it fits into LazyBridgeOptimizer?

If a solver has required bridges, maybe it shouldn't publicly return its MOI optimizer and instead return a LazyBridgeOptimizer that wraps the optimizer with the required bridges? It doesn't make sense to me to have required bridges while the default way of constructing the solver doesn't include them.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is indeed the other option of returning the optimizer wrapped in a SingleBridgeOptimizer (like we currently do in tests). As the bridge is required there is no need to include it in the Bellman-Ford computation.
What would be the recommendation for naming the constructor and the optimizer ?
Adding an underscore before Optimizer ?

struct _Optimizer <: MOI.AbstractOptimizer
end
Optimizer(...) = CustomBridge(_Optimizer(...))

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding an underscore before Optimizer ?

Yes, that makes sense.

@blegat blegat force-pushed the bl/required_bridges branch from 5d19010 to 182e522 Compare August 11, 2021 16:49
@blegat blegat changed the title ✨ Add RequiredBridges attribute Add Bridges.ToAdd attribute Aug 11, 2021
@blegat blegat requested a review from odow August 11, 2021 16:49
@blegat blegat changed the title Add Bridges.ToAdd attribute Add Bridges.ListOfNonstandardBridges attribute Aug 12, 2021
@blegat blegat requested a review from odow August 12, 2021 14:25
Copy link
Member

@odow odow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, other than the comment about language.

@blegat blegat merged commit 3a857fe into master Aug 17, 2021
@blegat blegat deleted the bl/required_bridges branch August 17, 2021 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants