Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Utilities] Remove EMPTYSTRING #2283

Merged
merged 1 commit into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Bridges/bridge_optimizer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1514,7 +1514,7 @@ function MOI.get(
vi::MOI.VariableIndex,
)
if is_bridged(b, vi)
return get(b.var_to_name, vi, MOI.Utilities.EMPTYSTRING)
return get(b.var_to_name, vi, "")
else
return MOI.get(b.model, attr, vi)
end
Expand All @@ -1541,7 +1541,7 @@ function MOI.get(
constraint_index::MOI.ConstraintIndex,
)
if is_bridged(b, constraint_index)
return get(b.con_to_name, constraint_index, MOI.Utilities.EMPTYSTRING)
return get(b.con_to_name, constraint_index, "")
else
return MOI.get(b.model, attr, constraint_index)
end
Expand Down
8 changes: 3 additions & 5 deletions src/Utilities/model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
# 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.

const EMPTYSTRING = ""

# Implementation of MOI for AbstractModel
abstract type AbstractModelLike{T} <: MOI.ModelLike end
abstract type AbstractOptimizer{T} <: MOI.AbstractOptimizer end
Expand Down Expand Up @@ -149,7 +147,7 @@ function MOI.set(model::AbstractModel, ::MOI.VariableName, vi::VI, name::String)
end

function MOI.get(model::AbstractModel, ::MOI.VariableName, vi::VI)
return get(model.var_to_name, vi, EMPTYSTRING)
return get(model.var_to_name, vi, "")
end

"""
Expand Down Expand Up @@ -234,7 +232,7 @@ function MOI.set(
end

function MOI.get(model::AbstractModel, ::MOI.ConstraintName, ci::CI)
return get(model.con_to_name, ci, EMPTYSTRING)
return get(model.con_to_name, ci, "")
end

"""
Expand Down Expand Up @@ -736,7 +734,7 @@ for (loop_name, loop_super_type) in [
ext::Dict{Symbol,Any}
function $name{T,O,V,C}() where {T,O,V,C}
return new{T,O,V,C}(
EMPTYSTRING,
"",
O(),
V(),
C(),
Expand Down
2 changes: 1 addition & 1 deletion src/Utilities/universalfallback.jl
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ function MOI.get(
if MOI.supports_constraint(uf.model, F, S)
return MOI.get(uf.model, attr, ci)
end
return get(uf.con_to_name, ci, EMPTYSTRING)
return get(uf.con_to_name, ci, "")
end

function MOI.get(uf::UniversalFallback, ::Type{VI}, name::String)
Expand Down
Loading