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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ Manifest.toml

# other ignores
.vscode/settings.json
*.txt
13 changes: 11 additions & 2 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,17 @@ data = ModelAnalyzer.analyze(
model,
optimizer = HiGHS.Optimizer,
)
# print report

# print report to the screen
ModelAnalyzer.summarize(data)

# or print ehte report to a file

# open a file
open("my_report.txt", "w") do io
# print report
ModelAnalyzer.summarize(io, data)
end
```

The `ModelAnalyzer.analyze(...)` function can always take the keyword arguments:
Expand Down Expand Up @@ -117,6 +126,6 @@ issues = ModelAnalyzer.list_of_issues(data, list[1])
# the list of issues of the given type can be summarized with:
ModelAnalyzer.summarize(data, issues)

# infdividual issues can also be summarized
# individual issues can also be summarized
ModelAnalyzer.summarize(data, issues[1])
```
20 changes: 10 additions & 10 deletions src/infeasibility.jl
Original file line number Diff line number Diff line change
Expand Up @@ -154,20 +154,18 @@ function ModelAnalyzer.analyze(
for var in JuMP.all_variables(model)
lb = if JuMP.has_lower_bound(var)
JuMP.lower_bound(var)
elseif JuMP.is_fixed(var)
JuMP.fix_value(var)
else
-Inf
end
ub = if JuMP.has_upper_bound(var)
JuMP.upper_bound(var)
elseif JuMP.is_fixed(var)
JuMP.fix_value(var)
else
Inf
end
if lb > ub
push!(out.infeasible_bounds, InfeasibleBounds(var, lb, ub))
bounds_consistent = false
else
variables[var] = Interval(lb, ub)
end
if JuMP.is_integer(var)
if abs(ub - lb) < 1 && ceil(ub) == ceil(lb)
push!(
Expand All @@ -186,6 +184,12 @@ function ModelAnalyzer.analyze(
bounds_consistent = false
end
end
if lb > ub
push!(out.infeasible_bounds, InfeasibleBounds(var, lb, ub))
bounds_consistent = false
else
variables[var] = Interval(lb, ub)
end
end
# check PSD diagonal >= 0 ?
# other cones?
Expand Down Expand Up @@ -371,10 +375,6 @@ function iis_elastic_filter(original_model::JuMP.GenericModel, optimizer)
end
end

# TODO: add deletion filter
# otherwise this is not an IIS (it does contain an IIS)

# pre_iis = Set(val[1] for val in de_elastisized)
pre_iis = Set(cadidates)
iis = JuMP.ConstraintRef[]
for con in JuMP.all_constraints(
Expand Down
4 changes: 2 additions & 2 deletions test/infeasibility.jl
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ function test_range_equalto()
return
end

function test_range_equalto()
function test_range_equalto_2()
model = Model()
@variable(model, x == 1)
@variable(model, y == 2)
Expand Down Expand Up @@ -261,7 +261,7 @@ function test_range_greaterthan()
return
end

function test_range_equalto()
function test_range_equalto_3()
model = Model()
@variable(model, 10 <= x <= 11)
@variable(model, 1 <= y <= 11)
Expand Down
7 changes: 7 additions & 0 deletions test/numerical.jl
Original file line number Diff line number Diff line change
Expand Up @@ -992,6 +992,13 @@ function test_qp_range()
ModelAnalyzer.summarize(buf, data)
ModelAnalyzer.summarize(buf, data, verbose = false)

open("my_report.txt", "w") do io
return ModelAnalyzer.summarize(io, data)
end

file_data = read("my_report.txt", String)
@test occursin("## Numerical Analysis", file_data)

return
end

Expand Down
Loading