Skip to content

Commit c5e98cc

Browse files
authored
Improve docs (#13)
1 parent c1b5367 commit c5e98cc

File tree

4 files changed

+193
-29
lines changed

4 files changed

+193
-29
lines changed

docs/src/index.md

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,35 @@ end
77

88
# ModelAnalyzer.jl
99

10-
This package provides tools for analyzing (and debugging) [JuMP](https://github.com/jump-dev/JuMP.jl) models.
10+
This package provides tools for analyzing (and debugging)
11+
[JuMP](https://github.com/jump-dev/JuMP.jl) models.
1112

1213
Three main functionalities are provided:
1314

14-
1. **Numerical Analysis**: Check for numerical issues in the model, such as large and small coefficients,
15-
empty constraints, non-convex quadratic functions.
16-
17-
2. **Feasibility Analysis**: Given an optimized model, or a candidate solution, check if the solutions is
18-
feasible and optimal (when possible). This includes checking the feasibility of the primal model and
19-
also the dual model (if available). Complementary slackness conditions are also checked (if applicable).
20-
21-
3. **Infeasibility Analysis**: Given an unsolved of solved model, three steps are made to check for
22-
infeasibility:
23-
- Check bounds, integers and binaries consistency is also checked at this point.
24-
- Propagate bounds in constraints individually, to check if each constraint is infeasible
25-
given the current variable bounds. This is only done if bounds are ok.
26-
- Run an IIS (Irreducible Inconsistent Subsystem / irreducible infeasible sets)
27-
resolver algorithm to find a minimal infeasible subset of constraints.
28-
This is only done if no issues are found in the previous two steps.
15+
1. **Numerical Analysis**: Check for numerical issues in the model, such as
16+
large and small coefficients, empty constraints, non-convex quadratic
17+
functions.
18+
2. **Feasibility Analysis**: Given an optimized model, or a candidate solution,
19+
check if the solutions is feasible and optimal (when possible). This
20+
includes checking the feasibility of the primal model and also the dual
21+
model (if available). Complementary slackness conditions are also checked
22+
(if applicable).
23+
3. **Infeasibility Analysis**: Given an unsolved of solved model, three steps
24+
are made to check for infeasibility:
25+
- Check bounds, integers and binaries consistency is also checked at this
26+
point.
27+
- Propagate bounds in constraints individually, to check if each constraint
28+
is infeasible given the current variable bounds. This is only done if
29+
bounds are ok.
30+
- Run an IIS (Irreducible Inconsistent Subsystem / irreducible infeasible
31+
sets) resolver algorithm to find a minimal infeasible subset of
32+
constraints. This is only done if no issues are found in the previous two
33+
steps.
2934

3035
## Installation
3136

32-
You can install the package using the Julia package manager. In the Julia REPL, run:
37+
You can install the package using the Julia package manager. In the Julia REPL,
38+
run:
3339

3440
```julia
3541
using Pkg
@@ -84,14 +90,16 @@ ModelAnalyzer.summarize(data)
8490

8591
The `ModelAnalyzer.analyze(...)` function can always take the keyword arguments:
8692
* `verbose = false` to condense the print output.
87-
* `max_issues = n` to limit the maximum number of issues to report for each type.
93+
* `max_issues = n` to limit the maximum number of issues to report for each
94+
type.
8895

89-
For certain analysis modes, the `summarize` function can take additional arguments.
96+
For certain analysis modes, the `summarize` function can take additional
97+
arguments.
9098

9199
### Advanced usage
92100

93-
After any `ModelAnalyzer.analyze(...)` call is performed, the resulting data structure
94-
can be summarized using `ModelAnalyzer.summarize(data)` as show above,
101+
After any `ModelAnalyzer.analyze(...)` call is performed, the resulting data
102+
structure can be summarized using `ModelAnalyzer.summarize(data)` as show above,
95103
or it can be further inspected programmatically.
96104

97105
```julia

src/feasibility.jl

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ julia> data = ModelAnalyzer.analyze(
3838
3939
The additional parameters:
4040
- `primal_point`: The primal solution point to use for feasibility checking.
41-
If `nothing`, it will use the current primal solution from optimized model.
41+
If `nothing`, it will use the current primal solution from optimized model.
4242
- `dual_point`: The dual solution point to use for feasibility checking.
43-
If `nothing` and the model can be dualized, it will use the current dual
44-
solution from the model.
43+
If `nothing` and the model can be dualized, it will use the current dual
44+
solution from the model.
4545
- `atol`: The absolute tolerance for feasibility checking.
4646
- `skip_missing`: If `true`, constraints with missing variables in the provided
47-
point will be ignored.
47+
point will be ignored.
4848
- `dual_check`: If `true`, it will perform dual feasibility checking. Disabling
49-
the dual check will also disable complementarity checking.
49+
the dual check will also disable complementarity checking.
5050
"""
5151
struct Analyzer <: ModelAnalyzer.AbstractAnalyzer end
5252

@@ -62,6 +62,11 @@ abstract type AbstractFeasibilityIssue <: ModelAnalyzer.AbstractIssue end
6262
6363
The `PrimalViolation` issue is identified when a primal constraint has a
6464
left-hand-side value that is not within the constraint's set.
65+
66+
For more information, run:
67+
```julia
68+
julia> ModelAnalyzer.summarize(ModelAnalyzer.Feasibility.PrimalViolation)
69+
```
6570
"""
6671
struct PrimalViolation <: AbstractFeasibilityIssue
6772
ref::JuMP.ConstraintRef
@@ -73,6 +78,11 @@ end
7378
7479
The `DualViolation` issue is identified when a constraint has a dual value
7580
that is not within the dual constraint's set.
81+
82+
For more information, run:
83+
```julia
84+
julia> ModelAnalyzer.summarize(ModelAnalyzer.Feasibility.DualViolation)
85+
```
7686
"""
7787
struct DualViolation <: AbstractFeasibilityIssue
7888
ref::Union{JuMP.ConstraintRef,JuMP.VariableRef}
@@ -86,6 +96,11 @@ The `ComplemetarityViolation` issue is identified when a pair of primal
8696
constraint and dual variable has a nonzero complementarity value, i.e., the
8797
inner product of the primal constraint's slack and the dual variable's
8898
violation is not zero.
99+
100+
For more information, run:
101+
```julia
102+
julia> ModelAnalyzer.summarize(ModelAnalyzer.Feasibility.ComplemetarityViolation)
103+
```
89104
"""
90105
struct ComplemetarityViolation <: AbstractFeasibilityIssue
91106
ref::JuMP.ConstraintRef
@@ -98,6 +113,11 @@ end
98113
The `DualObjectiveMismatch` issue is identified when the dual objective value
99114
computed from problem data and the dual solution does not match the solver's
100115
dual objective value.
116+
117+
For more information, run:
118+
```julia
119+
julia> ModelAnalyzer.summarize(ModelAnalyzer.Feasibility.DualObjectiveMismatch)
120+
```
101121
"""
102122
struct DualObjectiveMismatch <: AbstractFeasibilityIssue
103123
obj::Float64
@@ -110,6 +130,11 @@ end
110130
The `PrimalObjectiveMismatch` issue is identified when the primal objective
111131
value computed from problem data and the primal solution does not match
112132
the solver's primal objective value.
133+
134+
For more information, run:
135+
```julia
136+
julia> ModelAnalyzer.summarize(ModelAnalyzer.Feasibility.PrimalObjectiveMismatch)
137+
```
113138
"""
114139
struct PrimalObjectiveMismatch <: AbstractFeasibilityIssue
115140
obj::Float64
@@ -122,6 +147,11 @@ end
122147
The `PrimalDualMismatch` issue is identified when the primal objective value
123148
computed from problem data and the primal solution does not match the dual
124149
objective value computed from problem data and the dual solution.
150+
151+
For more information, run:
152+
```julia
153+
julia> ModelAnalyzer.summarize(ModelAnalyzer.Feasibility.PrimalDualMismatch)
154+
```
125155
"""
126156
struct PrimalDualMismatch <: AbstractFeasibilityIssue
127157
primal::Float64
@@ -134,6 +164,11 @@ end
134164
The `PrimalDualSolverMismatch` issue is identified when the primal objective
135165
value reported by the solver does not match the dual objective value reported
136166
by the solver.
167+
168+
For more information, run:
169+
```julia
170+
julia> ModelAnalyzer.summarize(ModelAnalyzer.Feasibility.PrimalDualSolverMismatch)
171+
```
137172
"""
138173
struct PrimalDualSolverMismatch <: AbstractFeasibilityIssue
139174
primal::Float64

src/infeasibility.jl

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ abstract type AbstractInfeasibilitylIssue <: ModelAnalyzer.AbstractIssue end
4343
4444
The `InfeasibleBounds` issue is identified when a variable has a lower bound
4545
that is greater than its upper bound.
46+
47+
For more information, run:
48+
```julia
49+
julia> ModelAnalyzer.summarize(ModelAnalyzer.Infeasibility.InfeasibleBounds)
50+
````
4651
"""
4752
struct InfeasibleBounds{T} <: AbstractInfeasibilitylIssue
4853
variable::JuMP.VariableRef
@@ -57,6 +62,13 @@ The `InfeasibleIntegrality` issue is identified when a variable has an
5762
integrality constraint (like `MOI.Integer` or `MOI.ZeroOne`) that is not
5863
consistent with its bounds. That is, the bounds do not allow for any
5964
integer value to be feasible.
65+
66+
For more information, run:
67+
```julia
68+
julia> ModelAnalyzer.summarize(
69+
ModelAnalyzer.Infeasibility.InfeasibleIntegrality
70+
)
71+
```
6072
"""
6173
struct InfeasibleIntegrality{T} <: AbstractInfeasibilitylIssue
6274
variable::JuMP.VariableRef
@@ -74,6 +86,13 @@ constraint at a time and all variable bounds of variables involved in the
7486
constraint.
7587
This issue can only be found is all variable bounds are consistent, that is,
7688
no issues of type `InfeasibleBounds` were found in the first layer of analysis.
89+
90+
For more information, run:
91+
```julia
92+
julia> ModelAnalyzer.summarize(
93+
ModelAnalyzer.Infeasibility.InfeasibleConstraintRange
94+
)
95+
```
7796
"""
7897
struct InfeasibleConstraintRange{T} <: AbstractInfeasibilitylIssue
7998
constraint::JuMP.ConstraintRef
@@ -90,6 +109,13 @@ constraints cannot be satisfied simultaneously. This is typically found
90109
by the IIS resolver after the first two layers of infeasibility analysis
91110
have been completed with no issues, that is, no issues of any other type
92111
were found.
112+
113+
For more information, run:
114+
```julia
115+
julia> ModelAnalyzer.summarize(
116+
ModelAnalyzer.Infeasibility.IrreducibleInfeasibleSubset
117+
)
118+
```
93119
"""
94120
struct IrreducibleInfeasibleSubset <: AbstractInfeasibilitylIssue
95121
constraint::Vector{JuMP.ConstraintRef}

0 commit comments

Comments
 (0)