Skip to content

Conversation

@odow
Copy link
Member

@odow odow commented Jan 27, 2026

Closes #2920

julia> using JuMP, HiGHS

julia> begin
           model = Model(HiGHS.Optimizer)
           set_silent(model)
           @variable(model, x, Bin)
           @variable(model, y in ComplexPlane(), lower_bound=-1.0 + im*-1.0, upper_bound=1.0 + im*1.0)
           @constraint(model, x --> {y == 0})
           @objective(model, Max, real(y))
           optimize!(model)
           value(x), value(y)
       end
(0.0, 1.0 + 1.0im)

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 odow merged commit 9263978 into master Jan 27, 2026
31 checks passed
@odow odow deleted the od/indicator-bridge branch January 27, 2026 21:57
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.

Indicator constraint support for complex-valued equality constraints

2 participants