Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/moi_wrapper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand All @@ -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,
)
Expand Down
11 changes: 8 additions & 3 deletions test/jump_wrapper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading