Skip to content

Commit

Permalink
[docs] add warning about Y <= X, Set() syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
odow authored Jun 5, 2024
1 parent 886a652 commit 5c2f7c0
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions docs/src/manual/constraints.md
Original file line number Diff line number Diff line change
Expand Up @@ -1238,8 +1238,9 @@ julia> @constraint(model, x in MOI.ExponentialCone())
## Set inequality syntax

For modeling convenience, the syntax `@constraint(model, x >= y, Set())` is
short-hand for `@constraint(model, x - y in Set())`. Therefore, the following
calls are equivalent:
short-hand for `@constraint(model, x - y in Set())`.

Therefore, the following calls are equivalent:
```jldoctest set_inequality
julia> model = Model();
Expand All @@ -1250,9 +1251,6 @@ julia> y = [0.5, 0.75];
julia> @constraint(model, x >= y, MOI.Nonnegatives(2))
[x[1] - 0.5, x[2] - 0.75] ∈ MathOptInterface.Nonnegatives(2)
julia> @constraint(model, y <= x, MOI.Nonnegatives(2))
[x[1] - 0.5, x[2] - 0.75] ∈ MathOptInterface.Nonnegatives(2)
julia> @constraint(model, x - y in MOI.Nonnegatives(2))
[x[1] - 0.5, x[2] - 0.75] ∈ MathOptInterface.Nonnegatives(2)
```
Expand All @@ -1270,6 +1268,11 @@ julia> @constraint(model, x .- 1 >= 0, MOI.Nonnegatives(2))
[x[1] - 1, x[2] - 1] ∈ MathOptInterface.Nonnegatives(2)
```

!!! warning
The syntax `@constraint(model, y <= x, Set())` is supported, but it is not
recommended because the value of the primal and dual solutions associated
with the connstraint may be the negative of what you expect.

Check failure on line 1274 in docs/src/manual/constraints.md

View workflow job for this annotation

GitHub Actions / build

[vale] reported by reviewdog 🐶 [Vale.Spelling] Did you really mean 'connstraint'? Raw Output: {"message": "[Vale.Spelling] Did you really mean 'connstraint'?", "location": {"path": "docs/src/manual/constraints.md", "range": {"start": {"line": 1274, "column": 14}}}, "severity": "ERROR"}

## Second-order cone constraints

A [`SecondOrderCone`](@ref) constrains the variables `t` and `x` to the set:
Expand Down Expand Up @@ -1440,6 +1443,11 @@ julia> @constraint(model, X >= Y, PSDCone())
X[2,1] - 2 X[2,2] - 1] ∈ PSDCone()
```

!!! warning
The syntax `@constraint(model, Y <= X, PSDCone())` is supported, but it is
not recommended because the value of the primal and dual solutions associated
with the connstraint may be the negative of what you expect.

Check failure on line 1449 in docs/src/manual/constraints.md

View workflow job for this annotation

GitHub Actions / build

[vale] reported by reviewdog 🐶 [Vale.Spelling] Did you really mean 'connstraint'? Raw Output: {"message": "[Vale.Spelling] Did you really mean 'connstraint'?", "location": {"path": "docs/src/manual/constraints.md", "range": {"start": {"line": 1449, "column": 14}}}, "severity": "ERROR"}

### Symmetry

Solvers supporting PSD constraints usually expect to be given a matrix that
Expand Down

0 comments on commit 5c2f7c0

Please sign in to comment.