Skip to content

Commit

Permalink
Fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
odow committed Oct 14, 2021
1 parent e19f712 commit d4d02b4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 18 deletions.
17 changes: 1 addition & 16 deletions src/JuMP.jl
Original file line number Diff line number Diff line change
Expand Up @@ -600,14 +600,6 @@ end
# No optimizer is attached, the bridge will be added when one is attached
_moi_add_bridge(::Nothing, ::Type{<:MOI.Bridges.AbstractBridge}) = nothing

function _moi_add_bridge(::MOI.ModelLike, ::Type{<:MOI.Bridges.AbstractBridge})
return error(
"`In order to add a bridge, you must pass " *
"`force_bridge_formulation = true` to `Model`, i.e., " *
"`Model(optimizer; force_bridge_formulation = true)`.",
)
end

function _moi_add_bridge(
bridge_opt::MOI.Bridges.LazyBridgeOptimizer,
BridgeType::Type{<:MOI.Bridges.AbstractBridge},
Expand Down Expand Up @@ -673,6 +665,7 @@ problems." URL: [https://arxiv.org/abs/2002.03447](https://arxiv.org/abs/2002.03
print_bridge_graph(model::Model) = print_bridge_graph(Base.stdout, model)

function print_bridge_graph(io::IO, model::Model)
_add_bridges_if_needed(model)
# The type of `backend(model)` is not type-stable, so we use a function
# barrier (`_moi_print_bridge_graph`) to improve performance.
return _moi_print_bridge_graph(io, backend(model))
Expand All @@ -686,14 +679,6 @@ function _moi_print_bridge_graph(io::IO, model::MOIU.CachingOptimizer)
return _moi_print_bridge_graph(io, model.optimizer)
end

function _moi_print_bridge_graph(::IO, ::MOI.ModelLike)
return error(
"`In order to print the bridge graph, you must pass " *
"`force_bridge_formulation = true` to `Model`, i.e., " *
"`Model(optimizer; force_bridge_formulation = true)`.",
)
end

"""
empty!(model::Model)::Model
Expand Down
4 changes: 2 additions & 2 deletions src/optimizer_interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ end
set_optimizer(
model::Model,
optimizer_factory;
force_bridge_formulation::Bool = length(model.bridge_types) > 0,
force_bridge_formulation::Bool = !isempty(model.bridge_types),
)
Creates an empty `MathOptInterface.AbstractOptimizer` instance by calling
Expand Down Expand Up @@ -105,7 +105,7 @@ function set_optimizer(
model::Model,
optimizer_constructor;
# By default, add bridges only if the user has manually added bridges.
force_bridge_formulation::Bool = length(model.bridge_types) > 0,
force_bridge_formulation::Bool = !isempty(model.bridge_types),
bridge_constraints::Union{Nothing,Bool} = nothing,
)
if bridge_constraints !== nothing
Expand Down

0 comments on commit d4d02b4

Please sign in to comment.