diff --git a/src/infeasibility.jl b/src/infeasibility.jl index 2dab25d..dcb13ad 100644 --- a/src/infeasibility.jl +++ b/src/infeasibility.jl @@ -541,32 +541,23 @@ end # API -function ModelAnalyzer._summarize(io::IO, ::Type{InfeasibleBounds{T}}) where {T} +function ModelAnalyzer._summarize(io::IO, ::Type{<:InfeasibleBounds}) return print(io, "# InfeasibleBounds") end -function ModelAnalyzer._summarize( - io::IO, - ::Type{InfeasibleIntegrality{T}}, -) where {T} +function ModelAnalyzer._summarize(io::IO, ::Type{<:InfeasibleIntegrality}) return print(io, "# InfeasibleIntegrality") end -function ModelAnalyzer._summarize( - io::IO, - ::Type{InfeasibleConstraintRange{T}}, -) where {T} +function ModelAnalyzer._summarize(io::IO, ::Type{<:InfeasibleConstraintRange}) return print(io, "# InfeasibleConstraintRange") end -function ModelAnalyzer._summarize(io::IO, ::Type{IrreducibleInfeasibleSubset}) +function ModelAnalyzer._summarize(io::IO, ::Type{<:IrreducibleInfeasibleSubset}) return print(io, "# IrreducibleInfeasibleSubset") end -function ModelAnalyzer._verbose_summarize( - io::IO, - ::Type{InfeasibleBounds{T}}, -) where {T} +function ModelAnalyzer._verbose_summarize(io::IO, ::Type{<:InfeasibleBounds}) return print( io, """ @@ -595,8 +586,8 @@ end function ModelAnalyzer._verbose_summarize( io::IO, - ::Type{InfeasibleIntegrality{T}}, -) where {T} + ::Type{<:InfeasibleIntegrality}, +) return print( io, """ @@ -626,8 +617,8 @@ end function ModelAnalyzer._verbose_summarize( io::IO, - ::Type{InfeasibleConstraintRange{T}}, -) where {T} + ::Type{<:InfeasibleConstraintRange}, +) return print( io, """ @@ -657,7 +648,7 @@ end function ModelAnalyzer._verbose_summarize( io::IO, - ::Type{IrreducibleInfeasibleSubset}, + ::Type{<:IrreducibleInfeasibleSubset}, ) return print( io, @@ -685,11 +676,7 @@ function ModelAnalyzer._verbose_summarize( ) end -function ModelAnalyzer._summarize( - io::IO, - issue::InfeasibleBounds{T}, - model, -) where {T} +function ModelAnalyzer._summarize(io::IO, issue::InfeasibleBounds, model) return print( io, ModelAnalyzer._name(issue.variable, model), @@ -700,11 +687,7 @@ function ModelAnalyzer._summarize( ) end -function ModelAnalyzer._summarize( - io::IO, - issue::InfeasibleIntegrality{T}, - model, -) where {T} +function ModelAnalyzer._summarize(io::IO, issue::InfeasibleIntegrality, model) return print( io, ModelAnalyzer._name(issue.variable, model), @@ -719,9 +702,9 @@ end function ModelAnalyzer._summarize( io::IO, - issue::InfeasibleConstraintRange{T}, + issue::InfeasibleConstraintRange, model, -) where {T} +) return print( io, ModelAnalyzer._name(issue.constraint, model), @@ -748,9 +731,9 @@ end function ModelAnalyzer._verbose_summarize( io::IO, - issue::InfeasibleBounds{T}, + issue::InfeasibleBounds, model, -) where {T} +) return print( io, "Variable: ", @@ -764,9 +747,9 @@ end function ModelAnalyzer._verbose_summarize( io::IO, - issue::InfeasibleIntegrality{T}, + issue::InfeasibleIntegrality, model, -) where {T} +) return print( io, "Variable: ", @@ -782,9 +765,9 @@ end function ModelAnalyzer._verbose_summarize( io::IO, - issue::InfeasibleConstraintRange{T}, + issue::InfeasibleConstraintRange, model, -) where {T} +) return print( io, "Constraint: ", diff --git a/test/infeasibility.jl b/test/infeasibility.jl index cde2582..4d5b7c0 100644 --- a/test/infeasibility.jl +++ b/test/infeasibility.jl @@ -64,6 +64,8 @@ function test_bounds() str = String(take!(buf)) @test contains(str, " : ") @test contains(str, " !<= ") + ModelAnalyzer.summarize(buf, data, verbose = false) + ModelAnalyzer.summarize(buf, data, verbose = true) return end @@ -114,6 +116,8 @@ function test_integrality() @test contains(str, " : [") @test contains(str, "; ") @test contains(str, "], ") + ModelAnalyzer.summarize(buf, data, verbose = false) + ModelAnalyzer.summarize(buf, data, verbose = true) return end @@ -137,6 +141,9 @@ function test_binary() @test ModelAnalyzer.variable(ret[], model) == x @test ModelAnalyzer.values(ret[]) == [0.5, 0.8] @test ModelAnalyzer.set(ret[]) == MOI.ZeroOne() + buf = IOBuffer() + ModelAnalyzer.summarize(buf, data, verbose = false) + ModelAnalyzer.summarize(buf, data, verbose = true) return end @@ -188,6 +195,8 @@ function test_range() @test contains(str, " : [") @test contains(str, "; ") @test contains(str, "], !in ") + ModelAnalyzer.summarize(buf, data, verbose = false) + ModelAnalyzer.summarize(buf, data, verbose = true) return end @@ -405,6 +414,8 @@ function test_iis() ModelAnalyzer.summarize(buf, data, verbose = true) str = String(take!(buf)) @test startswith(str, "## Infeasibility Analysis\n\n") + ModelAnalyzer.summarize(buf, data, verbose = false) + ModelAnalyzer.summarize(buf, data, verbose = true) return end