From d00e3748e00b84a418a99179d9b9cedff7ae177e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Legat?= Date: Tue, 4 Aug 2026 18:08:12 +0200 Subject: [PATCH] Fix registration with MOI v1.52 --- Project.toml | 2 +- src/MOI_wrapper.jl | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Project.toml b/Project.toml index 0203965..58fd516 100644 --- a/Project.toml +++ b/Project.toml @@ -13,5 +13,5 @@ MathOptComplementsJuMPExt = "JuMP" [compat] JuMP = "1" -MathOptInterface = "1.51" +MathOptInterface = "1.52" julia = "1.10" diff --git a/src/MOI_wrapper.jl b/src/MOI_wrapper.jl index db5816c..f5f382a 100644 --- a/src/MOI_wrapper.jl +++ b/src/MOI_wrapper.jl @@ -263,7 +263,12 @@ end # implementation of `add_bridged_constraint` so that I don't have to reimplement # it function MOI.Bridges.add_bridged_constraint(b::Optimizer, BridgeType, f, s) - bridge = MOI.Bridges.Constraint.Constraint.bridge_constraint( + map = MOI.Bridges.Constraint.bridges(b)::MOI.Bridges.Constraint.Map + # `bridge_constraint` may add bridges that also need `final_touch` and, as + # explained in the default implementation, `bridge` must come *before* them + # in `needs_final_touch`, hence the `insert!` at the remembered position. + n_final_touch = length(map.needs_final_touch) + bridge = MOI.Bridges.Constraint.bridge_constraint( BridgeType, MOI.Bridges.recursive_model(b), f, @@ -272,8 +277,11 @@ function MOI.Bridges.add_bridged_constraint(b::Optimizer, BridgeType, f, s) ) # The rest is copy-pasted from the default implementation of # `add_bridged_constraint` in MOI + if MOI.Bridges.needs_final_touch(bridge) + insert!(map.needs_final_touch, n_final_touch + 1, bridge) + end ci = MOI.Bridges.Constraint.add_key_for_bridge( - MOI.Bridges.Constraint.bridges(b)::MOI.Bridges.Constraint.Map, + map, bridge, f, s,