You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/apimanual.md
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -526,14 +526,14 @@ MOI defines a very general interface, with multiple possible ways to describe th
526
526
-`@constraint(m, 2x + y == 10)` becomes `ScalarAffineFunction`-in-`EqualTo`;
527
527
-`@constraint(m, 0 <= 2x + y <= 10)` becomes `ScalarAffineFunction`-in-`Interval`;
528
528
-`@constraint(m, 2x + y in ArbitrarySet())` becomes `ScalarAffineFunction`-in-`ArbitrarySet`.
529
-
529
+
530
530
Variable bounds are handled in a similar fashion:
531
531
-`@variable(m, x <= 1)` becomes `SingleVariable`-in-`LessThan`;
532
532
-`@variable(m, x >= 1)` becomes `SingleVariable`-in-`GreaterThan`.
533
533
534
534
One notable difference is that a variable with an upper and lower bound is translated into two constraints, rather than an interval. i.e.:
535
535
-`@variable(m, 0 <= x <= 1)` becomes `SingleVariable`-in-`LessThan`*and*`SingleVariable`-in-`GreaterThan`.
536
-
536
+
537
537
Therefore, if a solver wrapper does not support `ScalarAffineFunction`-in-`LessThan` constraints, users will not be able to write: `@constraint(m, 2x + y <= 10)` in JuMP. With this in mind, developers should support all the constraint types that they want to be usable from JuMP. That said, from the perspective of JuMP, solvers can safely choose to not support the following constraints:
538
538
539
539
-`ScalarAffineFunction` in `GreaterThan`, `LessThan`, or `EqualTo` with a nonzero constant in the function. Constants in the affine function should instead be moved into the parameters of the corresponding sets.
@@ -559,8 +559,8 @@ Solver wrappers should document how the low-level solver statuses map to the MOI
559
559
560
560
### canXXX
561
561
562
-
For most operations, MOI provides a function `canXXX` that can be used to check if the operation `XXX` is allowed.
563
-
For example, `addconstraint!(model::ModelLike, func::F, set::S)` has the corresponding function `canaddconstraint(model, ::Type{F}, ::Type{S})::Bool`.
562
+
For most operations, MOI provides a function `canXXX` that can be used to check if the operation `XXX` is allowed.
563
+
For example, `addconstraint!(model::ModelLike, func::F, set::S)` has the corresponding function `canaddconstraint(model, ::Type{F}, ::Type{S})::Bool`.
564
564
If `canaddconstraint` returns `false`, then calling `addconstraint!` must throw an error (likewise with all `XXX` and `canXXX` pairs). Note that even if `canaddconstraint` returns `true`, `addconstraint!` may still throw an error if, for example, the constraint function does not meet some sparsity conditions, one of the coefficients is `NaN`, or an invalid variable index is provided. This is because (in most cases) the `canXXX` method receives type information instead of the actual arguments.
0 commit comments