diff --git a/src/Bridges/Constraint/bridges/functionize.jl b/src/Bridges/Constraint/bridges/functionize.jl index 164f60afd2..3e9f6ffbf8 100644 --- a/src/Bridges/Constraint/bridges/functionize.jl +++ b/src/Bridges/Constraint/bridges/functionize.jl @@ -299,7 +299,7 @@ function MOI.get( # We need canonical, because the downstream bridges may have added # additional terms that mean it can't be directly converted to G. f = MOI.get(model, MOI.ConstraintFunction(), b.constraint) - return convert(G, MOI.Utilities.canonical(f)) + return MOI.Utilities.convert_approx(G, MOI.Utilities.canonical(f)) end """ diff --git a/test/Bridges/Constraint/functionize.jl b/test/Bridges/Constraint/functionize.jl index 2a5d2aa4c1..741813c013 100644 --- a/test/Bridges/Constraint/functionize.jl +++ b/test/Bridges/Constraint/functionize.jl @@ -361,6 +361,18 @@ function test_first_bridge() return end +function test_approx_convert(T = Float64) + inner = MOI.Utilities.Model{T}() + # `SOCtoRSOC` will rotate the function so there will be small + # rounding errors when getting the `ConstraintFunction` + # and we test that it's ignored + soc = MOI.Bridges.Constraint.SOCR{T}(inner) + model = MOI.Bridges.Constraint.VectorFunctionize{T}(soc) + config = MOI.Test.Config(T) + MOI.Test.test_basic_VectorOfVariables_SecondOrderCone(model, config) + return +end + end # module TestConstraintFunctionize.runtests()