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
+25-1Lines changed: 25 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -929,7 +929,9 @@ If ``\mathcal{C}_i`` is a vector set, the discussion remains valid with
929
929
``y_i(\frac{1}{2}x^TQ_ix + a_i^T x + b_i)`` replaced with the scalar product
930
930
between `y_i` and the vector of scalar-valued quadratic functions.
931
931
932
-
### Constraint bridges
932
+
### Automatic reformulation
933
+
934
+
#### Constraint reformulation
933
935
934
936
A constraint often possess different equivalent formulations, but a solver may only support one of them.
935
937
It would be duplicate work to implement rewritting rules in every solver wrapper for every different formulation of the constraint to express it in the form supported by the solver.
@@ -966,6 +968,28 @@ model = MyPackage.Optimizer()
966
968
MOI.set(model, MyPackage.PrintLevel(), 0)
967
969
```
968
970
971
+
### Supported constrained variables and constraints
972
+
973
+
The solver interface should only implement support for constrained variables
974
+
(see [`add_constrained_variable`](@ref)/[`add_constrained_variables`](@ref))
975
+
or constraints that directly map to a structure exploited by the solver
976
+
algorithm. There is no need to add support for additional types, this is
977
+
handled by the [Automatic reformulation](@ref). Furthermore, this allows
978
+
[`supports_constraint`](@ref) to indicate which types are exploited by the
979
+
solver and hence allows layers such as [`Bridges.LazyBridgeOptimizer`](@ref)
980
+
to accurately select the most appropriate transformations.
981
+
982
+
As [`add_constrained_variable`](@ref) (resp. [`add_constrained_variables`](@ref))
983
+
falls back to [`add_variable`](@ref) (resp. [`add_variables`](@ref)) followed by
984
+
[`add_constraint`](@ref), there is no need to implement this function
985
+
if `model` supports creating free variables. However, if `model` does not
986
+
support creating free variables, then it should only implement
987
+
[`add_constrained_variable`](@ref) and not [`add_variable`](@ref) nor
988
+
[`add_constraint`](@ref) for [`SingleVariable`](@ref)-in-`typeof(set)`.
989
+
In addition, it should implement `supports_constraint(::Optimizer,
990
+
::Type{VectorOfVariables}, ::Type{Reals})` and return `false` so that free
991
+
variables are bridged, see [`supports_constraint`](@ref).
992
+
969
993
### Implementing copy
970
994
971
995
Avoid storing extra copies of the problem when possible. This means that solver
0 commit comments