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
+
934
960
#### Constraint reformulation
935
961
936
962
A constraint often possess different equivalent formulations, but a solver may only support one of them.
937
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.
938
964
Constraint bridges provide a way to define a rewritting rule on top of the MOI interface which can be used by any optimizer.
939
965
Some rules also implement constraint modifications and constraint primal and duals translations.
940
966
941
-
For example, the `SplitIntervalBridge` defines the reformulation of a `ScalarAffineFunction`-in-`Interval` constraint into a `ScalarAffineFunction`-in-`GreaterThan` and a `ScalarAffineFunction`-in-`LessThan` constraint.
942
-
The `SplitInterval` is the bridge optimizer that applies the `SplitIntervalBridge` rewritting rule.
943
-
Given an optimizer `optimizer` implementing `ScalarAffineFunction`-in-`GreaterThan` and `ScalarAffineFunction`-in-`LessThan`, the optimizer
944
-
```
945
-
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`.
606
+
Stacktrace:
607
+
[1] error(::String, ::String, ::String) at ./error.jl:42
608
+
[2] throw_if_cannot_unbridge at /home/blegat/.julia/dev/MathOptInterface/src/Bridges/Variable/map.jl:343 [inlined]
609
+
[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
610
+
[4] top-level scope at none:0
611
+
```
612
+
613
+
```@docs
614
+
Bridges.Variable.AbstractBridge
615
+
Bridges.bridged_variable_function
616
+
Bridges.unbridged_variable_function
492
617
```
493
618
494
-
Below is the list of bridges implemented in this package.
619
+
Below is the list of variable bridges implemented in this package.
620
+
```@docs
621
+
Bridges.Variable.ZerosBridge
622
+
Bridges.Variable.FreeBridge
623
+
Bridges.Variable.NonposToNonnegBridge
624
+
Bridges.Variable.VectorizeBridge
625
+
Bridges.Variable.RSOCtoPSDBridge
626
+
```
627
+
628
+
For each bridge defined in this package, a corresponding
629
+
[`Bridges.Variable.SingleBridgeOptimizer`](@ref) is available with the same
630
+
name without the "Bridge" suffix, e.g., `SplitInterval` is a
631
+
`SingleBridgeOptimizer` for the `SplitIntervalBridge`. Moreover, they are all
632
+
added in the [`Bridges.LazyBridgeOptimizer`](@ref) returned by
633
+
[`Bridges.full_bridge_optimizer`](@ref) as it calls
634
+
[`Bridges.Variable.add_all_bridges`](@ref).
635
+
```@docs
636
+
Bridges.Variable.SingleBridgeOptimizer
637
+
Bridges.Variable.add_all_bridges
638
+
```
639
+
640
+
### Constraint bridges
641
+
642
+
When constraints are added with [`add_constraint`](@ref), constraint bridges
643
+
allow to return *bridged constraints* that do not correspond to
644
+
constraints of the underlying model. These constraints were enforced by an
645
+
equivalent formulation that added constraints (and possibly also variables) in
For each bridge defined in this package, a corresponding bridge optimizer is available with the same name without the "Bridge" suffix, e.g., `SplitInterval` is an `SingleBridgeOptimizer` for the `SplitIntervalBridge`.
518
-
Moreover, a `LazyBridgeOptimizer` with all the bridges defined in this package can be obtained with
718
+
For each bridge defined in this package, a corresponding
719
+
[`Bridges.Constraint.SingleBridgeOptimizer`](@ref) is available with the same
720
+
name without the "Bridge" suffix, e.g., `SplitInterval` is a
721
+
`SingleBridgeOptimizer` for the `SplitIntervalBridge`. Moreover, they are all
722
+
added in the [`Bridges.LazyBridgeOptimizer`](@ref) returned by
723
+
[`Bridges.full_bridge_optimizer`](@ref) as it calls
724
+
[`Bridges.Constraint.add_all_bridges`](@ref).
519
725
```@docs
520
-
Bridges.full_bridge_optimizer
726
+
Bridges.Constraint.SingleBridgeOptimizer
727
+
Bridges.Constraint.add_all_bridges
521
728
```
522
729
523
730
### Bridge interface
524
731
525
732
A bridge should implement the following functions to be usable by a bridge optimizer:
0 commit comments