diff --git a/docs/src/background/duality.md b/docs/src/background/duality.md index 1042e2b5eb..c60f12d600 100644 --- a/docs/src/background/duality.md +++ b/docs/src/background/duality.md @@ -257,7 +257,7 @@ Second, let us see why ``\mathcal{D}_+^{*} = \mathcal{P}_+``. Since ``A \in \mathcal{D}_+`` implies that ``A^\top \in \mathcal{D}_+``, ``B \in \mathcal{D}_+^{*}`` means that ``\langle A+A^\top,B\rangle \ge 0`` -for all ``A \in \mathcal{D}_+``, and hence ``B \in \\mathcal{P}_+``. +for all ``A \in \mathcal{D}_+``, and hence ``B \in \mathcal{P}_+``. To see why it should be symmetric, simply notice that if ``B_{i,j} < B_{j,i}``, then ``\langle A,B\rangle`` can be made arbitrarily small by setting diff --git a/docs/src/background/infeasibility_certificates.md b/docs/src/background/infeasibility_certificates.md index e2c3efa7ad..6f24ed326d 100644 --- a/docs/src/background/infeasibility_certificates.md +++ b/docs/src/background/infeasibility_certificates.md @@ -151,8 +151,8 @@ the primal certificate of the variable bounds can be computed using the primal certificate associated with the affine constraints, ``d``. (Note that ``d`` will have one element for each row of the ``A`` matrix, and that some or all of the elements in the vectors ``l_A`` and ``u_A`` may be ``\pm \infty``. If both -``l_A`` and ``u_A`` are finite for some row, the corresponding element in ``d` - must be `0`.) +``l_A`` and ``u_A`` are finite for some row, the corresponding element in ``d`` +must be `0`.) Given ``d``, compute ``\bar{d} = d^\top A``. If the bound is finite, a certificate for the lower variable bound of ``x_i`` is ``\max\{\bar{d}_i, 0\}``, diff --git a/docs/src/developer/checklists.md b/docs/src/developer/checklists.md index a91eef8fc0..2e4f2fade9 100644 --- a/docs/src/developer/checklists.md +++ b/docs/src/developer/checklists.md @@ -51,7 +51,7 @@ Use this checklist when adding a new set to the MathOptInterface repository. `LinearAlgebra.dot` - [ ] If an `AbstractVectorSet`, implement `Utilities.set_with_dimension` in `src/Utilities/matrix_of_constraints.jl` - - [ ] Add the set to the `@model` macro at the bottom of `src/Utilities.model.jl` + - [ ] Add the set to the `@model` macro at the bottom of `src/Utilities/model.jl` ## Documentation @@ -142,7 +142,7 @@ Use this checklist when updating the version of MathOptFormat. - [ ] `set_to_moi` is defined for each set in `src/FileFormats/MOF/read.jl` - [ ] `head_name` is defined for each set in `src/FileFormats/MOF/write.jl` - [ ] A new unit test calling `_test_model_equality` is added to - `test/FileFormats/MOF/MOF.jl` + `test/FileFormats/MOF/test_MOF.jl` ## Tests diff --git a/docs/src/developer/contributing.md b/docs/src/developer/contributing.md index 6ce105ed98..3ab4005c84 100644 --- a/docs/src/developer/contributing.md +++ b/docs/src/developer/contributing.md @@ -94,17 +94,17 @@ example: ```julia julia> using Revise -julia> include("test/Nonlinear/runtests.jl") +julia> include("test/Nonlinear/test_Nonlinear.jl") julia> # make changes to `src/Nonlinear` -julia> include("test/Nonlinear/runtests.jl") +julia> include("test/Nonlinear/test_Nonlinear.jl") ``` -You can also run other tests such as `test/Bridges/Constraint/runtests.jl`, or -any individual file, such as `test/Utilities/distance_to_set.jl`. +You can also run other tests such as `test/Bridges/Constraint/test_bridge.jl`, +or `test/Utilities/test_distance_to_set.jl`. There is one complication: `JSONSchema` is a test-time dependency that is not -present in the default project. If you want to run `test/FileFormats/MOF/MOF.jl`, +present in the default project. If you want to run `test/FileFormats/MOF/test_MOF.jl`, you will first need to install the package (`Pkg.test("MathOptInterface")` does this automatically): ```julia diff --git a/docs/src/manual/solutions.md b/docs/src/manual/solutions.md index 24dc0ec1f6..409f5ace79 100644 --- a/docs/src/manual/solutions.md +++ b/docs/src/manual/solutions.md @@ -135,7 +135,7 @@ non-global tree search solvers like Some solvers will not implement every solution attribute. Therefore, a call like `MOI.get(model, MOI.SolveTimeSec())` may throw an [`UnsupportedAttribute`](@ref) -error. +or [`GetAttributeNotAllowed`](@ref) error. If you need to write code that is agnostic to the solver (for example, you are writing a library that an end-user passes their choice of solver to), you can @@ -145,7 +145,7 @@ function get_solve_time(model) try return MOI.get(model, MOI.SolveTimeSec()) catch err - if err isa MOI.UnsupportedAttribute + if err isa Union{MOI.UnsupportedAttribute,MOI.GetAttributeNotAllowed} return NaN # Solver doesn't support. Return a placeholder value. end rethrow(err) # Something else went wrong. Rethrow the error @@ -170,7 +170,7 @@ function get_solve_time(model::CachedSolveTime) try return MOI.get(model, MOI.SolveTimeSec()) catch err - if err isa MOI.UnsupportedAttribute + if Union{MOI.UnsupportedAttribute,MOI.GetAttributeNotAllowed} model.supports_solve_time = false return NaN end diff --git a/src/Utilities/parser.jl b/src/Utilities/parser.jl index 4898c996e7..a678eaf1f0 100644 --- a/src/Utilities/parser.jl +++ b/src/Utilities/parser.jl @@ -131,7 +131,7 @@ function _parse_function(ex, ::Type{T} = Float64) where {T} "Unsupported operator in `loadfromstring!`: `$(ex.args[1])`. " * "The parser is deliberately limited in the syntax it " * "accepts. Write `x - y` as `x + -1 * y`, and `x^2` as " * - "`x * x`.", + "`1 * x * x`.", ) end affine_terms = _ParsedScalarAffineTerm{T}[] @@ -367,7 +367,7 @@ Do not name `VariableIndex` constraints. ## Exceptions * `x - y` does NOT currently parse. Instead, write `x + -1.0 * y`. - * `x^2` does NOT currently parse. Instead, write `x * x`. + * `x^2` does NOT currently parse. Instead, write `1 * x * x`. """ function loadfromstring!(model, s) for string_line in split(s, "\n") diff --git a/src/attributes.jl b/src/attributes.jl index e19649cf7f..398bab4edb 100644 --- a/src/attributes.jl +++ b/src/attributes.jl @@ -1988,7 +1988,7 @@ Optimizers should implement the following methods: MOI.get( ::Optimizer, ::MOI.ListOfVariablesWithAttributeSet{<:MOI.AbstractVariableAttribute}, -)::Vector{MOI.VarialbeIndex} +)::Vector{MOI.VariableIndex} ``` They should not implement [`set`](@ref) or [`supports`](@ref). """ @@ -2274,7 +2274,7 @@ Two constraints may have the same name; however, constraints with duplicate names cannot be looked up using [`get`](@ref), regardless of whether they have the same `F`-in-`S` type. -## VariableIndex connstraints +## VariableIndex constraints You should _not_ implement [`ConstraintName`](@ref) for [`VariableIndex`](@ref) constraints. diff --git a/test/Utilities/test_parser.jl b/test/Utilities/test_parser.jl index 4f4c4dacdf..a52030e324 100644 --- a/test/Utilities/test_parser.jl +++ b/test/Utilities/test_parser.jl @@ -63,7 +63,7 @@ function test__parse_function() "Unsupported operator in `loadfromstring!`: `-`. " * "The parser is deliberately limited in the syntax it " * "accepts. Write `x - y` as `x + -1 * y`, and `x^2` as " * - "`x * x`.", + "`1 * x * x`.", ) @test_throws err MOIU._parse_function(:(x - y))