@@ -126,16 +126,20 @@ x_fixed
126
126
In the above examples, ` x_free ` represents an unbounded optimization variable,
127
127
` x_lower ` represents an optimization variable with a lower bound and so forth.
128
128
129
- !!! note
129
+ !!! warning
130
130
When creating a variable with only a lower-bound or an upper-bound, and the
131
- value of the bound is not a numeric literal, the name of the variable must appear on the
132
- left-hand side. Putting the name on the right-hand side will result in an
133
- error. For example:
131
+ value of the bound is not a numeric literal (e.g., ` 1 ` or ` 1.0 ` ), the name
132
+ of the variable must appear on the left-hand side. Putting the name on the
133
+ right-hand side will result in an error. For example to create a variable
134
+ ` x ` :
134
135
```julia
135
- @variable (model, 1 <= x) # works
136
136
a = 1
137
- @variable (model, a <= x) # errors
138
- @variable (model, x >= a) # works
137
+ @variable (model, x >= 1) # ✓ Okay
138
+ @variable (model, 1.0 <= x) # ✓ Okay
139
+ @variable (model, x >= a) # ✓ Okay
140
+ @variable (model, a <= x) # × Not okay
141
+ @variable (model, x >= 1 / 2) # ✓ Okay
142
+ @variable (model, 1 / 2 <= x) # × Not okay
139
143
```
140
144
141
145
### Check if a variable bound exists
0 commit comments