Skip to content

Commit f4b59e6

Browse files
committed
Fix docs
1 parent df67c62 commit f4b59e6

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

docs/src/submodules/Utilities/overview.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ julia> MOI.set(model, MOI.VariableName(), x, "x")
330330
331331
julia> c = MOI.add_constraint(model, 1.0 * x, MOI.LessThan(2.0));
332332
333-
julia> MOI.modify(model, MOI.Utilities.PenaltyRelaxation(Dict(c => 2.0)))
333+
julia> map = MOI.modify(model, MOI.Utilities.PenaltyRelaxation(Dict(c => 2.0)));
334334
335335
julia> print(model)
336336
Minimize ScalarAffineFunction{Float64}:
@@ -343,6 +343,9 @@ ScalarAffineFunction{Float64}-in-LessThan{Float64}
343343
344344
VariableIndex-in-GreaterThan{Float64}
345345
v[2] >= 0.0
346+
347+
julia> map[c]
348+
MathOptInterface.ScalarAffineFunction{Float64}(MathOptInterface.ScalarAffineTerm{Float64}[MathOptInterface.ScalarAffineTerm{Float64}(1.0, MathOptInterface.VariableIndex(2))], 0.0)
346349
```
347350

348351
## Utilities.MatrixOfConstraints

src/Utilities/penalty_relaxation.jl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,17 @@ constraint that is being relaxed. If no value exists, the default is `default`.
2929
When `S` is [`MOI.LessThan`](@ref) or [`MOI.GreaterThan`](@ref), we omit `y` or
3030
`z` respectively as a performance optimization.
3131
32+
## Return value
33+
34+
`MOI.modify(model, PenaltyRelaxation())` returns a
35+
`Dict{MOI.ConstraintIndex,MOI.ScalarAffineFunction}` that maps constraint
36+
indices to a [`MOI.ScalarAffineFunction`](@ref) comprised of `y + z`. In an
37+
optimal solution, query the value of these functions to compute the violation of
38+
each constraint.
39+
3240
## Relax a subset of constraints
3341
34-
To relax a subset of constraints, pass a `penalties` dictionary` and set
42+
To relax a subset of constraints, pass a `penalties` dictionary and set
3543
`default = nothing`.
3644
3745
## Supported constraint types

0 commit comments

Comments
 (0)