From 63fa08b27bdf3b2856b5dbab2cfc01ca44a895ff Mon Sep 17 00:00:00 2001 From: odow Date: Thu, 1 May 2025 19:53:57 +1200 Subject: [PATCH] Add import MathOptInterface as MOI to DocTestSetup --- docs/make.jl | 7 ++ src/Benchmarks/Benchmarks.jl | 4 - src/Bridges/Bridges.jl | 6 +- src/Bridges/Constraint/bridge.jl | 2 +- .../Constraint/single_bridge_optimizer.jl | 2 +- .../Objective/single_bridge_optimizer.jl | 2 +- src/Bridges/Variable/bridge.jl | 4 +- .../Variable/single_bridge_optimizer.jl | 2 +- src/Bridges/bridge.jl | 8 +- src/Bridges/lazy_bridge_optimizer.jl | 2 +- src/Nonlinear/ReverseAD/utils.jl | 2 - src/Nonlinear/SymbolicAD/SymbolicAD.jl | 8 -- src/Nonlinear/evaluator.jl | 2 - src/Nonlinear/model.jl | 10 -- src/Nonlinear/operators.jl | 12 -- src/Test/Test.jl | 2 - src/Utilities/functions.jl | 6 - src/Utilities/model.jl | 2 - src/Utilities/parser.jl | 2 +- src/Utilities/penalty_relaxation.jl | 6 +- src/Utilities/product_of_sets.jl | 4 - src/Utilities/set_dot.jl | 2 - src/Utilities/sets.jl | 4 - src/attributes.jl | 18 --- src/constraints.jl | 4 - src/functions.jl | 24 ---- src/modifications.jl | 8 -- src/nlp.jl | 52 --------- src/sets.jl | 108 ------------------ src/variables.jl | 6 - 30 files changed, 24 insertions(+), 297 deletions(-) diff --git a/docs/make.jl b/docs/make.jl index 644a5fb389..83a82dd7b6 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -123,6 +123,13 @@ end # link checking. Inn production we replace this by running the LaTeX build. write(joinpath(@__DIR__, "src", "MathOptInterface.pdf"), "") +Documenter.DocMeta.setdocmeta!( + MathOptInterface, + :DocTestSetup, + :(import MathOptInterface as MOI); + recursive = true, +) + @time Documenter.makedocs( sitename = "MathOptInterface", authors = "The JuMP core developers and contributors", diff --git a/src/Benchmarks/Benchmarks.jl b/src/Benchmarks/Benchmarks.jl index a711b8f262..73aaf9d947 100644 --- a/src/Benchmarks/Benchmarks.jl +++ b/src/Benchmarks/Benchmarks.jl @@ -53,8 +53,6 @@ Extra `kwargs` are based to `BenchmarkTools.run`. ## Example ```julia -julia> import MathOptInterface as MOI - julia> import GLPK julia> my_suite = MOI.Benchmarks.suite(() -> GLPK.Optimizer()); @@ -100,8 +98,6 @@ Extra `kwargs` are based to `BenchmarkTools.run`. ## Example ```julia -julia> import MathOptInterface as MOI - julia> import GLPK julia> my_suite = MOI.Benchmarks.suite(() -> GLPK.Optimizer()); diff --git a/src/Bridges/Bridges.jl b/src/Bridges/Bridges.jl index 2ef7a9d970..b3b963a9f6 100644 --- a/src/Bridges/Bridges.jl +++ b/src/Bridges/Bridges.jl @@ -41,7 +41,7 @@ coefficient type `T`, as well as the bridges in the list returned by the ## Example -```jldoctest; setup=:(import MathOptInterface as MOI) +```jldoctest julia> model = MOI.Utilities.Model{Float64}(); julia> bridged_model = MOI.Bridges.full_bridge_optimizer(model, Float64); @@ -273,7 +273,7 @@ and [`MOI.ConstraintPrimalStart`](@ref) to throw [`MOI.GetAttributeNotAllowed`]( ## Example -```jldoctest; setup=:(import MathOptInterface as MOI), filter=r"[0-9.]+s" +```jldoctest; filter=r"[0-9.]+s" julia> MOI.Bridges.runtests( MOI.Bridges.Constraint.ZeroOneBridge, model -> MOI.add_constrained_variable(model, MOI.ZeroOne()), @@ -423,7 +423,7 @@ Run a series of tests that check the correctness of `Bridge`. ## Example -```jldoctest; setup=:(import MathOptInterface as MOI), filter=r"[0-9.]+s" +```jldoctest; filter=r"[0-9.]+s" julia> MOI.Bridges.runtests( MOI.Bridges.Constraint.ZeroOneBridge, \"\"\" diff --git a/src/Bridges/Constraint/bridge.jl b/src/Bridges/Constraint/bridge.jl index 300645a0ca..0320db5e1f 100644 --- a/src/Bridges/Constraint/bridge.jl +++ b/src/Bridges/Constraint/bridge.jl @@ -61,7 +61,7 @@ The [`SplitIntervalBridge`](@ref) bridges a [`MOI.VariableIndex`](@ref)-in-[`MOI constraint into a [`MOI.VariableIndex`](@ref)-in-[`MOI.GreaterThan`](@ref) and a [`MOI.VariableIndex`](@ref)-in-[`MOI.LessThan`](@ref) constraint. -```jldoctest; setup=:(import MathOptInterface as MOI) +```jldoctest julia> MOI.Bridges.Constraint.concrete_bridge_type( MOI.Bridges.Constraint.SplitIntervalBridge{Float64}, MOI.VariableIndex, diff --git a/src/Bridges/Constraint/single_bridge_optimizer.jl b/src/Bridges/Constraint/single_bridge_optimizer.jl index f388c68f6d..5839ac7c1a 100644 --- a/src/Bridges/Constraint/single_bridge_optimizer.jl +++ b/src/Bridges/Constraint/single_bridge_optimizer.jl @@ -16,7 +16,7 @@ and unsupported by `model`. ## Example -```jldoctest con_singlebridgeoptimizer; setup=:(import MathOptInterface as MOI) +```jldoctest con_singlebridgeoptimizer julia> struct MyNewBridge{T} <: MOI.Bridges.Constraint.AbstractBridge end julia> bridge = MOI.Bridges.Constraint.SingleBridgeOptimizer{MyNewBridge{Float64}}( diff --git a/src/Bridges/Objective/single_bridge_optimizer.jl b/src/Bridges/Objective/single_bridge_optimizer.jl index 8f93e44efc..bd6be6bde2 100644 --- a/src/Bridges/Objective/single_bridge_optimizer.jl +++ b/src/Bridges/Objective/single_bridge_optimizer.jl @@ -16,7 +16,7 @@ and unsupported by `model`. ## Example -```jldoctest obj_singlebridgeoptimizer; setup=:(import MathOptInterface as MOI) +```jldoctest obj_singlebridgeoptimizer julia> struct MyNewBridge{T} <: MOI.Bridges.Objective.AbstractBridge end julia> bridge = MOI.Bridges.Objective.SingleBridgeOptimizer{MyNewBridge{Float64}}( diff --git a/src/Bridges/Variable/bridge.jl b/src/Bridges/Variable/bridge.jl index 30990e536c..6125dac6ac 100644 --- a/src/Bridges/Variable/bridge.jl +++ b/src/Bridges/Variable/bridge.jl @@ -39,7 +39,7 @@ solver. ## Example -```jldoctest; setup=(import MathOptInterface as MOI) +```jldoctest julia> MOI.Bridges.Variable.supports_constrained_variable( MOI.Bridges.Variable.NonposToNonnegBridge{Float64}, MOI.Nonpositives, @@ -78,8 +78,6 @@ variables in [`MOI.Nonnegatives`](@ref) by the [`VectorizeBridge`](@ref): ```jldoctest -julia> import MathOptInterface as MOI - julia> MOI.Bridges.Variable.concrete_bridge_type( MOI.Bridges.Variable.VectorizeBridge{Float64}, MOI.GreaterThan{Float64}, diff --git a/src/Bridges/Variable/single_bridge_optimizer.jl b/src/Bridges/Variable/single_bridge_optimizer.jl index 6b0b2b77c3..3b7ca9a022 100644 --- a/src/Bridges/Variable/single_bridge_optimizer.jl +++ b/src/Bridges/Variable/single_bridge_optimizer.jl @@ -21,7 +21,7 @@ by the bridge `BT` and unsupported by `model`. ## Example -```jldoctest var_singlebridgeoptimizer; setup=:(import MathOptInterface as MOI) +```jldoctest var_singlebridgeoptimizer julia> struct MyNewBridge{T} <: MOI.Bridges.Variable.AbstractBridge end julia> bridge = MOI.Bridges.Variable.SingleBridgeOptimizer{MyNewBridge{Float64}}( diff --git a/src/Bridges/bridge.jl b/src/Bridges/bridge.jl index f3748db176..1951d60635 100644 --- a/src/Bridges/bridge.jl +++ b/src/Bridges/bridge.jl @@ -203,7 +203,7 @@ type `BT` add. ## Example -```jldoctest; setup=(import MathOptInterface as MOI) +```jldoctest julia> MOI.Bridges.added_constrained_variable_types( MOI.Bridges.Variable.NonposToNonnegBridge{Float64}, ) @@ -229,7 +229,7 @@ add. ## Example -```jldoctest; setup=(import MathOptInterface as MOI) +```jldoctest julia> MOI.Bridges.added_constraint_types( MOI.Bridges.Constraint.ZeroOneBridge{Float64}, ) @@ -254,7 +254,7 @@ set. ## Example -```jldoctest; setup=(import MathOptInterface as MOI) +```jldoctest julia> MOI.Bridges.set_objective_function_type( MOI.Bridges.Objective.FunctionizeBridge{Float64}, ) @@ -311,7 +311,7 @@ constraint. For this reason, the [`Bridges.Constraint.FunctionConversionBridge`](@ref) is given a cost of `10`: -```jldoctest; setup=(import MathOptInterface as MOI) +```jldoctest julia> F = MOI.ScalarQuadraticFunction{Float64}; julia> G = MOI.ScalarAffineFunction{Float64}; diff --git a/src/Bridges/lazy_bridge_optimizer.jl b/src/Bridges/lazy_bridge_optimizer.jl index 3804e5523c..cc4387467f 100644 --- a/src/Bridges/lazy_bridge_optimizer.jl +++ b/src/Bridges/lazy_bridge_optimizer.jl @@ -24,7 +24,7 @@ and [`full_bridge_optimizer`](@ref). ## Example -```jldoctest; setup=:(import MathOptInterface as MOI) +```jldoctest julia> model = MOI.Bridges.LazyBridgeOptimizer(MOI.Utilities.Model{Float64}()); julia> MOI.Bridges.add_bridge(model, MOI.Bridges.Variable.FreeBridge{Float64}) diff --git a/src/Nonlinear/ReverseAD/utils.jl b/src/Nonlinear/ReverseAD/utils.jl index 1b92fcd33b..6b2a7bd325 100644 --- a/src/Nonlinear/ReverseAD/utils.jl +++ b/src/Nonlinear/ReverseAD/utils.jl @@ -182,8 +182,6 @@ end. ## Examples ```jldoctest -julia> import MathOptInterface as MOI - julia> x = [(1, 2, 3), (4, 5, 6), (7, 8, 9)] 3-element Vector{Tuple{Int64, Int64, Int64}}: (1, 2, 3) diff --git a/src/Nonlinear/SymbolicAD/SymbolicAD.jl b/src/Nonlinear/SymbolicAD/SymbolicAD.jl index c68ff58cc0..b1c4c8573e 100644 --- a/src/Nonlinear/SymbolicAD/SymbolicAD.jl +++ b/src/Nonlinear/SymbolicAD/SymbolicAD.jl @@ -22,8 +22,6 @@ Return a simplified copy of the function `f`. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> x = MOI.VariableIndex(1) MOI.VariableIndex(1) @@ -52,8 +50,6 @@ new object if `f` can be represented in a simpler type. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> x = MOI.VariableIndex(1) MOI.VariableIndex(1) @@ -356,8 +352,6 @@ Return a sorted list of the `MOI.VariableIndex` present in the function `f`. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> x = MOI.VariableIndex.(1:3) 3-element Vector{MathOptInterface.VariableIndex}: MOI.VariableIndex(1) @@ -463,8 +457,6 @@ simplified expression of the derivative. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> x = MOI.VariableIndex(1) MOI.VariableIndex(1) diff --git a/src/Nonlinear/evaluator.jl b/src/Nonlinear/evaluator.jl index 17416208ce..9c1d083238 100644 --- a/src/Nonlinear/evaluator.jl +++ b/src/Nonlinear/evaluator.jl @@ -16,8 +16,6 @@ Return the 1-indexed value of the constraint index `c` in `evaluator`. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Nonlinear.Model() A Nonlinear.Model with: 0 objectives diff --git a/src/Nonlinear/model.jl b/src/Nonlinear/model.jl index cd68929788..b570a0dcc3 100644 --- a/src/Nonlinear/model.jl +++ b/src/Nonlinear/model.jl @@ -50,8 +50,6 @@ To remove the objective, pass `nothing`. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Nonlinear.Model() A Nonlinear.Model with: 0 objectives @@ -90,8 +88,6 @@ Parse `expr` into a [`Expression`](@ref) and add to `model`. Returns an ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Nonlinear.Model(); julia> x = MOI.VariableIndex(1); @@ -130,8 +126,6 @@ solution information. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Nonlinear.Model(); julia> x = MOI.VariableIndex(1); @@ -165,8 +159,6 @@ Delete the constraint index `c` from `model`. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Nonlinear.Model() A Nonlinear.Model with: 0 objectives @@ -220,8 +212,6 @@ and used to modify the value of the parameter. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Nonlinear.Model() A Nonlinear.Model with: 0 objectives diff --git a/src/Nonlinear/operators.jl b/src/Nonlinear/operators.jl index c4b53de468..857f873133 100644 --- a/src/Nonlinear/operators.jl +++ b/src/Nonlinear/operators.jl @@ -105,8 +105,6 @@ The list of univariate operators that are supported by default. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> MOI.Nonlinear.DEFAULT_UNIVARIATE_OPERATORS 73-element Vector{Symbol}: :+ @@ -141,8 +139,6 @@ The list of multivariate operators that are supported by default. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> MOI.Nonlinear.DEFAULT_MULTIVARIATE_OPERATORS 9-element Vector{Symbol}: :+ @@ -550,8 +546,6 @@ If `op isa Integer`, then `op` is the index in ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> r = MOI.Nonlinear.OperatorRegistry(); julia> MOI.Nonlinear.eval_univariate_function(r, :abs, -1.2) @@ -603,8 +597,6 @@ If `op isa Integer`, then `op` is the index in ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> r = MOI.Nonlinear.OperatorRegistry(); julia> MOI.Nonlinear.eval_univariate_gradient(r, :abs, -1.2) @@ -656,8 +648,6 @@ If `op isa Integer`, then `op` is the index in ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> r = MOI.Nonlinear.OperatorRegistry(); julia> MOI.Nonlinear.eval_univariate_function_and_gradient(r, :abs, -1.2) @@ -708,8 +698,6 @@ If `op isa Integer`, then `op` is the index in ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> r = MOI.Nonlinear.OperatorRegistry(); julia> MOI.Nonlinear.eval_univariate_hessian(r, :sin, 1.0) diff --git a/src/Test/Test.jl b/src/Test/Test.jl index 00f0f9be0b..3332e3cc3c 100644 --- a/src/Test/Test.jl +++ b/src/Test/Test.jl @@ -78,8 +78,6 @@ For a nonlinear solver that finds local optima and does not support finding dual variables or constraint names: ```jldoctest -julia> import MathOptInterface as MOI - julia> config = MOI.Test.Config( Float64; optimal_status = MOI.LOCALLY_SOLVED, diff --git a/src/Utilities/functions.jl b/src/Utilities/functions.jl index f5483f8b83..5826319ec4 100644 --- a/src/Utilities/functions.jl +++ b/src/Utilities/functions.jl @@ -1034,8 +1034,6 @@ The output of `canonical` can be assumed to be a copy of `f`, even for ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> x, y, z = MOI.VariableIndex.(1:3); julia> f = MOI.ScalarAffineFunction( @@ -1165,8 +1163,6 @@ want to first call [`canonical`](@ref) if that is not guaranteed. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> x = MOI.VariableIndex(1) MOI.VariableIndex(1) @@ -2557,8 +2553,6 @@ complex-valued). ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> MOI.Utilities.is_complex(MOI.VariableIndex) false diff --git a/src/Utilities/model.jl b/src/Utilities/model.jl index 303b77a890..5b6230010c 100644 --- a/src/Utilities/model.jl +++ b/src/Utilities/model.jl @@ -859,8 +859,6 @@ in MOI. It is parameterized by the coefficient type. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}() MOIU.Model{Float64} ├ ObjectiveSense: FEASIBILITY_SENSE diff --git a/src/Utilities/parser.jl b/src/Utilities/parser.jl index 47e8f672ac..4898c996e7 100644 --- a/src/Utilities/parser.jl +++ b/src/Utilities/parser.jl @@ -337,7 +337,7 @@ A utility function to aid writing tests. ## Example -```jldoctest; setup=:(import MathOptInterface as MOI) +```jldoctest julia> model = MOI.Utilities.Model{Float64}(); julia> MOI.Utilities.loadfromstring!(model, \"\"\" diff --git a/src/Utilities/penalty_relaxation.jl b/src/Utilities/penalty_relaxation.jl index dd51c88c63..3521cc3cce 100644 --- a/src/Utilities/penalty_relaxation.jl +++ b/src/Utilities/penalty_relaxation.jl @@ -34,7 +34,7 @@ this function to compute the violation of the constraint. ## Example -```jldoctest; setup=:(import MathOptInterface as MOI) +```jldoctest julia> model = MOI.Utilities.Model{Float64}(); julia> x = MOI.add_variable(model); @@ -189,7 +189,7 @@ To modify variable bounds, rewrite them as linear constraints. ## Example -```jldoctest; setup=:(import MathOptInterface as MOI) +```jldoctest julia> model = MOI.Utilities.Model{Float64}(); julia> x = MOI.add_variable(model); @@ -214,7 +214,7 @@ julia> map[c] isa MOI.ScalarAffineFunction{Float64} true ``` -```jldoctest; setup=:(import MathOptInterface as MOI) +```jldoctest julia> model = MOI.Utilities.Model{Float64}(); julia> x = MOI.add_variable(model); diff --git a/src/Utilities/product_of_sets.jl b/src/Utilities/product_of_sets.jl index 48de49cc7e..0b951d201c 100644 --- a/src/Utilities/product_of_sets.jl +++ b/src/Utilities/product_of_sets.jl @@ -56,8 +56,6 @@ Generate a new [`MixOfScalarSets`](@ref) subtype. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> MOI.Utilities.@mix_of_scalar_sets( MixedIntegerLinearProgramSets, MOI.GreaterThan{T}, @@ -156,8 +154,6 @@ Generate a new [`OrderedProductOfSets`](@ref) subtype. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> MOI.Utilities.@product_of_sets( LinearOrthants, MOI.Zeros, diff --git a/src/Utilities/set_dot.jl b/src/Utilities/set_dot.jl index 31378da1fe..91bf0d11fd 100644 --- a/src/Utilities/set_dot.jl +++ b/src/Utilities/set_dot.jl @@ -251,8 +251,6 @@ Combined with `LinearAlgebra`, this vector can be used to scale a [`MOI.AbstractVectorFunction`](@ref). ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> x = MOI.add_variables(model, 3); diff --git a/src/Utilities/sets.jl b/src/Utilities/sets.jl index 5e5907a2a3..09343ba3da 100644 --- a/src/Utilities/sets.jl +++ b/src/Utilities/sets.jl @@ -29,8 +29,6 @@ Only define this function if it makes sense and you have implemented ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> set = MOI.Interval(-2.0, 3.0) MathOptInterface.Interval{Float64}(-2.0, 3.0) @@ -53,8 +51,6 @@ See also [`shift_constant`](@ref). ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> MOI.Utilities.supports_shift_constant(MOI.Interval{Float64}) true diff --git a/src/attributes.jl b/src/attributes.jl index 6d5d4392da..6bc6ec2845 100644 --- a/src/attributes.jl +++ b/src/attributes.jl @@ -1561,8 +1561,6 @@ They should not implement [`set`](@ref) or [`supports`](@ref). ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> x = MOI.add_variable(model) @@ -1919,8 +1917,6 @@ cannot be looked up using [`get`](@ref). ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> x = MOI.add_variable(model); @@ -1961,8 +1957,6 @@ May be a number or `nothing` (unset). ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.UniversalFallback(MOI.Utilities.Model{Float64}()); julia> x = MOI.add_variable(model); @@ -2187,8 +2181,6 @@ constraints. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> x = MOI.add_variable(model); @@ -2447,8 +2439,6 @@ then it returns the function stored internally instead of a copy. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> x = MOI.add_variable(model); @@ -2507,8 +2497,6 @@ provided by the user. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> x = MOI.add_variable(model); @@ -2590,8 +2578,6 @@ used to define the constraint. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> x = MOI.add_variable(model); @@ -2739,8 +2725,6 @@ have the form: ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> f(x, y) = x^2 + y^2 f (generic function with 1 method) @@ -3227,8 +3211,6 @@ call to [`optimize!`](@ref) is undefined and depends on solver-specific behavior ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> MOI.is_set_by_optimize(MOI.ObjectiveValue()) true diff --git a/src/constraints.jl b/src/constraints.jl index 28529f0e1c..081b4235d2 100644 --- a/src/constraints.jl +++ b/src/constraints.jl @@ -34,8 +34,6 @@ An error indicating that constraints of type `F`-in-`S` are not supported by the model, that is, that [`supports_constraint`](@ref) returns `false`. ```jldoctest -julia> import MathOptInterface as MOI - julia> showerror(stdout, MOI.UnsupportedConstraint{MOI.VariableIndex,MOI.ZeroOne}()) UnsupportedConstraint: `MathOptInterface.VariableIndex`-in-`MathOptInterface.ZeroOne` constraints are not supported by the solver you have chosen, and we could not reformulate your model into a @@ -338,8 +336,6 @@ Typically, the user should delete the constraint and add a new one. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> x = MOI.add_variable(model); diff --git a/src/functions.jl b/src/functions.jl index b6193e0192..c1a5c36b53 100644 --- a/src/functions.jl +++ b/src/functions.jl @@ -78,8 +78,6 @@ Represents the scalar-valued term `coefficient * variable`. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> x = MOI.VariableIndex(1) MOI.VariableIndex(1) @@ -126,8 +124,6 @@ coefficients are summed together. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> x = MOI.VariableIndex(1) MOI.VariableIndex(1) @@ -168,8 +164,6 @@ Represents the scalar-valued term ``c x_i x_j`` where ``c`` is `coefficient`, ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> x = MOI.VariableIndex(1) MOI.VariableIndex(1) @@ -242,8 +236,6 @@ As a rule, to represent ``a * x^2 + b * x * y``: To represent the function ``f(x, y) = 2 * x^2 + 3 * x * y + 4 * x + 5``, do: ```jldoctest -julia> import MathOptInterface as MOI - julia> x = MOI.VariableIndex(1); julia> y = MOI.VariableIndex(2); @@ -333,8 +325,6 @@ when the function is first added to the model, or it may be thrown when To represent the function ``f(x) = sin(x)^2``, do: ```jldoctest -julia> import MathOptInterface as MOI - julia> x = MOI.VariableIndex(1) MOI.VariableIndex(1) @@ -397,8 +387,6 @@ An error thrown by optimizers if they do not support the operator `head` in a ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> throw(MOI.UnsupportedNonlinearOperator(:black_box)) ERROR: MathOptInterface.UnsupportedNonlinearOperator: The nonlinear operator `:black_box` is not supported by the model. Stacktrace: @@ -442,8 +430,6 @@ The list of `variables` may contain duplicates. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> x = MOI.VariableIndex.(1:2) 2-element Vector{MathOptInterface.VariableIndex}: MOI.VariableIndex(1) @@ -491,8 +477,6 @@ of the vector-valued [`VectorAffineFunction`](@ref) or ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> x = MOI.VariableIndex(1); julia> MOI.VectorAffineTerm(Int64(2), MOI.ScalarAffineTerm(3.0, x)) @@ -538,8 +522,6 @@ are summed together. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> x = MOI.VariableIndex(1); julia> terms = [ @@ -591,8 +573,6 @@ appears in the `output_index` row of the vector-valued ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> x = MOI.VariableIndex(1); julia> MOI.VectorQuadraticTerm(Int64(2), MOI.ScalarQuadraticTerm(3.0, x, x)) @@ -645,8 +625,6 @@ Duplicate indices in `quadratic_terms` and `affine_terms` with the same ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> x = MOI.VariableIndex(1); julia> y = MOI.VariableIndex(2); @@ -715,8 +693,6 @@ following: To represent the function ``f(x) = [sin(x)^2, x]``, do: ```jldoctest -julia> import MathOptInterface as MOI - julia> x = MOI.VariableIndex(1) MOI.VariableIndex(1) diff --git a/src/modifications.jl b/src/modifications.jl index feab10f30a..0437f47f05 100644 --- a/src/modifications.jl +++ b/src/modifications.jl @@ -83,8 +83,6 @@ constraints is not supported by the model `model`. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> x = MOI.add_variable(model); @@ -125,8 +123,6 @@ constraints is not supported by `model`. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> x = MOI.add_variables(model, 2); @@ -169,8 +165,6 @@ objectives is not supported by the model `model`. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> x = MOI.add_variable(model); @@ -218,8 +212,6 @@ objective coefficients is not supported by `model`. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> x = MOI.add_variables(model, 2); diff --git a/src/nlp.jl b/src/nlp.jl index 31b328e577..2a5b307674 100644 --- a/src/nlp.jl +++ b/src/nlp.jl @@ -25,8 +25,6 @@ It is used in [`NLPBlockData`](@ref). This example uses the [`Test.HS071`](@ref) evaluator. ```jldoctest -julia> import MathOptInterface as MOI - julia> evaluator = MOI.Test.HS071(true); julia> supertype(typeof(evaluator)) @@ -47,8 +45,6 @@ objective. This example uses the [`Test.HS071`](@ref) evaluator. ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.UniversalFallback(MOI.Utilities.Model{Float64}()); julia> block = MOI.NLPBlockData( @@ -73,8 +69,6 @@ If `result_index` is omitted, it is `1` by default. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> MOI.NLPBlockDual() MathOptInterface.NLPBlockDual(1) @@ -101,8 +95,6 @@ use to warm-start the solve. This example uses the [`Test.HS071`](@ref) evaluator. ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.UniversalFallback(MOI.Utilities.Model{Float64}()); julia> block = MOI.NLPBlockData( @@ -128,8 +120,6 @@ A struct holding a pair of lower and upper bounds. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> bounds = MOI.NLPBoundsPair.([25.0, 40.0], [Inf, 40.0]) 2-element Vector{MathOptInterface.NLPBoundsPair}: MathOptInterface.NLPBoundsPair(25.0, Inf) @@ -170,8 +160,6 @@ Hessian-of-the-Lagrangian queries, `σ` must be set to zero. This example uses the [`Test.HS071`](@ref) evaluator. ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.UniversalFallback(MOI.Utilities.Model{Float64}()); julia> block = MOI.NLPBlockData( @@ -223,8 +211,6 @@ In all cases, including when `requested_features` is empty, This example uses the [`Test.HS071`](@ref) evaluator. ```jldoctest -julia> import MathOptInterface as MOI - julia> evaluator = MOI.Test.HS071(true); julia> MOI.initialize(evaluator, [:Grad, :Jac]) @@ -244,8 +230,6 @@ See [`initialize`](@ref) for the list of defined features. This example uses the [`Test.HS071`](@ref) evaluator. ```jldoctest -julia> import MathOptInterface as MOI - julia> evaluator = MOI.Test.HS071(true, true); julia> MOI.features_available(evaluator) @@ -275,8 +259,6 @@ need to pass a value. This example uses the [`Test.HS071`](@ref) evaluator. ```jldoctest -julia> import MathOptInterface as MOI - julia> evaluator = MOI.Test.HS071(true); julia> MOI.initialize(evaluator, Symbol[]) @@ -313,8 +295,6 @@ For example, it may be the `view` of a vector. This example uses the [`Test.HS071`](@ref) evaluator. ```jldoctest -julia> import MathOptInterface as MOI - julia> evaluator = MOI.Test.HS071(true); julia> MOI.initialize(evaluator, Symbol[]) @@ -356,8 +336,6 @@ For example, it may be the `view` of a vector. This example uses the [`Test.HS071`](@ref) evaluator. ```jldoctest -julia> import MathOptInterface as MOI - julia> evaluator = MOI.Test.HS071(true); julia> MOI.initialize(evaluator, Symbol[:Grad]) @@ -400,8 +378,6 @@ Before calling this function, you must call [`initialize`](@ref) with `:Jac`. This example uses the [`Test.HS071`](@ref) evaluator. ```jldoctest -julia> import MathOptInterface as MOI - julia> evaluator = MOI.Test.HS071(true); julia> MOI.initialize(evaluator, Symbol[:Jac]) @@ -447,8 +423,6 @@ Before calling this function, you must call [`initialize`](@ref) with `:Hess`. This example uses the [`Test.HS071`](@ref) evaluator. ```jldoctest -julia> import MathOptInterface as MOI - julia> evaluator = MOI.Test.HS071(true); julia> MOI.initialize(evaluator, Symbol[:Hess]) @@ -493,8 +467,6 @@ Before calling this function, you must call [`initialize`](@ref) with `:Hess`. This example uses the [`Test.HS071`](@ref) evaluator. ```jldoctest -julia> import MathOptInterface as MOI - julia> evaluator = MOI.Test.HS071(true); julia> MOI.initialize(evaluator, Symbol[:Hess]) @@ -545,8 +517,6 @@ Before calling this function, you must call [`initialize`](@ref) with `:Hess`. This example uses the [`Test.HS071`](@ref) evaluator. ```jldoctest -julia> import MathOptInterface as MOI - julia> evaluator = MOI.Test.HS071(true); julia> MOI.initialize(evaluator, Symbol[:Hess]) @@ -588,8 +558,6 @@ Before calling this function, you must call [`initialize`](@ref) with `:Jac`. This example uses the [`Test.HS071`](@ref) evaluator. ```jldoctest -julia> import MathOptInterface as MOI - julia> evaluator = MOI.Test.HS071(true); julia> MOI.initialize(evaluator, Symbol[:Jac]) @@ -631,8 +599,6 @@ Before calling this function, you must call [`initialize`](@ref) with `:Jac`. This example uses the [`Test.HS071`](@ref) evaluator. ```jldoctest -julia> import MathOptInterface as MOI - julia> evaluator = MOI.Test.HS071(true); julia> MOI.initialize(evaluator, Symbol[:Jac]) @@ -681,8 +647,6 @@ Before calling this function, you must call [`initialize`](@ref) with `:Hess`. This example uses the [`Test.HS071`](@ref) evaluator. ```jldoctest -julia> import MathOptInterface as MOI - julia> evaluator = MOI.Test.HS071(true); julia> MOI.initialize(evaluator, Symbol[:Jac]) @@ -736,8 +700,6 @@ Before calling this function, you must call [`initialize`](@ref) with `:JacVec`. This example uses the [`Test.HS071`](@ref) evaluator. ```jldoctest -julia> import MathOptInterface as MOI - julia> evaluator = MOI.Test.HS071(true); julia> MOI.initialize(evaluator, Symbol[:Jac, :JacVec]) @@ -787,8 +749,6 @@ Before calling this function, you must call [`initialize`](@ref) with `:JacVec`. This example uses the [`Test.HS071`](@ref) evaluator. ```jldoctest -julia> import MathOptInterface as MOI - julia> evaluator = MOI.Test.HS071(true); julia> MOI.initialize(evaluator, Symbol[:Jac, :JacVec]) @@ -843,8 +803,6 @@ Before calling this function, you must call [`initialize`](@ref) with `:HessVec` This example uses the [`Test.HS071`](@ref) evaluator. ```jldoctest -julia> import MathOptInterface as MOI - julia> evaluator = MOI.Test.HS071(true, true); julia> MOI.initialize(evaluator, Symbol[:HessVec]) @@ -898,8 +856,6 @@ Before calling this function, you must call [`initialize`](@ref) with `:Hess`. This example uses the [`Test.HS071`](@ref) evaluator. ```jldoctest -julia> import MathOptInterface as MOI - julia> evaluator = MOI.Test.HS071(true, true); julia> MOI.initialize(evaluator, Symbol[:Hess]) @@ -952,8 +908,6 @@ Before calling this function, you must call [`initialize`](@ref) with `:Hess`. This example uses the [`Test.HS071`](@ref) evaluator. ```jldoctest -julia> import MathOptInterface as MOI - julia> evaluator = MOI.Test.HS071(true, true); julia> MOI.initialize(evaluator, Symbol[:Hess]) @@ -1008,8 +962,6 @@ Before calling this function, you must call [`initialize`](@ref) with `:Hess`. This example uses the [`Test.HS071`](@ref) evaluator. ```jldoctest -julia> import MathOptInterface as MOI - julia> evaluator = MOI.Test.HS071(true); julia> MOI.initialize(evaluator, Symbol[:Hess]) @@ -1073,8 +1025,6 @@ Before calling this function, you must call [`initialize`](@ref) with This example uses the [`Test.HS071`](@ref) evaluator. ```jldoctest -julia> import MathOptInterface as MOI - julia> evaluator = MOI.Test.HS071(true); julia> MOI.initialize(evaluator, [:ExprGraph]) @@ -1116,8 +1066,6 @@ Before calling this function, you must call [`initialize`](@ref) with This example uses the [`Test.HS071`](@ref) evaluator. ```jldoctest -julia> import MathOptInterface as MOI - julia> evaluator = MOI.Test.HS071(true); julia> MOI.initialize(evaluator, [:ExprGraph]) diff --git a/src/sets.jl b/src/sets.jl index 09d4b16428..dc95db7b14 100644 --- a/src/sets.jl +++ b/src/sets.jl @@ -51,8 +51,6 @@ have to be used with the set `set`. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> MOI.dimension(MOI.Reals(4)) 4 @@ -79,8 +77,6 @@ If the dual cone is not defined it returns an error. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> MOI.dual_set(MOI.Reals(4)) MathOptInterface.Zeros(4) @@ -102,8 +98,6 @@ Return the type of dual set of sets of type `S`, as returned by ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> MOI.dual_set_type(MOI.Reals) MathOptInterface.Zeros @@ -155,8 +149,6 @@ The set ``[lower, \\infty) \\subseteq \\mathbb{R}``. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> x = MOI.add_variable(model) @@ -180,8 +172,6 @@ The set ``(-\\infty, upper] \\subseteq \\mathbb{R}``. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> x = MOI.add_variable(model) @@ -205,8 +195,6 @@ The set containing the single point ``\\{value\\} \\subseteq \\mathbb{R}``. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> x = MOI.add_variable(model) @@ -240,8 +228,6 @@ and solvers should declare [`supports_add_constrained_variable`](@ref) and not ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> p, ci = MOI.add_constrained_variable(model, MOI.Parameter(2.5)) @@ -270,8 +256,6 @@ as a one-sided interval. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> x = MOI.add_variable(model) @@ -306,8 +290,6 @@ Construct an interval set from the set `set`, assuming any missing bounds are ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> MOI.Interval(MOI.GreaterThan(1.0)) MathOptInterface.Interval{Float64}(1.0, Inf) @@ -334,8 +316,6 @@ The set of integers, ``\\mathbb{Z}``. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> x = MOI.add_variable(model) @@ -357,8 +337,6 @@ Variables belonging to the `ZeroOne` set are also known as "binary" variables. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> x = MOI.add_variable(model) @@ -378,8 +356,6 @@ The set ``\\{0\\} \\cup [lower, upper]``. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> x = MOI.add_variable(model) @@ -414,8 +390,6 @@ the nearest integers. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> x = MOI.add_variable(model) @@ -447,8 +421,6 @@ dimension `dimension`. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> x = MOI.add_variables(model, 3); @@ -483,8 +455,6 @@ dimension `dimension`. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> x = MOI.add_variables(model, 3); @@ -519,8 +489,6 @@ non-negative dimension `dimension`. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> x = MOI.add_variables(model, 3); @@ -555,8 +523,6 @@ non-negative dimension `dimension`. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> x = MOI.add_variables(model, 3); @@ -593,8 +559,6 @@ The `dimension` must be at least `1`. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> t = MOI.add_variable(model) @@ -635,8 +599,6 @@ The `dimension` must be at least `1`. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> t = MOI.add_variable(model) @@ -677,8 +639,6 @@ The `dimension` must be at least `1`. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> t = MOI.add_variable(model) @@ -719,8 +679,6 @@ The `dimension` must be at least `2`. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> t = MOI.add_variable(model) @@ -768,8 +726,6 @@ The `dimension` must be at least `1`. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> t = MOI.add_variable(model) @@ -820,8 +776,6 @@ where `dimension = n + 1 >= 2`. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> t = MOI.add_variable(model) @@ -860,8 +814,6 @@ The 3-dimensional exponential cone ``\\{ (x,y,z) \\in \\mathbb{R}^3 : y \\exp (x ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> x = MOI.add_variables(model, 3); @@ -885,8 +837,6 @@ The 3-dimensional dual exponential cone ``\\{ (u,v,w) \\in \\mathbb{R}^3 : -u \\ ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> x = MOI.add_variables(model, 3); @@ -911,8 +861,6 @@ with parameter `exponent`. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> x = MOI.add_variables(model, 3); @@ -943,8 +891,6 @@ with parameter `exponent`. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> x = MOI.add_variables(model, 3); @@ -982,8 +928,6 @@ of dimension `dimension```{}=2n+1``. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> u = MOI.add_variable(model); @@ -1029,8 +973,6 @@ Julia's `vec` function. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> t = MOI.add_variable(model) @@ -1084,8 +1026,6 @@ Julia's `vec` function. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> t = MOI.add_variable(model) @@ -1453,8 +1393,6 @@ The non-negative argument `side_dimension` is the side dimension of the matrix ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> t = MOI.add_variable(model) @@ -1506,8 +1444,6 @@ The non-negative argument `side_dimension` is the side dimension of the matrix ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> t = MOI.add_variable(model) @@ -1563,8 +1499,6 @@ The non-negative argument `side_dimension` is the side dimension of the matrix ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> t = MOI.add_variable(model) @@ -1616,8 +1550,6 @@ The non-negative argument `side_dimension` is the side dimension of the matrix ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> t = MOI.add_variable(model) @@ -1710,8 +1642,6 @@ the set `Scaled(set)` is defined as This can be used to scale a vector of numbers ```jldoctest scaling -julia> import MathOptInterface as MOI - julia> set = MOI.PositiveSemidefiniteConeTriangle(2) MathOptInterface.PositiveSemidefiniteConeTriangle(2) @@ -1818,8 +1748,6 @@ not change the set of feasible solutions. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> x = MOI.add_variables(model, 3); @@ -1857,8 +1785,6 @@ they must be adjacent in the ordering of the set. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> x = MOI.add_variables(model, 3); @@ -1929,8 +1855,6 @@ The constraint ``\\{(y, x) \\in \\{0, 1\\} \\times \\mathbb{R}^2 : y = 1 \\implies x_1 + x_2 \\leq 9 \\}`` is defined as ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> x = MOI.add_variables(model, 2); @@ -1954,8 +1878,6 @@ The constraint ``\\{(y, x) \\in \\{0, 1\\} \\times \\mathbb{R} : y = 0 \\implies x = 0 \\}`` is defined as ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> x = MOI.add_variable(model); @@ -2032,8 +1954,6 @@ There are three solutions: 3. `x = 1` with `F(x) = -7` ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> x, _ = MOI.add_constrained_variable(model, MOI.Interval(-1.0, 1.0)); @@ -2056,8 +1976,6 @@ defines the complementarity problem where `0 <= x_1 ⟂ x_3 >= 0` and `0 <= x_2 ⟂ x_4 >= 0`. ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> x = MOI.add_variables(model, 4); @@ -2103,8 +2021,6 @@ called `distinct`. To enforce `x[1] != x[2]` AND `x[1] != x[3]` AND `x[2] != x[3]`: ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> x = [MOI.add_constrained_variable(model, MOI.Integer())[1] for _ in 1:3] @@ -2147,8 +2063,6 @@ This constraint is called `bin_packing` in MiniZinc. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> bins = MOI.add_variables(model, 5) @@ -2229,8 +2143,6 @@ a (potentially sub-optimal) tour in the travelling salesperson problem. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> x = [MOI.add_constrained_variable(model, MOI.Integer())[1] for _ in 1:3] @@ -2271,8 +2183,6 @@ To ensure that `3` appears at least once in each of the subsets `{a, b}` and `{b, c}`: ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> a, _ = MOI.add_constrained_variable(model, MOI.Integer()) @@ -2330,8 +2240,6 @@ This constraint is called `among` by MiniZinc. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> n, _ = MOI.add_constrained_variable(model, MOI.Integer()) @@ -2392,8 +2300,6 @@ To model: * if `n == 3`, then `x[1] != x[2]`, `x[2] != x[3]` and `x[3] != x[1]` ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> n, _ = MOI.add_constrained_variable(model, MOI.Integer()) @@ -2437,8 +2343,6 @@ This constraint is called `count_gt` in MiniZinc. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> c, _ = MOI.add_constrained_variable(model, MOI.Integer()) @@ -2489,8 +2393,6 @@ This constraint is called `cumulative` in MiniZinc. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> s = [MOI.add_constrained_variable(model, MOI.Integer())[1] for _ in 1:3] @@ -2548,8 +2450,6 @@ This constraint is called `path` in MiniZinc. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> N, E = 4, 5 @@ -2646,8 +2546,6 @@ This constraint is called `table` in MiniZinc. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> x = MOI.add_variables(model, 3) @@ -2685,8 +2583,6 @@ The set ``\\{x \\in \\bar{\\mathbb{R}}^d: x_i \\in [lower_i, upper_i] \\forall i ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> x = MOI.add_variables(model, 3) @@ -2736,8 +2632,6 @@ The constraint ``[z; f(x)] \\in Reified(S)`` ensures that ``f(x) \\in S`` if and only if ``z == 1``, where ``z \\in \\{0, 1\\}``. ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.UniversalFallback(MOI.Utilities.Model{Float64}()); julia> z, _ = MOI.add_constrained_variable(model, MOI.ZeroOne()) @@ -2824,8 +2718,6 @@ Returns the constant term of the set `set`. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> MOI.constant(MOI.GreaterThan(1.0)) 1.0 diff --git a/src/variables.jl b/src/variables.jl index 2b14216937..838b9d9e1d 100644 --- a/src/variables.jl +++ b/src/variables.jl @@ -32,8 +32,6 @@ done in the current state of the model `model`. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> MOI.add_variables(model, 2) @@ -57,8 +55,6 @@ done in the current state of the model `model`. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> x = MOI.add_variable(model) @@ -139,8 +135,6 @@ bounds after creation. ## Example ```jldoctest -julia> import MathOptInterface as MOI - julia> model = MOI.Utilities.Model{Float64}(); julia> set = (MOI.GreaterThan(1.0), MOI.LessThan(2.0));