Skip to content

Commit 90c7e46

Browse files
authored
Add blank lines between definitions (#2638)
1 parent 762ce28 commit 90c7e46

21 files changed

+50
-0
lines changed

perf/bellman_ford.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,34 +28,39 @@ function MOI.supports_constraint(
2828
) where {T}
2929
return false
3030
end
31+
3132
function MOI.supports_constraint(
3233
::SDPAModel{T},
3334
::Type{MOI.VariableIndex},
3435
::Type{MOI.LessThan{T}},
3536
) where {T}
3637
return false
3738
end
39+
3840
function MOI.supports_constraint(
3941
::SDPAModel{T},
4042
::Type{MOI.VariableIndex},
4143
::Type{MOI.EqualTo{T}},
4244
) where {T}
4345
return false
4446
end
47+
4548
function MOI.supports_constraint(
4649
::SDPAModel{T},
4750
::Type{MOI.VariableIndex},
4851
::Type{MOI.Interval{T}},
4952
) where {T}
5053
return false
5154
end
55+
5256
function MOI.supports_constraint(
5357
::SDPAModel,
5458
::Type{MOI.VectorOfVariables},
5559
::Type{MOI.Reals},
5660
)
5761
return false
5862
end
63+
5964
function MOI.supports(
6065
::SDPAModel{T},
6166
::MOI.ObjectiveFunction{MOI.ScalarQuadraticFunction{T}},

src/Bridges/Constraint/single_bridge_optimizer.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ function MOI.Bridges.is_bridged(
8686
return MOI.Bridges.is_bridged(b, MOI.VariableIndex, S) &&
8787
haskey(Constraint.bridges(b), ci)
8888
end
89+
8990
function MOI.Bridges.is_bridged(
9091
b::SingleBridgeOptimizer,
9192
ci::MOI.ConstraintIndex{MOI.VectorOfVariables,S},

src/Bridges/Variable/set_map.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ function MOI.delete(
113113
MOI.delete(model, bridge.variable)
114114
return
115115
end
116+
116117
function MOI.delete(
117118
model::MOI.ModelLike,
118119
bridge::SetMapBridge{T,S1,S2},

src/FileFormats/MOF/write.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,7 @@ head_name(::Type{MOI.LogDetConeSquare}) = "LogDetConeSquare"
476476
function head_name(::Type{MOI.PositiveSemidefiniteConeTriangle})
477477
return "PositiveSemidefiniteConeTriangle"
478478
end
479+
479480
function head_name(::Type{MOI.PositiveSemidefiniteConeSquare})
480481
return "PositiveSemidefiniteConeSquare"
481482
end

src/FileFormats/SDPA/SDPA.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ function MOI.supports_constraint(
3030
) where {T}
3131
return false
3232
end
33+
3334
function MOI.supports_constraint(
3435
::Model,
3536
::Type{MOI.VariableIndex},
@@ -300,6 +301,7 @@ function _dim_to_set(s::AbstractString)
300301
return MOI.Nonnegatives(-block_dim)
301302
end
302303
end
304+
303305
function _parse_dimensions(dims::AbstractString)
304306
isvalid(char) = isdigit(char) || char == '-'
305307
is_delimiter(char) = isspace(char) || char == ','

src/Test/test_basic_constraint.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ _set(::Type{MOI.Integer}) = MOI.Integer()
100100
function _set(::Type{T}, ::Type{MOI.Semicontinuous}) where {T}
101101
return MOI.Semicontinuous(zero(T), one(T))
102102
end
103+
103104
function _set(::Type{T}, ::Type{MOI.Semiinteger}) where {T}
104105
return MOI.Semiinteger(zero(T), one(T))
105106
end
@@ -124,12 +125,15 @@ _set(::Type{MOI.NormNuclearCone}) = MOI.NormNuclearCone(2, 3)
124125
function _set(::Type{MOI.PositiveSemidefiniteConeTriangle})
125126
return MOI.PositiveSemidefiniteConeTriangle(3)
126127
end
128+
127129
function _set(::Type{MOI.PositiveSemidefiniteConeSquare})
128130
return MOI.PositiveSemidefiniteConeSquare(3)
129131
end
132+
130133
function _set(::Type{MOI.HermitianPositiveSemidefiniteConeTriangle})
131134
return MOI.HermitianPositiveSemidefiniteConeTriangle(3)
132135
end
136+
133137
function _set(::Type{MOI.Scaled{MOI.PositiveSemidefiniteConeTriangle}})
134138
return MOI.Scaled{MOI.PositiveSemidefiniteConeTriangle}(3)
135139
end

src/Test/test_model.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ function MOI.get(::BadModelAttributeModel, ::MOI.ListOfModelAttributesSet)
106106
end
107107

108108
struct UnknownVariableAttribute <: MOI.AbstractVariableAttribute end
109+
109110
struct BadVariableAttributeModel{T} <: BadModel{T}
110111
BadVariableAttributeModel(T = Float64) = new{T}()
111112
end

src/Utilities/cachingoptimizer.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,9 +272,11 @@ function pass_nonvariable_constraints(
272272
constraint_types,
273273
)
274274
end
275+
275276
function final_touch(m::CachingOptimizer, index_map)
276277
return final_touch(m.model_cache, index_map)
277278
end
279+
278280
function MOI.copy_to(m::CachingOptimizer, src::MOI.ModelLike)
279281
if m.state == ATTACHED_OPTIMIZER
280282
reset_optimizer(m)
@@ -394,6 +396,7 @@ function MOI.supports_add_constrained_variable(
394396
MOI.supports_add_constrained_variable(m.optimizer, S)::Bool
395397
)
396398
end
399+
397400
function MOI.add_constrained_variable(
398401
m::CachingOptimizer,
399402
set::S,
@@ -1032,6 +1035,7 @@ function MOI.supports(
10321035
)
10331036
return MOI.supports(model.model_cache, attr, IndexType)
10341037
end
1038+
10351039
function MOI.set(
10361040
model::CachingOptimizer,
10371041
attr::Union{MOI.VariableName,MOI.ConstraintName},
@@ -1045,6 +1049,7 @@ end
10451049
function MOI.supports(m::CachingOptimizer, attr::MOI.Name)
10461050
return MOI.supports(m.model_cache, attr)
10471051
end
1052+
10481053
function MOI.set(model::CachingOptimizer, attr::MOI.Name, value)
10491054
MOI.set(model.model_cache, attr, value)
10501055
return
@@ -1205,12 +1210,14 @@ end
12051210
function map_indices_to_optimizer(m::CachingOptimizer, idx::MOI.Index)
12061211
return m.model_to_optimizer_map[idx]
12071212
end
1213+
12081214
function map_indices_to_optimizer(
12091215
m::CachingOptimizer,
12101216
indices::Vector{<:MOI.Index},
12111217
)
12121218
return getindex.(Ref(m.model_to_optimizer_map), indices)
12131219
end
1220+
12141221
function MOI.set(
12151222
m::CachingOptimizer,
12161223
attr::AttributeFromOptimizer{T},
@@ -1272,6 +1279,7 @@ function MOI.supports(
12721279
return caching_opt.optimizer !== nothing &&
12731280
MOI.supports(caching_opt.optimizer, sub)::Bool
12741281
end
1282+
12751283
function MOI.submit(
12761284
caching_opt::CachingOptimizer,
12771285
sub::MOI.AbstractSubmittable,

src/Utilities/mockoptimizer.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,7 @@ function MOI.get(mock::MockOptimizer, attr::MOI.AbstractOptimizerAttribute)
465465
return MOI.get(mock.inner_model, attr)
466466
end
467467
end
468+
468469
function MOI.get(mock::MockOptimizer, attr::MOI.AbstractModelAttribute)
469470
if MOI.is_set_by_optimize(attr)
470471
return mock.model_attributes[attr]
@@ -680,6 +681,7 @@ function MOI.get(
680681
return _safe_get_result(mock.constraint_dual, attr, idx, "dual")
681682
end
682683
end
684+
683685
function MOI.get(
684686
mock::MockOptimizer,
685687
::MockConstraintAttribute,

src/Utilities/struct_of_constraints.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@ function _add_variable(model::StructOfConstraints)
1919
model.num_variables += 1
2020
return broadcastcall(_add_variable, model)
2121
end
22+
2223
function _add_variables(model::StructOfConstraints, n)
2324
model.num_variables += n
2425
return broadcastcall(Base.Fix2(_add_variables, n), model)
2526
end
2627

2728
function final_touch(::Nothing, index_map) end
29+
2830
function final_touch(model::StructOfConstraints, index_map)
2931
broadcastcall(Base.Fix2(final_touch, index_map), model)
3032
return

src/Utilities/vector_of_constraints.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ function MOI.modify(
179179
end
180180

181181
function _add_variable(::VectorOfConstraints) end
182+
182183
function _add_variables(::VectorOfConstraints, ::Int64) end
183184

184185
# Deletion of variables in vector of variables

src/constraints.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,12 +135,14 @@ function throw_if_scalar_and_constant_not_zero(
135135
end
136136
return
137137
end
138+
138139
function throw_if_scalar_and_constant_not_zero(
139140
::VariableIndex,
140141
::Type{S},
141142
) where {S<:AbstractScalarSet}
142143
return
143144
end
145+
144146
function throw_if_scalar_and_constant_not_zero(
145147
::AbstractVectorFunction,
146148
::Type{S},
@@ -197,6 +199,7 @@ function throw_add_constraint_error_fallback(
197199
kwargs...,
198200
)
199201
end
202+
200203
function throw_add_constraint_error_fallback(
201204
model::ModelLike,
202205
func::AbstractVectorFunction,
@@ -210,6 +213,7 @@ function throw_add_constraint_error_fallback(
210213
kwargs...,
211214
)
212215
end
216+
213217
function throw_add_constraint_error_fallback(
214218
model::ModelLike,
215219
func::AbstractScalarFunction,
@@ -220,6 +224,7 @@ function throw_add_constraint_error_fallback(
220224
"Cannot add a constraint of the form `ScalarFunction`-in-`VectorSet`",
221225
)
222226
end
227+
223228
function throw_add_constraint_error_fallback(
224229
model::ModelLike,
225230
func::AbstractVectorFunction,

src/instantiate.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ _to_param(param::Pair{<:AbstractOptimizerAttribute}) = param
2727
function _to_param(param::Pair{String})
2828
return RawOptimizerAttribute(param.first) => param.second
2929
end
30+
3031
function _to_param(param::Pair)
3132
return error(
3233
"Expected an optimizer attribute or a string, got `$(param.first)` which is a `$(typeof(param.first))`.",

src/modifications.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,15 @@ struct ModifyConstraintNotAllowed{
2424
change::C
2525
message::String
2626
end
27+
2728
function ModifyConstraintNotAllowed(
2829
ci::ConstraintIndex{F,S},
2930
change::AbstractFunctionModification,
3031
message = "",
3132
) where {F<:AbstractFunction,S<:AbstractSet}
3233
return ModifyConstraintNotAllowed{F,S,typeof(change)}(ci, change, message)
3334
end
35+
3436
function throw_modify_not_allowed(ci::ConstraintIndex, args...)
3537
return throw(ModifyConstraintNotAllowed(ci, args...))
3638
end

test/Bridges/bridge_optimizer.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,11 @@ end
2424
include("utilities.jl")
2525

2626
struct DummyModelAttribute <: MOI.AbstractModelAttribute end
27+
2728
struct DummyEvaluator <: MOI.AbstractNLPEvaluator end
29+
2830
struct DummyVariableAttribute <: MOI.AbstractVariableAttribute end
31+
2932
struct DummyConstraintAttribute <: MOI.AbstractConstraintAttribute end
3033

3134
function test_subsitution_of_variables_constant()

test/Bridges/lazy_bridge_optimizer.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1970,8 +1970,10 @@ function test_wrong_coefficient()
19701970
end
19711971

19721972
struct OptimizerWithBridgeListOfNonstandardBridges <: MOI.AbstractOptimizer end
1973+
19731974
struct BridgeListOfNonstandardBridges{T} <:
19741975
MOI.Bridges.Constraint.AbstractBridge end
1976+
19751977
function MOI.get(
19761978
::OptimizerWithBridgeListOfNonstandardBridges,
19771979
::MOI.Bridges.ListOfNonstandardBridges{T},

test/FileFormats/MOF/MOF.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ function _validate(filename::String)
5555
end
5656

5757
struct UnsupportedSet <: MOI.AbstractSet end
58+
5859
struct UnsupportedFunction <: MOI.AbstractFunction end
5960

6061
function _test_model_equality(

test/FileFormats/SDPA/SDPA.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@ end
326326
function _spacer(char)
327327
return [" ", "$char", " $char", "$char ", " $char "]
328328
end
329+
329330
function test_dim_reader()
330331
for before in _spacer('{')
331332
for sep in _spacer(',')

test/Utilities/cachingoptimizer.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,12 +1001,15 @@ function MOI.Utilities.final_touch(model::FinalTouchDetector, index_map)
10011001
model.index_map = index_map
10021002
return
10031003
end
1004+
10041005
function MOI.copy_to(::MOI.Utilities.MockOptimizer, ::FinalTouchDetector)
10051006
return MOI.Utilities.IndexMap()
10061007
end
1008+
10071009
function MOI.get(::FinalTouchDetector, ::MOI.ListOfOptimizerAttributesSet)
10081010
return MOI.AbstractOptimizerAttribute[]
10091011
end
1012+
10101013
function MOI.get(::FinalTouchDetector, ::MOI.ListOfModelAttributesSet)
10111014
return MOI.AbstractModelAttribute[]
10121015
end

test/Utilities/mutable_arithmetics.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,11 @@ end
5656
function test_promote_operation_allocation_Int()
5757
return _test_promote_operation_allocation(Int)
5858
end
59+
5960
function test_promote_operation_allocation_Float64()
6061
return _test_promote_operation_allocation(Float64)
6162
end
63+
6264
function test_promote_operation_allocation_Float32()
6365
return _test_promote_operation_allocation(Float32)
6466
end

test/dummy.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,15 @@ function MOI.supports(
2626
)
2727
return true
2828
end
29+
2930
function MOI.supports_constraint(
3031
::AbstractDummyModel,
3132
::Type{MOI.VariableIndex},
3233
::Type{MOI.EqualTo{Float64}},
3334
)
3435
return true
3536
end
37+
3638
function MOI.supports_constraint(
3739
::AbstractDummyModel,
3840
::Type{MOI.VectorOfVariables},

0 commit comments

Comments
 (0)