Skip to content

Commit

Permalink
Remove MOIBC
Browse files Browse the repository at this point in the history
  • Loading branch information
blegat committed Aug 25, 2019
1 parent 00056c4 commit 0a6211c
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/JuMP.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ using SparseArrays
import MathOptInterface
const MOI = MathOptInterface
const MOIU = MOI.Utilities
const MOIBC = MOI.Bridges.Constraint

import Calculus
import DataStructures.OrderedDict
Expand Down Expand Up @@ -319,36 +318,36 @@ function bridge_constraints(model::Model)
end

function _moi_add_bridge(model::Nothing,
BridgeType::Type{<:MOIBC.AbstractBridge})
BridgeType::Type{<:MOIB.AbstractBridge})
# No optimizer is attached, the bridge will be added when one is attached
return
end
function _moi_add_bridge(model::MOI.ModelLike,
BridgeType::Type{<:MOIBC.AbstractBridge})
BridgeType::Type{<:MOIB.AbstractBridge})
error("Cannot add bridge if `bridge_constraints` was set to `false` in the",
" `Model` constructor.")
end
function _moi_add_bridge(bridge_opt::MOI.Bridges.LazyBridgeOptimizer,
BridgeType::Type{<:MOIBC.AbstractBridge})
BridgeType::Type{<:MOIB.AbstractBridge})
MOI.Bridges.add_bridge(bridge_opt, BridgeType{Float64})
return
end
function _moi_add_bridge(caching_opt::MOIU.CachingOptimizer,
BridgeType::Type{<:MOIBC.AbstractBridge})
BridgeType::Type{<:MOIB.AbstractBridge})
_moi_add_bridge(caching_opt.optimizer, BridgeType)
return
end

"""
add_bridge(model::Model,
BridgeType::Type{<:MOIBC.AbstractBridge})
BridgeType::Type{<:MOIB.AbstractBridge})
Add `BridgeType` to the list of bridges that can be used to transform
unsupported constraints into an equivalent formulation using only constraints
supported by the optimizer.
"""
function add_bridge(model::Model,
BridgeType::Type{<:MOIBC.AbstractBridge})
BridgeType::Type{<:MOIB.AbstractBridge})
push!(model.bridge_types, BridgeType)
# The type of `backend(model)` is not type-stable, so we use a function
# barrier (`_moi_add_bridge`) to improve performance.
Expand Down

0 comments on commit 0a6211c

Please sign in to comment.