Skip to content

Commit d27b1de

Browse files
authored
Update to MathOptIIS@0.2 (#68)
1 parent 48e5fae commit d27b1de

5 files changed

Lines changed: 32 additions & 37 deletions

File tree

Project.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
1616
MathOptAnalyzerJuMPExt = "JuMP"
1717

1818
[compat]
19-
Dualization = "0.6.0"
20-
JuMP = "1.24.0"
21-
MathOptIIS = "0.1.1"
22-
MathOptInterface = "1.37.0"
19+
Dualization = "0.7"
20+
JuMP = "1.24"
21+
MathOptIIS = "0.2"
22+
MathOptInterface = "1.37"
2323
julia = "1.10"

src/Infeasibility/Infeasibility.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
module Infeasibility
77

88
import MathOptAnalyzer
9-
import MathOptIIS as MOIIS
9+
import MathOptIIS
1010
import MathOptInterface as MOI
1111

1212
include("structs.jl")

src/Infeasibility/analyze.jl

Lines changed: 24 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,14 @@
33
# Use of this source code is governed by an MIT-style license that can be found
44
# in the LICENSE.md file or at https://opensource.org/licenses/MIT.
55

6-
function _add_result(out::Data, model, iis, meta::MOIIS.BoundsData)
6+
function _add_result(
7+
out::Data,
8+
model,
9+
iis,
10+
meta::MathOptIIS.Metadata{T,Nothing},
11+
) where {T}
712
@assert length(iis.constraints) == 2
8-
err = InfeasibleBounds{Float64}(
13+
err = InfeasibleBounds{T}(
914
MOI.get(model, MOI.ConstraintFunction(), iis.constraints[1]),
1015
meta.lower_bound,
1116
meta.upper_bound,
@@ -14,9 +19,14 @@ function _add_result(out::Data, model, iis, meta::MOIIS.BoundsData)
1419
return
1520
end
1621

17-
function _add_result(out::Data, model, iis, meta::MOIIS.IntegralityData)
22+
function _add_result(
23+
out::Data,
24+
model,
25+
iis,
26+
meta::MathOptIIS.Metadata{T,S},
27+
) where {T,S<:Union{MOI.Integer,MOI.ZeroOne}}
1828
@assert length(iis.constraints) >= 2
19-
err = InfeasibleIntegrality{Float64}(
29+
err = InfeasibleIntegrality{T}(
2030
MOI.get(model, MOI.ConstraintFunction(), iis.constraints[1]),
2131
meta.lower_bound,
2232
meta.upper_bound,
@@ -26,13 +36,18 @@ function _add_result(out::Data, model, iis, meta::MOIIS.IntegralityData)
2636
return
2737
end
2838

29-
function _add_result(out::Data, model, iis, meta::MOIIS.RangeData)
39+
function _add_result(
40+
out::Data,
41+
model,
42+
iis,
43+
meta::MathOptIIS.Metadata{T,S},
44+
) where {T,S<:MOI.AbstractSet}
3045
@assert length(iis.constraints) >= 1
3146
for con in iis.constraints
3247
if con isa MOI.ConstraintIndex{MOI.VariableIndex}
3348
continue
3449
end
35-
err = InfeasibleConstraintRange{Float64}(
50+
err = InfeasibleConstraintRange{T}(
3651
con,
3752
meta.lower_bound,
3853
meta.upper_bound,
@@ -49,35 +64,15 @@ function _add_result(out::Data, model, iis, meta)
4964
return
5065
end
5166

52-
function _instantiate_with_modify(optimizer, ::Type{T}) where {T}
53-
model = MOI.instantiate(optimizer)
54-
if !MOI.supports_incremental_interface(model)
55-
# Don't use `default_cache` for the cache because, for example, SCS's
56-
# default cache doesn't support modifying coefficients of the constraint
57-
# matrix. JuMP uses the default cache with SCS because it has an outer
58-
# layer of caching; we don't have that here, so we can't use the
59-
# default.
60-
#
61-
# We could revert to using the default cache if we fix this in MOI.
62-
cache = MOI.Utilities.UniversalFallback(MOI.Utilities.Model{T}())
63-
model = MOI.Utilities.CachingOptimizer(cache, model)
64-
end
65-
return MOI.Bridges.full_bridge_optimizer(model, T)
66-
end
67-
6867
function MathOptAnalyzer.analyze(
6968
::Analyzer,
7069
model::MOI.ModelLike;
7170
optimizer = nothing,
7271
)
73-
solver = MOIIS.Optimizer()
74-
MOI.set(solver, MOIIS.InfeasibleModel(), model)
72+
solver = MathOptIIS.Optimizer()
73+
MOI.set(solver, MathOptIIS.InfeasibleModel(), model)
7574
if optimizer !== nothing
76-
MOI.set(
77-
solver,
78-
MOIIS.InnerOptimizer(),
79-
() -> _instantiate_with_modify(optimizer, Float64),
80-
)
75+
MOI.set(solver, MathOptIIS.InnerOptimizer(), optimizer)
8176
end
8277
MOI.compute_conflict!(solver)
8378
out = Data()

test/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
1010
HiGHS = "1"
1111
JuMP = "1"
1212
MathOptInterface = "1"
13-
SCS = "1"
13+
SCS = "2"

test/test_Infeasibility.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function test_bounds()
3232
data =
3333
MathOptAnalyzer.analyze(MathOptAnalyzer.Infeasibility.Analyzer(), model)
3434
list = MathOptAnalyzer.list_of_issue_types(data)
35-
@test length(list) == 1
35+
@test 1 <= length(list) <= 2
3636
ret = MathOptAnalyzer.list_of_issues(data, list[1])
3737
@test length(ret) == 1
3838
@test ret[] == MathOptAnalyzer.Infeasibility.InfeasibleBounds{Float64}(
@@ -81,7 +81,7 @@ function test_integrality()
8181
data =
8282
MathOptAnalyzer.analyze(MathOptAnalyzer.Infeasibility.Analyzer(), model)
8383
list = MathOptAnalyzer.list_of_issue_types(data)
84-
@test length(list) == 1
84+
@test 1 <= length(list) <= 2
8585
ret = MathOptAnalyzer.list_of_issues(data, list[1])
8686
@test length(ret) == 1
8787
@test ret[] == MathOptAnalyzer.Infeasibility.InfeasibleIntegrality{Float64}(

0 commit comments

Comments
 (0)