Skip to content

Commit

Permalink
[docs] suggest fix over a new constraint (#2645)
Browse files Browse the repository at this point in the history
  • Loading branch information
odow authored Jul 12, 2021
1 parent 7ef4be4 commit 6901e8f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions docs/src/manual/variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ julia> unfix(x)
julia> is_fixed(x)
false
```

Fixing a variable with existing bounds will throw an error. To delete the bounds
prior to fixing, use `fix(variable, value; force = true)`.

Expand All @@ -256,6 +257,10 @@ julia> fix_value(x)
2.0
```

!!! tip
Use [`fix`](@ref) instead of `@constraint(model, x == 2)`. The former modifies
variable bounds, while the latter adds a new linear constraint to the problem.

## Variable names

The name, i.e. the value of the `MOI.VariableName` attribute, of a variable can
Expand Down

0 comments on commit 6901e8f

Please sign in to comment.