Skip to content

Commit

Permalink
Add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
blegat committed Jun 18, 2024
1 parent f9f53bd commit 9e6a5e3
Showing 1 changed file with 30 additions and 3 deletions.
33 changes: 30 additions & 3 deletions src/Bridges/set_map.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@
# Use of this source code is governed by an MIT-style license that can be found
# in the LICENSE.md file or at https://opensource.org/licenses/MIT.

"""
struct MapNotInvertible <: Exception end
An error thrown by [`inverse_map_function`](@ref) or
[`inverse_adjoint_map_function`](@ref) indicating that the linear map `A`
defined in [`Variable.SetMapBridge`](@ref) and [`Constraint.SetMapBridge`](@ref)
is not invertible.
"""
struct MapNotInvertible <: Exception end

"""
Expand Down Expand Up @@ -55,7 +63,7 @@ function map_function(::Type{BT}, func, i::IndexInVector) where {BT}
end

"""
inverse_map_function(::Type{BT}, func) where {BT}
inverse_map_function(bridge::MOI.Bridges.AbstractBridge, func)
Return the image of `func` through the inverse of the linear map `A` defined in
[`Variable.SetMapBridge`](@ref) and [`Constraint.SetMapBridge`](@ref). This is
Expand All @@ -64,6 +72,13 @@ used by [`Variable.unbridged_map`](@ref) and for setting the
and for getting the [`MOI.ConstraintFunction`](@ref),
the [`MOI.ConstraintPrimal`](@ref) and the
[`MOI.ConstraintPrimalStart`](@ref) of constraint bridges.
If the linear map `A` is not invertible, the error [`MapNotInvertible`](@ref) is
thrown.
inverse_map_function(::Type{BT}, func) where {BT}
The method can alternatively be defined on the bridge type. This legacy
interface is kept for backward compatibility.
"""
function inverse_map_function end

Expand All @@ -72,12 +87,17 @@ function inverse_map_function(bridge::AbstractBridge, func)
end

"""
adjoint_map_function(::Type{BT}, func) where {BT}
adjoint_map_function(bridge::MOI.Bridges.AbstractBridge, func)
Return the image of `func` through the adjoint of the linear map `A` defined in
[`Variable.SetMapBridge`](@ref) and [`Constraint.SetMapBridge`](@ref). This is
used for getting the [`MOI.ConstraintDual`](@ref) and
[`MOI.ConstraintDualStart`](@ref) of constraint bridges.
adjoint_map_function(::Type{BT}, func) where {BT}
The method can alternatively be defined on the bridge type. This legacy
interface is kept for backward compatibility.
"""
function adjoint_map_function end

Expand All @@ -86,13 +106,20 @@ function adjoint_map_function(bridge::AbstractBridge, func)
end

"""
inverse_adjoint_map_function(::Type{BT}, func) where {BT}
inverse_adjoint_map_function(bridge::MOI.Bridges.AbstractBridge, func)
Return the image of `func` through the inverse of the adjoint of the linear map
`A` defined in [`Variable.SetMapBridge`](@ref) and
[`Constraint.SetMapBridge`](@ref). This is used for getting the
[`MOI.ConstraintDual`](@ref) of variable bridges and setting the
[`MOI.ConstraintDualStart`](@ref) of constraint bridges.
If the linear map `A` is not invertible, the error [`MapNotInvertible`](@ref) is
thrown.
inverse_adjoint_map_function(::Type{BT}, func) where {BT}
The method can alternatively be defined on the bridge type. This legacy
interface is kept for backward compatibility.
"""
function inverse_adjoint_map_function end

Expand Down

0 comments on commit 9e6a5e3

Please sign in to comment.