Skip to content

Commit 916f55c

Browse files
committed
Add docs
1 parent 62390ac commit 916f55c

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

docs/src/submodules/Utilities/overview.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,36 @@ $$ \begin{aligned}
315315
In IJulia, calling `print` or ending a cell with
316316
[`Utilities.latex_formulation`](@ref) will render the model in LaTeX.
317317

318+
## Utilities.FeasibilityRelaxation
319+
320+
Set the [`Utilities.FeasibilityRelaxation`](@ref) attribute to relax the
321+
problem by adding penalized slack variables to the constraints. This is helpful
322+
when debugging sources of infeasible models.
323+
324+
```jldoctest
325+
julia> model = MOI.Utilities.Model{Float64}();
326+
327+
julia> x = MOI.add_variable(model);
328+
329+
julia> MOI.set(model, MOI.VariableName(), x, "x")
330+
331+
julia> c = MOI.add_constraint(model, 1.0 * x, MOI.LessThan(2.0));
332+
333+
julia> MOI.set(model, MOI.Utilities.FeasibilityRelaxation(Dict(c => 2.0)))
334+
335+
julia> print(model)
336+
Minimize ScalarAffineFunction{Float64}:
337+
0.0 + 2.0 v[2]
338+
339+
Subject to:
340+
341+
ScalarAffineFunction{Float64}-in-LessThan{Float64}
342+
0.0 + 1.0 x - 1.0 v[2] <= 2.0
343+
344+
VariableIndex-in-GreaterThan{Float64}
345+
v[2] >= 0.0
346+
```
347+
318348
## Utilities.MatrixOfConstraints
319349

320350
The constraints of [`Utilities.Model`](@ref) are stored as a vector of tuples

docs/src/submodules/Utilities/reference.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@ Utilities.identity_index_map
9090
Utilities.ModelFilter
9191
```
9292

93+
## Feasibility relaxation
94+
95+
```@docs
96+
Utilities.FeasibilityRelaxation
97+
```
98+
9399
## MatrixOfConstraints
94100

95101
```@docs

0 commit comments

Comments
 (0)