Skip to content

[Bridges] Add Interval to HyperRectangle constraint bridge #2754

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 7 commits into from
Aug 7, 2025

Conversation

blegat
Copy link
Member

@blegat blegat commented May 10, 2025

Needed to use MatrixOfConstraints in the COSMO MOI wrapper (see oxfordcontrol/COSMO.jl#198)

Requires

Basic

  • Create a new file in src/Bridges/XXX/bridges named after the type of
    the bridge
  • Define the bridge, following existing examples. The name of the bridge
    struct must end in Bridge
  • Check if your bridge can be a subtype of MOI.Bridges.Constraint.SetMapBridge
  • Define a new const that is a SingleBridgeOptimizer wrapping the
    new bridge. The name of the const must be the name of the bridge, less
    the Bridge suffix
  • If the bridge should be enabled by default, add the bridge to
    add_all_bridges at the bottom of src/Bridges/XXX/XXX.jl

Tests

  • Create a new file in the appropriate subdirectory of tests/Bridges/XXX
    named after the type of the bridge
  • Use MOI.Bridges.runtests to test various inputs and outputs of the
    bridge
  • If, after opening the pull request to add the bridge, some lines are not
    covered by the tests, add additional bridge-specific tests to cover the
    untested lines.

Documentation

  • Add a docstring which uses the same template as existing bridges.

Final touch

If the bridge depends on run-time values of other variables and constraints in
the model:

  • Implement MOI.Utilities.needs_final_touch(::Bridge)
  • Implement MOI.Utilities.final_touch(::Bridge, ::MOI.ModelLike)
  • Ensure that final_touch can be called multiple times in a row

@odow
Copy link
Member

odow commented May 18, 2025

What's the status of this?

@odow odow force-pushed the bl/interval_to_hyperrectangle branch from 7bd50ed to 0a98b93 Compare August 3, 2025 21:32
@blegat
Copy link
Member Author

blegat commented Aug 6, 2025

Should be good to go now (assuming ci passes)

@odow
Copy link
Member

odow commented Aug 6, 2025

CI did, unfortunately, not pass.

@odow odow merged commit 78e7db2 into master Aug 7, 2025
31 checks passed
@odow odow deleted the bl/interval_to_hyperrectangle branch August 7, 2025 23:26
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.

2 participants