@@ -430,19 +430,59 @@ DeleteNotAllowed
430430
431431## Bridges
432432
433- Bridges can be used for automatic reformulation of a certain constraint type into equivalent constraints.
433+ Bridges can be used for automatic reformulation of a certain constrained
434+ variables or constraints into equivalent formulations using constrained
435+ variables and constraints of different types.
436+ There are two important concepts to distinguish:
437+ * [ ` Bridges.AbstractBridge ` ] ( @ref ) s are recipes implementing a specific
438+ reformulation. Bridges are not directly subtypes of
439+ [ ` Bridges.AbstractBridge ` ] ( @ref ) , they are either
440+ [ ` Bridges.Variable.AbstractBridge ` ] ( @ref ) or
441+ [ ` Bridges.Constraint.AbstractBridge ` ] ( @ref ) .
442+ * [ ` Bridges.AbstractBridgeOptimizer ` ] ( @ref ) s is a layer that can applied to
443+ another [ ` ModelLike ` ] ( @ref ) to apply the reformulation. The
444+ [ ` Bridges.LazyBridgeOptimizer ` ] ( @ref ) automatically choose the appropriate
445+ bridges to use when a constrained variable or constraint is not supported
446+ using the list of bridges that were added to it by [ ` Bridges.add_bridge ` ] ( @ref ) .
447+ [ ` Bridges.full_bridge_optimizer ` ] ( @ref ) wraps a model in a
448+ [ ` Bridges.LazyBridgeOptimizer ` ] ( @ref ) where all the bridges defined in MOI
449+ are added. This is the recommended way to use bridges in the
450+ [ Testing guideline] ( @ref ) and JuMP automatically calls this function when
451+ attaching an optimizer.
452+
434453``` @docs
435454Bridges.AbstractBridge
436455Bridges.AbstractBridgeOptimizer
437- Bridges.Constraint.SingleBridgeOptimizer
438456Bridges.LazyBridgeOptimizer
439457Bridges.add_bridge
458+ Bridges.full_bridge_optimizer
440459```
441460
442461### Variable bridges
443462
463+ When variables are added, either free with
464+ [ ` add_variable ` ] ( @ref ) /[ ` add_variables ` ] ( @ref ) ,
465+ or constrained with
466+ [ ` add_constrained_variable ` ] ( @ref ) /[ ` add_constrained_variables ` ] ( @ref ) ,
467+ variable bridges allow to return * bridged variables* that do not correspond to
468+ variables of the underlying model. These variables are parametrized by
469+ variables of the underlying model and this parametrization can be obtained with
470+ [ ` Bridges.variable_bridged_function ` ] ( @ref ) . Similarly, the variables of the
471+ underlying model that were created by the bridge can be expressed in terms of
472+ the bridged variables and this expression can be obtained with
473+ [ ` Bridges.variable_unbridged_function ` ] ( @ref ) .
474+
475+ !!! note
476+ A notable exception is with [ ` Bridges.Variable.ZerosBridge ` ] ( @ref ) where no
477+ variable is created in the underlying model as the variables are simply
478+ transformed to zeros. When this bridge is used, it is not possible to
479+ recover functions with bridged variables from functions of the underlying
480+ model.
481+
444482``` @docs
445483Bridges.Variable.AbstractBridge
484+ Bridges.variable_bridged_function
485+ Bridges.variable_unbridged_function
446486```
447487
448488Below is the list of variable bridges implemented in this package.
@@ -454,8 +494,25 @@ Bridges.Variable.VectorizeBridge
454494Bridges.Variable.RSOCtoPSDBridge
455495```
456496
497+ For each bridge defined in this package, a corresponding
498+ [ ` Bridges.Variable.SingleBridgeOptimizer ` ] ( @ref ) is available with the same
499+ name without the "Bridge" suffix, e.g., ` SplitInterval ` is a
500+ ` SingleBridgeOptimizer ` for the ` SplitIntervalBridge ` . Moreover, they are all
501+ added in the [ ` Bridges.LazyBridgeOptimizer ` ] ( @ref ) returned by
502+ [ ` Bridges.full_bridge_optimizer ` ] ( @ref ) as it calls
503+ [ ` Bridges.Variable.add_all_bridges ` ] ( @ref ) .
504+ ``` @docs
505+ Bridges.Variable.SingleBridgeOptimizer
506+ Bridges.Variable.add_all_bridges
507+ ```
508+
457509### Constraint bridges
458510
511+ When constraints are added with [ ` add_constraint ` ] ( @ref ) , constraint bridges
512+ allow to return * bridged constraints* that do not correspond to
513+ constraints of the underlying model. These constraints were enforced by an
514+ equivalent formulation that added constraints (and possibly also variables) in
515+ the underlying model.
459516``` @docs
460517Bridges.Constraint.AbstractBridge
461518```
@@ -483,27 +540,34 @@ Bridges.Constraint.SOCtoPSDBridge
483540Bridges.Constraint.RSOCtoPSDBridge
484541Bridges.Constraint.IndicatorActiveOnFalseBridge
485542```
486- 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 ` .
487- Moreover, a ` LazyBridgeOptimizer ` with all the bridges defined in this package can be obtained with
543+ For each bridge defined in this package, a corresponding
544+ [ ` Bridges.Constraint.SingleBridgeOptimizer ` ] ( @ref ) is available with the same
545+ name without the "Bridge" suffix, e.g., ` SplitInterval ` is a
546+ ` SingleBridgeOptimizer ` for the ` SplitIntervalBridge ` . Moreover, they are all
547+ added in the [ ` Bridges.LazyBridgeOptimizer ` ] ( @ref ) returned by
548+ [ ` Bridges.full_bridge_optimizer ` ] ( @ref ) as it calls
549+ [ ` Bridges.Constraint.add_all_bridges ` ] ( @ref ) .
488550``` @docs
489- Bridges.full_bridge_optimizer
551+ Bridges.Constraint.SingleBridgeOptimizer
552+ Bridges.Constraint.add_all_bridges
490553```
491554
492555### Bridge interface
493556
494557A bridge should implement the following functions to be usable by a bridge optimizer:
495558``` @docs
496- supports_constraint(::Type{<:Bridges.Constraint.AbstractBridge}, ::Type{<:AbstractFunction}, ::Type{<:AbstractSet})
497559Bridges.added_constrained_variable_types
498560Bridges.added_constraint_types
499561```
500562Additionally, variable bridges should implement:
501563``` @docs
564+ Bridges.Variable.supports_constrained_variable
502565Bridges.Variable.concrete_bridge_type
503566Bridges.Variable.bridge_constrained_variable
504567```
505568and constraint bridges should implement
506569``` @docs
570+ supports_constraint(::Type{<:Bridges.Constraint.AbstractBridge}, ::Type{<:AbstractFunction}, ::Type{<:AbstractSet})
507571Bridges.Constraint.concrete_bridge_type
508572Bridges.Constraint.bridge_constraint
509573```
0 commit comments