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
will additionally support constrained variables in [`GreaterThan`](@ref).
955
+
Note that these [`Bridges.Variable.SingleBridgeOptimizer`](@ref) are mainly
956
+
used for testing bridges. It is recommended to rather use
957
+
[`Bridges.full_bridge_optimizer`](@ref) which automatically select the
958
+
appropriate bridges for unsupported constrained variables.
959
+
960
+
#### Constraint reformulation
933
961
934
962
A constraint often possess different equivalent formulations, but a solver may only support one of them.
935
963
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.
936
964
Constraint bridges provide a way to define a rewritting rule on top of the MOI interface which can be used by any optimizer.
937
965
Some rules also implement constraint modifications and constraint primal and duals translations.
938
966
939
-
For example, the `SplitIntervalBridge` defines the reformulation of a `ScalarAffineFunction`-in-`Interval` constraint into a `ScalarAffineFunction`-in-`GreaterThan` and a `ScalarAffineFunction`-in-`LessThan` constraint.
940
-
The `SplitInterval` is the bridge optimizer that applies the `SplitIntervalBridge` rewritting rule.
941
-
Given an optimizer `optimizer` implementing `ScalarAffineFunction`-in-`GreaterThan` and `ScalarAffineFunction`-in-`LessThan`, the optimizer
942
-
```
943
-
bridgedoptimizer = SplitInterval(optimizer)
967
+
For example, the [`Bridges.Constraint.SplitIntervalBridge`](@ref) defines the
968
+
reformulation of a [`ScalarAffineFunction`](@ref)-in-[`Interval`](@ref)
969
+
constraint into a [`ScalarAffineFunction`](@ref)-in-[`GreaterThan`](@ref) and a
ERROR: Cannot unbridge function because some variables are bridged by variable bridges that do not support reverse mapping, e.g., `ZerosBridge`.
600
+
Stacktrace:
601
+
[1] error(::String, ::String, ::String) at ./error.jl:42
602
+
[2] throw_if_cannot_unbridge at /home/blegat/.julia/dev/MathOptInterface/src/Bridges/Variable/map.jl:343 [inlined]
603
+
[3] unbridged_function(::MOI.Bridges.Variable.SingleBridgeOptimizer{MOI.Bridges.Variable.ZerosBridge{Float64},MOI.Utilities.Model{Float64}}, ::MOI.ScalarAffineFunction{Float64}) at /home/blegat/.julia/dev/MOI/src/Bridges/bridge_optimizer.jl:920
604
+
[4] top-level scope at none:0
605
+
```
513
606
514
607
```@docs
515
608
Bridges.Variable.AbstractBridge
516
-
Bridges.variable_bridged_function
517
-
Bridges.variable_unbridged_function
609
+
Bridges.bridged_variable_function
610
+
Bridges.unbridged_variable_function
518
611
```
519
612
520
613
Below is the list of variable bridges implemented in this package.
@@ -545,6 +638,50 @@ allow to return *bridged constraints* that do not correspond to
545
638
constraints of the underlying model. These constraints were enforced by an
546
639
equivalent formulation that added constraints (and possibly also variables) in
0 commit comments