Skip to content

Commit 2be1c9b

Browse files
authored
[docs] some more vale fixes (#2404)
1 parent 77555b3 commit 2be1c9b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+141
-115
lines changed

.vale.ini

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,30 @@ BasedOnStyles = Vale, Google
88

99
# TODO(odow): fix all of these
1010
Google.Ellipses = OFF
11-
Google.Exclamation = OFF
1211
Google.FirstPerson = OFF
1312
Google.OptionalPlurals = OFF
1413
Google.Units = OFF
1514
Vale.Spelling = OFF
15+
Google.Quotes = OFF
1616

1717
[*.md]
1818
BasedOnStyles = Vale, Google
1919

2020
[*]
21-
TokenIgnores = (\$.+?\$), \]\(@(ref|id).+?\)
22-
Google.Quotes = OFF
21+
TokenIgnores = (\$+.+?\$+)|(\]\(@(ref|id).+?\))
22+
23+
# TODO(odow): investigate
24+
25+
[docs/src/submodules/Bridges/implementation.md]
26+
Vale.Spelling = OFF
27+
28+
[docs/src/submodules/Utilities/overview.md]
29+
Vale.Spelling = OFF
30+
31+
[src/FileFormats/NL/README.md]
32+
Google.FirstPerson = NO
33+
34+
# Okay to ignore
35+
36+
[LICENSE.md]
37+
Google.Quotes = NO

docs/styles/config/vocabularies/JuMP/accept.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
% Julia-related vocab
22
api|API
3+
[Aa]rgs
4+
attr
5+
kwargs
36
arXiv
47
backports
58
blogposts
@@ -14,10 +17,14 @@ getters
1417
[Jj]ulia
1518
linkcheck
1619
nonlinearly
20+
nonzeros
1721
[Pp]recompil(ation|(e(?d)))
22+
Stacktrace
1823
subexpression(?s)
1924
sublicense
25+
supertype
2026
textualist
27+
untyped
2128

2229
% JuMP-related vocab
2330
[Cc]anonicaliz(e|ation|ing)
@@ -29,10 +36,15 @@ Presolve
2936
[Ss]emidefinite
3037
unboundedness
3138
[Un]nivariate
39+
unary
3240

3341
% Other
42+
Alizadeh
43+
Arkadi
44+
Cholesky
3445
Codecov
3546
Clp
47+
Goldfarb
3648
Gurobi
3749
GZip
3850
Holy
@@ -41,3 +53,4 @@ MOI
4153
PATHSolver
4254
preprint
4355
Lubin
56+
Nemirovski

src/Bridges/Constraint/bridges/geomean.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ struct GeoMeanBridge{T,F,G,H} <: AbstractBridge
6161
xij::Vector{MOI.VariableIndex}
6262
t_upper_bound_constraint::MOI.ConstraintIndex{F,MOI.LessThan{T}}
6363
rsoc_constraints::Vector{MOI.ConstraintIndex{G,MOI.RotatedSecondOrderCone}}
64-
# Ihe case that `d > 2`, this is `Nothing` because the new variables are
64+
# In the case that `d > 2`, this is `Nothing` because the new variables are
6565
# non-negative due to the RotatedSecondOrderCone constraint.
6666
x_nonnegative_constraint::Union{
6767
Nothing,

src/Bridges/Constraint/bridges/indicator_sos.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ function bridge_constraint(
5252
sos_index = MOI.add_constraint(
5353
model,
5454
MOI.VectorOfVariables([slack, z]),
55-
MOI.SOS1{T}([0.4, 0.6]), # This weight vector is arbitrary!
55+
MOI.SOS1{T}([0.4, 0.6]), # This weight vector is arbitrary
5656
)
5757
new_f = MOI.Utilities.operate(+, T, f_scalars[2], slack)
5858
affine_index = MOI.add_constraint(model, new_f, s.set)

src/Bridges/Constraint/bridges/quad_to_soc.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ end
346346
# where Q = U^T * U$, we have `x = U * z` and `s = -a^T z - b` hence, we have
347347
# = -u * (z^T Q z/2 + a^T z + b)
348348
# So the dual of the quadratic constraint is `-u`, so that the contribution
349-
# to the lagrangian function of both the quadratic and RotatedSOC formulation
349+
# to the Lagrangian function of both the quadratic and RotatedSOC formulation
350350
# is exactly the same.
351351
function MOI.get(
352352
model::MOI.ModelLike,

src/Bridges/Constraint/bridges/set_dot_scaling.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ end
9393
# scalar product for the scaled PSD cone is `<x, y>_2 = x'y` but the scalar
9494
# product for the PSD cone additionally scales the offdiagonal entries by `2`
9595
# hence by `D^2` so `<x, y>_1 = x'D^2y`.
96-
# So `<Dx, y>_2 = <x, D^(-1)y>_1` hence the adjoint of `D` is its inverse!
96+
# So `<Dx, y>_2 = <x, D^(-1)y>_1` hence the adjoint of `D` is its inverse.
9797
function MOI.Bridges.adjoint_map_function(
9898
::Type{<:SetDotScalingBridge{T,S}},
9999
func,

src/Bridges/Constraint/bridges/slack.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ function MOI.set(
141141
# As the slack appears `+slack` in `slack_in_set` and `-slack` in equality,
142142
# giving `value` to both will cancel it out in the Lagrangian.
143143
# Giving `value` to `bridge.equality` will put the function in the
144-
# lagrangian as expected.
144+
# Lagrangian as expected.
145145
MOI.set(model, attr, bridge.slack_in_set, value)
146146
MOI.set(model, attr, bridge.equality, value)
147147
return

src/Bridges/Variable/bridges/rsoc_to_psd.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
``Y = \\left[\\begin{array}{c c}t & x^\\top \\\\ x & 2u \\mathbf{I}\\end{array}\\right].``
1515
1616
Additional bounds are added to ensure the off-diagonals of the ``2uI`` submatrix
17-
are `0`, and linear constraints are added to ennsure the diagonal of ``2uI``
17+
are `0`, and linear constraints are added to ensure the diagonal of ``2uI``
1818
takes the same values.
1919
2020
As a special case, if ``|x|| = 0``, then `RSOCtoPSDBridge` reformulates into
@@ -36,7 +36,7 @@ As a special case, if ``|x|| = 0``, then `RSOCtoPSDBridge` reformulates into
3636
* [`MOI.VectorOfVariables`](@ref) in
3737
[`MOI.PositiveSemidefiniteConeTriangle`](@ref) otherwise
3838
* The constraint node [`MOI.VariableIndex`](@ref) in [`MOI.EqualTo`](@ref)
39-
* The constrant node [`MOI.ScalarAffineFunction`](@ref) in [`MOI.EqualTo`](@ref)
39+
* The constant node [`MOI.ScalarAffineFunction`](@ref) in [`MOI.EqualTo`](@ref)
4040
"""
4141
struct RSOCtoPSDBridge{T} <: AbstractBridge
4242
variables::Vector{MOI.VariableIndex}

src/Bridges/Variable/bridges/vectorize.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ function MOI.set(
124124
bridge::VectorizeBridge,
125125
::MOI.Utilities.ScalarLinearSet,
126126
)
127-
# This would require modifing any constraint which uses the bridged
127+
# This would require modifying any constraint which uses the bridged
128128
# variable.
129129
return throw(
130130
MOI.SetAttributeNotAllowed(

src/Bridges/bridge.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ needs_final_touch(::AbstractBridge) = false
274274
final_touch(bridge::AbstractBridge, model::MOI.ModelLike)::Nothing
275275
276276
A function that is called immediately prior to [`MOI.optimize!`](@ref) to allow
277-
bridges to modify their reformulations with repsect to other variables and
277+
bridges to modify their reformulations with respect to other variables and
278278
constraints in `model`.
279279
280280
For example, if the correctness of `bridge` depends on the bounds of a variable

src/Bridges/bridge_optimizer.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2205,7 +2205,7 @@ function bridged_function(bridge::AbstractBridgeOptimizer, value)
22052205
end
22062206
# We assume that the type of `value` is not altered. This restricts
22072207
# variable bridges to only return `ScalarAffineFunction` but otherwise,
2208-
# the peformance would be bad.
2208+
# the performance would be bad.
22092209
return MOI.Utilities.substitute_variables(
22102210
vi -> bridged_variable_function(bridge, vi),
22112211
value,
@@ -2383,9 +2383,9 @@ function unbridged_constraint_function(
23832383
# Otherwise, first unbridge the function:
23842384
f = unbridged_function(b, func)::typeof(func)
23852385
# But now we have to deal with an issue. Something like x in [1, ∞) might
2386-
# get bridged into y in R₊, with x => y + 1, so if the orginal constraint is
2386+
# get bridged into y in R₊, with x => y + 1, so if the original constraint is
23872387
# 2x >= 1, the bridged function is 2y >= -1. Unbridging this with y = x - 1
2388-
# gives 2x - 2, but we only care about 2x! Where did the -2 come from? It
2388+
# gives 2x - 2, but we only care about 2x. Where did the -2 come from? It
23892389
# was moved into the set. This gets handled separately, so for
23902390
# ConstraintFunction it is sufficient to drop any non-zero constant terms.
23912391
#

src/FileFormats/CBF/write.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ function _add_function(
8484
f::MOI.VectorOfVariables,
8585
::Type{<:Union{MOI.ExponentialCone,MOI.DualExponentialCone}},
8686
)
87-
# The Exponential cone in MOI and CBF are reversed!
87+
# The Exponential cone in MOI and CBF are reversed
8888
for v in reverse(f.variables)
8989
data.num_rows += 1
9090
push!(data.acoord, (data.num_rows, v.value, 1.0))
@@ -97,7 +97,7 @@ function _add_function(
9797
f::MOI.VectorAffineFunction,
9898
::Type{<:Union{MOI.ExponentialCone,MOI.DualExponentialCone}},
9999
)
100-
# The Exponential cone in MOI and CBF are reversed!
100+
# The Exponential cone in MOI and CBF are reversed
101101
for term in f.terms
102102
t = term.scalar_term
103103
row = data.num_rows + 4 - term.output_index

src/FileFormats/LP/LP.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ end
401401

402402
# ==============================================================================
403403
#
404-
# Base.read!
404+
# `Base.read!`
405405
#
406406
# ==============================================================================
407407

@@ -541,7 +541,7 @@ function _get_term(token_types, token_values, offset)
541541
error("Invalid line")
542542
end
543543
if offset > length(token_types) || token_types[offset] == _TOKEN_SIGN
544-
return coef, offset # It's a standalone constant!
544+
return coef, offset # It's a standalone constant
545545
end
546546
if token_types[offset] == _TOKEN_QUADRATIC_OPEN
547547
return _get_term(token_types, token_values, offset + 1)
@@ -588,7 +588,7 @@ function _parse_function(
588588
else
589589
@assert token_type == _TOKEN_VARIABLE
590590
x = _get_variable_from_name(model, cache, token::String)
591-
# A cheat for type-stability. Store `Float64` of the variable index!
591+
# A cheat for type-stability. Store `Float64` of the variable index
592592
token_values[i] = Float64(x.value)
593593
end
594594
end

src/FileFormats/MOF/mof.schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1133,7 +1133,7 @@
11331133
}
11341134
}
11351135
}, {
1136-
"description": "The set `{(c, y, x) in Z^{1+1+d}}`, such that `c` is strictly greater than the number of occurances of `y` in `x` and `dimension = 1 + 1 + d`.",
1136+
"description": "The set `{(c, y, x) in Z^{1+1+d}}`, such that `c` is strictly greater than the number of occurences of `y` in `x` and `dimension = 1 + 1 + d`.",
11371137
"examples": ["{\"type\": \"CountGreaterThan\", \"dimension\": 3}"],
11381138
"required": ["dimension"],
11391139
"properties": {

src/FileFormats/MPS/MPS.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ function write_columns(io::IO, model::Model, flip_obj, ordered_names, names)
489489
int_open = false
490490
end
491491
if length(coefficients[variable]) == 0
492-
# Every variable must appear in the COLUMNS section! Add a 0
492+
# Every variable must appear in the COLUMNS section. Add a 0
493493
# objective coefficient instead.
494494
println(io, Card(f2 = variable, f3 = "OBJ", f4 = "0"))
495495
end
@@ -906,7 +906,7 @@ end
906906

907907
# ==============================================================================
908908
#
909-
# Base.read!
909+
# `Base.read!`
910910
#
911911
# Here is a template for an MPS file, reproduced from
912912
# http://lpsolve.sourceforge.net/5.5/mps-format.htm.
@@ -1024,7 +1024,7 @@ end
10241024
HEADER_INDICATORS,
10251025
)
10261026

1027-
# `Headers(s)` gets called _alot_ (on every line), so we try very hard to be
1027+
# `Headers` gets called _alot_ (on every line), so we try very hard to be
10281028
# efficient.
10291029
function Headers(s::AbstractString)
10301030
N = length(s)
@@ -1687,7 +1687,7 @@ function parse_qmatrix_line(data, items)
16871687
error("Malformed QMATRIX line: $(join(items, " "))")
16881688
end
16891689
if data.name_to_col[items[1]] <= data.name_to_col[items[2]]
1690-
# Off-diagonals have duplicate entries! We don't need to store both
1690+
# Off-diagonals have duplicate entries. We don't need to store both
16911691
# triangles.
16921692
push!(data.quad_obj, (items[1], items[2], parse(Float64, items[3])))
16931693
end
@@ -1703,7 +1703,7 @@ function parse_qcmatrix_line(data, items)
17031703
error("Malformed QCMATRIX line: $(join(items, " "))")
17041704
end
17051705
if data.name_to_col[items[1]] <= data.name_to_col[items[2]]
1706-
# Off-diagonals have duplicate entries! We don't need to store both
1706+
# Off-diagonals have duplicate entries. We don't need to store both
17071707
# triangles.
17081708
push!(
17091709
data.qc_matrix[data.current_qc_matrix],

src/FileFormats/NL/NL.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ function MOI.copy_to(dest::Model, model::MOI.ModelLike)
296296
end
297297
# Correct bounds of binary variables. Mainly because AMPL doesn't have the
298298
# concept of binary nonlinear variables, but it does have binary linear
299-
# variables! How annoying.
299+
# variables. How annoying.
300300
for (_, v) in dest.x
301301
if v.type == _BINARY
302302
v.lower = max(0.0, v.lower)

src/FileFormats/NL/NLExpr.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ function _process_expr!(expr::_NLExpr, arg::MOI.VariableIndex)
384384
return push!(expr.nonlinear_terms, arg)
385385
end
386386

387-
# TODO(odow): these process_expr! functions use recursion. For large models,
387+
# TODO(odow): these functions use recursion. For large models,
388388
# this may exceed the stack. At some point, we may have to rewrite this to not
389389
# use recursion.
390390
function _process_expr!(expr::_NLExpr, arg::Expr)
@@ -443,7 +443,7 @@ function _process_expr!(expr::_NLExpr, args::Vector{Any})
443443
if op == :+
444444
if N == 1 # +x, so we can just drop the op and process the args.
445445
return _process_expr!(expr, args[2])
446-
elseif N > 2 # nary-addition!
446+
elseif N > 2 # nary-addition
447447
op = :sum
448448
end
449449
elseif op == :- && N == 1
@@ -458,7 +458,7 @@ function _process_expr!(expr::_NLExpr, args::Vector{Any})
458458
N = length(args) - 1
459459
end
460460
elseif op == :* && N == 1
461-
# Unary multiplication! We can drop the op and process the args.
461+
# unary multiplication: we can drop the op and process the args.
462462
return _process_expr!(expr, args[2])
463463
end
464464
# Now convert the Julia expression into an _NLExpr.

src/FileFormats/SDPA/SDPA.jl

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

281281
# ==============================================================================
282282
#
283-
# Base.read!
283+
# `Base.read!`
284284
#
285285
# ==============================================================================
286286

src/FileFormats/utils.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ function create_unique_constraint_names(
8888
replacements,
8989
)
9090
if new_name in added_names
91-
# We found a duplicate name! We could just append a string like
91+
# We found a duplicate name. We could just append a string like
9292
# "_", but we're going to be clever and loop through the
9393
# integers to name them appropriately. Thus, if we have three
9494
# constraints named c, we'll end up with variables named c, c_1,
@@ -145,7 +145,7 @@ function create_unique_variable_names(
145145
replacements,
146146
)
147147
if new_name in added_names
148-
# We found a duplicate name! We could just append a string like "_",
148+
# We found a duplicate name. We could just append a string like "_",
149149
# but we're going to be clever and loop through the integers to name
150150
# them appropriately. Thus, if we have three variables named x,
151151
# we'll end up with variables named x, x_1, and x_2.

src/Nonlinear/ReverseAD/forward_over_reverse.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ function _forward_eval_ϵ(
232232
@inbounds partial = ex.partials_storage[ix]
233233
@inbounds storage_val = storage_ϵ[ix]
234234
# TODO: This "if" statement can take 8% of the hessian
235-
# evaluation time! Find a more efficient way.
235+
# evaluation time. Find a more efficient way.
236236
if !isfinite(partial) && storage_val == zero_ϵ
237237
continue
238238
end

src/Nonlinear/ReverseAD/graph_tools.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
moi_index_to_consecutive_index::Dict{MOI.VariableIndex,Int},
1111
)
1212
13-
Return a new `Vector{Nonlinear.Node}` where all occurances of
13+
Return a new `Vector{Nonlinear.Node}` where all occurences of
1414
`NODE_MOI_VARIABLE` are replaced by `NODE_VARIABLE` that is 1-indexed and
1515
ordered.
1616
"""
@@ -356,7 +356,7 @@ end
356356
Vector{Vector{Int}}(undef, length(subexpressions)),
357357
)
358358
359-
Return a topologically sorted list of the integer subexpresssion indices that
359+
Return a topologically sorted list of the integer subexpression indices that
360360
need to be computed to evaluate `subexpressions[s]` for all `s in starts`.
361361
362362
`starts` should be ordered, and not contain duplicates.
@@ -369,14 +369,14 @@ If calling `_topological_sort` a single time, you may omit the
369369
`subexpression_dependency_graph` argument.
370370
371371
However, if calling `_topological_sort` multiple times on the _same_ vector of
372-
subexpresssions, you should create `subexpression_dependency_graph` once (either
372+
subexpressions, you should create `subexpression_dependency_graph` once (either
373373
as the uninitialized vector, or by explicitly computing the full
374374
`subexpression_dependency_graph`), and pass it in.
375375
376376
## Notes
377377
378378
* It is important to not use recursion here, because expressions may have
379-
arbitrary levels of nesting!
379+
arbitrary levels of nesting.
380380
* This function assumes `subexpressions` is acyclic.
381381
"""
382382
function _topological_sort(
@@ -441,7 +441,7 @@ Returns two things:
441441
subexpression-indices that need to be evaluated to compute
442442
`main_expressions[i]`.
443443
444-
**Warning:** This doesn't handle cyclic expressions! But this should be fine
444+
**Warning:** This doesn't handle cyclic expressions. But this should be fine
445445
because we can't compute them in JuMP anyway.
446446
"""
447447
function _order_subexpressions(

0 commit comments

Comments
 (0)