Skip to content

Commit 3681c6e

Browse files
authored
[Utilities] Remove EMPTYSTRING (#2283)
1 parent b605464 commit 3681c6e

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

src/Bridges/bridge_optimizer.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1514,7 +1514,7 @@ function MOI.get(
15141514
vi::MOI.VariableIndex,
15151515
)
15161516
if is_bridged(b, vi)
1517-
return get(b.var_to_name, vi, MOI.Utilities.EMPTYSTRING)
1517+
return get(b.var_to_name, vi, "")
15181518
else
15191519
return MOI.get(b.model, attr, vi)
15201520
end
@@ -1541,7 +1541,7 @@ function MOI.get(
15411541
constraint_index::MOI.ConstraintIndex,
15421542
)
15431543
if is_bridged(b, constraint_index)
1544-
return get(b.con_to_name, constraint_index, MOI.Utilities.EMPTYSTRING)
1544+
return get(b.con_to_name, constraint_index, "")
15451545
else
15461546
return MOI.get(b.model, attr, constraint_index)
15471547
end

src/Utilities/model.jl

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
# Use of this source code is governed by an MIT-style license that can be found
55
# in the LICENSE.md file or at https://opensource.org/licenses/MIT.
66

7-
const EMPTYSTRING = ""
8-
97
# Implementation of MOI for AbstractModel
108
abstract type AbstractModelLike{T} <: MOI.ModelLike end
119
abstract type AbstractOptimizer{T} <: MOI.AbstractOptimizer end
@@ -149,7 +147,7 @@ function MOI.set(model::AbstractModel, ::MOI.VariableName, vi::VI, name::String)
149147
end
150148

151149
function MOI.get(model::AbstractModel, ::MOI.VariableName, vi::VI)
152-
return get(model.var_to_name, vi, EMPTYSTRING)
150+
return get(model.var_to_name, vi, "")
153151
end
154152

155153
"""
@@ -234,7 +232,7 @@ function MOI.set(
234232
end
235233

236234
function MOI.get(model::AbstractModel, ::MOI.ConstraintName, ci::CI)
237-
return get(model.con_to_name, ci, EMPTYSTRING)
235+
return get(model.con_to_name, ci, "")
238236
end
239237

240238
"""
@@ -736,7 +734,7 @@ for (loop_name, loop_super_type) in [
736734
ext::Dict{Symbol,Any}
737735
function $name{T,O,V,C}() where {T,O,V,C}
738736
return new{T,O,V,C}(
739-
EMPTYSTRING,
737+
"",
740738
O(),
741739
V(),
742740
C(),

src/Utilities/universalfallback.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ function MOI.get(
626626
if MOI.supports_constraint(uf.model, F, S)
627627
return MOI.get(uf.model, attr, ci)
628628
end
629-
return get(uf.con_to_name, ci, EMPTYSTRING)
629+
return get(uf.con_to_name, ci, "")
630630
end
631631

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

0 commit comments

Comments
 (0)