Skip to content

Commit

Permalink
improve the deprecation warning for with_optimizer
Browse files Browse the repository at this point in the history
  • Loading branch information
mlubin committed Feb 17, 2020
1 parent aa08802 commit 255c3b8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/JuMP.jl
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,13 @@ end
function with_optimizer(constructor; kwargs...)
if isempty(kwargs)
deprecation_message = """
`with_optimizer` is deprecated, replace `with_optimizer(Ipopt.Optimizer)` by `Ipopt.Optimizer`.
`with_optimizer` is deprecated. For example, replace `with_optimizer(Ipopt.Optimizer)` by `Ipopt.Optimizer`.
"""
Base.depwarn(deprecation_message, :with_optimizer)
return constructor
else
deprecation_message = """
`with_optimizer` is deprecated, replace `with_optimizer(Ipopt.Optimizer, max_cpu_time=60.0)`
`with_optimizer` is deprecated. For example, replace `with_optimizer(Ipopt.Optimizer, max_cpu_time=60.0)`
by `optimizer_with_attributes(Ipopt.Optimizer, "max_cpu_time" => 60.0)`.
"""
Base.depwarn(deprecation_message, :with_optimizer_kw)
Expand All @@ -111,7 +111,7 @@ end
function with_optimizer(constructor, args...; kwargs...)
if isempty(kwargs)
deprecation_message = """
`with_optimizer` is deprecated, replace `with_optimizer(Gurobi.Optimizer, env)` by `() -> Gurobi.Optimizer(env)`.
`with_optimizer` is deprecated. For example, replace `with_optimizer(Gurobi.Optimizer, env)` by `() -> Gurobi.Optimizer(env)`.
"""
Base.depwarn(deprecation_message, :with_optimizer_args)
if !applicable(constructor, args...)
Expand All @@ -122,7 +122,7 @@ function with_optimizer(constructor, args...; kwargs...)
return with_optimizer(() -> constructor(args...); kwargs...)
else
deprecation_message = """
`with_optimizer` is deprecated, replace `with_optimizer(Gurobi.Optimizer, env, Presolve=0)`
`with_optimizer` is deprecated. For example, replace `with_optimizer(Gurobi.Optimizer, env, Presolve=0)`
by `optimizer_with_attributes(() -> Gurobi.Optimizer(env), "Presolve" => 0)`.
"""
Base.depwarn(deprecation_message, :with_optimizer_args_kw)
Expand Down

0 comments on commit 255c3b8

Please sign in to comment.