Skip to content

Commit e6e906d

Browse files
committed
Fix print of Infeasibility analysis
1 parent 8ba404c commit e6e906d

File tree

2 files changed

+36
-25
lines changed

2 files changed

+36
-25
lines changed

src/infeasibility.jl

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -541,32 +541,32 @@ end
541541

542542
# API
543543

544-
function ModelAnalyzer._summarize(io::IO, ::Type{InfeasibleBounds{T}}) where {T}
544+
function ModelAnalyzer._summarize(io::IO, ::Type{<:InfeasibleBounds})
545545
return print(io, "# InfeasibleBounds")
546546
end
547547

548548
function ModelAnalyzer._summarize(
549549
io::IO,
550-
::Type{InfeasibleIntegrality{T}},
551-
) where {T}
550+
::Type{<:InfeasibleIntegrality},
551+
)
552552
return print(io, "# InfeasibleIntegrality")
553553
end
554554

555555
function ModelAnalyzer._summarize(
556556
io::IO,
557-
::Type{InfeasibleConstraintRange{T}},
558-
) where {T}
557+
::Type{<:InfeasibleConstraintRange},
558+
)
559559
return print(io, "# InfeasibleConstraintRange")
560560
end
561561

562-
function ModelAnalyzer._summarize(io::IO, ::Type{IrreducibleInfeasibleSubset})
562+
function ModelAnalyzer._summarize(io::IO, ::Type{<:IrreducibleInfeasibleSubset})
563563
return print(io, "# IrreducibleInfeasibleSubset")
564564
end
565565

566566
function ModelAnalyzer._verbose_summarize(
567567
io::IO,
568-
::Type{InfeasibleBounds{T}},
569-
) where {T}
568+
::Type{<:InfeasibleBounds},
569+
)
570570
return print(
571571
io,
572572
"""
@@ -595,8 +595,8 @@ end
595595

596596
function ModelAnalyzer._verbose_summarize(
597597
io::IO,
598-
::Type{InfeasibleIntegrality{T}},
599-
) where {T}
598+
::Type{<:InfeasibleIntegrality},
599+
)
600600
return print(
601601
io,
602602
"""
@@ -626,8 +626,8 @@ end
626626

627627
function ModelAnalyzer._verbose_summarize(
628628
io::IO,
629-
::Type{InfeasibleConstraintRange{T}},
630-
) where {T}
629+
::Type{<:InfeasibleConstraintRange},
630+
)
631631
return print(
632632
io,
633633
"""
@@ -657,7 +657,7 @@ end
657657

658658
function ModelAnalyzer._verbose_summarize(
659659
io::IO,
660-
::Type{IrreducibleInfeasibleSubset},
660+
::Type{<:IrreducibleInfeasibleSubset},
661661
)
662662
return print(
663663
io,
@@ -687,9 +687,9 @@ end
687687

688688
function ModelAnalyzer._summarize(
689689
io::IO,
690-
issue::InfeasibleBounds{T},
690+
issue::InfeasibleBounds,
691691
model,
692-
) where {T}
692+
)
693693
return print(
694694
io,
695695
ModelAnalyzer._name(issue.variable, model),
@@ -702,9 +702,9 @@ end
702702

703703
function ModelAnalyzer._summarize(
704704
io::IO,
705-
issue::InfeasibleIntegrality{T},
705+
issue::InfeasibleIntegrality,
706706
model,
707-
) where {T}
707+
)
708708
return print(
709709
io,
710710
ModelAnalyzer._name(issue.variable, model),
@@ -719,9 +719,9 @@ end
719719

720720
function ModelAnalyzer._summarize(
721721
io::IO,
722-
issue::InfeasibleConstraintRange{T},
722+
issue::InfeasibleConstraintRange,
723723
model,
724-
) where {T}
724+
)
725725
return print(
726726
io,
727727
ModelAnalyzer._name(issue.constraint, model),
@@ -748,9 +748,9 @@ end
748748

749749
function ModelAnalyzer._verbose_summarize(
750750
io::IO,
751-
issue::InfeasibleBounds{T},
751+
issue::InfeasibleBounds,
752752
model,
753-
) where {T}
753+
)
754754
return print(
755755
io,
756756
"Variable: ",
@@ -764,9 +764,9 @@ end
764764

765765
function ModelAnalyzer._verbose_summarize(
766766
io::IO,
767-
issue::InfeasibleIntegrality{T},
767+
issue::InfeasibleIntegrality,
768768
model,
769-
) where {T}
769+
)
770770
return print(
771771
io,
772772
"Variable: ",
@@ -782,9 +782,9 @@ end
782782

783783
function ModelAnalyzer._verbose_summarize(
784784
io::IO,
785-
issue::InfeasibleConstraintRange{T},
785+
issue::InfeasibleConstraintRange,
786786
model,
787-
) where {T}
787+
)
788788
return print(
789789
io,
790790
"Constraint: ",

test/infeasibility.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ function test_bounds()
6464
str = String(take!(buf))
6565
@test contains(str, " : ")
6666
@test contains(str, " !<= ")
67+
ModelAnalyzer.summarize(buf, data, verbose = false)
68+
ModelAnalyzer.summarize(buf, data, verbose = true)
6769
return
6870
end
6971

@@ -114,6 +116,8 @@ function test_integrality()
114116
@test contains(str, " : [")
115117
@test contains(str, "; ")
116118
@test contains(str, "], ")
119+
ModelAnalyzer.summarize(buf, data, verbose = false)
120+
ModelAnalyzer.summarize(buf, data, verbose = true)
117121
return
118122
end
119123

@@ -137,6 +141,9 @@ function test_binary()
137141
@test ModelAnalyzer.variable(ret[], model) == x
138142
@test ModelAnalyzer.values(ret[]) == [0.5, 0.8]
139143
@test ModelAnalyzer.set(ret[]) == MOI.ZeroOne()
144+
buf = IOBuffer()
145+
ModelAnalyzer.summarize(buf, data, verbose = false)
146+
ModelAnalyzer.summarize(buf, data, verbose = true)
140147
return
141148
end
142149

@@ -188,6 +195,8 @@ function test_range()
188195
@test contains(str, " : [")
189196
@test contains(str, "; ")
190197
@test contains(str, "], !in ")
198+
ModelAnalyzer.summarize(buf, data, verbose = false)
199+
ModelAnalyzer.summarize(buf, data, verbose = true)
191200
return
192201
end
193202

@@ -405,6 +414,8 @@ function test_iis()
405414
ModelAnalyzer.summarize(buf, data, verbose = true)
406415
str = String(take!(buf))
407416
@test startswith(str, "## Infeasibility Analysis\n\n")
417+
ModelAnalyzer.summarize(buf, data, verbose = false)
418+
ModelAnalyzer.summarize(buf, data, verbose = true)
408419
return
409420
end
410421

0 commit comments

Comments
 (0)