Skip to content

Commit f8dcabe

Browse files
authored
[Utilities] remove MOIU acronym (#2280)
1 parent 3681c6e commit f8dcabe

File tree

6 files changed

+25
-22
lines changed

6 files changed

+25
-22
lines changed

src/Utilities/Utilities.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ module Utilities
88

99
import LinearAlgebra
1010
import MathOptInterface as MOI
11-
import MathOptInterface.Utilities as MOIU # used in macro
1211
import MutableArithmetics as MA
1312
import OrderedCollections: OrderedDict
1413

src/Utilities/cachingoptimizer.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ end
115115

116116
function Base.show(io::IO, C::CachingOptimizer)
117117
indent = " "^get(io, :indent, 0)
118-
MOIU.print_with_acronym(io, summary(C))
118+
print_with_acronym(io, summary(C))
119119
print(io, "\n$(indent)in state $(C.state)")
120120
print(io, "\n$(indent)in mode $(C.mode)")
121121
print(io, "\n$(indent)with model cache ")
@@ -393,8 +393,8 @@ function MOI.add_constrained_variable(
393393
m::CachingOptimizer,
394394
set::S,
395395
) where {S<:MOI.AbstractScalarSet}
396-
if m.state == MOIU.ATTACHED_OPTIMIZER
397-
if m.mode == MOIU.AUTOMATIC
396+
if m.state == ATTACHED_OPTIMIZER
397+
if m.mode == AUTOMATIC
398398
try
399399
vindex_optimizer, cindex_optimizer =
400400
MOI.add_constrained_variable(
@@ -422,7 +422,7 @@ function MOI.add_constrained_variable(
422422
end
423423
end
424424
vindex, cindex = MOI.add_constrained_variable(m.model_cache, set)
425-
if m.state == MOIU.ATTACHED_OPTIMIZER
425+
if m.state == ATTACHED_OPTIMIZER
426426
m.model_to_optimizer_map[vindex] = vindex_optimizer
427427
m.optimizer_to_model_map[vindex_optimizer] = vindex
428428
m.model_to_optimizer_map[cindex] = cindex_optimizer

src/Utilities/copy/index_map.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ end
3535

3636
function _identity_constraints_map(
3737
model,
38-
map::MOIU.DoubleDicts.IndexDoubleDictInner{F,S},
38+
map::DoubleDicts.IndexDoubleDictInner{F,S},
3939
) where {F,S}
4040
for c in MOI.get(model, MOI.ListOfConstraintIndices{F,S}())
4141
map[c] = c

src/Utilities/product_of_sets.jl

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function _sets_code(esc_name, T, type_def, set_types...)
2020
push!(
2121
code.args,
2222
:(
23-
function $MOIU.set_index(
23+
function $MOI.Utilities.set_index(
2424
::$esc_name{$(T)},
2525
::Type{$(esc_type)},
2626
) where {$T}
@@ -31,7 +31,9 @@ function _sets_code(esc_name, T, type_def, set_types...)
3131
end
3232
push!(
3333
code.args,
34-
:($MOIU.set_types(::$esc_name{$T}) where {$T} = [$(esc_types...)]),
34+
:(function $MOI.Utilities.set_types(::$esc_name{$T}) where {$T}
35+
return [$(esc_types...)]
36+
end),
3537
)
3638
return code
3739
end
@@ -66,14 +68,15 @@ Generate a new [`MixOfScalarSets`](@ref) subtype.
6668
macro mix_of_scalar_sets(name, set_types...)
6769
esc_name = esc(name)
6870
T = esc(:T)
69-
type_def = :(struct $(esc_name){$(T)} <: $(MOIU).MixOfScalarSets{$(T)}
70-
"""
71-
`set_ids[i]` maps the row `i` to the corresponding set type.
72-
"""
73-
set_ids::Vector{Int}
74-
75-
$(esc_name){$(T)}() where {$(T)} = new(Int[])
76-
end)
71+
type_def =
72+
:(struct $(esc_name){$(T)} <: $MOI.Utilities.MixOfScalarSets{$(T)}
73+
"""
74+
`set_ids[i]` maps the row `i` to the corresponding set type.
75+
"""
76+
set_ids::Vector{Int}
77+
78+
$(esc_name){$(T)}() where {$(T)} = new(Int[])
79+
end)
7780
return _sets_code(esc_name, T, type_def, set_types...)
7881
end
7982

@@ -164,7 +167,8 @@ macro product_of_sets(name, set_types...)
164167
esc_name = esc(name)
165168
T = esc(:T)
166169
type_def = :(
167-
mutable struct $(esc_name){$(T)} <: $(MOIU).OrderedProductOfSets{$(T)}
170+
mutable struct $(esc_name){$(T)} <:
171+
$MOI.Utilities.OrderedProductOfSets{$(T)}
168172
"""
169173
During the copy, this counts the number of rows corresponding to
170174
each set. At the end of copy, `final_touch` is called, which

src/Utilities/struct_of_constraints.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -291,16 +291,16 @@ function struct_of_constraint_code(struct_name, types, field_types = nothing)
291291
num_variables::Int64
292292
end
293293

294-
function $MOIU.broadcastcall(f::Function, model::$struct_name)
294+
function $MOI.Utilities.broadcastcall(f::Function, model::$struct_name)
295295
$(Expr(:block, _callfield.(Ref(:f), types)...))
296296
return
297297
end
298298

299-
function $MOIU.broadcastvcat(f::Function, model::$struct_name)
299+
function $MOI.Utilities.broadcastvcat(f::Function, model::$struct_name)
300300
return vcat($(_callfield.(Ref(:f), types)...))
301301
end
302302

303-
function $MOIU.mapreduce_constraints(
303+
function $MOI.Utilities.mapreduce_constraints(
304304
f::Function,
305305
op::Function,
306306
model::$struct_name,
@@ -316,7 +316,7 @@ function struct_of_constraint_code(struct_name, types, field_types = nothing)
316316
fun = t isa SymbolFun ? _typed(t) : :(MOI.AbstractFunction)
317317
set = t isa SymbolFun ? :(MOI.AbstractSet) : _typed(t)
318318
constraints_code = :(
319-
function $MOIU.constraints(
319+
function $MOI.Utilities.constraints(
320320
model::$typed_struct,
321321
::Type{<:$fun},
322322
::Type{<:$set},

src/Utilities/universalfallback.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ end
5757
function Base.show(io::IO, U::UniversalFallback)
5858
s(n) = n == 1 ? "" : "s"
5959
indent = " "^get(io, :indent, 0)
60-
MOIU.print_with_acronym(io, summary(U))
60+
print_with_acronym(io, summary(U))
6161
!(U.objective === nothing) && print(io, "\n$(indent)with objective")
6262
for (attr, name) in (
6363
(U.single_variable_constraints, "`VariableIndex` constraint"),

0 commit comments

Comments
 (0)