diff --git a/src/moi_wrapper.jl b/src/moi_wrapper.jl index d6cdca51..ab5745e3 100644 --- a/src/moi_wrapper.jl +++ b/src/moi_wrapper.jl @@ -37,7 +37,7 @@ function diff_optimizer( add_poi = allow_parametric_opt_interface && !MOI.supports_add_constrained_variable( - optimizer.model, + isnothing(with_bridge_type) ? optimizer : optimizer.model, MOI.Parameter{Float64}, ) # When we do `MOI.copy_to(diff, optimizer)` we need to efficiently `MOI.get` @@ -48,7 +48,9 @@ function diff_optimizer( caching_opt = if with_outer_cache MOI.Utilities.CachingOptimizer( MOI.Utilities.UniversalFallback( - MOI.Utilities.Model{with_bridge_type}(), + MOI.Utilities.Model{ + something(with_bridge_type, with_cache_type), + }(), ), add_poi ? POI.Optimizer(optimizer) : optimizer, ) diff --git a/test/jump_wrapper.jl b/test/jump_wrapper.jl index 68d7be38..6588ab0c 100644 --- a/test/jump_wrapper.jl +++ b/test/jump_wrapper.jl @@ -46,10 +46,15 @@ function test_jump_api() ], ineq in [true, false], _min in [true, false], - flip in [true, false] + flip in [true, false], + with_bridge_type in [Float64, nothing] - @testset "$(MODEL) with: $(SOLVER), $(ineq ? "ineqs" : "eqs"), $(_min ? "Min" : "Max"), $(flip ? "geq" : "leq")" begin - model = MODEL(SOLVER) + if isnothing(with_bridge_type) && SOLVER === SCS.Optimizer + continue + end + + @testset "$(MODEL) with: $(SOLVER), $(ineq ? "ineqs" : "eqs"), $(_min ? "Min" : "Max"), $(flip ? "geq" : "leq") bridge:$with_bridge_type" begin + model = MODEL(SOLVER; with_bridge_type) set_silent(model) p_val = 4.0