diff --git a/previews/PR3778/.documenter-siteinfo.json b/previews/PR3778/.documenter-siteinfo.json index 6ab63345908..2b4997d67bb 100644 --- a/previews/PR3778/.documenter-siteinfo.json +++ b/previews/PR3778/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.10.4","generation_timestamp":"2024-08-05T04:35:45","documenter_version":"1.4.1"}} \ No newline at end of file +{"documenter":{"julia_version":"1.10.4","generation_timestamp":"2024-08-05T21:23:35","documenter_version":"1.4.1"}} \ No newline at end of file diff --git a/previews/PR3778/JuMP.pdf b/previews/PR3778/JuMP.pdf index 32945ac3163..fa216add92a 100644 Binary files a/previews/PR3778/JuMP.pdf and b/previews/PR3778/JuMP.pdf differ diff --git a/previews/PR3778/api/JuMP.Containers/index.html b/previews/PR3778/api/JuMP.Containers/index.html index 236e027cccb..8c3f656df86 100644 --- a/previews/PR3778/api/JuMP.Containers/index.html +++ b/previews/PR3778/api/JuMP.Containers/index.html @@ -12,7 +12,7 @@ 3 4 julia> array[:b, 3] -4source
DenseAxisArray{T}(undef, axes...) where T

Construct an uninitialized DenseAxisArray with element-type T indexed over the given axes.

Example

julia> array = Containers.DenseAxisArray{Float64}(undef, [:a, :b], 1:2);
+4
source
DenseAxisArray{T}(undef, axes...) where T

Construct an uninitialized DenseAxisArray with element-type T indexed over the given axes.

Example

julia> array = Containers.DenseAxisArray{Float64}(undef, [:a, :b], 1:2);
 
 julia> fill!(array, 1.0)
 2-dimensional DenseAxisArray{Float64,2,...} with index sets:
@@ -34,7 +34,7 @@
     Dimension 2, 1:2
 And data, a 2×2 Matrix{Float64}:
  1.0  5.0
- 1.0  1.0
source

SparseAxisArray

JuMP.Containers.SparseAxisArrayType
struct SparseAxisArray{T,N,K<:NTuple{N, Any}} <: AbstractArray{T,N}
+ 1.0  1.0
source

SparseAxisArray

JuMP.Containers.SparseAxisArrayType
struct SparseAxisArray{T,N,K<:NTuple{N, Any}} <: AbstractArray{T,N}
     data::OrderedCollections.OrderedDict{K,T}
 end

N-dimensional array with elements of type T where only a subset of the entries are defined. The entries with indices idx = (i1, i2, ..., iN) in keys(data) has value data[idx].

Note that, as opposed to SparseArrays.AbstractSparseArray, the missing entries are not assumed to be zero(T), they are simply not part of the array. This means that the result of map(f, sa::SparseAxisArray) or f.(sa::SparseAxisArray) has the same sparsity structure as sa, even if f(zero(T)) is not zero.

Example

julia> using OrderedCollections: OrderedDict
 
@@ -51,7 +51,7 @@
   [b, 3]  =  3.0
 
 julia> array[:b, 3]
-3.0
source

Containers.@container

JuMP.Containers.@containerMacro
@container([i=..., j=..., ...], expr[, container = :Auto])

Create a container with indices i, j, ... and values given by expr that may depend on the value of the indices.

@container(ref[i=..., j=..., ...], expr[, container = :Auto])

Same as above but the container is assigned to the variable of name ref.

The type of container can be controlled by the container keyword.

Note

When the index set is explicitly given as 1:n for any expression n, it is transformed to Base.OneTo(n) before being given to container.

Example

julia> Containers.@container([i = 1:3, j = 1:3], i + j)
+3.0
source

Containers.@container

JuMP.Containers.@containerMacro
@container([i=..., j=..., ...], expr[, container = :Auto])

Create a container with indices i, j, ... and values given by expr that may depend on the value of the indices.

@container(ref[i=..., j=..., ...], expr[, container = :Auto])

Same as above but the container is assigned to the variable of name ref.

The type of container can be controlled by the container keyword.

Note

When the index set is explicitly given as 1:n for any expression n, it is transformed to Base.OneTo(n) before being given to container.

Example

julia> Containers.@container([i = 1:3, j = 1:3], i + j)
 3×3 Matrix{Int64}:
  2  3  4
  3  4  5
@@ -86,7 +86,7 @@
   [1, 3]  =  4
   [2, 2]  =  4
   [2, 3]  =  5
-  [3, 3]  =  6
source

Containers.container

JuMP.Containers.containerFunction
container(f::Function, indices[[, ::Type{C} = AutoContainerType], names])

Create a container of type C with index names names, indices indices and values at given indices given by f.

If the method with names is not specialized on Type{C}, it falls back to calling container(f, indices, c) for backwards compatibility with containers not supporting index names.

Example

julia> Containers.container((i, j) -> i + j, Containers.vectorized_product(Base.OneTo(3), Base.OneTo(3)))
+  [3, 3]  =  6
source

Containers.container

JuMP.Containers.containerFunction
container(f::Function, indices[[, ::Type{C} = AutoContainerType], names])

Create a container of type C with index names names, indices indices and values at given indices given by f.

If the method with names is not specialized on Type{C}, it falls back to calling container(f, indices, c) for backwards compatibility with containers not supporting index names.

Example

julia> Containers.container((i, j) -> i + j, Containers.vectorized_product(Base.OneTo(3), Base.OneTo(3)))
 3×3 Matrix{Int64}:
  2  3  4
  3  4  5
@@ -115,7 +115,7 @@
   [1, 2]  =  3
   [1, 3]  =  4
   [2, 3]  =  5
-  [3, 3]  =  6
source

Containers.rowtable

JuMP.Containers.rowtableFunction
rowtable([f::Function=identity,] x; [header::Vector{Symbol} = Symbol[]])

Applies the function f to all elements of the variable container x, returning the result as a Vector of NamedTuples, where header is a vector containing the corresponding axis names.

If x is an N-dimensional array, there must be N+1 names, so that the last name corresponds to the result of f(x[i]).

If header is left empty, then the default header is [:x1, :x2, ..., :xN, :y].

Info

A Vector of NamedTuples implements the Tables.jl interface, and so the result can be used as input for any function that consumes a 'Tables.jl' compatible source.

Example

julia> model = Model();
+  [3, 3]  =  6
source

Containers.rowtable

JuMP.Containers.rowtableFunction
rowtable([f::Function=identity,] x; [header::Vector{Symbol} = Symbol[]])

Applies the function f to all elements of the variable container x, returning the result as a Vector of NamedTuples, where header is a vector containing the corresponding axis names.

If x is an N-dimensional array, there must be N+1 names, so that the last name corresponds to the result of f(x[i]).

If header is left empty, then the default header is [:x1, :x2, ..., :xN, :y].

Info

A Vector of NamedTuples implements the Tables.jl interface, and so the result can be used as input for any function that consumes a 'Tables.jl' compatible source.

Example

julia> model = Model();
 
 julia> @variable(model, x[i=1:2, j=i:2] >= 0, start = i+j);
 
@@ -129,7 +129,7 @@
 3-element Vector{@NamedTuple{x1::Int64, x2::Int64, y::VariableRef}}:
  (x1 = 1, x2 = 1, y = x[1,1])
  (x1 = 1, x2 = 2, y = x[1,2])
- (x1 = 2, x2 = 2, y = x[2,2])
source

Containers.default_container

JuMP.Containers.default_containerFunction
default_container(indices)

If indices is a NestedIterator, return a SparseAxisArray. Otherwise, indices should be a VectorizedProductIterator and the function returns Array if all iterators of the product are Base.OneTo and returns DenseAxisArray otherwise.

source

Containers.nested

JuMP.Containers.nestedFunction
nested(iterators...; condition = (args...) -> true)

Create a NestedIterator.

Example

julia> iterator = Containers.nested(
+ (x1 = 2, x2 = 2, y = x[2,2])
source

Containers.default_container

JuMP.Containers.default_containerFunction
default_container(indices)

If indices is a NestedIterator, return a SparseAxisArray. Otherwise, indices should be a VectorizedProductIterator and the function returns Array if all iterators of the product are Base.OneTo and returns DenseAxisArray otherwise.

source

Containers.nested

JuMP.Containers.nestedFunction
nested(iterators...; condition = (args...) -> true)

Create a NestedIterator.

Example

julia> iterator = Containers.nested(
            () -> 1:2,
            (i,) -> ["A", "B"];
            condition = (i, j) -> isodd(i) || j == "B",
@@ -139,21 +139,21 @@
 3-element Vector{Tuple{Int64, String}}:
  (1, "A")
  (1, "B")
- (2, "B")
source

Containers.vectorized_product

JuMP.Containers.vectorized_productFunction
vectorized_product(iterators...)

Created a VectorizedProductIterator.

Example

julia> iterator = Containers.vectorized_product(1:2, ["A", "B"]);
+ (2, "B")
source

Containers.vectorized_product

JuMP.Containers.vectorized_productFunction
vectorized_product(iterators...)

Created a VectorizedProductIterator.

Example

julia> iterator = Containers.vectorized_product(1:2, ["A", "B"]);
 
 julia> collect(iterator)
 2×2 Matrix{Tuple{Int64, String}}:
  (1, "A")  (1, "B")
- (2, "A")  (2, "B")
source

Containers.build_error_fn

JuMP.Containers.build_error_fnFunction
build_error_fn(macro_name, args, source)

Return a function that can be used in place of Base.error, but which additionally prints the macro from which it was called.

source

Containers.parse_macro_arguments

JuMP.Containers.parse_macro_argumentsFunction
parse_macro_arguments(
+ (2, "A")  (2, "B")
source

Containers.build_error_fn

JuMP.Containers.build_error_fnFunction
build_error_fn(macro_name, args, source)

Return a function that can be used in place of Base.error, but which additionally prints the macro from which it was called.

source

Containers.parse_macro_arguments

JuMP.Containers.parse_macro_argumentsFunction
parse_macro_arguments(
     error_fn::Function,
     args;
     valid_kwargs::Union{Nothing,Vector{Symbol}} = nothing,
     num_positional_args::Union{Nothing,Int,UnitRange{Int}} = nothing,
-)

Returns a Tuple{Vector{Any},Dict{Symbol,Any}} containing the ordered positional arguments and a dictionary mapping the keyword arguments.

This specially handles the distinction of @foo(key = value) and @foo(; key = value) in macros.

An error is thrown if multiple keyword arguments are passed with the same key.

If valid_kwargs is a Vector{Symbol}, an error is thrown if a keyword is not in valid_kwargs.

If num_positional_args is not nothing, an error is thrown if the number of positional arguments is not in num_positional_args.

source

Containers.parse_ref_sets

JuMP.Containers.parse_ref_setsFunction
parse_ref_sets(
+)

Returns a Tuple{Vector{Any},Dict{Symbol,Any}} containing the ordered positional arguments and a dictionary mapping the keyword arguments.

This specially handles the distinction of @foo(key = value) and @foo(; key = value) in macros.

An error is thrown if multiple keyword arguments are passed with the same key.

If valid_kwargs is a Vector{Symbol}, an error is thrown if a keyword is not in valid_kwargs.

If num_positional_args is not nothing, an error is thrown if the number of positional arguments is not in num_positional_args.

source

Containers.parse_ref_sets

JuMP.Containers.parse_ref_setsFunction
parse_ref_sets(
     error_fn::Function,
     expr;
     invalid_index_variables::Vector{Symbol} = Symbol[],
-)

Helper function for macros to construct container objects.

Warning

This function is for advanced users implementing JuMP extensions. See container_code for more details.

Arguments

  • error_fn: a function that takes a String and throws an error, potentially annotating the input string with extra information such as from which macro it was thrown from. Use error if you do not want a modified error message.
  • expr: an Expr that specifies the container, for example, :(x[i = 1:3, [:red, :blue], k = S; i + k <= 6])

Returns

  1. name: the name of the container, if given, otherwise nothing
  2. index_vars: a Vector{Any} of names for the index variables, for example, [:i, gensym(), :k]. These may also be expressions, like :((i, j)) from a call like :(x[(i, j) in S]).
  3. indices: an iterator over the indices, for example, Containers.NestedIterator

Example

See container_code for a worked example.

source

Containers.build_name_expr

JuMP.Containers.build_name_exprFunction
build_name_expr(
+)

Helper function for macros to construct container objects.

Warning

This function is for advanced users implementing JuMP extensions. See container_code for more details.

Arguments

  • error_fn: a function that takes a String and throws an error, potentially annotating the input string with extra information such as from which macro it was thrown from. Use error if you do not want a modified error message.
  • expr: an Expr that specifies the container, for example, :(x[i = 1:3, [:red, :blue], k = S; i + k <= 6])

Returns

  1. name: the name of the container, if given, otherwise nothing
  2. index_vars: a Vector{Any} of names for the index variables, for example, [:i, gensym(), :k]. These may also be expressions, like :((i, j)) from a call like :(x[(i, j) in S]).
  3. indices: an iterator over the indices, for example, Containers.NestedIterator

Example

See container_code for a worked example.

source

Containers.build_name_expr

JuMP.Containers.build_name_exprFunction
build_name_expr(
     name::Union{Symbol,Nothing},
     index_vars::Vector,
     kwargs::Dict{Symbol,Any},
@@ -164,12 +164,12 @@
 ""
 
 julia> Containers.build_name_expr(:y, [:i, :j], Dict{Symbol,Any}(:base_name => "y"))
-:(string("y", "[", string($(Expr(:escape, :i))), ",", string($(Expr(:escape, :j))), "]"))
source

Containers.add_additional_args

JuMP.Containers.add_additional_argsFunction
add_additional_args(
+:(string("y", "[", string($(Expr(:escape, :i))), ",", string($(Expr(:escape, :j))), "]"))
source

Containers.add_additional_args

JuMP.Containers.add_additional_argsFunction
add_additional_args(
     call::Expr,
     args::Vector,
     kwargs::Dict{Symbol,Any};
     kwarg_exclude::Vector{Symbol} = Symbol[],
-)

Add the positional arguments args to the function call expression call, escaping each argument expression.

This function is able to incorporate additional positional arguments to calls that already have keyword arguments.

source

Containers.container_code

JuMP.Containers.container_codeFunction
container_code(
+)

Add the positional arguments args to the function call expression call, escaping each argument expression.

This function is able to incorporate additional positional arguments to calls that already have keyword arguments.

source

Containers.container_code

JuMP.Containers.container_codeFunction
container_code(
     index_vars::Vector{Any},
     indices::Expr,
     code,
@@ -194,7 +194,7 @@
     Dimension 2, ["A", "B"]
 And data, a 2×2 Matrix{String}:
  "A"   "B"
- "AA"  "BB"
source

Containers.AutoContainerType

JuMP.Containers.AutoContainerTypeType
AutoContainerType

Pass AutoContainerType to container to let the container type be chosen based on the type of the indices using default_container.

source

Containers.NestedIterator

JuMP.Containers.NestedIteratorType
struct NestedIterator{T}
+ "AA"  "BB"
source

Containers.AutoContainerType

JuMP.Containers.AutoContainerTypeType
AutoContainerType

Pass AutoContainerType to container to let the container type be chosen based on the type of the indices using default_container.

source

Containers.NestedIterator

JuMP.Containers.NestedIteratorType
struct NestedIterator{T}
     iterators::T # Tuple of functions
     condition::Function
 end

Iterators over the tuples that are produced by a nested for loop.

Construct a NestedIterator using nested.

Example

julia> iterators = (() -> 1:2, (i,) -> ["A", "B"]);
@@ -217,6 +217,6 @@
        end
 (1, "A")
 (1, "B")
-(2, "B")
source

Containers.VectorizedProductIterator

JuMP.Containers.VectorizedProductIteratorType
struct VectorizedProductIterator{T}
+(2, "B")
source

Containers.VectorizedProductIterator

JuMP.Containers.VectorizedProductIteratorType
struct VectorizedProductIterator{T}
     prod::Iterators.ProductIterator{T}
-end

A wrapper type for Iterators.ProuctIterator that discards shape information and returns a Vector.

Construct a VectorizedProductIterator using vectorized_product.

source
+end

A wrapper type for Iterators.ProuctIterator that discards shape information and returns a Vector.

Construct a VectorizedProductIterator using vectorized_product.

source diff --git a/previews/PR3778/api/JuMP/index.html b/previews/PR3778/api/JuMP/index.html index f263ff7f396..cf0eb6d5015 100644 --- a/previews/PR3778/api/JuMP/index.html +++ b/previews/PR3778/api/JuMP/index.html @@ -15,7 +15,7 @@ julia> @build_constraint(x .>= 0) 2-element Vector{ScalarConstraint{AffExpr, MathOptInterface.GreaterThan{Float64}}}: ScalarConstraint{AffExpr, MathOptInterface.GreaterThan{Float64}}(x[1], MathOptInterface.GreaterThan{Float64}(-0.0)) - ScalarConstraint{AffExpr, MathOptInterface.GreaterThan{Float64}}(x[2], MathOptInterface.GreaterThan{Float64}(-0.0))source

@constraint

JuMP.@constraintMacro
@constraint(model, expr, args...; kwargs...)
+ ScalarConstraint{AffExpr, MathOptInterface.GreaterThan{Float64}}(x[2], MathOptInterface.GreaterThan{Float64}(-0.0))
source

@constraint

JuMP.@constraintMacro
@constraint(model, expr, args...; kwargs...)
 @constraint(model, [index_sets...], expr, args...; kwargs...)
 @constraint(model, name, expr, args...; kwargs...)
 @constraint(model, name[index_sets...], expr, args...; kwargs...)

Add a constraint described by the expression expr.

The name argument is optional. If index sets are passed, a container is built and the constraint may depend on the indices of the index sets.

The expression expr may be one of following forms:

  • func in set, constraining the function func to belong to the set set, which is either a MOI.AbstractSet or one of the JuMP shortcuts like SecondOrderCone or PSDCone

  • a <op> b, where <op> is one of ==, , >=, , <=

  • l <= f <= u or u >= f >= l, constraining the expression f to lie between l and u

  • f(x) ⟂ x, which defines a complementarity constraint

  • z --> {expr}, which defines an indicator constraint that activates when z is 1

  • !z --> {expr}, which defines an indicator constraint that activates when z is 0

  • z <--> {expr}, which defines a reified constraint

  • expr := rhs, which defines a Boolean equality constraint

Broadcasted comparison operators like .== are also supported for the case when the left- and right-hand sides of the comparison operator are arrays.

JuMP extensions may additionally provide support for constraint expressions which are not listed here.

Keyword arguments

  • base_name: sets the name prefix used to generate constraint names. It corresponds to the constraint name for scalar constraints, otherwise, the constraint names are set to base_name[...] for each index ....

  • container = :Auto: force the container type by passing container = Array,

container = DenseAxisArray, container = SparseAxisArray, or any another container type which is supported by a JuMP extension.

  • set_string_name::Bool = true: control whether to set the MOI.ConstraintName attribute. Passing set_string_name = false can improve performance.

Other keyword arguments may be supported by JuMP extensions.

Example

julia> model = Model();
@@ -52,7 +52,7 @@
 z --> {x[1] ≥ 0}
 
 julia> @constraint(model, !z --> {2 * x[2] <= 3})
-!z --> {2 x[2] ≤ 3}
source

@constraints

JuMP.@constraintsMacro
@constraints(model, args...)

Adds groups of constraints at once, in the same fashion as the @constraint macro.

The model must be the first argument, and multiple constraints can be added on multiple lines wrapped in a begin ... end block.

The macro returns a tuple containing the constraints that were defined.

Example

julia> model = Model();
+!z --> {2 x[2] ≤ 3}
source

@constraints

JuMP.@constraintsMacro
@constraints(model, args...)

Adds groups of constraints at once, in the same fashion as the @constraint macro.

The model must be the first argument, and multiple constraints can be added on multiple lines wrapped in a begin ... end block.

The macro returns a tuple containing the constraints that were defined.

Example

julia> model = Model();
 
 julia> @variable(model, w);
 
@@ -75,7 +75,7 @@
  sum_to_one[2] : y + z[2] = 1
  sum_to_one[3] : y + z[3] = 1
  x ≥ 1
- -w + y ≤ 2
source

@expression

JuMP.@expressionMacro
@expression(model::GenericModel, expression)
+ -w + y ≤ 2
source

@expression

JuMP.@expressionMacro
@expression(model::GenericModel, expression)
 @expression(model::GenericModel, [index_sets...], expression)
 @expression(model::GenericModel, name, expression)
 @expression(model::GenericModel, name[index_sets...], expression)

Efficiently builds and returns an expression.

The name argument is optional. If index sets are passed, a container is built and the expression may depend on the indices of the index sets.

Keyword arguments

  • container = :Auto: force the container type by passing container = Array, container = DenseAxisArray, container = SparseAxisArray, or any another container type which is supported by a JuMP extension.

Example

julia> model = Model();
@@ -102,7 +102,7 @@
 3-element Vector{AffExpr}:
  x[1] + x[2] + x[3]
  2 x[1] + 2 x[2] + 2 x[3]
- 3 x[1] + 3 x[2] + 3 x[3]
source

@expressions

JuMP.@expressionsMacro
@expressions(model, args...)

Adds multiple expressions to model at once, in the same fashion as the @expression macro.

The model must be the first argument, and multiple expressions can be added on multiple lines wrapped in a begin ... end block.

The macro returns a tuple containing the expressions that were defined.

Example

julia> model = Model();
+ 3 x[1] + 3 x[2] + 3 x[3]
source

@expressions

JuMP.@expressionsMacro
@expressions(model, args...)

Adds multiple expressions to model at once, in the same fashion as the @expression macro.

The model must be the first argument, and multiple expressions can be added on multiple lines wrapped in a begin ... end block.

The macro returns a tuple containing the expressions that were defined.

Example

julia> model = Model();
 
 julia> @variable(model, x);
 
@@ -116,7 +116,7 @@
            my_expr, x^2 + y^2
            my_expr_1[i = 1:2], a[i] - z[i]
        end)
-(x² + y², AffExpr[-z[1] + 4, -z[2] + 5])
source

@force_nonlinear

JuMP.@force_nonlinearMacro
@force_nonlinear(expr)

Change the parsing of expr to construct GenericNonlinearExpr instead of GenericAffExpr or GenericQuadExpr.

This macro works by walking expr and substituting all calls to +, -, *, /, and ^ in favor of ones that construct GenericNonlinearExpr.

This macro will error if the resulting expression does not produce a GenericNonlinearExpr because, for example, it is used on an expression that does not use the basic arithmetic operators.

When to use this macro

In most cases, you should not use this macro.

Use this macro only if the intended output type is a GenericNonlinearExpr and the regular macro calls destroy problem structure, or in rare cases, if the regular macro calls introduce a large amount of intermediate variables, for example, because they promote types to a common quadratic expression.

Example

Use-case one: preserve problem structure.

julia> model = Model();
+(x² + y², AffExpr[-z[1] + 4, -z[2] + 5])
source

@force_nonlinear

JuMP.@force_nonlinearMacro
@force_nonlinear(expr)

Change the parsing of expr to construct GenericNonlinearExpr instead of GenericAffExpr or GenericQuadExpr.

This macro works by walking expr and substituting all calls to +, -, *, /, and ^ in favor of ones that construct GenericNonlinearExpr.

This macro will error if the resulting expression does not produce a GenericNonlinearExpr because, for example, it is used on an expression that does not use the basic arithmetic operators.

When to use this macro

In most cases, you should not use this macro.

Use this macro only if the intended output type is a GenericNonlinearExpr and the regular macro calls destroy problem structure, or in rare cases, if the regular macro calls introduce a large amount of intermediate variables, for example, because they promote types to a common quadratic expression.

Example

Use-case one: preserve problem structure.

julia> model = Model();
 
 julia> @variable(model, x);
 
@@ -144,7 +144,7 @@
 3200
 
 julia> @allocated @expression(model, @force_nonlinear(x * 2.0 * (1 + x) * x))
-640
source

@objective

JuMP.@objectiveMacro
@objective(model::GenericModel, sense, func)

Set the objective sense to sense and objective function to func.

The objective sense can be either Min, Max, MOI.MIN_SENSE, MOI.MAX_SENSE or MOI.FEASIBILITY_SENSE. In order to set the sense programmatically, that is, when sense is a variable whose value is the sense, one of the three MOI.OptimizationSense values must be used.

Example

Minimize the value of the variable x, do:

julia> model = Model();
+640
source

@objective

JuMP.@objectiveMacro
@objective(model::GenericModel, sense, func)

Set the objective sense to sense and objective function to func.

The objective sense can be either Min, Max, MOI.MIN_SENSE, MOI.MAX_SENSE or MOI.FEASIBILITY_SENSE. In order to set the sense programmatically, that is, when sense is a variable whose value is the sense, one of the three MOI.OptimizationSense values must be used.

Example

Minimize the value of the variable x, do:

julia> model = Model();
 
 julia> @variable(model, x)
 x
@@ -165,7 +165,7 @@
 MIN_SENSE::OptimizationSense = 0
 
 julia> @objective(model, sense, x^2 - 2x + 1)
-x² - 2 x + 1
source

@operator

JuMP.@operatorMacro
@operator(model, operator, dim, f[, ∇f[, ∇²f]])

Add the nonlinear operator operator in model with dim arguments, and create a new NonlinearOperator object called operator in the current scope.

The function f evaluates the operator and must return a scalar.

The optional function ∇f evaluates the first derivative, and the optional function ∇²f evaluates the second derivative.

∇²f may be provided only if ∇f is also provided.

Univariate syntax

If dim == 1, then the method signatures of each function must be:

  • f(::T)::T where {T<:Real}
  • ∇f(::T)::T where {T<:Real}
  • ∇²f(::T)::T where {T<:Real}

Multivariate syntax

If dim > 1, then the method signatures of each function must be:

  • f(x::T...)::T where {T<:Real}
  • ∇f(g::AbstractVector{T}, x::T...)::Nothing where {T<:Real}
  • ∇²f(H::AbstractMatrix{T}, x::T...)::Nothing where {T<:Real}

Where the gradient vector g and Hessian matrix H are filled in-place. For the Hessian, you must fill in the non-zero lower-triangular entries only. Setting an off-diagonal upper-triangular element may error.

Example

julia> model = Model();
+x² - 2 x + 1
source

@operator

JuMP.@operatorMacro
@operator(model, operator, dim, f[, ∇f[, ∇²f]])

Add the nonlinear operator operator in model with dim arguments, and create a new NonlinearOperator object called operator in the current scope.

The function f evaluates the operator and must return a scalar.

The optional function ∇f evaluates the first derivative, and the optional function ∇²f evaluates the second derivative.

∇²f may be provided only if ∇f is also provided.

Univariate syntax

If dim == 1, then the method signatures of each function must be:

  • f(::T)::T where {T<:Real}
  • ∇f(::T)::T where {T<:Real}
  • ∇²f(::T)::T where {T<:Real}

Multivariate syntax

If dim > 1, then the method signatures of each function must be:

  • f(x::T...)::T where {T<:Real}
  • ∇f(g::AbstractVector{T}, x::T...)::Nothing where {T<:Real}
  • ∇²f(H::AbstractMatrix{T}, x::T...)::Nothing where {T<:Real}

Where the gradient vector g and Hessian matrix H are filled in-place. For the Hessian, you must fill in the non-zero lower-triangular entries only. Setting an off-diagonal upper-triangular element may error.

Example

julia> model = Model();
 
 julia> @variable(model, x)
 x
@@ -204,7 +204,7 @@
 f (generic function with 1 method)
 
 julia> op_f = model[:op_f] = add_nonlinear_operator(model, 1, f; name = :op_f)
-NonlinearOperator(f, :op_f)
source

@variable

JuMP.@variableMacro
@variable(model, expr, args..., kw_args...)

Add a variable to the model model described by the expression expr, the positional arguments args and the keyword arguments kw_args.

Anonymous and named variables

expr must be one of the forms:

  • Omitted, like @variable(model), which creates an anonymous variable
  • A single symbol like @variable(model, x)
  • A container expression like @variable(model, x[i=1:3])
  • An anonymous container expression like @variable(model, [i=1:3])

Bounds

In addition, the expression can have bounds, such as:

  • @variable(model, x >= 0)
  • @variable(model, x <= 0)
  • @variable(model, x == 0)
  • @variable(model, 0 <= x <= 1)

and bounds can depend on the indices of the container expressions:

  • @variable(model, -i <= x[i=1:3] <= i)

Sets

You can explicitly specify the set to which the variable belongs:

  • @variable(model, x in MOI.Interval(0.0, 1.0))

For more information on this syntax, read Variables constrained on creation.

Positional arguments

The recognized positional arguments in args are the following:

  • Bin: restricts the variable to the MOI.ZeroOne set, that is, {0, 1}. For example, @variable(model, x, Bin). Note: you cannot use @variable(model, Bin), use the binary keyword instead.
  • Int: restricts the variable to the set of integers, that is, ..., -2, -1, 0, 1, 2, ... For example, @variable(model, x, Int). Note: you cannot use @variable(model, Int), use the integer keyword instead.
  • Symmetric: Only available when creating a square matrix of variables, that is when expr is of the form varname[1:n,1:n] or varname[i=1:n,j=1:n], it creates a symmetric matrix of variables.
  • PSD: A restrictive extension to Symmetric which constraints a square matrix of variables to Symmetric and constrains to be positive semidefinite.

Keyword arguments

Four keyword arguments are useful in all cases:

  • base_name: Sets the name prefix used to generate variable names. It corresponds to the variable name for scalar variable, otherwise, the variable names are set to base_name[...] for each index ... of the axes axes.
  • start::Float64: specify the value passed to set_start_value for each variable
  • container: specify the container type. See Forcing the container type for more information.
  • set_string_name::Bool = true: control whether to set the MOI.VariableName attribute. Passing set_string_name = false can improve performance.

Other keyword arguments are needed to disambiguate sitations with anonymous variables:

  • lower_bound::Float64: an alternative to x >= lb, sets the value of the variable lower bound.
  • upper_bound::Float64: an alternative to x <= ub, sets the value of the variable upper bound.
  • binary::Bool: an alternative to passing Bin, sets whether the variable is binary or not.
  • integer::Bool: an alternative to passing Int, sets whether the variable is integer or not.
  • set::MOI.AbstractSet: an alternative to using x in set
  • variable_type: used by JuMP extensions. See Extend @variable for more information.

Example

The following are equivalent ways of creating a variable x of name x with lower bound 0:

julia> model = Model();
+NonlinearOperator(f, :op_f)
source

@variable

JuMP.@variableMacro
@variable(model, expr, args..., kw_args...)

Add a variable to the model model described by the expression expr, the positional arguments args and the keyword arguments kw_args.

Anonymous and named variables

expr must be one of the forms:

  • Omitted, like @variable(model), which creates an anonymous variable
  • A single symbol like @variable(model, x)
  • A container expression like @variable(model, x[i=1:3])
  • An anonymous container expression like @variable(model, [i=1:3])

Bounds

In addition, the expression can have bounds, such as:

  • @variable(model, x >= 0)
  • @variable(model, x <= 0)
  • @variable(model, x == 0)
  • @variable(model, 0 <= x <= 1)

and bounds can depend on the indices of the container expressions:

  • @variable(model, -i <= x[i=1:3] <= i)

Sets

You can explicitly specify the set to which the variable belongs:

  • @variable(model, x in MOI.Interval(0.0, 1.0))

For more information on this syntax, read Variables constrained on creation.

Positional arguments

The recognized positional arguments in args are the following:

  • Bin: restricts the variable to the MOI.ZeroOne set, that is, {0, 1}. For example, @variable(model, x, Bin). Note: you cannot use @variable(model, Bin), use the binary keyword instead.
  • Int: restricts the variable to the set of integers, that is, ..., -2, -1, 0, 1, 2, ... For example, @variable(model, x, Int). Note: you cannot use @variable(model, Int), use the integer keyword instead.
  • Symmetric: Only available when creating a square matrix of variables, that is when expr is of the form varname[1:n,1:n] or varname[i=1:n,j=1:n], it creates a symmetric matrix of variables.
  • PSD: A restrictive extension to Symmetric which constraints a square matrix of variables to Symmetric and constrains to be positive semidefinite.

Keyword arguments

Four keyword arguments are useful in all cases:

  • base_name: Sets the name prefix used to generate variable names. It corresponds to the variable name for scalar variable, otherwise, the variable names are set to base_name[...] for each index ... of the axes axes.
  • start::Float64: specify the value passed to set_start_value for each variable
  • container: specify the container type. See Forcing the container type for more information.
  • set_string_name::Bool = true: control whether to set the MOI.VariableName attribute. Passing set_string_name = false can improve performance.

Other keyword arguments are needed to disambiguate sitations with anonymous variables:

  • lower_bound::Float64: an alternative to x >= lb, sets the value of the variable lower bound.
  • upper_bound::Float64: an alternative to x <= ub, sets the value of the variable upper bound.
  • binary::Bool: an alternative to passing Bin, sets whether the variable is binary or not.
  • integer::Bool: an alternative to passing Int, sets whether the variable is integer or not.
  • set::MOI.AbstractSet: an alternative to using x in set
  • variable_type: used by JuMP extensions. See Extend @variable for more information.

Example

The following are equivalent ways of creating a variable x of name x with lower bound 0:

julia> model = Model();
 
 julia> @variable(model, x >= 0)
 x
julia> model = Model();
@@ -233,14 +233,14 @@
 3-element Vector{VariableRef}:
  _[7]
  _[8]
- _[9]
source

@variables

JuMP.@variablesMacro
@variables(model, args...)

Adds multiple variables to model at once, in the same fashion as the @variable macro.

The model must be the first argument, and multiple variables can be added on multiple lines wrapped in a begin ... end block.

The macro returns a tuple containing the variables that were defined.

Example

julia> model = Model();
+ _[9]
source

@variables

JuMP.@variablesMacro
@variables(model, args...)

Adds multiple variables to model at once, in the same fashion as the @variable macro.

The model must be the first argument, and multiple variables can be added on multiple lines wrapped in a begin ... end block.

The macro returns a tuple containing the variables that were defined.

Example

julia> model = Model();
 
 julia> @variables(model, begin
            x
            y[i = 1:2] >= 0, (start = i)
            z, Bin, (start = 0, base_name = "Z")
        end)
-(x, VariableRef[y[1], y[2]], Z)
Note

Keyword arguments must be contained within parentheses (refer to the example above).

source

add_bridge

JuMP.add_bridgeFunction
add_bridge(
+(x, VariableRef[y[1], y[2]], Z)
Note

Keyword arguments must be contained within parentheses (refer to the example above).

source

add_bridge

JuMP.add_bridgeFunction
add_bridge(
     model::GenericModel{T},
     BT::Type{<:MOI.Bridges.AbstractBridge};
     coefficient_type::Type{S} = T,
@@ -252,11 +252,11 @@
            model,
            MOI.Bridges.Constraint.NumberConversionBridge;
            coefficient_type = Complex{Float64}
-       )
source

add_constraint

JuMP.add_constraintFunction
add_constraint(
+       )
source

add_constraint

JuMP.add_constraintFunction
add_constraint(
     model::GenericModel,
     con::AbstractConstraint,
     name::String= "",
-)

This method should only be implemented by developers creating JuMP extensions. It should never be called by users of JuMP.

source

add_nonlinear_operator

JuMP.add_nonlinear_operatorFunction
add_nonlinear_operator(
+)

This method should only be implemented by developers creating JuMP extensions. It should never be called by users of JuMP.

source

add_nonlinear_operator

JuMP.add_nonlinear_operatorFunction
add_nonlinear_operator(
     model::Model,
     dim::Int,
     f::Function,
@@ -284,7 +284,7 @@
 f(x)
 
 julia> op_f(2.0)
-4.0
source

add_to_expression!

JuMP.add_to_expression!Function
add_to_expression!(expression, terms...)

Updates expression in-place to expression + (*)(terms...).

This is typically much more efficient than expression += (*)(terms...) because it avoids the temorary allocation of the right-hand side term.

For example, add_to_expression!(expression, a, b) produces the same result as expression += a*b, and add_to_expression!(expression, a) produces the same result as expression += a.

When to implement

Only a few methods are defined, mostly for internal use, and only for the cases when:

  1. they can be implemented efficiently
  2. expression is capable of storing the result. For example, add_to_expression!(::AffExpr, ::GenericVariableRef, ::GenericVariableRef) is not defined because a GenericAffExpr cannot store the product of two variables.

Example

julia> model = Model();
+4.0
source

add_to_expression!

JuMP.add_to_expression!Function
add_to_expression!(expression, terms...)

Updates expression in-place to expression + (*)(terms...).

This is typically much more efficient than expression += (*)(terms...) because it avoids the temorary allocation of the right-hand side term.

For example, add_to_expression!(expression, a, b) produces the same result as expression += a*b, and add_to_expression!(expression, a) produces the same result as expression += a.

When to implement

Only a few methods are defined, mostly for internal use, and only for the cases when:

  1. they can be implemented efficiently
  2. expression is capable of storing the result. For example, add_to_expression!(::AffExpr, ::GenericVariableRef, ::GenericVariableRef) is not defined because a GenericAffExpr cannot store the product of two variables.

Example

julia> model = Model();
 
 julia> @variable(model, x)
 x
@@ -296,7 +296,7 @@
 4 x + 2
 
 julia> expr
-4 x + 2
source

add_to_function_constant

JuMP.add_to_function_constantFunction
add_to_function_constant(constraint::ConstraintRef, value)

Add value to the function constant term of constraint.

Note that for scalar constraints, JuMP will aggregate all constant terms onto the right-hand side of the constraint so instead of modifying the function, the set will be translated by -value. For example, given a constraint 2x <= 3, add_to_function_constant(c, 4) will modify it to 2x <= -1.

Example

For scalar constraints, the set is translated by -value:

julia> model = Model();
+4 x + 2
source

add_to_function_constant

JuMP.add_to_function_constantFunction
add_to_function_constant(constraint::ConstraintRef, value)

Add value to the function constant term of constraint.

Note that for scalar constraints, JuMP will aggregate all constant terms onto the right-hand side of the constraint so instead of modifying the function, the set will be translated by -value. For example, given a constraint 2x <= 3, add_to_function_constant(c, 4) will modify it to 2x <= -1.

Example

For scalar constraints, the set is translated by -value:

julia> model = Model();
 
 julia> @variable(model, x);
 
@@ -318,7 +318,7 @@
 julia> add_to_function_constant(con, [1, 2, 2])
 
 julia> con
-con : [x + y + 1, x + 2, y + 2] ∈ MathOptInterface.SecondOrderCone(3)
source

add_variable

JuMP.add_variableFunction
add_variable(m::GenericModel, v::AbstractVariable, name::String = "")

This method should only be implemented by developers creating JuMP extensions. It should never be called by users of JuMP.

source

all_constraints

JuMP.all_constraintsFunction
all_constraints(model::GenericModel, function_type, set_type)::Vector{<:ConstraintRef}

Return a list of all constraints currently in the model where the function has type function_type and the set has type set_type. The constraints are ordered by creation time.

See also list_of_constraint_types and num_constraints.

Example

julia> model = Model();
+con : [x + y + 1, x + 2, y + 2] ∈ MathOptInterface.SecondOrderCone(3)
source

add_variable

JuMP.add_variableFunction
add_variable(m::GenericModel, v::AbstractVariable, name::String = "")

This method should only be implemented by developers creating JuMP extensions. It should never be called by users of JuMP.

source

all_constraints

JuMP.all_constraintsFunction
all_constraints(model::GenericModel, function_type, set_type)::Vector{<:ConstraintRef}

Return a list of all constraints currently in the model where the function has type function_type and the set has type set_type. The constraints are ordered by creation time.

See also list_of_constraint_types and num_constraints.

Example

julia> model = Model();
 
 julia> @variable(model, x >= 0, Bin);
 
@@ -334,7 +334,7 @@
 
 julia> all_constraints(model, AffExpr, MOI.LessThan{Float64})
 1-element Vector{ConstraintRef{Model, MathOptInterface.ConstraintIndex{MathOptInterface.ScalarAffineFunction{Float64}, MathOptInterface.LessThan{Float64}}, ScalarShape}}:
- 2 x ≤ 1
source
all_constraints(
+ 2 x ≤ 1
source
all_constraints(
     model::GenericModel;
     include_variable_in_set_constraints::Bool,
 )::Vector{ConstraintRef}

Return a list of all constraints in model.

If include_variable_in_set_constraints == true, then VariableRef constraints such as VariableRef-in-Integer are included. To return only the structural constraints (for example, the rows in the constraint matrix of a linear program), pass include_variable_in_set_constraints = false.

Example

julia> model = Model();
@@ -355,7 +355,7 @@
 julia> all_constraints(model; include_variable_in_set_constraints = false)
 2-element Vector{ConstraintRef}:
  2 x ≤ 1
- x ^ 2.0 - 1.0 ≤ 0

Performance considerations

Note that this function is type-unstable because it returns an abstractly typed vector. If performance is a problem, consider using list_of_constraint_types and a function barrier. See the Performance tips for extensions section of the documentation for more details.

source

all_variables

JuMP.all_variablesFunction
all_variables(model::GenericModel{T})::Vector{GenericVariableRef{T}} where {T}

Returns a list of all variables currently in the model. The variables are ordered by creation time.

Example

julia> model = Model();
+ x ^ 2.0 - 1.0 ≤ 0

Performance considerations

Note that this function is type-unstable because it returns an abstractly typed vector. If performance is a problem, consider using list_of_constraint_types and a function barrier. See the Performance tips for extensions section of the documentation for more details.

source

all_variables

JuMP.all_variablesFunction
all_variables(model::GenericModel{T})::Vector{GenericVariableRef{T}} where {T}

Returns a list of all variables currently in the model. The variables are ordered by creation time.

Example

julia> model = Model();
 
 julia> @variable(model, x);
 
@@ -364,12 +364,12 @@
 julia> all_variables(model)
 2-element Vector{VariableRef}:
  x
- y
source

anonymous_name

JuMP.anonymous_nameFunction
anonymous_name(::MIME, x::AbstractVariableRef)

The name to use for an anonymous variable x when printing.

Example

julia> model = Model();
+ y
source

anonymous_name

JuMP.anonymous_nameFunction
anonymous_name(::MIME, x::AbstractVariableRef)

The name to use for an anonymous variable x when printing.

Example

julia> model = Model();
 
 julia> x = @variable(model);
 
 julia> anonymous_name(MIME("text/plain"), x)
-"_[1]"
source

backend

JuMP.backendFunction
backend(model::GenericModel)

Return the lower-level MathOptInterface model that sits underneath JuMP. This model depends on which operating mode JuMP is in (see mode).

  • If JuMP is in DIRECT mode (that is, the model was created using direct_model), the backend will be the optimizer passed to direct_model.
  • If JuMP is in MANUAL or AUTOMATIC mode, the backend is a MOI.Utilities.CachingOptimizer.

Use index to get the index of a variable or constraint in the backend model.

Warning

This function should only be used by advanced users looking to access low-level MathOptInterface or solver-specific functionality.

Notes

If JuMP is not in DIRECT mode, the type returned by backend may change between any JuMP releases. Therefore, only use the public API exposed by MathOptInterface, and do not access internal fields. If you require access to the innermost optimizer, see unsafe_backend. Alternatively, use direct_model to create a JuMP model in DIRECT mode.

See also: unsafe_backend.

Example

julia> import HiGHS
+"_[1]"
source

backend

JuMP.backendFunction
backend(model::GenericModel)

Return the lower-level MathOptInterface model that sits underneath JuMP. This model depends on which operating mode JuMP is in (see mode).

  • If JuMP is in DIRECT mode (that is, the model was created using direct_model), the backend will be the optimizer passed to direct_model.
  • If JuMP is in MANUAL or AUTOMATIC mode, the backend is a MOI.Utilities.CachingOptimizer.

Use index to get the index of a variable or constraint in the backend model.

Warning

This function should only be used by advanced users looking to access low-level MathOptInterface or solver-specific functionality.

Notes

If JuMP is not in DIRECT mode, the type returned by backend may change between any JuMP releases. Therefore, only use the public API exposed by MathOptInterface, and do not access internal fields. If you require access to the innermost optimizer, see unsafe_backend. Alternatively, use direct_model to create a JuMP model in DIRECT mode.

See also: unsafe_backend.

Example

julia> import HiGHS
 
 julia> model = direct_model(HiGHS.Optimizer());
 
@@ -382,7 +382,7 @@
 A HiGHS model with 1 columns and 0 rows.
 
 julia> index(x)
-MOI.VariableIndex(1)
source

barrier_iterations

JuMP.barrier_iterationsFunction
barrier_iterations(model::GenericModel)

If available, returns the cumulative number of barrier iterations during the most-recent optimization (the MOI.BarrierIterations attribute).

Throws a MOI.GetAttributeNotAllowed error if the attribute is not implemented by the solver.

Example

julia> import HiGHS
+MOI.VariableIndex(1)
source

barrier_iterations

JuMP.barrier_iterationsFunction
barrier_iterations(model::GenericModel)

If available, returns the cumulative number of barrier iterations during the most-recent optimization (the MOI.BarrierIterations attribute).

Throws a MOI.GetAttributeNotAllowed error if the attribute is not implemented by the solver.

Example

julia> import HiGHS
 
 julia> model = Model(HiGHS.Optimizer);
 
@@ -391,7 +391,7 @@
 julia> optimize!(model)
 
 julia> barrier_iterations(model)
-0
source

bridge_constraints

JuMP.bridge_constraintsFunction
bridge_constraints(model::GenericModel)

When in direct mode, return false.

When in manual or automatic mode, return a Bool indicating whether the optimizer is set and unsupported constraints are automatically bridged to equivalent supported constraints when an appropriate transformation is available.

Example

julia> import Ipopt
+0
source

bridge_constraints

JuMP.bridge_constraintsFunction
bridge_constraints(model::GenericModel)

When in direct mode, return false.

When in manual or automatic mode, return a Bool indicating whether the optimizer is set and unsupported constraints are automatically bridged to equivalent supported constraints when an appropriate transformation is available.

Example

julia> import Ipopt
 
 julia> model = Model(Ipopt.Optimizer);
 
@@ -401,14 +401,14 @@
 julia> model = Model(Ipopt.Optimizer; add_bridges = false);
 
 julia> bridge_constraints(model)
-false
source

build_constraint

JuMP.build_constraintFunction
build_constraint(error_fn::Function, func, set, args...; kwargs...)

This method should only be implemented by developers creating JuMP extensions. It should never be called by users of JuMP.

source

build_variable

JuMP.build_variableFunction
build_variable(
+false
source

build_constraint

JuMP.build_constraintFunction
build_constraint(error_fn::Function, func, set, args...; kwargs...)

This method should only be implemented by developers creating JuMP extensions. It should never be called by users of JuMP.

source

build_variable

JuMP.build_variableFunction
build_variable(
     error_fn::Function,
     info::VariableInfo,
     args...;
     kwargs...,
 )

Return a new AbstractVariable object.

This method should only be implemented by developers creating JuMP extensions. It should never be called by users of JuMP.

Arguments

  • error_fn: a function to call instead of error. error_fn annotates the error message with additional information for the user.
  • info: an instance of VariableInfo. This has a variety of fields relating to the variable such as info.lower_bound and info.binary.
  • args: optional additional positional arguments for extending the @variable macro.
  • kwargs: optional keyword arguments for extending the @variable macro.

See also: @variable

Warning

Extensions should define a method with ONE positional argument to dispatch the call to a different method. Creating an extension that relies on multiple positional arguments leads to MethodErrors if the user passes the arguments in the wrong order.

Example

@variable(model, x, Foo)

will call

build_variable(error_fn::Function, info::VariableInfo, ::Type{Foo})

Passing special-case positional arguments such as Bin, Int, and PSD is okay, along with keyword arguments:

@variable(model, x, Int, Foo(), mykwarg = true)
 # or
-@variable(model, x, Foo(), Int, mykwarg = true)

will call

build_variable(error_fn::Function, info::VariableInfo, ::Foo; mykwarg)

and info.integer will be true.

Note that the order of the positional arguments does not matter.

source

callback_node_status

JuMP.callback_node_statusFunction
callback_node_status(cb_data, model::GenericModel)

Return an MOI.CallbackNodeStatusCode enum, indicating if the current primal solution available from callback_value is integer feasible.

Example

julia> import GLPK
+@variable(model, x, Foo(), Int, mykwarg = true)

will call

build_variable(error_fn::Function, info::VariableInfo, ::Foo; mykwarg)

and info.integer will be true.

Note that the order of the positional arguments does not matter.

source

callback_node_status

JuMP.callback_node_statusFunction
callback_node_status(cb_data, model::GenericModel)

Return an MOI.CallbackNodeStatusCode enum, indicating if the current primal solution available from callback_value is integer feasible.

Example

julia> import GLPK
 
 julia> model = Model(GLPK.Optimizer);
 
@@ -429,7 +429,7 @@
 Status is: CALLBACK_NODE_STATUS_UNKNOWN
 Status is: CALLBACK_NODE_STATUS_UNKNOWN
 Status is: CALLBACK_NODE_STATUS_INTEGER
-Status is: CALLBACK_NODE_STATUS_INTEGER
source

callback_value

JuMP.callback_valueFunction
callback_value(cb_data, x::GenericVariableRef)
+Status is: CALLBACK_NODE_STATUS_INTEGER
source

callback_value

JuMP.callback_valueFunction
callback_value(cb_data, x::GenericVariableRef)
 callback_value(cb_data, x::Union{GenericAffExpr,GenericQuadExpr})

Return the primal solution of x inside a callback.

cb_data is the argument to the callback function, and the type is dependent on the solver.

Use callback_node_status to check whether a solution is available.

Example

julia> import GLPK
 
 julia> model = Model(GLPK.Optimizer);
@@ -451,7 +451,7 @@
 
 julia> optimize!(model)
 Solution is: 10.0
-Solution is: 10.0
source

check_belongs_to_model

JuMP.check_belongs_to_modelFunction
check_belongs_to_model(x::AbstractJuMPScalar, model::AbstractModel)
+Solution is: 10.0
source

check_belongs_to_model

JuMP.check_belongs_to_modelFunction
check_belongs_to_model(x::AbstractJuMPScalar, model::AbstractModel)
 check_belongs_to_model(x::AbstractConstraint, model::AbstractModel)

Throw VariableNotOwned if the owner_model of x is not model.

Example

julia> model = Model();
 
 julia> @variable(model, x);
@@ -463,7 +463,7 @@
 julia> check_belongs_to_model(x, model_2)
 ERROR: VariableNotOwned{VariableRef}(x): the variable x cannot be used in this model because
 it belongs to a different model.
-[...]
source

coefficient

JuMP.coefficientFunction
coefficient(v1::GenericVariableRef{T}, v2::GenericVariableRef{T}) where {T}

Return one(T) if v1 == v2 and zero(T) otherwise.

This is a fallback for other coefficient methods to simplify code in which the expression may be a single variable.

Example

julia> model = Model();
+[...]
source

coefficient

JuMP.coefficientFunction
coefficient(v1::GenericVariableRef{T}, v2::GenericVariableRef{T}) where {T}

Return one(T) if v1 == v2 and zero(T) otherwise.

This is a fallback for other coefficient methods to simplify code in which the expression may be a single variable.

Example

julia> model = Model();
 
 julia> @variable(model, x[1:2]);
 
@@ -471,14 +471,14 @@
 1.0
 
 julia> coefficient(x[1], x[2])
-0.0
source
coefficient(a::GenericAffExpr{C,V}, v::V) where {C,V}

Return the coefficient associated with variable v in the affine expression a.

Example

julia> model = Model();
+0.0
source
coefficient(a::GenericAffExpr{C,V}, v::V) where {C,V}

Return the coefficient associated with variable v in the affine expression a.

Example

julia> model = Model();
 
 julia> @variable(model, x);
 
 julia> expr = 2.0 * x + 1.0;
 
 julia> coefficient(expr, x)
-2.0
source
coefficient(a::GenericQuadExpr{C,V}, v1::V, v2::V) where {C,V}

Return the coefficient associated with the term v1 * v2 in the quadratic expression a.

Note that coefficient(a, v1, v2) is the same as coefficient(a, v2, v1).

Example

julia> model = Model();
+2.0
source
coefficient(a::GenericQuadExpr{C,V}, v1::V, v2::V) where {C,V}

Return the coefficient associated with the term v1 * v2 in the quadratic expression a.

Note that coefficient(a, v1, v2) is the same as coefficient(a, v2, v1).

Example

julia> model = Model();
 
 julia> @variable(model, x[1:2]);
 
@@ -491,14 +491,14 @@
 2.0
 
 julia> coefficient(expr, x[1], x[1])
-0.0
source
coefficient(a::GenericQuadExpr{C,V}, v::V) where {C,V}

Return the coefficient associated with variable v in the affine component of a.

Example

julia> model = Model();
+0.0
source
coefficient(a::GenericQuadExpr{C,V}, v::V) where {C,V}

Return the coefficient associated with variable v in the affine component of a.

Example

julia> model = Model();
 
 julia> @variable(model, x);
 
 julia> expr = 2.0 * x^2 + 3.0 * x;
 
 julia> coefficient(expr, x)
-3.0
source

compute_conflict!

JuMP.compute_conflict!Function
compute_conflict!(model::GenericModel)

Compute a conflict if the model is infeasible.

The conflict is also called the Irreducible Infeasible Subsystem (IIS).

If an optimizer has not been set yet (see set_optimizer), a NoOptimizer error is thrown.

The status of the conflict can be checked with the MOI.ConflictStatus model attribute. Then, the status for each constraint can be queried with the MOI.ConstraintConflictStatus attribute.

See also: copy_conflict

Example

julia> using JuMP
+3.0
source

compute_conflict!

JuMP.compute_conflict!Function
compute_conflict!(model::GenericModel)

Compute a conflict if the model is infeasible.

The conflict is also called the Irreducible Infeasible Subsystem (IIS).

If an optimizer has not been set yet (see set_optimizer), a NoOptimizer error is thrown.

The status of the conflict can be checked with the MOI.ConflictStatus model attribute. Then, the status for each constraint can be queried with the MOI.ConstraintConflictStatus attribute.

See also: copy_conflict

Example

julia> using JuMP
 
 julia> model = Model(Gurobi.Optimizer);
 
@@ -515,21 +515,21 @@
 julia> compute_conflict!(model)
 
 julia> get_attribute(model, MOI.ConflictStatus())
-CONFLICT_FOUND::ConflictStatusCode = 3
source

constant

JuMP.constantFunction
constant(aff::GenericAffExpr{C,V})::C

Return the constant of the affine expression.

Example

julia> model = Model();
+CONFLICT_FOUND::ConflictStatusCode = 3
source

constant

JuMP.constantFunction
constant(aff::GenericAffExpr{C,V})::C

Return the constant of the affine expression.

Example

julia> model = Model();
 
 julia> @variable(model, x);
 
 julia> aff = 2.0 * x + 3.0;
 
 julia> constant(aff)
-3.0
source
constant(quad::GenericQuadExpr{C,V})::C

Return the constant of the quadratic expression.

Example

julia> model = Model();
+3.0
source
constant(quad::GenericQuadExpr{C,V})::C

Return the constant of the quadratic expression.

Example

julia> model = Model();
 
 julia> @variable(model, x);
 
 julia> quad = 2.0 * x^2 + 3.0;
 
 julia> constant(quad)
-3.0
source

constraint_by_name

JuMP.constraint_by_nameFunction
constraint_by_name(model::AbstractModel, name::String, [F, S])::Union{ConstraintRef,Nothing}

Return the reference of the constraint with name attribute name or Nothing if no constraint has this name attribute.

Throws an error if several constraints have name as their name attribute.

If F and S are provided, this method addititionally throws an error if the constraint is not an F-in-S contraint where F is either the JuMP or MOI type of the function and S is the MOI type of the set.

Providing F and S is recommended if you know the type of the function and set since its returned type can be inferred while for the method above (that is, without F and S), the exact return type of the constraint index cannot be inferred.

Example

julia> model = Model();
+3.0
source

constraint_by_name

JuMP.constraint_by_nameFunction
constraint_by_name(model::AbstractModel, name::String, [F, S])::Union{ConstraintRef,Nothing}

Return the reference of the constraint with name attribute name or Nothing if no constraint has this name attribute.

Throws an error if several constraints have name as their name attribute.

If F and S are provided, this method addititionally throws an error if the constraint is not an F-in-S contraint where F is either the JuMP or MOI type of the function and S is the MOI type of the set.

Providing F and S is recommended if you know the type of the function and set since its returned type can be inferred while for the method above (that is, without F and S), the exact return type of the constraint index cannot be inferred.

Example

julia> model = Model();
 
 julia> @variable(model, x)
 x
@@ -545,7 +545,7 @@
 julia> constraint_by_name(model, "con", AffExpr, MOI.EqualTo{Float64})
 
 julia> constraint_by_name(model, "con", QuadExpr, MOI.EqualTo{Float64})
-con : x² = 1
source

constraint_object

JuMP.constraint_objectFunction
constraint_object(con_ref::ConstraintRef)

Return the underlying constraint data for the constraint referenced by con_ref.

Example

A scalar constraint:

julia> model = Model();
+con : x² = 1
source

constraint_object

JuMP.constraint_objectFunction
constraint_object(con_ref::ConstraintRef)

Return the underlying constraint data for the constraint referenced by con_ref.

Example

A scalar constraint:

julia> model = Model();
 
 julia> @variable(model, x);
 
@@ -582,7 +582,7 @@
  x[3]
 
 julia> object.set
-MathOptInterface.SecondOrderCone(3)
source

constraint_ref_with_index

JuMP.constraint_ref_with_indexFunction
constraint_ref_with_index(model::AbstractModel, index::MOI.ConstraintIndex)

Return a ConstraintRef of model corresponding to index.

This function is a helper function used internally by JuMP and some JuMP extensions. It should not need to be called in user-code.

source

constraint_string

JuMP.constraint_stringFunction
constraint_string(
+MathOptInterface.SecondOrderCone(3)
source

constraint_ref_with_index

JuMP.constraint_ref_with_indexFunction
constraint_ref_with_index(model::AbstractModel, index::MOI.ConstraintIndex)

Return a ConstraintRef of model corresponding to index.

This function is a helper function used internally by JuMP and some JuMP extensions. It should not need to be called in user-code.

source

constraint_string

JuMP.constraint_stringFunction
constraint_string(
     mode::MIME,
     ref::ConstraintRef;
     in_math_mode::Bool = false,
@@ -593,7 +593,7 @@
 julia> @constraint(model, c, 2 * x <= 1);
 
 julia> constraint_string(MIME("text/plain"), c)
-"c : 2 x ≤ 1"
source

constraints_string

JuMP.constraints_stringFunction
constraints_string(mode, model::AbstractModel)::Vector{String}

Return a list of Strings describing each constraint of the model.

Example

julia> model = Model();
+"c : 2 x ≤ 1"
source

constraints_string

JuMP.constraints_stringFunction
constraints_string(mode, model::AbstractModel)::Vector{String}

Return a list of Strings describing each constraint of the model.

Example

julia> model = Model();
 
 julia> @variable(model, x >= 0);
 
@@ -602,7 +602,7 @@
 julia> constraints_string(MIME("text/plain"), model)
 2-element Vector{String}:
  "c : 2 x ≤ 1"
- "x ≥ 0"
source

copy_conflict

JuMP.copy_conflictFunction
copy_conflict(model::GenericModel)

Return a copy of the current conflict for the model model and a GenericReferenceMap that can be used to obtain the variable and constraint reference of the new model corresponding to a given model's reference.

This is a convenience function that provides a filtering function for copy_model.

Note

Model copy is not supported in DIRECT mode, that is, when a model is constructed using the direct_model constructor instead of the Model constructor. Moreover, independently on whether an optimizer was provided at model construction, the new model will have no optimizer, that is, an optimizer will have to be provided to the new model in the optimize! call.

Example

In the following example, a model model is constructed with a variable x and two constraints c1 and c2. This model has no solution, as the two constraints are mutually exclusive. The solver is asked to compute a conflict with compute_conflict!. The parts of model participating in the conflict are then copied into a model iis_model.

julia> using JuMP
+ "x ≥ 0"
source

copy_conflict

JuMP.copy_conflictFunction
copy_conflict(model::GenericModel)

Return a copy of the current conflict for the model model and a GenericReferenceMap that can be used to obtain the variable and constraint reference of the new model corresponding to a given model's reference.

This is a convenience function that provides a filtering function for copy_model.

Note

Model copy is not supported in DIRECT mode, that is, when a model is constructed using the direct_model constructor instead of the Model constructor. Moreover, independently on whether an optimizer was provided at model construction, the new model will have no optimizer, that is, an optimizer will have to be provided to the new model in the optimize! call.

Example

In the following example, a model model is constructed with a variable x and two constraints c1 and c2. This model has no solution, as the two constraints are mutually exclusive. The solver is asked to compute a conflict with compute_conflict!. The parts of model participating in the conflict are then copied into a model iis_model.

julia> using JuMP
 
 julia> import Gurobi
 
@@ -630,7 +630,7 @@
 Feasibility
 Subject to
  c1 : x ≥ 2
- c2 : x ≤ 1
source

copy_extension_data

JuMP.copy_extension_dataFunction
copy_extension_data(data, new_model::AbstractModel, model::AbstractModel)

Return a copy of the extension data data of the model model to the extension data of the new model new_model.

A method should be added for any JuMP extension storing data in the ext field.

This method should only be implemented by developers creating JuMP extensions. It should never be called by users of JuMP.

Warning

Do not engage in type piracy by implementing this method for types of data that you did not define! JuMP extensions should store types that they define in model.ext, rather than regular Julia types.

source

copy_model

JuMP.copy_modelFunction
copy_model(model::GenericModel; filter_constraints::Union{Nothing, Function}=nothing)

Return a copy of the model model and a GenericReferenceMap that can be used to obtain the variable and constraint reference of the new model corresponding to a given model's reference. A Base.copy(::AbstractModel) method has also been implemented, it is similar to copy_model but does not return the reference map.

If the filter_constraints argument is given, only the constraints for which this function returns true will be copied. This function is given a constraint reference as argument.

Note

Model copy is not supported in DIRECT mode, that is, when a model is constructed using the direct_model constructor instead of the Model constructor. Moreover, independently on whether an optimizer was provided at model construction, the new model will have no optimizer, that is, an optimizer will have to be provided to the new model in the optimize! call.

Example

In the following example, a model model is constructed with a variable x and a constraint cref. It is then copied into a model new_model with the new references assigned to x_new and cref_new.

julia> model = Model();
+ c2 : x ≤ 1
source

copy_extension_data

JuMP.copy_extension_dataFunction
copy_extension_data(data, new_model::AbstractModel, model::AbstractModel)

Return a copy of the extension data data of the model model to the extension data of the new model new_model.

A method should be added for any JuMP extension storing data in the ext field.

This method should only be implemented by developers creating JuMP extensions. It should never be called by users of JuMP.

Warning

Do not engage in type piracy by implementing this method for types of data that you did not define! JuMP extensions should store types that they define in model.ext, rather than regular Julia types.

source

copy_model

JuMP.copy_modelFunction
copy_model(model::GenericModel; filter_constraints::Union{Nothing, Function}=nothing)

Return a copy of the model model and a GenericReferenceMap that can be used to obtain the variable and constraint reference of the new model corresponding to a given model's reference. A Base.copy(::AbstractModel) method has also been implemented, it is similar to copy_model but does not return the reference map.

If the filter_constraints argument is given, only the constraints for which this function returns true will be copied. This function is given a constraint reference as argument.

Note

Model copy is not supported in DIRECT mode, that is, when a model is constructed using the direct_model constructor instead of the Model constructor. Moreover, independently on whether an optimizer was provided at model construction, the new model will have no optimizer, that is, an optimizer will have to be provided to the new model in the optimize! call.

Example

In the following example, a model model is constructed with a variable x and a constraint cref. It is then copied into a model new_model with the new references assigned to x_new and cref_new.

julia> model = Model();
 
 julia> @variable(model, x)
 x
@@ -644,7 +644,7 @@
 x
 
 julia> cref_new = reference_map[cref]
-cref : x = 2
source

delete

JuMP.deleteFunction
delete(model::GenericModel, con_ref::ConstraintRef)

Delete the constraint associated with constraint_ref from the model model.

Note that delete does not unregister the name from the model, so adding a new constraint of the same name will throw an error. Use unregister to unregister the name after deletion.

Example

julia> model = Model();
+cref : x = 2
source

delete

JuMP.deleteFunction
delete(model::GenericModel, con_ref::ConstraintRef)

Delete the constraint associated with constraint_ref from the model model.

Note that delete does not unregister the name from the model, so adding a new constraint of the same name will throw an error. Use unregister to unregister the name after deletion.

Example

julia> model = Model();
 
 julia> @variable(model, x);
 
@@ -662,7 +662,7 @@
 julia> model[:c]
 ERROR: KeyError: key :c not found
 Stacktrace:
-[...]
source
delete(model::GenericModel, con_refs::Vector{<:ConstraintRef})

Delete the constraints associated with con_refs from the model model.

Solvers may implement specialized methods for deleting multiple constraints of the same concrete type. These methods may be more efficient than repeatedly calling the single constraint delete method.

See also: unregister

Example

julia> model = Model();
+[...]
source
delete(model::GenericModel, con_refs::Vector{<:ConstraintRef})

Delete the constraints associated with con_refs from the model model.

Solvers may implement specialized methods for deleting multiple constraints of the same concrete type. These methods may be more efficient than repeatedly calling the single constraint delete method.

See also: unregister

Example

julia> model = Model();
 
 julia> @variable(model, x[1:3]);
 
@@ -683,7 +683,7 @@
 julia> model[:c]
 ERROR: KeyError: key :c not found
 Stacktrace:
-[...]
source
delete(model::GenericModel, variable_ref::GenericVariableRef)

Delete the variable associated with variable_ref from the model model.

Note that delete does not unregister the name from the model, so adding a new variable of the same name will throw an error. Use unregister to unregister the name after deletion.

Example

julia> model = Model();
+[...]
source
delete(model::GenericModel, variable_ref::GenericVariableRef)

Delete the variable associated with variable_ref from the model model.

Note that delete does not unregister the name from the model, so adding a new variable of the same name will throw an error. Use unregister to unregister the name after deletion.

Example

julia> model = Model();
 
 julia> @variable(model, x)
 x
@@ -699,7 +699,7 @@
 julia> model[:x]
 ERROR: KeyError: key :x not found
 Stacktrace:
-[...]
source
delete(model::GenericModel, variable_refs::Vector{<:GenericVariableRef})

Delete the variables associated with variable_refs from the model model. Solvers may implement methods for deleting multiple variables that are more efficient than repeatedly calling the single variable delete method.

See also: unregister

Example

julia> model = Model();
+[...]
source
delete(model::GenericModel, variable_refs::Vector{<:GenericVariableRef})

Delete the variables associated with variable_refs from the model model. Solvers may implement methods for deleting multiple variables that are more efficient than repeatedly calling the single variable delete method.

See also: unregister

Example

julia> model = Model();
 
 julia> @variable(model, x[1:2]);
 
@@ -714,7 +714,7 @@
 julia> model[:x]
 ERROR: KeyError: key :x not found
 Stacktrace:
-[...]
source

delete_lower_bound

JuMP.delete_lower_boundFunction
delete_lower_bound(v::GenericVariableRef)

Delete the lower bound constraint of a variable.

See also LowerBoundRef, has_lower_bound, lower_bound, set_lower_bound.

Example

julia> model = Model();
+[...]
source

delete_lower_bound

JuMP.delete_lower_boundFunction
delete_lower_bound(v::GenericVariableRef)

Delete the lower bound constraint of a variable.

See also LowerBoundRef, has_lower_bound, lower_bound, set_lower_bound.

Example

julia> model = Model();
 
 julia> @variable(model, x >= 1.0);
 
@@ -724,7 +724,7 @@
 julia> delete_lower_bound(x)
 
 julia> has_lower_bound(x)
-false
source

delete_upper_bound

JuMP.delete_upper_boundFunction
delete_upper_bound(v::GenericVariableRef)

Delete the upper bound constraint of a variable.

Errors if one does not exist.

See also UpperBoundRef, has_upper_bound, upper_bound, set_upper_bound.

Example

julia> model = Model();
+false
source

delete_upper_bound

JuMP.delete_upper_boundFunction
delete_upper_bound(v::GenericVariableRef)

Delete the upper bound constraint of a variable.

Errors if one does not exist.

See also UpperBoundRef, has_upper_bound, upper_bound, set_upper_bound.

Example

julia> model = Model();
 
 julia> @variable(model, x <= 1.0);
 
@@ -734,10 +734,10 @@
 julia> delete_upper_bound(x)
 
 julia> has_upper_bound(x)
-false
source

direct_generic_model

JuMP.direct_generic_modelFunction
direct_generic_model(
+false
source

direct_generic_model

JuMP.direct_generic_modelFunction
direct_generic_model(
     value_type::Type{T},
     backend::MOI.ModelLike;
-) where {T<:Real}

Return a new JuMP model using backend to store the model and solve it.

As opposed to the Model constructor, no cache of the model is stored outside of backend and no bridges are automatically applied to backend.

Notes

The absence of a cache reduces the memory footprint but, it is important to bear in mind the following implications of creating models using this direct mode:

  • When backend does not support an operation, such as modifying constraints or adding variables/constraints after solving, an error is thrown. For models created using the Model constructor, such situations can be dealt with by storing the modifications in a cache and loading them into the optimizer when optimize! is called.
  • No constraint bridging is supported by default.
  • The optimizer used cannot be changed the model is constructed.
  • The model created cannot be copied.
source
direct_generic_model(::Type{T}, factory::MOI.OptimizerWithAttributes)

Create a direct_generic_model using factory, a MOI.OptimizerWithAttributes object created by optimizer_with_attributes.

Example

julia> import HiGHS
+) where {T<:Real}

Return a new JuMP model using backend to store the model and solve it.

As opposed to the Model constructor, no cache of the model is stored outside of backend and no bridges are automatically applied to backend.

Notes

The absence of a cache reduces the memory footprint but, it is important to bear in mind the following implications of creating models using this direct mode:

  • When backend does not support an operation, such as modifying constraints or adding variables/constraints after solving, an error is thrown. For models created using the Model constructor, such situations can be dealt with by storing the modifications in a cache and loading them into the optimizer when optimize! is called.
  • No constraint bridging is supported by default.
  • The optimizer used cannot be changed the model is constructed.
  • The model created cannot be copied.
source
direct_generic_model(::Type{T}, factory::MOI.OptimizerWithAttributes)

Create a direct_generic_model using factory, a MOI.OptimizerWithAttributes object created by optimizer_with_attributes.

Example

julia> import HiGHS
 
 julia> optimizer = optimizer_with_attributes(
            HiGHS.Optimizer,
@@ -761,7 +761,7 @@
 
 julia> set_attribute(model, "presolve", "off")
 
-julia> set_attribute(model, MOI.Silent(), true)
source

direct_model

JuMP.direct_modelFunction
direct_model(backend::MOI.ModelLike)

Return a new JuMP model using backend to store the model and solve it.

As opposed to the Model constructor, no cache of the model is stored outside of backend and no bridges are automatically applied to backend.

Notes

The absence of a cache reduces the memory footprint but, it is important to bear in mind the following implications of creating models using this direct mode:

  • When backend does not support an operation, such as modifying constraints or adding variables/constraints after solving, an error is thrown. For models created using the Model constructor, such situations can be dealt with by storing the modifications in a cache and loading them into the optimizer when optimize! is called.
  • No constraint bridging is supported by default.
  • The optimizer used cannot be changed the model is constructed.
  • The model created cannot be copied.
source
direct_model(factory::MOI.OptimizerWithAttributes)

Create a direct_model using factory, a MOI.OptimizerWithAttributes object created by optimizer_with_attributes.

Example

julia> import HiGHS
+julia> set_attribute(model, MOI.Silent(), true)
source

direct_model

JuMP.direct_modelFunction
direct_model(backend::MOI.ModelLike)

Return a new JuMP model using backend to store the model and solve it.

As opposed to the Model constructor, no cache of the model is stored outside of backend and no bridges are automatically applied to backend.

Notes

The absence of a cache reduces the memory footprint but, it is important to bear in mind the following implications of creating models using this direct mode:

  • When backend does not support an operation, such as modifying constraints or adding variables/constraints after solving, an error is thrown. For models created using the Model constructor, such situations can be dealt with by storing the modifications in a cache and loading them into the optimizer when optimize! is called.
  • No constraint bridging is supported by default.
  • The optimizer used cannot be changed the model is constructed.
  • The model created cannot be copied.
source
direct_model(factory::MOI.OptimizerWithAttributes)

Create a direct_model using factory, a MOI.OptimizerWithAttributes object created by optimizer_with_attributes.

Example

julia> import HiGHS
 
 julia> optimizer = optimizer_with_attributes(
            HiGHS.Optimizer,
@@ -785,7 +785,7 @@
 
 julia> set_attribute(model, "presolve", "off")
 
-julia> set_attribute(model, MOI.Silent(), true)
source

drop_zeros!

JuMP.drop_zeros!Function
drop_zeros!(expr::GenericAffExpr)

Remove terms in the affine expression with 0 coefficients.

Example

julia> model = Model();
+julia> set_attribute(model, MOI.Silent(), true)
source

drop_zeros!

JuMP.drop_zeros!Function
drop_zeros!(expr::GenericAffExpr)

Remove terms in the affine expression with 0 coefficients.

Example

julia> model = Model();
 
 julia> @variable(model, x[1:2]);
 
@@ -797,7 +797,7 @@
 julia> drop_zeros!(expr)
 
 julia> expr
-x[2]
source
drop_zeros!(expr::GenericQuadExpr)

Remove terms in the quadratic expression with 0 coefficients.

Example

julia> model = Model();
+x[2]
source
drop_zeros!(expr::GenericQuadExpr)

Remove terms in the quadratic expression with 0 coefficients.

Example

julia> model = Model();
 
 julia> @variable(model, x[1:2]);
 
@@ -809,7 +809,7 @@
 julia> drop_zeros!(expr)
 
 julia> expr
-x[2]²
source

dual

JuMP.dualFunction
dual(con_ref::ConstraintRef; result::Int = 1)

Return the dual value of constraint con_ref associated with result index result of the most-recent solution returned by the solver.

Use has_duals to check if a result exists before asking for values.

See also: result_count, shadow_price.

Example

julia> import HiGHS
+x[2]²
source

dual

JuMP.dualFunction
dual(con_ref::ConstraintRef; result::Int = 1)

Return the dual value of constraint con_ref associated with result index result of the most-recent solution returned by the solver.

Use has_duals to check if a result exists before asking for values.

See also: result_count, shadow_price.

Example

julia> import HiGHS
 
 julia> model = Model(HiGHS.Optimizer);
 
@@ -828,7 +828,7 @@
 true
 
 julia> dual(c)
--2.0
source

dual_objective_value

JuMP.dual_objective_valueFunction
dual_objective_value(model::GenericModel; result::Int = 1)

Return the value of the objective of the dual problem associated with result index result of the most-recent solution returned by the solver.

Throws MOI.UnsupportedAttribute{MOI.DualObjectiveValue} if the solver does not support this attribute.

This function is equivalent to querying the MOI.DualObjectiveValue attribute.

See also: result_count.

Example

julia> import HiGHS
+-2.0
source

dual_objective_value

JuMP.dual_objective_valueFunction
dual_objective_value(model::GenericModel; result::Int = 1)

Return the value of the objective of the dual problem associated with result index result of the most-recent solution returned by the solver.

Throws MOI.UnsupportedAttribute{MOI.DualObjectiveValue} if the solver does not support this attribute.

This function is equivalent to querying the MOI.DualObjectiveValue attribute.

See also: result_count.

Example

julia> import HiGHS
 
 julia> model = Model(HiGHS.Optimizer);
 
@@ -846,7 +846,7 @@
 julia> dual_objective_value(model; result = 2)
 ERROR: Result index of attribute MathOptInterface.DualObjectiveValue(2) out of bounds. There are currently 1 solution(s) in the model.
 Stacktrace:
-[...]
source

dual_shape

JuMP.dual_shapeFunction
dual_shape(shape::AbstractShape)::AbstractShape

Returns the shape of the dual space of the space of objects of shape shape. By default, the dual_shape of a shape is itself. See the examples section below for an example for which this is not the case.

Example

Consider polynomial constraints for which the dual is moment constraints and moment constraints for which the dual is polynomial constraints. Shapes for polynomials can be defined as follows:

struct Polynomial
+[...]
source

dual_shape

JuMP.dual_shapeFunction
dual_shape(shape::AbstractShape)::AbstractShape

Returns the shape of the dual space of the space of objects of shape shape. By default, the dual_shape of a shape is itself. See the examples section below for an example for which this is not the case.

Example

Consider polynomial constraints for which the dual is moment constraints and moment constraints for which the dual is polynomial constraints. Shapes for polynomials can be defined as follows:

struct Polynomial
     coefficients::Vector{Float64}
     monomials::Vector{Monomial}
 end
@@ -861,7 +861,7 @@
     monomials::Vector{Monomial}
 end
 JuMP.reshape_vector(x::Vector, shape::MomentsShape) = Moments(x, shape.monomials)

Then dual_shape allows the definition of the shape of the dual of polynomial and moment constraints:

dual_shape(shape::PolynomialShape) = MomentsShape(shape.monomials)
-dual_shape(shape::MomentsShape) = PolynomialShape(shape.monomials)
source

dual_start_value

JuMP.dual_start_valueFunction
dual_start_value(con_ref::ConstraintRef)

Return the dual start value (MOI attribute ConstraintDualStart) of the constraint con_ref.

If no dual start value has been set, dual_start_value will return nothing.

See also set_dual_start_value.

Example

julia> model = Model();
+dual_shape(shape::MomentsShape) = PolynomialShape(shape.monomials)
source

dual_start_value

JuMP.dual_start_valueFunction
dual_start_value(con_ref::ConstraintRef)

Return the dual start value (MOI attribute ConstraintDualStart) of the constraint con_ref.

If no dual start value has been set, dual_start_value will return nothing.

See also set_dual_start_value.

Example

julia> model = Model();
 
 julia> @variable(model, x, start = 2.0);
 
@@ -876,19 +876,19 @@
 
 julia> set_dual_start_value(c, nothing)
 
-julia> dual_start_value(c)
source

dual_status

JuMP.dual_statusFunction
dual_status(model::GenericModel; result::Int = 1)

Return a MOI.ResultStatusCode describing the status of the most recent dual solution of the solver (that is, the MOI.DualStatus attribute) associated with the result index result.

See also: result_count.

Example

julia> import Ipopt
+julia> dual_start_value(c)
source

dual_status

JuMP.dual_statusFunction
dual_status(model::GenericModel; result::Int = 1)

Return a MOI.ResultStatusCode describing the status of the most recent dual solution of the solver (that is, the MOI.DualStatus attribute) associated with the result index result.

See also: result_count.

Example

julia> import Ipopt
 
 julia> model = Model(Ipopt.Optimizer);
 
 julia> dual_status(model; result = 2)
-NO_SOLUTION::ResultStatusCode = 0
source

error_if_direct_mode

JuMP.error_if_direct_modeFunction
error_if_direct_mode(model::GenericModel, func::Symbol)

Errors if model is in direct mode during a call from the function named func.

Used internally within JuMP, or by JuMP extensions who do not want to support models in direct mode.

Example

julia> import HiGHS
+NO_SOLUTION::ResultStatusCode = 0
source

error_if_direct_mode

JuMP.error_if_direct_modeFunction
error_if_direct_mode(model::GenericModel, func::Symbol)

Errors if model is in direct mode during a call from the function named func.

Used internally within JuMP, or by JuMP extensions who do not want to support models in direct mode.

Example

julia> import HiGHS
 
 julia> model = direct_model(HiGHS.Optimizer());
 
 julia> error_if_direct_mode(model, :foo)
 ERROR: The `foo` function is not supported in DIRECT mode.
 Stacktrace:
-[...]
source

fix

JuMP.fixFunction
fix(v::GenericVariableRef, value::Number; force::Bool = false)

Fix a variable to a value. Update the fixing constraint if one exists, otherwise create a new one.

If the variable already has variable bounds and force=false, calling fix will throw an error. If force=true, existing variable bounds will be deleted, and the fixing constraint will be added. Note a variable will have no bounds after a call to unfix.

See also FixRef, is_fixed, fix_value, unfix.

Example

julia> model = Model();
+[...]
source

fix

JuMP.fixFunction
fix(v::GenericVariableRef, value::Number; force::Bool = false)

Fix a variable to a value. Update the fixing constraint if one exists, otherwise create a new one.

If the variable already has variable bounds and force=false, calling fix will throw an error. If force=true, existing variable bounds will be deleted, and the fixing constraint will be added. Note a variable will have no bounds after a call to unfix.

See also FixRef, is_fixed, fix_value, unfix.

Example

julia> model = Model();
 
 julia> @variable(model, x);
 
@@ -908,7 +908,7 @@
 julia> fix(x, 1.0; force = true)
 
 julia> is_fixed(x)
-true
source

fix_discrete_variables

JuMP.fix_discrete_variablesFunction
fix_discrete_variables([var_value::Function = value,] model::GenericModel)

Modifies model to convert all binary and integer variables to continuous variables with fixed bounds of var_value(x).

Return

Returns a function that can be called without any arguments to restore the original model. The behavior of this function is undefined if additional changes are made to the affected variables in the meantime.

Notes

  • An error is thrown if semi-continuous or semi-integer constraints are present (support may be added for these in the future).
  • All other constraints are ignored (left in place). This includes discrete constraints like SOS and indicator constraints.

Example

julia> model = Model();
+true
source

fix_discrete_variables

JuMP.fix_discrete_variablesFunction
fix_discrete_variables([var_value::Function = value,] model::GenericModel)

Modifies model to convert all binary and integer variables to continuous variables with fixed bounds of var_value(x).

Return

Returns a function that can be called without any arguments to restore the original model. The behavior of this function is undefined if additional changes are made to the affected variables in the meantime.

Notes

  • An error is thrown if semi-continuous or semi-integer constraints are present (support may be added for these in the future).
  • All other constraints are ignored (left in place). This includes discrete constraints like SOS and indicator constraints.

Example

julia> model = Model();
 
 julia> @variable(model, x, Bin, start = 1);
 
@@ -932,12 +932,12 @@
  y ≥ 1
  y ≤ 10
  y integer
- x binary
source

fix_value

JuMP.fix_valueFunction
fix_value(v::GenericVariableRef)

Return the value to which a variable is fixed.

Error if one does not exist.

See also FixRef, is_fixed, fix, unfix.

Example

julia> model = Model();
+ x binary
source

fix_value

JuMP.fix_valueFunction
fix_value(v::GenericVariableRef)

Return the value to which a variable is fixed.

Error if one does not exist.

See also FixRef, is_fixed, fix, unfix.

Example

julia> model = Model();
 
 julia> @variable(model, x == 1);
 
 julia> fix_value(x)
-1.0
source

flatten!

JuMP.flatten!Function
flatten!(expr::GenericNonlinearExpr)

Flatten a nonlinear expression in-place by lifting nested + and * nodes into a single n-ary operation.

Motivation

Nonlinear expressions created using operator overloading can be deeply nested and unbalanced. For example, prod(x for i in 1:4) creates *(x, *(x, *(x, x))) instead of the more preferable *(x, x, x, x).

Example

julia> model = Model();
+1.0
source

flatten!

JuMP.flatten!Function
flatten!(expr::GenericNonlinearExpr)

Flatten a nonlinear expression in-place by lifting nested + and * nodes into a single n-ary operation.

Motivation

Nonlinear expressions created using operator overloading can be deeply nested and unbalanced. For example, prod(x for i in 1:4) creates *(x, *(x, *(x, x))) instead of the more preferable *(x, x, x, x).

Example

julia> model = Model();
 
 julia> @variable(model, x)
 x
@@ -949,7 +949,7 @@
 (x²) * x * x
 
 julia> flatten!(sin(prod(x for i in 1:4)))
-sin((x²) * x * x)
source

function_string

JuMP.function_stringFunction
function_string(
+sin((x²) * x * x)
source

function_string

JuMP.function_stringFunction
function_string(
     mode::MIME,
     func::Union{JuMP.AbstractJuMPScalar,Vector{<:JuMP.AbstractJuMPScalar}},
 )

Return a String representing the function func using print mode mode.

Example

julia> model = Model();
@@ -957,7 +957,7 @@
 julia> @variable(model, x);
 
 julia> function_string(MIME("text/plain"), 2 * x + 1)
-"2 x + 1"
source

get_attribute

JuMP.get_attributeFunction
get_attribute(model::GenericModel, attr::MOI.AbstractModelAttribute)
+"2 x + 1"
source

get_attribute

JuMP.get_attributeFunction
get_attribute(model::GenericModel, attr::MOI.AbstractModelAttribute)
 get_attribute(x::GenericVariableRef, attr::MOI.AbstractVariableAttribute)
 get_attribute(cr::ConstraintRef, attr::MOI.AbstractConstraintAttribute)

Get the value of a solver-specifc attribute attr.

This is equivalent to calling MOI.get with the associated MOI model and, for variables and constraints, with the associated MOI.VariableIndex or MOI.ConstraintIndex.

Example

julia> model = Model();
 
@@ -974,7 +974,7 @@
 "x"
 
 julia> get_attribute(c, MOI.ConstraintName())
-"c"
source
get_attribute(
+"c"
source
get_attribute(
     model::Union{GenericModel,MOI.OptimizerWithAttributes},
     attr::Union{AbstractString,MOI.AbstractOptimizerAttribute},
 )

Get the value of a solver-specifc attribute attr.

This is equivalent to calling MOI.get with the associated MOI model.

If attr is an AbstractString, it is converted to MOI.RawOptimizerAttribute.

Example

julia> import HiGHS
@@ -993,7 +993,7 @@
 true
 
 julia> get_attribute(opt, MOI.RawOptimizerAttribute("output_flag"))
-true
source

has_duals

JuMP.has_dualsFunction
has_duals(model::GenericModel; result::Int = 1)

Return true if the solver has a dual solution in result index result available to query, otherwise return false.

See also dual, shadow_price, and result_count.

Example

julia> import HiGHS
+true
source

has_duals

JuMP.has_dualsFunction
has_duals(model::GenericModel; result::Int = 1)

Return true if the solver has a dual solution in result index result available to query, otherwise return false.

See also dual, shadow_price, and result_count.

Example

julia> import HiGHS
 
 julia> model = Model(HiGHS.Optimizer);
 
@@ -1012,12 +1012,12 @@
 julia> optimize!(model)
 
 julia> has_duals(model)
-true
source

has_lower_bound

JuMP.has_lower_boundFunction
has_lower_bound(v::GenericVariableRef)

Return true if v has a lower bound. If true, the lower bound can be queried with lower_bound.

See also LowerBoundRef, lower_bound, set_lower_bound, delete_lower_bound.

Example

julia> model = Model();
+true
source

has_lower_bound

JuMP.has_lower_boundFunction
has_lower_bound(v::GenericVariableRef)

Return true if v has a lower bound. If true, the lower bound can be queried with lower_bound.

See also LowerBoundRef, lower_bound, set_lower_bound, delete_lower_bound.

Example

julia> model = Model();
 
 julia> @variable(model, x >= 1.0);
 
 julia> has_lower_bound(x)
-true
source

has_start_value

JuMP.has_start_valueFunction
has_start_value(variable::AbstractVariableRef)

Return true if the variable has a start value set, otherwise return false.

See also: start_value, set_start_value.

Example

julia> model = Model();
+true
source

has_start_value

JuMP.has_start_valueFunction
has_start_value(variable::AbstractVariableRef)

Return true if the variable has a start value set, otherwise return false.

See also: start_value, set_start_value.

Example

julia> model = Model();
 
 julia> @variable(model, x, start = 1.5);
 
@@ -1038,12 +1038,12 @@
 true
 
 julia> start_value(y)
-2.0
source

has_upper_bound

JuMP.has_upper_boundFunction
has_upper_bound(v::GenericVariableRef)

Return true if v has a upper bound. If true, the upper bound can be queried with upper_bound.

See also UpperBoundRef, upper_bound, set_upper_bound, delete_upper_bound.

Example

julia> model = Model();
+2.0
source

has_upper_bound

JuMP.has_upper_boundFunction
has_upper_bound(v::GenericVariableRef)

Return true if v has a upper bound. If true, the upper bound can be queried with upper_bound.

See also UpperBoundRef, upper_bound, set_upper_bound, delete_upper_bound.

Example

julia> model = Model();
 
 julia> @variable(model, x <= 1.0);
 
 julia> has_upper_bound(x)
-true
source

has_values

JuMP.has_valuesFunction
has_values(model::GenericModel; result::Int = 1)

Return true if the solver has a primal solution in result index result available to query, otherwise return false.

See also value and result_count.

Example

julia> import HiGHS
+true
source

has_values

JuMP.has_valuesFunction
has_values(model::GenericModel; result::Int = 1)

Return true if the solver has a primal solution in result index result available to query, otherwise return false.

See also value and result_count.

Example

julia> import HiGHS
 
 julia> model = Model(HiGHS.Optimizer);
 
@@ -1062,25 +1062,25 @@
 julia> optimize!(model)
 
 julia> has_values(model)
-true
source

in_set_string

JuMP.in_set_stringFunction
in_set_string(mode::MIME, set)

Return a String representing the membership to the set set using print mode mode.

Extensions

JuMP extensions may extend this method for new set types to improve the legibility of their printing.

Example

julia> in_set_string(MIME("text/plain"), MOI.Interval(1.0, 2.0))
-"∈ [1, 2]"
source

index

JuMP.indexFunction
index(cr::ConstraintRef)::MOI.ConstraintIndex

Return the index of the constraint that corresponds to cr in the MOI backend.

Example

julia> model = Model();
+true
source

in_set_string

JuMP.in_set_stringFunction
in_set_string(mode::MIME, set)

Return a String representing the membership to the set set using print mode mode.

Extensions

JuMP extensions may extend this method for new set types to improve the legibility of their printing.

Example

julia> in_set_string(MIME("text/plain"), MOI.Interval(1.0, 2.0))
+"∈ [1, 2]"
source

index

JuMP.indexFunction
index(cr::ConstraintRef)::MOI.ConstraintIndex

Return the index of the constraint that corresponds to cr in the MOI backend.

Example

julia> model = Model();
 
 julia> @variable(model, x);
 
 julia> @constraint(model, c, x >= 0);
 
 julia> index(c)
-MathOptInterface.ConstraintIndex{MathOptInterface.ScalarAffineFunction{Float64}, MathOptInterface.GreaterThan{Float64}}(1)
source
index(v::GenericVariableRef)::MOI.VariableIndex

Return the index of the variable that corresponds to v in the MOI backend.

Example

julia> model = Model();
+MathOptInterface.ConstraintIndex{MathOptInterface.ScalarAffineFunction{Float64}, MathOptInterface.GreaterThan{Float64}}(1)
source
index(v::GenericVariableRef)::MOI.VariableIndex

Return the index of the variable that corresponds to v in the MOI backend.

Example

julia> model = Model();
 
 julia> @variable(model, x);
 
 julia> index(x)
-MOI.VariableIndex(1)
source

is_binary

JuMP.is_binaryFunction
is_binary(v::GenericVariableRef)

Return true if v is constrained to be binary.

See also BinaryRef, set_binary, unset_binary.

Example

julia> model = Model();
+MOI.VariableIndex(1)
source

is_binary

JuMP.is_binaryFunction
is_binary(v::GenericVariableRef)

Return true if v is constrained to be binary.

See also BinaryRef, set_binary, unset_binary.

Example

julia> model = Model();
 
 julia> @variable(model, x, Bin);
 
 julia> is_binary(x)
-true
source

is_fixed

JuMP.is_fixedFunction
is_fixed(v::GenericVariableRef)

Return true if v is a fixed variable. If true, the fixed value can be queried with fix_value.

See also FixRef, fix_value, fix, unfix.

Example

julia> model = Model();
+true
source

is_fixed

JuMP.is_fixedFunction
is_fixed(v::GenericVariableRef)

Return true if v is a fixed variable. If true, the fixed value can be queried with fix_value.

See also FixRef, fix_value, fix, unfix.

Example

julia> model = Model();
 
 julia> @variable(model, x);
 
@@ -1090,7 +1090,7 @@
 julia> fix(x, 1.0)
 
 julia> is_fixed(x)
-true
source

is_integer

JuMP.is_integerFunction
is_integer(v::GenericVariableRef)

Return true if v is constrained to be integer.

See also IntegerRef, set_integer, unset_integer.

Example

julia> model = Model();
+true
source

is_integer

JuMP.is_integerFunction
is_integer(v::GenericVariableRef)

Return true if v is constrained to be integer.

See also IntegerRef, set_integer, unset_integer.

Example

julia> model = Model();
 
 julia> @variable(model, x);
 
@@ -1100,7 +1100,7 @@
 julia> set_integer(x)
 
 julia> is_integer(x)
-true
source

is_parameter

JuMP.is_parameterFunction
is_parameter(x::GenericVariableRef)::Bool

Return true if x is constrained to be a parameter.

See also ParameterRef, set_parameter_value, parameter_value.

Example

julia> model = Model();
+true
source

is_parameter

JuMP.is_parameterFunction
is_parameter(x::GenericVariableRef)::Bool

Return true if x is constrained to be a parameter.

See also ParameterRef, set_parameter_value, parameter_value.

Example

julia> model = Model();
 
 julia> @variable(model, p in Parameter(2))
 p
@@ -1112,7 +1112,7 @@
 x
 
 julia> is_parameter(x)
-false
source

is_solved_and_feasible

JuMP.is_solved_and_feasibleFunction
is_solved_and_feasible(
+false
source

is_solved_and_feasible

JuMP.is_solved_and_feasibleFunction
is_solved_and_feasible(
     model::GenericModel;
     allow_local::Bool = true,
     allow_almost::Bool = false,
@@ -1123,7 +1123,7 @@
 julia> model = Model(Ipopt.Optimizer);
 
 julia> is_solved_and_feasible(model)
-false
source

is_valid

JuMP.is_validFunction
is_valid(model::GenericModel, con_ref::ConstraintRef{<:AbstractModel})

Return true if con_ref refers to a valid constraint in model.

Example

julia> model = Model();
+false
source

is_valid

JuMP.is_validFunction
is_valid(model::GenericModel, con_ref::ConstraintRef{<:AbstractModel})

Return true if con_ref refers to a valid constraint in model.

Example

julia> model = Model();
 
 julia> @variable(model, x);
 
@@ -1135,7 +1135,7 @@
 julia> model_2 = Model();
 
 julia> is_valid(model_2, c)
-false
source
is_valid(model::GenericModel, variable_ref::GenericVariableRef)

Return true if variable refers to a valid variable in model.

Example

julia> model = Model();
+false
source
is_valid(model::GenericModel, variable_ref::GenericVariableRef)

Return true if variable refers to a valid variable in model.

Example

julia> model = Model();
 
 julia> @variable(model, x);
 
@@ -1145,7 +1145,7 @@
 julia> model_2 = Model();
 
 julia> is_valid(model_2, x)
-false
source

isequal_canonical

JuMP.isequal_canonicalFunction
isequal_canonical(
+false
source

isequal_canonical

JuMP.isequal_canonicalFunction
isequal_canonical(
     x::T,
     y::T
 ) where {T<:AbstractJuMPScalar,AbstractArray{<:AbstractJuMPScalar}}

Return true if x is equal to y after dropping zeros and disregarding the order.

This method is mainly useful for testing, because fallbacks like x == y do not account for valid mathematical comparisons like x[1] + 0 x[2] + 1 == x[1] + 1.

Example

julia> model = Model();
@@ -1165,7 +1165,7 @@
 false
 
 julia> isequal_canonical(a, b)
-true
source

jump_function

JuMP.jump_functionFunction
jump_function(model::AbstractModel, x::MOI.AbstractFunction)

Given an MathOptInterface object x, return the JuMP equivalent.

See also: moi_function.

Example

julia> model = Model();
+true
source

jump_function

JuMP.jump_functionFunction
jump_function(model::AbstractModel, x::MOI.AbstractFunction)

Given an MathOptInterface object x, return the JuMP equivalent.

See also: moi_function.

Example

julia> model = Model();
 
 julia> @variable(model, x);
 
@@ -1173,10 +1173,10 @@
 1.0 + 2.0 MOI.VariableIndex(1)
 
 julia> jump_function(model, f)
-2 x + 1
source

jump_function_type

JuMP.jump_function_typeFunction
jump_function_type(model::AbstractModel, ::Type{T}) where {T}

Given an MathOptInterface object type T, return the JuMP equivalent.

See also: moi_function_type.

Example

julia> model = Model();
+2 x + 1
source

jump_function_type

JuMP.jump_function_typeFunction
jump_function_type(model::AbstractModel, ::Type{T}) where {T}

Given an MathOptInterface object type T, return the JuMP equivalent.

See also: moi_function_type.

Example

julia> model = Model();
 
 julia> jump_function_type(model, MOI.ScalarAffineFunction{Float64})
-AffExpr (alias for GenericAffExpr{Float64, GenericVariableRef{Float64}})
source

latex_formulation

JuMP.latex_formulationFunction
latex_formulation(model::AbstractModel)

Wrap model in a type so that it can be pretty-printed as text/latex in a notebook like IJulia, or in Documenter.

To render the model, end the cell with latex_formulation(model), or call display(latex_formulation(model)) in to force the display of the model from inside a function.

source

linear_terms

JuMP.linear_termsFunction
linear_terms(aff::GenericAffExpr{C,V})

Provides an iterator over coefficient-variable tuples (a_i::C, x_i::V) in the linear part of the affine expression.

source
linear_terms(quad::GenericQuadExpr{C,V})

Provides an iterator over tuples (coefficient::C, variable::V) in the linear part of the quadratic expression.

source

list_of_constraint_types

JuMP.list_of_constraint_typesFunction
list_of_constraint_types(model::GenericModel)::Vector{Tuple{Type,Type}}

Return a list of tuples of the form (F, S) where F is a JuMP function type and S is an MOI set type such that all_constraints(model, F, S) returns a nonempty list.

Example

julia> model = Model();
+AffExpr (alias for GenericAffExpr{Float64, GenericVariableRef{Float64}})
source

latex_formulation

JuMP.latex_formulationFunction
latex_formulation(model::AbstractModel)

Wrap model in a type so that it can be pretty-printed as text/latex in a notebook like IJulia, or in Documenter.

To render the model, end the cell with latex_formulation(model), or call display(latex_formulation(model)) in to force the display of the model from inside a function.

source

linear_terms

JuMP.linear_termsFunction
linear_terms(aff::GenericAffExpr{C,V})

Provides an iterator over coefficient-variable tuples (a_i::C, x_i::V) in the linear part of the affine expression.

source
linear_terms(quad::GenericQuadExpr{C,V})

Provides an iterator over tuples (coefficient::C, variable::V) in the linear part of the quadratic expression.

source

list_of_constraint_types

JuMP.list_of_constraint_typesFunction
list_of_constraint_types(model::GenericModel)::Vector{Tuple{Type,Type}}

Return a list of tuples of the form (F, S) where F is a JuMP function type and S is an MOI set type such that all_constraints(model, F, S) returns a nonempty list.

Example

julia> model = Model();
 
 julia> @variable(model, x >= 0, Bin);
 
@@ -1186,12 +1186,12 @@
 3-element Vector{Tuple{Type, Type}}:
  (AffExpr, MathOptInterface.LessThan{Float64})
  (VariableRef, MathOptInterface.GreaterThan{Float64})
- (VariableRef, MathOptInterface.ZeroOne)

Performance considerations

Iterating over the list of function and set types is a type-unstable operation. Consider using a function barrier. See the Performance tips for extensions section of the documentation for more details.

source

lower_bound

JuMP.lower_boundFunction
lower_bound(v::GenericVariableRef)

Return the lower bound of a variable. Error if one does not exist.

See also LowerBoundRef, has_lower_bound, set_lower_bound, delete_lower_bound.

Example

julia> model = Model();
+ (VariableRef, MathOptInterface.ZeroOne)

Performance considerations

Iterating over the list of function and set types is a type-unstable operation. Consider using a function barrier. See the Performance tips for extensions section of the documentation for more details.

source

lower_bound

JuMP.lower_boundFunction
lower_bound(v::GenericVariableRef)

Return the lower bound of a variable. Error if one does not exist.

See also LowerBoundRef, has_lower_bound, set_lower_bound, delete_lower_bound.

Example

julia> model = Model();
 
 julia> @variable(model, x >= 1.0);
 
 julia> lower_bound(x)
-1.0
source

lp_matrix_data

JuMP.lp_matrix_dataFunction
lp_matrix_data(model::GenericModel{T})

Given a JuMP model of a linear program, return an LPMatrixData{T} struct storing data for an equivalent linear program in the form:

\[\begin{aligned} +1.0

source

lp_matrix_data

JuMP.lp_matrix_dataFunction
lp_matrix_data(model::GenericModel{T})

Given a JuMP model of a linear program, return an LPMatrixData{T} struct storing data for an equivalent linear program in the form:

\[\begin{aligned} \min & c^\top x + c_0 \\ & b_l \le A x \le b_u \\ & x_l \le x \le x_u @@ -1236,7 +1236,7 @@ 0.0 julia> data.sense -MAX_SENSE::OptimizationSense = 1

source

lp_sensitivity_report

JuMP.lp_sensitivity_reportFunction
lp_sensitivity_report(model::GenericModel{T}; atol::T = Base.rtoldefault(T))::SensitivityReport{T} where {T}

Given a linear program model with a current optimal basis, return a SensitivityReport object, which maps:

  • Every variable reference to a tuple (d_lo, d_hi)::Tuple{T,T}, explaining how much the objective coefficient of the corresponding variable can change by, such that the original basis remains optimal.
  • Every constraint reference to a tuple (d_lo, d_hi)::Tuple{T,T}, explaining how much the right-hand side of the corresponding constraint can change by, such that the basis remains optimal.

Both tuples are relative, rather than absolute. So given a objective coefficient of 1.0 and a tuple (-0.5, 0.5), the objective coefficient can range between 1.0 - 0.5 an 1.0 + 0.5.

atol is the primal/dual optimality tolerance, and should match the tolerance of the solver used to compute the basis.

Note: interval constraints are NOT supported.

Example

julia> import HiGHS
+MAX_SENSE::OptimizationSense = 1
source

lp_sensitivity_report

JuMP.lp_sensitivity_reportFunction
lp_sensitivity_report(model::GenericModel{T}; atol::T = Base.rtoldefault(T))::SensitivityReport{T} where {T}

Given a linear program model with a current optimal basis, return a SensitivityReport object, which maps:

  • Every variable reference to a tuple (d_lo, d_hi)::Tuple{T,T}, explaining how much the objective coefficient of the corresponding variable can change by, such that the original basis remains optimal.
  • Every constraint reference to a tuple (d_lo, d_hi)::Tuple{T,T}, explaining how much the right-hand side of the corresponding constraint can change by, such that the basis remains optimal.

Both tuples are relative, rather than absolute. So given a objective coefficient of 1.0 and a tuple (-0.5, 0.5), the objective coefficient can range between 1.0 - 0.5 an 1.0 + 0.5.

atol is the primal/dual optimality tolerance, and should match the tolerance of the solver used to compute the basis.

Note: interval constraints are NOT supported.

Example

julia> import HiGHS
 
 julia> model = Model(HiGHS.Optimizer);
 
@@ -1268,7 +1268,7 @@
            "The lower bound of `x` can decrease by $dRHS_lo or increase " *
            "by $dRHS_hi."
        )
-The lower bound of `x` can decrease by -Inf or increase by 3.0.
source

map_coefficients

JuMP.map_coefficientsFunction
map_coefficients(f::Function, a::GenericAffExpr)

Apply f to the coefficients and constant term of an GenericAffExpr a and return a new expression.

See also: map_coefficients_inplace!

Example

julia> model = Model();
+The lower bound of `x` can decrease by -Inf or increase by 3.0.
source

map_coefficients

JuMP.map_coefficientsFunction
map_coefficients(f::Function, a::GenericAffExpr)

Apply f to the coefficients and constant term of an GenericAffExpr a and return a new expression.

See also: map_coefficients_inplace!

Example

julia> model = Model();
 
 julia> @variable(model, x);
 
@@ -1279,7 +1279,7 @@
 2 x + 2
 
 julia> a
-x + 1
source
map_coefficients(f::Function, a::GenericQuadExpr)

Apply f to the coefficients and constant term of an GenericQuadExpr a and return a new expression.

See also: map_coefficients_inplace!

Example

julia> model = Model();
+x + 1
source
map_coefficients(f::Function, a::GenericQuadExpr)

Apply f to the coefficients and constant term of an GenericQuadExpr a and return a new expression.

See also: map_coefficients_inplace!

Example

julia> model = Model();
 
 julia> @variable(model, x);
 
@@ -1290,7 +1290,7 @@
 2 x² + 2 x + 2
 
 julia> a
-x² + x + 1
source

map_coefficients_inplace!

JuMP.map_coefficients_inplace!Function
map_coefficients_inplace!(f::Function, a::GenericAffExpr)

Apply f to the coefficients and constant term of an GenericAffExpr a and update them in-place.

See also: map_coefficients

Example

julia> model = Model();
+x² + x + 1
source

map_coefficients_inplace!

JuMP.map_coefficients_inplace!Function
map_coefficients_inplace!(f::Function, a::GenericAffExpr)

Apply f to the coefficients and constant term of an GenericAffExpr a and update them in-place.

See also: map_coefficients

Example

julia> model = Model();
 
 julia> @variable(model, x);
 
@@ -1301,7 +1301,7 @@
 2 x + 2
 
 julia> a
-2 x + 2
source
map_coefficients_inplace!(f::Function, a::GenericQuadExpr)

Apply f to the coefficients and constant term of an GenericQuadExpr a and update them in-place.

See also: map_coefficients

Example

julia> model = Model();
+2 x + 2
source
map_coefficients_inplace!(f::Function, a::GenericQuadExpr)

Apply f to the coefficients and constant term of an GenericQuadExpr a and update them in-place.

See also: map_coefficients

Example

julia> model = Model();
 
 julia> @variable(model, x);
 
@@ -1312,10 +1312,10 @@
 2 x² + 2 x + 2
 
 julia> a
-2 x² + 2 x + 2
source

mode

JuMP.modeFunction
mode(model::GenericModel)

Return the ModelMode of model.

Example

julia> model = Model();
+2 x² + 2 x + 2
source

mode

JuMP.modeFunction
mode(model::GenericModel)

Return the ModelMode of model.

Example

julia> model = Model();
 
 julia> mode(model)
-AUTOMATIC::ModelMode = 0
source

model_convert

JuMP.model_convertFunction
model_convert(
+AUTOMATIC::ModelMode = 0
source

model_convert

JuMP.model_convertFunction
model_convert(
     model::AbstractModel,
     rhs::Union{
         AbstractConstraint,
@@ -1323,14 +1323,14 @@
         AbstractJuMPScalar,
         MOI.AbstractSet,
     },
-)

Convert the coefficients and constants of functions and sets in the rhs to the coefficient type value_type(typeof(model)).

Purpose

Creating and adding a constraint is a two-step process. The first step calls build_constraint, and the result of that is passed to add_constraint.

However, because build_constraint does not take the model as an argument, the coefficients and constants of the function or set might be different than value_type(typeof(model)).

Therefore, the result of build_constraint is converted in a call to model_convert before the result is passed to add_constraint.

source

model_string

JuMP.model_stringFunction
model_string(mode::MIME, model::AbstractModel)

Return a String representation of model given the mode.

Example

julia> model = Model();
+)

Convert the coefficients and constants of functions and sets in the rhs to the coefficient type value_type(typeof(model)).

Purpose

Creating and adding a constraint is a two-step process. The first step calls build_constraint, and the result of that is passed to add_constraint.

However, because build_constraint does not take the model as an argument, the coefficients and constants of the function or set might be different than value_type(typeof(model)).

Therefore, the result of build_constraint is converted in a call to model_convert before the result is passed to add_constraint.

source

model_string

JuMP.model_stringFunction
model_string(mode::MIME, model::AbstractModel)

Return a String representation of model given the mode.

Example

julia> model = Model();
 
 julia> @variable(model, x >= 0);
 
 julia> print(model_string(MIME("text/plain"), model))
 Feasibility
 Subject to
- x ≥ 0
source

moi_function

JuMP.moi_functionFunction
moi_function(x::AbstractJuMPScalar)
+ x ≥ 0
source

moi_function

JuMP.moi_functionFunction
moi_function(x::AbstractJuMPScalar)
 moi_function(x::AbstractArray{<:AbstractJuMPScalar})

Given a JuMP object x, return the MathOptInterface equivalent.

See also: jump_function.

Example

julia> model = Model();
 
 julia> @variable(model, x);
@@ -1339,8 +1339,8 @@
 2 x + 1
 
 julia> moi_function(f)
-1.0 + 2.0 MOI.VariableIndex(1)
source

moi_function_type

JuMP.moi_function_typeFunction
moi_function_type(::Type{T}) where {T}

Given a JuMP object type T, return the MathOptInterface equivalent.

See also: jump_function_type.

Example

julia> moi_function_type(AffExpr)
-MathOptInterface.ScalarAffineFunction{Float64}
source

moi_set

JuMP.moi_setFunction
moi_set(constraint::AbstractConstraint)

Return the set of the constraint constraint in the function-in-set form as a MathOptInterface.AbstractSet.

moi_set(s::AbstractVectorSet, dim::Int)

Returns the MOI set of dimension dim corresponding to the JuMP set s.

moi_set(s::AbstractScalarSet)

Returns the MOI set corresponding to the JuMP set s.

source

name

JuMP.nameFunction
name(con_ref::ConstraintRef)

Get a constraint's name attribute.

Example

julia> model = Model();
+1.0 + 2.0 MOI.VariableIndex(1)
source

moi_function_type

JuMP.moi_function_typeFunction
moi_function_type(::Type{T}) where {T}

Given a JuMP object type T, return the MathOptInterface equivalent.

See also: jump_function_type.

Example

julia> moi_function_type(AffExpr)
+MathOptInterface.ScalarAffineFunction{Float64}
source

moi_set

JuMP.moi_setFunction
moi_set(constraint::AbstractConstraint)

Return the set of the constraint constraint in the function-in-set form as a MathOptInterface.AbstractSet.

moi_set(s::AbstractVectorSet, dim::Int)

Returns the MOI set of dimension dim corresponding to the JuMP set s.

moi_set(s::AbstractScalarSet)

Returns the MOI set corresponding to the JuMP set s.

source

name

JuMP.nameFunction
name(con_ref::ConstraintRef)

Get a constraint's name attribute.

Example

julia> model = Model();
 
 julia> @variable(model, x);
 
@@ -1348,7 +1348,7 @@
 c : [2 x] ∈ Nonnegatives()
 
 julia> name(c)
-"c"
source
name(v::GenericVariableRef)::String

Get a variable's name attribute.

Example

julia> model = Model();
+"c"
source
name(v::GenericVariableRef)::String

Get a variable's name attribute.

Example

julia> model = Model();
 
 julia> @variable(model, x[1:2])
 2-element Vector{VariableRef}:
@@ -1356,10 +1356,10 @@
  x[2]
 
 julia> name(x[1])
-"x[1]"
source
name(model::AbstractModel)

Return the MOI.Name attribute of model's backend, or a default if empty.

Example

julia> model = Model();
+"x[1]"
source
name(model::AbstractModel)

Return the MOI.Name attribute of model's backend, or a default if empty.

Example

julia> model = Model();
 
 julia> name(model)
-"A JuMP Model"
source

node_count

JuMP.node_countFunction
node_count(model::GenericModel)

If available, returns the total number of branch-and-bound nodes explored during the most recent optimization in a Mixed Integer Program (the MOI.NodeCount attribute).

Throws a MOI.GetAttributeNotAllowed error if the attribute is not implemented by the solver.

Example

julia> import HiGHS
+"A JuMP Model"
source

node_count

JuMP.node_countFunction
node_count(model::GenericModel)

If available, returns the total number of branch-and-bound nodes explored during the most recent optimization in a Mixed Integer Program (the MOI.NodeCount attribute).

Throws a MOI.GetAttributeNotAllowed error if the attribute is not implemented by the solver.

Example

julia> import HiGHS
 
 julia> model = Model(HiGHS.Optimizer);
 
@@ -1368,7 +1368,7 @@
 julia> optimize!(model)
 
 julia> node_count(model)
-0
source

normalized_coefficient

JuMP.normalized_coefficientFunction
normalized_coefficient(
+0
source

normalized_coefficient

JuMP.normalized_coefficientFunction
normalized_coefficient(
     constraint::ConstraintRef,
     variable::GenericVariableRef,
 )

Return the coefficient associated with variable in constraint after JuMP has normalized the constraint into its standard form.

See also set_normalized_coefficient.

Example

julia> model = Model();
@@ -1388,7 +1388,7 @@
 julia> normalized_coefficient(con_vec, x)
 2-element Vector{Tuple{Int64, Float64}}:
  (1, 1.0)
- (2, 2.0)
source
normalized_coefficient(
+ (2, 2.0)
source
normalized_coefficient(
     constraint::ConstraintRef,
     variable_1::GenericVariableRef,
     variable_2::GenericVariableRef,
@@ -1413,7 +1413,7 @@
  (1, 1.0)
 
 julia> normalized_coefficient(con_vec, x[1], x[2])
-Tuple{Int64, Float64}[]
source

normalized_rhs

JuMP.normalized_rhsFunction
normalized_rhs(constraint::ConstraintRef)

Return the right-hand side term of constraint after JuMP has converted the constraint into its normalized form.

See also set_normalized_rhs.

Example

julia> model = Model();
+Tuple{Int64, Float64}[]
source

normalized_rhs

JuMP.normalized_rhsFunction
normalized_rhs(constraint::ConstraintRef)

Return the right-hand side term of constraint after JuMP has converted the constraint into its normalized form.

See also set_normalized_rhs.

Example

julia> model = Model();
 
 julia> @variable(model, x);
 
@@ -1421,7 +1421,7 @@
 con : 2 x ≤ 1
 
 julia> normalized_rhs(con)
-1.0
source

num_constraints

JuMP.num_constraintsFunction
num_constraints(model::GenericModel, function_type, set_type)::Int64

Return the number of constraints currently in the model where the function has type function_type and the set has type set_type.

See also list_of_constraint_types and all_constraints.

Example

julia> model = Model();
+1.0
source

num_constraints

JuMP.num_constraintsFunction
num_constraints(model::GenericModel, function_type, set_type)::Int64

Return the number of constraints currently in the model where the function has type function_type and the set has type set_type.

See also list_of_constraint_types and all_constraints.

Example

julia> model = Model();
 
 julia> @variable(model, x >= 0, Bin);
 
@@ -1440,7 +1440,7 @@
 1
 
 julia> num_constraints(model, AffExpr, MOI.LessThan{Float64})
-2
source
num_constraints(model::GenericModel; count_variable_in_set_constraints::Bool)

Return the number of constraints in model.

If count_variable_in_set_constraints == true, then VariableRef constraints such as VariableRef-in-Integer are included. To count only the number of structural constraints (for example, the rows in the constraint matrix of a linear program), pass count_variable_in_set_constraints = false.

Example

julia> model = Model();
+2
source
num_constraints(model::GenericModel; count_variable_in_set_constraints::Bool)

Return the number of constraints in model.

If count_variable_in_set_constraints == true, then VariableRef constraints such as VariableRef-in-Integer are included. To count only the number of structural constraints (for example, the rows in the constraint matrix of a linear program), pass count_variable_in_set_constraints = false.

Example

julia> model = Model();
 
 julia> @variable(model, x >= 0, Int);
 
@@ -1450,18 +1450,18 @@
 3
 
 julia> num_constraints(model; count_variable_in_set_constraints = false)
-1
source

num_variables

JuMP.num_variablesFunction
num_variables(model::GenericModel)::Int64

Returns number of variables in model.

Example

julia> model = Model();
+1
source

num_variables

JuMP.num_variablesFunction
num_variables(model::GenericModel)::Int64

Returns number of variables in model.

Example

julia> model = Model();
 
 julia> @variable(model, x[1:2]);
 
 julia> num_variables(model)
-2
source

object_dictionary

JuMP.object_dictionaryFunction
object_dictionary(model::GenericModel)

Return the dictionary that maps the symbol name of a variable, constraint, or expression to the corresponding object.

Objects are registered to a specific symbol in the macros. For example, @variable(model, x[1:2, 1:2]) registers the array of variables x to the symbol :x.

This method should be defined for any subtype of AbstractModel.

See also: unregister.

Example

julia> model = Model();
+2
source

object_dictionary

JuMP.object_dictionaryFunction
object_dictionary(model::GenericModel)

Return the dictionary that maps the symbol name of a variable, constraint, or expression to the corresponding object.

Objects are registered to a specific symbol in the macros. For example, @variable(model, x[1:2, 1:2]) registers the array of variables x to the symbol :x.

This method should be defined for any subtype of AbstractModel.

See also: unregister.

Example

julia> model = Model();
 
 julia> @variable(model, x[1:2]);
 
 julia> object_dictionary(model)
 Dict{Symbol, Any} with 1 entry:
-  :x => VariableRef[x[1], x[2]]
source

objective_bound

JuMP.objective_boundFunction
objective_bound(model::GenericModel)

Return the best known bound on the optimal objective value after a call to optimize!(model).

For scalar-valued objectives, this function returns a Float64. For vector-valued objectives, it returns a Vector{Float64}.

In the case of a vector-valued objective, this returns the ideal point, that is, the point obtained if each objective was optimized independently.

This function is equivalent to querying the MOI.ObjectiveBound attribute.

Example

julia> import HiGHS
+  :x => VariableRef[x[1], x[2]]
source

objective_bound

JuMP.objective_boundFunction
objective_bound(model::GenericModel)

Return the best known bound on the optimal objective value after a call to optimize!(model).

For scalar-valued objectives, this function returns a Float64. For vector-valued objectives, it returns a Vector{Float64}.

In the case of a vector-valued objective, this returns the ideal point, that is, the point obtained if each objective was optimized independently.

This function is equivalent to querying the MOI.ObjectiveBound attribute.

Example

julia> import HiGHS
 
 julia> model = Model(HiGHS.Optimizer);
 
@@ -1474,7 +1474,7 @@
 julia> optimize!(model)
 
 julia> objective_bound(model)
-3.0
source

objective_function

JuMP.objective_functionFunction
objective_function(
+3.0
source

objective_function

JuMP.objective_functionFunction
objective_function(
     model::GenericModel,
     ::Type{F} = objective_function_type(model),
 ) where {F}

Return an object of type F representing the objective function.

Errors if the objective is not convertible to type F.

This function is equivalent to querying the MOI.ObjectiveFunction{F} attribute.

Example

julia> model = Model();
@@ -1494,21 +1494,21 @@
 julia> typeof(objective_function(model, QuadExpr))
 QuadExpr (alias for GenericQuadExpr{Float64, GenericVariableRef{Float64}})

We see with the last two commands that even if the objective function is affine, as it is convertible to a quadratic function, it can be queried as a quadratic function and the result is quadratic.

However, it is not convertible to a variable:

julia> objective_function(model, VariableRef)
 ERROR: InexactError: convert(MathOptInterface.VariableIndex, 1.0 + 2.0 MOI.VariableIndex(1))
-[...]
source

objective_function_string

JuMP.objective_function_stringFunction
objective_function_string(mode, model::AbstractModel)::String

Return a String describing the objective function of the model.

Example

julia> model = Model();
+[...]
source

objective_function_string

JuMP.objective_function_stringFunction
objective_function_string(mode, model::AbstractModel)::String

Return a String describing the objective function of the model.

Example

julia> model = Model();
 
 julia> @variable(model, x);
 
 julia> @objective(model, Min, 2 * x);
 
 julia> objective_function_string(MIME("text/plain"), model)
-"2 x"
source

objective_function_type

JuMP.objective_function_typeFunction
objective_function_type(model::GenericModel)::AbstractJuMPScalar

Return the type of the objective function.

This function is equivalent to querying the MOI.ObjectiveFunctionType attribute.

Example

julia> model = Model();
+"2 x"
source

objective_function_type

JuMP.objective_function_typeFunction
objective_function_type(model::GenericModel)::AbstractJuMPScalar

Return the type of the objective function.

This function is equivalent to querying the MOI.ObjectiveFunctionType attribute.

Example

julia> model = Model();
 
 julia> @variable(model, x);
 
 julia> @objective(model, Min, 2 * x + 1);
 
 julia> objective_function_type(model)
-AffExpr (alias for GenericAffExpr{Float64, GenericVariableRef{Float64}})
source

objective_sense

JuMP.objective_senseFunction
objective_sense(model::GenericModel)::MOI.OptimizationSense

Return the objective sense.

This function is equivalent to querying the MOI.ObjectiveSense attribute.

Example

julia> model = Model();
+AffExpr (alias for GenericAffExpr{Float64, GenericVariableRef{Float64}})
source

objective_sense

JuMP.objective_senseFunction
objective_sense(model::GenericModel)::MOI.OptimizationSense

Return the objective sense.

This function is equivalent to querying the MOI.ObjectiveSense attribute.

Example

julia> model = Model();
 
 julia> objective_sense(model)
 FEASIBILITY_SENSE::OptimizationSense = 2
@@ -1519,7 +1519,7 @@
 x
 
 julia> objective_sense(model)
-MAX_SENSE::OptimizationSense = 1
source

objective_value

JuMP.objective_valueFunction
objective_value(model::GenericModel; result::Int = 1)

Return the objective value associated with result index result of the most-recent solution returned by the solver.

For scalar-valued objectives, this function returns a Float64. For vector-valued objectives, it returns a Vector{Float64}.

This function is equivalent to querying the MOI.ObjectiveValue attribute.

See also: result_count.

Example

julia> import HiGHS
+MAX_SENSE::OptimizationSense = 1
source

objective_value

JuMP.objective_valueFunction
objective_value(model::GenericModel; result::Int = 1)

Return the objective value associated with result index result of the most-recent solution returned by the solver.

For scalar-valued objectives, this function returns a Float64. For vector-valued objectives, it returns a Vector{Float64}.

This function is equivalent to querying the MOI.ObjectiveValue attribute.

See also: result_count.

Example

julia> import HiGHS
 
 julia> model = Model(HiGHS.Optimizer);
 
@@ -1537,7 +1537,7 @@
 julia> objective_value(model; result = 2)
 ERROR: Result index of attribute MathOptInterface.ObjectiveValue(2) out of bounds. There are currently 1 solution(s) in the model.
 Stacktrace:
-[...]
source

op_ifelse

JuMP.op_ifelseFunction
op_ifelse(a, x, y)

A function that falls back to ifelse(a, x, y), but when called with a JuMP variables or expression in the first argument, returns a GenericNonlinearExpr.

Example

julia> model = Model();
+[...]
source

op_ifelse

JuMP.op_ifelseFunction
op_ifelse(a, x, y)

A function that falls back to ifelse(a, x, y), but when called with a JuMP variables or expression in the first argument, returns a GenericNonlinearExpr.

Example

julia> model = Model();
 
 julia> @variable(model, x);
 
@@ -1548,14 +1548,14 @@
 ifelse(x, 1.0, 2.0)
 
 julia> op_ifelse(true, x, 2.0)
-x
source

op_string

JuMP.op_stringFunction
op_string(mime::MIME, x::GenericNonlinearExpr, ::Val{op}) where {op}

Return the string that should be printed for the operator op when function_string is called with mime and x.

Example

julia> model = Model();
+x
source

op_string

JuMP.op_stringFunction
op_string(mime::MIME, x::GenericNonlinearExpr, ::Val{op}) where {op}

Return the string that should be printed for the operator op when function_string is called with mime and x.

Example

julia> model = Model();
 
 julia> @variable(model, x[1:2], Bin);
 
 julia> f = @expression(model, x[1] || x[2]);
 
 julia> op_string(MIME("text/plain"), f, Val(:||))
-"||"
source

operator_to_set

JuMP.operator_to_setFunction
operator_to_set(error_fn::Function, ::Val{sense_symbol})

Converts a sense symbol to a set set such that @constraint(model, func sense_symbol 0) is equivalent to @constraint(model, func in set) for any func::AbstractJuMPScalar.

Example

Once a custom set is defined you can directly create a JuMP constraint with it:

julia> struct CustomSet{T} <: MOI.AbstractScalarSet
+"||"
source

operator_to_set

JuMP.operator_to_setFunction
operator_to_set(error_fn::Function, ::Val{sense_symbol})

Converts a sense symbol to a set set such that @constraint(model, func sense_symbol 0) is equivalent to @constraint(model, func in set) for any func::AbstractJuMPScalar.

Example

Once a custom set is defined you can directly create a JuMP constraint with it:

julia> struct CustomSet{T} <: MOI.AbstractScalarSet
            value::T
        end
 
@@ -1574,8 +1574,8 @@
 julia> MOIU.shift_constant(set::CustomSet, value) = CustomSet(set.value + value)
 
 julia> cref = @constraint(model, x ⊰ 1)
-x ∈ CustomSet{Float64}(1.0)

Note that the whole function is first moved to the right-hand side, then the sign is transformed into a set with zero constant and finally the constant is moved to the set with MOIU.shift_constant.

source

operator_warn

JuMP.operator_warnFunction
operator_warn(model::AbstractModel)
-operator_warn(model::GenericModel)

This function is called on the model whenever two affine expressions are added together without using destructive_add!, and at least one of the two expressions has more than 50 terms.

For the case of Model, if this function is called more than 20,000 times then a warning is generated once.

This method should only be implemented by developers creating JuMP extensions. It should never be called by users of JuMP.

source

optimize!

JuMP.optimize!Function
optimize!(
+x ∈ CustomSet{Float64}(1.0)

Note that the whole function is first moved to the right-hand side, then the sign is transformed into a set with zero constant and finally the constant is moved to the set with MOIU.shift_constant.

source

operator_warn

JuMP.operator_warnFunction
operator_warn(model::AbstractModel)
+operator_warn(model::GenericModel)

This function is called on the model whenever two affine expressions are added together without using destructive_add!, and at least one of the two expressions has more than 50 terms.

For the case of Model, if this function is called more than 20,000 times then a warning is generated once.

This method should only be implemented by developers creating JuMP extensions. It should never be called by users of JuMP.

source

optimize!

JuMP.optimize!Function
optimize!(
     model::GenericModel;
     ignore_optimize_hook = (model.optimize_hook === nothing),
     kwargs...,
@@ -1595,7 +1595,7 @@
 my_optimize_hook (generic function with 1 method)
 
 julia> optimize!(model; foo = 2)
-Hook called with foo = 2
source

optimizer_index

JuMP.optimizer_indexFunction
optimizer_index(x::GenericVariableRef)::MOI.VariableIndex
+Hook called with foo = 2
source

optimizer_index

JuMP.optimizer_indexFunction
optimizer_index(x::GenericVariableRef)::MOI.VariableIndex
 optimizer_index(x::ConstraintRef{<:GenericModel})::MOI.ConstraintIndex

Return the variable or constraint index that corresponds to x in the associated model unsafe_backend(owner_model(x)).

This function should be used with unsafe_backend.

As a safer alternative, use backend and index. See the docstrings of backend and unsafe_backend for more details.

Throws

  • Throws NoOptimizer if no optimizer is set.
  • Throws an ErrorException if the optimizer is set but is not attached.
  • Throws an ErrorException if the index is bridged.

Example

julia> import HiGHS
 
 julia> model = Model(HiGHS.Optimizer);
@@ -1611,7 +1611,7 @@
 A HiGHS model with 1 columns and 0 rows.
 
 julia> optimizer_index(x)
-MOI.VariableIndex(1)
source

optimizer_with_attributes

JuMP.optimizer_with_attributesFunction
optimizer_with_attributes(optimizer_constructor, attrs::Pair...)

Groups an optimizer constructor with the list of attributes attrs. Note that it is equivalent to MOI.OptimizerWithAttributes.

When provided to the Model constructor or to set_optimizer, it creates an optimizer by calling optimizer_constructor(), and then sets the attributes using set_attribute.

See also: set_attribute, get_attribute.

Note

The string names of the attributes are specific to each solver. One should consult the solver's documentation to find the attributes of interest.

Example

julia> import HiGHS
+MOI.VariableIndex(1)
source

optimizer_with_attributes

JuMP.optimizer_with_attributesFunction
optimizer_with_attributes(optimizer_constructor, attrs::Pair...)

Groups an optimizer constructor with the list of attributes attrs. Note that it is equivalent to MOI.OptimizerWithAttributes.

When provided to the Model constructor or to set_optimizer, it creates an optimizer by calling optimizer_constructor(), and then sets the attributes using set_attribute.

See also: set_attribute, get_attribute.

Note

The string names of the attributes are specific to each solver. One should consult the solver's documentation to find the attributes of interest.

Example

julia> import HiGHS
 
 julia> optimizer = optimizer_with_attributes(
            HiGHS.Optimizer, "presolve" => "off", MOI.Silent() => true,
@@ -1623,12 +1623,12 @@
 
 julia> set_attribute(model, "presolve", "off")
 
-julia> set_attribute(model, MOI.Silent(), true)
source

owner_model

JuMP.owner_modelFunction
owner_model(s::AbstractJuMPScalar)

Return the model owning the scalar s.

Example

julia> model = Model();
+julia> set_attribute(model, MOI.Silent(), true)
source

owner_model

JuMP.owner_modelFunction
owner_model(s::AbstractJuMPScalar)

Return the model owning the scalar s.

Example

julia> model = Model();
 
 julia> @variable(model, x);
 
 julia> owner_model(x) === model
-true
source

parameter_value

JuMP.parameter_valueFunction
parameter_value(x::GenericVariableRef)

Return the value of the parameter x.

Errors if x is not a parameter.

See also ParameterRef, is_parameter, set_parameter_value.

Example

julia> model = Model();
+true
source

parameter_value

JuMP.parameter_valueFunction
parameter_value(x::GenericVariableRef)

Return the value of the parameter x.

Errors if x is not a parameter.

See also ParameterRef, is_parameter, set_parameter_value.

Example

julia> model = Model();
 
 julia> @variable(model, p in Parameter(2))
 p
@@ -1639,23 +1639,23 @@
 julia> set_parameter_value(p, 2.5)
 
 julia> parameter_value(p)
-2.5
source

parse_constraint

JuMP.parse_constraintFunction
parse_constraint(error_fn::Function, expr::Expr)

The entry-point for all constraint-related parsing.

Arguments

  • The error_fn function is passed everywhere to provide better error messages
  • expr comes from the @constraint macro. There are two possibilities:
    • @constraint(model, expr)
    • @constraint(model, name[args], expr)
    In both cases, expr is the main component of the constraint.

Supported syntax

JuMP currently supports the following expr objects:

  • lhs <= rhs
  • lhs == rhs
  • lhs >= rhs
  • l <= body <= u
  • u >= body >= l
  • lhs ⟂ rhs
  • lhs in rhs
  • lhs ∈ rhs
  • z --> {constraint}
  • !z --> {constraint}
  • z <--> {constraint}
  • !z <--> {constraint}
  • z => {constraint}
  • !z => {constraint}

as well as all broadcasted variants.

Extensions

The infrastructure behind parse_constraint is extendable. See parse_constraint_head and parse_constraint_call for details.

source

parse_constraint_call

JuMP.parse_constraint_callFunction
parse_constraint_call(
+2.5
source

parse_constraint

JuMP.parse_constraintFunction
parse_constraint(error_fn::Function, expr::Expr)

The entry-point for all constraint-related parsing.

Arguments

  • The error_fn function is passed everywhere to provide better error messages
  • expr comes from the @constraint macro. There are two possibilities:
    • @constraint(model, expr)
    • @constraint(model, name[args], expr)
    In both cases, expr is the main component of the constraint.

Supported syntax

JuMP currently supports the following expr objects:

  • lhs <= rhs
  • lhs == rhs
  • lhs >= rhs
  • l <= body <= u
  • u >= body >= l
  • lhs ⟂ rhs
  • lhs in rhs
  • lhs ∈ rhs
  • z --> {constraint}
  • !z --> {constraint}
  • z <--> {constraint}
  • !z <--> {constraint}
  • z => {constraint}
  • !z => {constraint}

as well as all broadcasted variants.

Extensions

The infrastructure behind parse_constraint is extendable. See parse_constraint_head and parse_constraint_call for details.

source

parse_constraint_call

JuMP.parse_constraint_callFunction
parse_constraint_call(
     error_fn::Function,
     is_vectorized::Bool,
     ::Val{op},
     args...,
-)

Implement this method to intercept the parsing of a :call expression with operator op.

Warning

Extending the constraint macro at parse time is an advanced operation and has the potential to interfere with existing JuMP syntax. Please discuss with the developer chatroom before publishing any code that implements these methods.

Arguments

  • error_fn: a function that accepts a String and throws the string as an error, along with some descriptive information of the macro from which it was thrown.
  • is_vectorized: a boolean to indicate if op should be broadcast or not
  • op: the first element of the .args field of the Expr to intercept
  • args...: the .args field of the Expr.

Returns

This function must return:

  • parse_code::Expr: an expression containing any setup or rewriting code that needs to be called before build_constraint
  • build_code::Expr: an expression that calls build_constraint( or build_constraint.( depending on is_vectorized.

See also: parse_constraint_head, build_constraint

source
parse_constraint_call(
+)

Implement this method to intercept the parsing of a :call expression with operator op.

Warning

Extending the constraint macro at parse time is an advanced operation and has the potential to interfere with existing JuMP syntax. Please discuss with the developer chatroom before publishing any code that implements these methods.

Arguments

  • error_fn: a function that accepts a String and throws the string as an error, along with some descriptive information of the macro from which it was thrown.
  • is_vectorized: a boolean to indicate if op should be broadcast or not
  • op: the first element of the .args field of the Expr to intercept
  • args...: the .args field of the Expr.

Returns

This function must return:

  • parse_code::Expr: an expression containing any setup or rewriting code that needs to be called before build_constraint
  • build_code::Expr: an expression that calls build_constraint( or build_constraint.( depending on is_vectorized.

See also: parse_constraint_head, build_constraint

source
parse_constraint_call(
     error_fn::Function,
     vectorized::Bool,
     ::Val{op},
     lhs,
     rhs,
-) where {op}

Fallback handler for binary operators. These might be infix operators like @constraint(model, lhs op rhs), or normal operators like @constraint(model, op(lhs, rhs)).

In both cases, we rewrite as lhs - rhs in operator_to_set(error_fn, op).

See operator_to_set for details.

source

parse_constraint_head

JuMP.parse_constraint_headFunction
parse_constraint_head(error_fn::Function, ::Val{head}, args...)

Implement this method to intercept the parsing of an expression with head head.

Warning

Extending the constraint macro at parse time is an advanced operation and has the potential to interfere with existing JuMP syntax. Please discuss with the developer chatroom before publishing any code that implements these methods.

Arguments

  • error_fn: a function that accepts a String and throws the string as an error, along with some descriptive information of the macro from which it was thrown.
  • head: the .head field of the Expr to intercept
  • args...: the .args field of the Expr.

Returns

This function must return:

  • is_vectorized::Bool: whether the expression represents a broadcasted expression like x .<= 1
  • parse_code::Expr: an expression containing any setup or rewriting code that needs to be called before build_constraint
  • build_code::Expr: an expression that calls build_constraint( or build_constraint.( depending on is_vectorized.

Existing implementations

JuMP currently implements:

  • ::Val{:call}, which forwards calls to parse_constraint_call
  • ::Val{:comparison}, which handles the special case of l <= body <= u.

See also: parse_constraint_call, build_constraint

source

parse_one_operator_variable

JuMP.parse_one_operator_variableFunction
parse_one_operator_variable(
+) where {op}

Fallback handler for binary operators. These might be infix operators like @constraint(model, lhs op rhs), or normal operators like @constraint(model, op(lhs, rhs)).

In both cases, we rewrite as lhs - rhs in operator_to_set(error_fn, op).

See operator_to_set for details.

source

parse_constraint_head

JuMP.parse_constraint_headFunction
parse_constraint_head(error_fn::Function, ::Val{head}, args...)

Implement this method to intercept the parsing of an expression with head head.

Warning

Extending the constraint macro at parse time is an advanced operation and has the potential to interfere with existing JuMP syntax. Please discuss with the developer chatroom before publishing any code that implements these methods.

Arguments

  • error_fn: a function that accepts a String and throws the string as an error, along with some descriptive information of the macro from which it was thrown.
  • head: the .head field of the Expr to intercept
  • args...: the .args field of the Expr.

Returns

This function must return:

  • is_vectorized::Bool: whether the expression represents a broadcasted expression like x .<= 1
  • parse_code::Expr: an expression containing any setup or rewriting code that needs to be called before build_constraint
  • build_code::Expr: an expression that calls build_constraint( or build_constraint.( depending on is_vectorized.

Existing implementations

JuMP currently implements:

  • ::Val{:call}, which forwards calls to parse_constraint_call
  • ::Val{:comparison}, which handles the special case of l <= body <= u.

See also: parse_constraint_call, build_constraint

source

parse_one_operator_variable

JuMP.parse_one_operator_variableFunction
parse_one_operator_variable(
     error_fn::Function,
     info_expr::_VariableInfoExpr,
     sense::Val{S},
     value,
-) where {S}

Update infoexr for a variable expression in the @variable macro of the form variable name S value.

source

parse_ternary_variable

JuMP.parse_ternary_variableFunction
parse_ternary_variable(error_fn, info_expr, lhs_sense, lhs, rhs_sense, rhs)

A hook for JuMP extensions to intercept the parsing of a :comparison expression, which has the form lhs lhs_sense variable rhs_sense rhs.

source

parse_variable

JuMP.parse_variableFunction
parse_variable(error_fn::Function, ::_VariableInfoExpr, args...)

A hook for extensions to intercept the parsing of inequality constraints in the @variable macro.

source

primal_feasibility_report

JuMP.primal_feasibility_reportFunction
primal_feasibility_report(
+) where {S}

Update infoexr for a variable expression in the @variable macro of the form variable name S value.

source

parse_ternary_variable

JuMP.parse_ternary_variableFunction
parse_ternary_variable(error_fn, info_expr, lhs_sense, lhs, rhs_sense, rhs)

A hook for JuMP extensions to intercept the parsing of a :comparison expression, which has the form lhs lhs_sense variable rhs_sense rhs.

source

parse_variable

JuMP.parse_variableFunction
parse_variable(error_fn::Function, ::_VariableInfoExpr, args...)

A hook for extensions to intercept the parsing of inequality constraints in the @variable macro.

source

primal_feasibility_report

JuMP.primal_feasibility_reportFunction
primal_feasibility_report(
     model::GenericModel{T},
     point::AbstractDict{GenericVariableRef{T},T} = _last_primal_solution(model),
     atol::T = zero(T),
@@ -1666,7 +1666,7 @@
 
 julia> primal_feasibility_report(model, Dict(x => 0.2))
 Dict{Any, Float64} with 1 entry:
-  x ≥ 0.5 => 0.3
source
primal_feasibility_report(
+  x ≥ 0.5 => 0.3
source
primal_feasibility_report(
     point::Function,
     model::GenericModel{T};
     atol::T = zero(T),
@@ -1679,30 +1679,30 @@
            return start_value(v)
        end
 Dict{Any, Float64} with 1 entry:
-  x ≤ 1 => 0.3
source

primal_status

JuMP.primal_statusFunction
primal_status(model::GenericModel; result::Int = 1)

Return a MOI.ResultStatusCode describing the status of the most recent primal solution of the solver (that is, the MOI.PrimalStatus attribute) associated with the result index result.

See also: result_count.

Example

julia> import Ipopt
+  x ≤ 1 => 0.3
source

primal_status

JuMP.primal_statusFunction
primal_status(model::GenericModel; result::Int = 1)

Return a MOI.ResultStatusCode describing the status of the most recent primal solution of the solver (that is, the MOI.PrimalStatus attribute) associated with the result index result.

See also: result_count.

Example

julia> import Ipopt
 
 julia> model = Model(Ipopt.Optimizer);
 
 julia> primal_status(model; result = 2)
-NO_SOLUTION::ResultStatusCode = 0
source
JuMP.print_active_bridgesFunction
print_active_bridges([io::IO = stdout,] model::GenericModel)

Print a list of the variable, constraint, and objective bridges that are currently used in the model.

source
print_active_bridges([io::IO = stdout,] model::GenericModel, ::Type{F}) where {F}

Print a list of bridges required for an objective function of type F.

source
print_active_bridges(
+NO_SOLUTION::ResultStatusCode = 0
source
JuMP.print_active_bridgesFunction
print_active_bridges([io::IO = stdout,] model::GenericModel)

Print a list of the variable, constraint, and objective bridges that are currently used in the model.

source
print_active_bridges([io::IO = stdout,] model::GenericModel, ::Type{F}) where {F}

Print a list of bridges required for an objective function of type F.

source
print_active_bridges(
     [io::IO = stdout,]
     model::GenericModel,
     F::Type,
     S::Type{<:MOI.AbstractSet},
-)

Print a list of bridges required for a constraint of type F-in-S.

source
print_active_bridges(
+)

Print a list of bridges required for a constraint of type F-in-S.

source
print_active_bridges(
     [io::IO = stdout,]
     model::GenericModel,
     S::Type{<:MOI.AbstractSet},
-)

Print a list of bridges required to add a variable constrained to the set S.

source
JuMP.print_bridge_graphFunction
 print_bridge_graph([io::IO,] model::GenericModel)

Print the hyper-graph containing all variable, constraint, and objective types that could be obtained by bridging the variables, constraints, and objectives that are present in the model.

Warning

This function is intended for advanced users. If you want to see only the bridges that are currently used, use print_active_bridges instead.

Explanation of output

Each node in the hyper-graph corresponds to a variable, constraint, or objective type.

  • Variable nodes are indicated by [ ]
  • Constraint nodes are indicated by ( )
  • Objective nodes are indicated by | |

The number inside each pair of brackets is an index of the node in the hyper-graph.

Note that this hyper-graph is the full list of possible transformations. When the bridged model is created, we select the shortest hyper-path(s) from this graph, so many nodes may be un-used.

For more information, see Legat, B., Dowson, O., Garcia, J., and Lubin, M. (2020). "MathOptInterface: a data structure for mathematical optimization problems." URL: https://arxiv.org/abs/2002.03447

source

quad_terms

JuMP.quad_termsFunction
quad_terms(quad::GenericQuadExpr{C,V})

Provides an iterator over tuples (coefficient::C, var_1::V, var_2::V) in the quadratic part of the quadratic expression.

source

raw_status

JuMP.raw_statusFunction
raw_status(model::GenericModel)

Return the reason why the solver stopped in its own words (that is, the MathOptInterface model attribute MOI.RawStatusString).

Example

julia> import Ipopt
+)

Print a list of bridges required to add a variable constrained to the set S.

source
JuMP.print_bridge_graphFunction
 print_bridge_graph([io::IO,] model::GenericModel)

Print the hyper-graph containing all variable, constraint, and objective types that could be obtained by bridging the variables, constraints, and objectives that are present in the model.

Warning

This function is intended for advanced users. If you want to see only the bridges that are currently used, use print_active_bridges instead.

Explanation of output

Each node in the hyper-graph corresponds to a variable, constraint, or objective type.

  • Variable nodes are indicated by [ ]
  • Constraint nodes are indicated by ( )
  • Objective nodes are indicated by | |

The number inside each pair of brackets is an index of the node in the hyper-graph.

Note that this hyper-graph is the full list of possible transformations. When the bridged model is created, we select the shortest hyper-path(s) from this graph, so many nodes may be un-used.

For more information, see Legat, B., Dowson, O., Garcia, J., and Lubin, M. (2020). "MathOptInterface: a data structure for mathematical optimization problems." URL: https://arxiv.org/abs/2002.03447

source

quad_terms

JuMP.quad_termsFunction
quad_terms(quad::GenericQuadExpr{C,V})

Provides an iterator over tuples (coefficient::C, var_1::V, var_2::V) in the quadratic part of the quadratic expression.

source

raw_status

JuMP.raw_statusFunction
raw_status(model::GenericModel)

Return the reason why the solver stopped in its own words (that is, the MathOptInterface model attribute MOI.RawStatusString).

Example

julia> import Ipopt
 
 julia> model = Model(Ipopt.Optimizer);
 
 julia> raw_status(model)
-"optimize not called"
source

read_from_file

JuMP.read_from_fileFunction
read_from_file(
+"optimize not called"
source

read_from_file

JuMP.read_from_fileFunction
read_from_file(
     filename::String;
     format::MOI.FileFormats.FileFormat = MOI.FileFormats.FORMAT_AUTOMATIC,
     kwargs...,
-)

Return a JuMP model read from filename in the format format.

If the filename ends in .gz, it will be uncompressed using GZip. If the filename ends in .bz2, it will be uncompressed using BZip2.

Other kwargs are passed to the Model constructor of the chosen format.

source

reduced_cost

JuMP.reduced_costFunction
reduced_cost(x::GenericVariableRef{T})::T where {T}

Return the reduced cost associated with variable x.

One interpretation of the reduced cost is that it is the change in the objective from an infinitesimal relaxation of the variable bounds.

This method is equivalent to querying the shadow price of the active variable bound (if one exists and is active).

See also: shadow_price.

Example

julia> import HiGHS
+)

Return a JuMP model read from filename in the format format.

If the filename ends in .gz, it will be uncompressed using GZip. If the filename ends in .bz2, it will be uncompressed using BZip2.

Other kwargs are passed to the Model constructor of the chosen format.

source

reduced_cost

JuMP.reduced_costFunction
reduced_cost(x::GenericVariableRef{T})::T where {T}

Return the reduced cost associated with variable x.

One interpretation of the reduced cost is that it is the change in the objective from an infinitesimal relaxation of the variable bounds.

This method is equivalent to querying the shadow price of the active variable bound (if one exists and is active).

See also: shadow_price.

Example

julia> import HiGHS
 
 julia> model = Model(HiGHS.Optimizer);
 
@@ -1718,7 +1718,7 @@
 true
 
 julia> reduced_cost(x)
-2.0
source

relative_gap

JuMP.relative_gapFunction
relative_gap(model::GenericModel)

Return the final relative optimality gap after a call to optimize!(model).

Exact value depends upon implementation of MOI.RelativeGap by the particular solver used for optimization.

This function is equivalent to querying the MOI.RelativeGap attribute.

Example

julia> import HiGHS
+2.0
source

relative_gap

JuMP.relative_gapFunction
relative_gap(model::GenericModel)

Return the final relative optimality gap after a call to optimize!(model).

Exact value depends upon implementation of MOI.RelativeGap by the particular solver used for optimization.

This function is equivalent to querying the MOI.RelativeGap attribute.

Example

julia> import HiGHS
 
 julia> model = Model(HiGHS.Optimizer);
 
@@ -1731,7 +1731,7 @@
 julia> optimize!(model)
 
 julia> relative_gap(model)
-0.0
source

relax_integrality

JuMP.relax_integralityFunction
relax_integrality(model::GenericModel)

Modifies model to "relax" all binary and integrality constraints on variables. Specifically,

  • Binary constraints are deleted, and variable bounds are tightened if necessary to ensure the variable is constrained to the interval $[0, 1]$.
  • Integrality constraints are deleted without modifying variable bounds.
  • An error is thrown if semi-continuous or semi-integer constraints are present (support may be added for these in the future).
  • All other constraints are ignored (left in place). This includes discrete constraints like SOS and indicator constraints.

Returns a function that can be called without any arguments to restore the original model. The behavior of this function is undefined if additional changes are made to the affected variables in the meantime.

Example

julia> model = Model();
+0.0
source

relax_integrality

JuMP.relax_integralityFunction
relax_integrality(model::GenericModel)

Modifies model to "relax" all binary and integrality constraints on variables. Specifically,

  • Binary constraints are deleted, and variable bounds are tightened if necessary to ensure the variable is constrained to the interval $[0, 1]$.
  • Integrality constraints are deleted without modifying variable bounds.
  • An error is thrown if semi-continuous or semi-integer constraints are present (support may be added for these in the future).
  • All other constraints are ignored (left in place). This includes discrete constraints like SOS and indicator constraints.

Returns a function that can be called without any arguments to restore the original model. The behavior of this function is undefined if additional changes are made to the affected variables in the meantime.

Example

julia> model = Model();
 
 julia> @variable(model, x, Bin);
 
@@ -1757,7 +1757,7 @@
  y ≥ 1
  y ≤ 10
  y integer
- x binary
source

relax_with_penalty!

JuMP.relax_with_penalty!Function
relax_with_penalty!(
+ x binary
source

relax_with_penalty!

JuMP.relax_with_penalty!Function
relax_with_penalty!(
     model::GenericModel{T},
     [penalties::Dict{ConstraintRef,T}];
     [default::Union{Nothing,Real} = nothing,]
@@ -1800,7 +1800,7 @@
 Subject to
  c2 : 3 x + _[2] ≥ 0
  c1 : 2 x ≤ -1
- _[2] ≥ 0
source

remove_bridge

JuMP.remove_bridgeFunction
remove_bridge(
+ _[2] ≥ 0
source

remove_bridge

JuMP.remove_bridgeFunction
remove_bridge(
     model::GenericModel{S},
     BT::Type{<:MOI.Bridges.AbstractBridge};
     coefficient_type::Type{T} = S,
@@ -1820,17 +1820,17 @@
            model,
            MOI.Bridges.Constraint.NumberConversionBridge;
            coefficient_type = Complex{Float64},
-       )
source

reshape_set

JuMP.reshape_setFunction
reshape_set(vectorized_set::MOI.AbstractSet, shape::AbstractShape)

Return a set in its original shape shape given its vectorized form vectorized_form.

Example

Given a SymmetricMatrixShape of vectorized form [1, 2, 3] in MOI.PositiveSemidefinieConeTriangle(2), the following code returns the set of the original constraint Symmetric(Matrix[1 2; 2 3]) in PSDCone():

julia> reshape_set(MOI.PositiveSemidefiniteConeTriangle(2), SymmetricMatrixShape(2))
-PSDCone()
source

reshape_vector

JuMP.reshape_vectorFunction
reshape_vector(vectorized_form::Vector, shape::AbstractShape)

Return an object in its original shape shape given its vectorized form vectorized_form.

Example

Given a SymmetricMatrixShape of vectorized form [1, 2, 3], the following code returns the matrix Symmetric(Matrix[1 2; 2 3]):

julia> reshape_vector([1, 2, 3], SymmetricMatrixShape(2))
+       )
source

reshape_set

JuMP.reshape_setFunction
reshape_set(vectorized_set::MOI.AbstractSet, shape::AbstractShape)

Return a set in its original shape shape given its vectorized form vectorized_form.

Example

Given a SymmetricMatrixShape of vectorized form [1, 2, 3] in MOI.PositiveSemidefinieConeTriangle(2), the following code returns the set of the original constraint Symmetric(Matrix[1 2; 2 3]) in PSDCone():

julia> reshape_set(MOI.PositiveSemidefiniteConeTriangle(2), SymmetricMatrixShape(2))
+PSDCone()
source

reshape_vector

JuMP.reshape_vectorFunction
reshape_vector(vectorized_form::Vector, shape::AbstractShape)

Return an object in its original shape shape given its vectorized form vectorized_form.

Example

Given a SymmetricMatrixShape of vectorized form [1, 2, 3], the following code returns the matrix Symmetric(Matrix[1 2; 2 3]):

julia> reshape_vector([1, 2, 3], SymmetricMatrixShape(2))
 2×2 LinearAlgebra.Symmetric{Int64, Matrix{Int64}}:
  1  2
- 2  3
source

result_count

JuMP.result_countFunction
result_count(model::GenericModel)

Return the number of results available to query after a call to optimize!.

Example

julia> import Ipopt
+ 2  3
source

result_count

JuMP.result_countFunction
result_count(model::GenericModel)

Return the number of results available to query after a call to optimize!.

Example

julia> import Ipopt
 
 julia> model = Model(Ipopt.Optimizer);
 
 julia> result_count(model)
-0
source

reverse_sense

JuMP.reverse_senseFunction
reverse_sense(::Val{T}) where {T}

Given an (in)equality symbol T, return a new Val object with the opposite (in)equality symbol.

This function is intended for use in JuMP extensions.

Example

julia> reverse_sense(Val(:>=))
-Val{:<=}()
source

set_attribute

JuMP.set_attributeFunction
set_attribute(model::GenericModel, attr::MOI.AbstractModelAttribute, value)
+0
source

reverse_sense

JuMP.reverse_senseFunction
reverse_sense(::Val{T}) where {T}

Given an (in)equality symbol T, return a new Val object with the opposite (in)equality symbol.

This function is intended for use in JuMP extensions.

Example

julia> reverse_sense(Val(:>=))
+Val{:<=}()
source

set_attribute

JuMP.set_attributeFunction
set_attribute(model::GenericModel, attr::MOI.AbstractModelAttribute, value)
 set_attribute(x::GenericVariableRef, attr::MOI.AbstractVariableAttribute, value)
 set_attribute(cr::ConstraintRef, attr::MOI.AbstractConstraintAttribute, value)

Set the value of a solver-specifc attribute attr to value.

This is equivalent to calling MOI.set with the associated MOI model and, for variables and constraints, with the associated MOI.VariableIndex or MOI.ConstraintIndex.

Example

julia> model = Model();
 
@@ -1844,7 +1844,7 @@
 
 julia> set_attribute(x, MOI.VariableName(), "x_new")
 
-julia> set_attribute(c, MOI.ConstraintName(), "c_new")
source
set_attribute(
+julia> set_attribute(c, MOI.ConstraintName(), "c_new")
source
set_attribute(
     model::Union{GenericModel,MOI.OptimizerWithAttributes},
     attr::Union{AbstractString,MOI.AbstractOptimizerAttribute},
     value,
@@ -1860,7 +1860,7 @@
 
 julia> set_attribute(opt, "output_flag", true)
 
-julia> set_attribute(opt, MOI.RawOptimizerAttribute("output_flag"), false)
source

set_attributes

JuMP.set_attributesFunction
set_attributes(
+julia> set_attribute(opt, MOI.RawOptimizerAttribute("output_flag"), false)
source

set_attributes

JuMP.set_attributesFunction
set_attributes(
     destination::Union{
         GenericModel,
         MOI.OptimizerWithAttributes,
@@ -1878,7 +1878,7 @@
 
 julia> set_attribute(model, "tol", 1e-4)
 
-julia> set_attribute(model, "max_iter", 100)
source

set_binary

JuMP.set_binaryFunction
set_binary(v::GenericVariableRef)

Add a constraint on the variable v that it must take values in the set $\{0,1\}$.

See also BinaryRef, is_binary, unset_binary.

Example

julia> model = Model();
+julia> set_attribute(model, "max_iter", 100)
source

set_binary

JuMP.set_binaryFunction
set_binary(v::GenericVariableRef)

Add a constraint on the variable v that it must take values in the set $\{0,1\}$.

See also BinaryRef, is_binary, unset_binary.

Example

julia> model = Model();
 
 julia> @variable(model, x);
 
@@ -1888,7 +1888,7 @@
 julia> set_binary(x)
 
 julia> is_binary(x)
-true
source

set_dual_start_value

JuMP.set_dual_start_valueFunction
set_dual_start_value(con_ref::ConstraintRef, value)

Set the dual start value (MOI attribute ConstraintDualStart) of the constraint con_ref to value.

To remove a dual start value set it to nothing.

See also dual_start_value.

Example

julia> model = Model();
+true
source

set_dual_start_value

JuMP.set_dual_start_valueFunction
set_dual_start_value(con_ref::ConstraintRef, value)

Set the dual start value (MOI attribute ConstraintDualStart) of the constraint con_ref to value.

To remove a dual start value set it to nothing.

See also dual_start_value.

Example

julia> model = Model();
 
 julia> @variable(model, x, start = 2.0);
 
@@ -1903,7 +1903,7 @@
 
 julia> set_dual_start_value(c, nothing)
 
-julia> dual_start_value(c)
source

set_integer

JuMP.set_integerFunction
set_integer(variable_ref::GenericVariableRef)

Add an integrality constraint on the variable variable_ref.

See also IntegerRef, is_integer, unset_integer.

Example

julia> model = Model();
+julia> dual_start_value(c)
source

set_integer

JuMP.set_integerFunction
set_integer(variable_ref::GenericVariableRef)

Add an integrality constraint on the variable variable_ref.

See also IntegerRef, is_integer, unset_integer.

Example

julia> model = Model();
 
 julia> @variable(model, x);
 
@@ -1913,7 +1913,7 @@
 julia> set_integer(x)
 
 julia> is_integer(x)
-true
source

set_lower_bound

JuMP.set_lower_boundFunction
set_lower_bound(v::GenericVariableRef, lower::Number)

Set the lower bound of a variable. If one does not exist, create a new lower bound constraint.

See also LowerBoundRef, has_lower_bound, lower_bound, delete_lower_bound.

Example

julia> model = Model();
+true
source

set_lower_bound

JuMP.set_lower_boundFunction
set_lower_bound(v::GenericVariableRef, lower::Number)

Set the lower bound of a variable. If one does not exist, create a new lower bound constraint.

See also LowerBoundRef, has_lower_bound, lower_bound, delete_lower_bound.

Example

julia> model = Model();
 
 julia> @variable(model, x >= 1.0);
 
@@ -1923,7 +1923,7 @@
 julia> set_lower_bound(x, 2.0)
 
 julia> lower_bound(x)
-2.0
source

set_name

JuMP.set_nameFunction
set_name(con_ref::ConstraintRef, s::AbstractString)

Set a constraint's name attribute.

Example

julia> model = Model();
+2.0
source

set_name

JuMP.set_nameFunction
set_name(con_ref::ConstraintRef, s::AbstractString)

Set a constraint's name attribute.

Example

julia> model = Model();
 
 julia> @variable(model, x);
 
@@ -1936,7 +1936,7 @@
 "my_constraint"
 
 julia> c
-my_constraint : [2 x] ∈ Nonnegatives()
source
set_name(v::GenericVariableRef, s::AbstractString)

Set a variable's name attribute.

Example

julia> model = Model();
+my_constraint : [2 x] ∈ Nonnegatives()
source
set_name(v::GenericVariableRef, s::AbstractString)

Set a variable's name attribute.

Example

julia> model = Model();
 
 julia> @variable(model, x)
 x
@@ -1947,7 +1947,7 @@
 x_foo
 
 julia> name(x)
-"x_foo"
source

set_normalized_coefficient

JuMP.set_normalized_coefficientFunction
set_normalized_coefficient(
+"x_foo"
source

set_normalized_coefficient

JuMP.set_normalized_coefficientFunction
set_normalized_coefficient(
     constraint::ConstraintRef,
     variable::GenericVariableRef,
     value::Number,
@@ -1962,7 +1962,7 @@
 julia> set_normalized_coefficient(con, x, 4)
 
 julia> con
-con : 4 x ≤ 2
source
set_normalized_coefficient(
+con : 4 x ≤ 2
source
set_normalized_coefficient(
     constraints::AbstractVector{<:ConstraintRef},
     variables::AbstractVector{<:GenericVariableRef},
     values::AbstractVector{<:Number},
@@ -1980,7 +1980,7 @@
 julia> set_normalized_coefficient([con, con], [x, y], [6, 7])
 
 julia> con
-con : 6 x + 7 y ≤ 2
source
set_normalized_coefficient(
+con : 6 x + 7 y ≤ 2
source
set_normalized_coefficient(
     con_ref::ConstraintRef,
     variable::AbstractVariableRef,
     new_coefficients::Vector{Tuple{Int64,T}},
@@ -1995,7 +1995,7 @@
 julia> set_normalized_coefficient(con, x, [(1, 2.0), (2, 5.0)])
 
 julia> con
-con : [2 x, 5 x] ∈ MathOptInterface.Nonnegatives(2)
source
set_normalized_coefficient(
+con : [2 x, 5 x] ∈ MathOptInterface.Nonnegatives(2)
source
set_normalized_coefficient(
     constraint::ConstraintRef,
     variable_1:GenericVariableRef,
     variable_2:GenericVariableRef,
@@ -2012,7 +2012,7 @@
 julia> set_normalized_coefficient(con, x[1], x[2], 5)
 
 julia> con
-con : 4 x[1]² + 5 x[1]*x[2] + x[2] ≤ 2
source
set_normalized_coefficient(
+con : 4 x[1]² + 5 x[1]*x[2] + x[2] ≤ 2
source
set_normalized_coefficient(
     constraints::AbstractVector{<:ConstraintRef},
     variables_1:AbstractVector{<:GenericVariableRef},
     variables_2:AbstractVector{<:GenericVariableRef},
@@ -2027,7 +2027,7 @@
 julia> set_normalized_coefficient([con, con], [x[1], x[1]], [x[1], x[2]], [4, 5])
 
 julia> con
-con : 4 x[1]² + 5 x[1]*x[2] + x[2] ≤ 2
source

set_normalized_rhs

JuMP.set_normalized_rhsFunction
set_normalized_rhs(constraint::ConstraintRef, value::Number)

Set the right-hand side term of constraint to value.

Note that prior to this step, JuMP will aggregate all constant terms onto the right-hand side of the constraint. For example, given a constraint 2x + 1 <= 2, set_normalized_rhs(con, 4) will create the constraint 2x <= 4, not 2x + 1 <= 4.

Example

julia> model = Model();
+con : 4 x[1]² + 5 x[1]*x[2] + x[2] ≤ 2
source

set_normalized_rhs

JuMP.set_normalized_rhsFunction
set_normalized_rhs(constraint::ConstraintRef, value::Number)

Set the right-hand side term of constraint to value.

Note that prior to this step, JuMP will aggregate all constant terms onto the right-hand side of the constraint. For example, given a constraint 2x + 1 <= 2, set_normalized_rhs(con, 4) will create the constraint 2x <= 4, not 2x + 1 <= 4.

Example

julia> model = Model();
 
 julia> @variable(model, x);
 
@@ -2037,7 +2037,7 @@
 julia> set_normalized_rhs(con, 4)
 
 julia> con
-con : 2 x ≤ 4
source
set_normalized_rhs(
+con : 2 x ≤ 4
source
set_normalized_rhs(
     constraints::AbstractVector{<:ConstraintRef},
     values::AbstractVector{<:Number}
 )

Set the right-hand side terms of all constraints to values.

Note that prior to this step, JuMP will aggregate all constant terms onto the right-hand side of the constraint. For example, given a constraint 2x + 1 <= 2, set_normalized_rhs([con], [4]) will create the constraint 2x <= 4, not 2x + 1 <= 4.

Example

julia> model = Model();
@@ -2056,12 +2056,12 @@
 con1 : 2 x ≤ 4
 
 julia> con2
-con2 : 3 x ≤ 5
source

set_objective

JuMP.set_objectiveFunction
set_objective(model::AbstractModel, sense::MOI.OptimizationSense, func)

The functional equivalent of the @objective macro.

Sets the objective sense and objective function simultaneously, and is equivalent to calling set_objective_sense and set_objective_function separately.

Example

julia> model = Model();
+con2 : 3 x ≤ 5
source

set_objective

JuMP.set_objectiveFunction
set_objective(model::AbstractModel, sense::MOI.OptimizationSense, func)

The functional equivalent of the @objective macro.

Sets the objective sense and objective function simultaneously, and is equivalent to calling set_objective_sense and set_objective_function separately.

Example

julia> model = Model();
 
 julia> @variable(model, x)
 x
 
-julia> set_objective(model, MIN_SENSE, x)
source

set_objective_coefficient

JuMP.set_objective_coefficientFunction
set_objective_coefficient(
+julia> set_objective(model, MIN_SENSE, x)
source

set_objective_coefficient

JuMP.set_objective_coefficientFunction
set_objective_coefficient(
     model::GenericModel,
     variable::GenericVariableRef,
     coefficient::Real,
@@ -2075,7 +2075,7 @@
 julia> set_objective_coefficient(model, x, 3)
 
 julia> objective_function(model)
-3 x + 1
source
set_objective_coefficient(
+3 x + 1
source
set_objective_coefficient(
     model::GenericModel,
     variables::Vector{<:GenericVariableRef},
     coefficients::Vector{<:Real},
@@ -2091,7 +2091,7 @@
 julia> set_objective_coefficient(model, [x, y], [5, 4])
 
 julia> objective_function(model)
-5 x + 4 y + 1
source
set_objective_coefficient(
+5 x + 4 y + 1
source
set_objective_coefficient(
     model::GenericModel{T},
     variable_1::GenericVariableRef{T},
     variable_2::GenericVariableRef{T},
@@ -2108,7 +2108,7 @@
 julia> set_objective_coefficient(model, x[1], x[2], 3)
 
 julia> objective_function(model)
-2 x[1]² + 3 x[1]*x[2]
source
set_objective_coefficient(
+2 x[1]² + 3 x[1]*x[2]
source
set_objective_coefficient(
     model::GenericModel{T},
     variables_1::AbstractVector{<:GenericVariableRef{T}},
     variables_2::AbstractVector{<:GenericVariableRef{T}},
@@ -2123,7 +2123,7 @@
 julia> set_objective_coefficient(model, [x[1], x[1]], [x[1], x[2]], [2, 3])
 
 julia> objective_function(model)
-2 x[1]² + 3 x[1]*x[2]
source

set_objective_function

JuMP.set_objective_functionFunction
set_objective_function(model::GenericModel, func::MOI.AbstractFunction)
+2 x[1]² + 3 x[1]*x[2]
source

set_objective_function

JuMP.set_objective_functionFunction
set_objective_function(model::GenericModel, func::MOI.AbstractFunction)
 set_objective_function(model::GenericModel, func::AbstractJuMPScalar)
 set_objective_function(model::GenericModel, func::Real)
 set_objective_function(model::GenericModel, func::Vector{<:AbstractJuMPScalar})

Sets the objective function of the model to the given function.

See set_objective_sense to set the objective sense.

These are low-level functions; the recommended way to set the objective is with the @objective macro.

Example

julia> model = Model();
@@ -2138,7 +2138,7 @@
 julia> set_objective_function(model, 2 * x + 1)
 
 julia> objective_function(model)
-2 x + 1
source

set_objective_sense

JuMP.set_objective_senseFunction
set_objective_sense(model::GenericModel, sense::MOI.OptimizationSense)

Sets the objective sense of the model to the given sense.

See set_objective_function to set the objective function.

These are low-level functions; the recommended way to set the objective is with the @objective macro.

Example

julia> model = Model();
+2 x + 1
source

set_objective_sense

JuMP.set_objective_senseFunction
set_objective_sense(model::GenericModel, sense::MOI.OptimizationSense)

Sets the objective sense of the model to the given sense.

See set_objective_function to set the objective function.

These are low-level functions; the recommended way to set the objective is with the @objective macro.

Example

julia> model = Model();
 
 julia> objective_sense(model)
 FEASIBILITY_SENSE::OptimizationSense = 2
@@ -2146,7 +2146,7 @@
 julia> set_objective_sense(model, MOI.MAX_SENSE)
 
 julia> objective_sense(model)
-MAX_SENSE::OptimizationSense = 1
source

set_optimize_hook

JuMP.set_optimize_hookFunction
set_optimize_hook(model::GenericModel, f::Union{Function,Nothing})

Set the function f as the optimize hook for model.

f should have a signature f(model::GenericModel; kwargs...), where the kwargs are those passed to optimize!.

Notes

  • The optimize hook should generally modify the model, or some external state in some way, and then call optimize!(model; ignore_optimize_hook = true) to optimize the problem, bypassing the hook.
  • Use set_optimize_hook(model, nothing) to unset an optimize hook.

Example

julia> model = Model();
+MAX_SENSE::OptimizationSense = 1
source

set_optimize_hook

JuMP.set_optimize_hookFunction
set_optimize_hook(model::GenericModel, f::Union{Function,Nothing})

Set the function f as the optimize hook for model.

f should have a signature f(model::GenericModel; kwargs...), where the kwargs are those passed to optimize!.

Notes

  • The optimize hook should generally modify the model, or some external state in some way, and then call optimize!(model; ignore_optimize_hook = true) to optimize the problem, bypassing the hook.
  • Use set_optimize_hook(model, nothing) to unset an optimize hook.

Example

julia> model = Model();
 
 julia> function my_hook(model::Model; kwargs...)
            println(kwargs)
@@ -2163,7 +2163,7 @@
 Base.Pairs{Symbol, Bool, Tuple{Symbol}, @NamedTuple{test_arg::Bool}}(:test_arg => 1)
 Calling with `ignore_optimize_hook = true`
 ERROR: NoOptimizer()
-[...]
source

set_optimizer

JuMP.set_optimizerFunction
set_optimizer(
+[...]
source

set_optimizer

JuMP.set_optimizerFunction
set_optimizer(
     model::GenericModel,
     optimizer_factory;
     add_bridges::Bool = true,
@@ -2173,7 +2173,7 @@
 
 julia> set_optimizer(model, () -> HiGHS.Optimizer())
 
-julia> set_optimizer(model, HiGHS.Optimizer; add_bridges = false)
source

set_parameter_value

JuMP.set_parameter_valueFunction
set_parameter_value(x::GenericVariableRef, value)

Update the parameter constraint on the variable x to value.

Errors if x is not a parameter.

See also ParameterRef, is_parameter, parameter_value.

Example

julia> model = Model();
+julia> set_optimizer(model, HiGHS.Optimizer; add_bridges = false)
source

set_parameter_value

JuMP.set_parameter_valueFunction
set_parameter_value(x::GenericVariableRef, value)

Update the parameter constraint on the variable x to value.

Errors if x is not a parameter.

See also ParameterRef, is_parameter, parameter_value.

Example

julia> model = Model();
 
 julia> @variable(model, p in Parameter(2))
 p
@@ -2184,7 +2184,7 @@
 julia> set_parameter_value(p, 2.5)
 
 julia> parameter_value(p)
-2.5
source

set_silent

JuMP.set_silentFunction
set_silent(model::GenericModel)

Takes precedence over any other attribute controlling verbosity and requires the solver to produce no output.

See also: unset_silent.

Example

julia> import Ipopt
+2.5
source

set_silent

JuMP.set_silentFunction
set_silent(model::GenericModel)

Takes precedence over any other attribute controlling verbosity and requires the solver to produce no output.

See also: unset_silent.

Example

julia> import Ipopt
 
 julia> model = Model(Ipopt.Optimizer);
 
@@ -2196,7 +2196,7 @@
 julia> unset_silent(model)
 
 julia> get_attribute(model, MOI.Silent())
-false
source

set_start_value

JuMP.set_start_valueFunction
set_start_value(con_ref::ConstraintRef, value)

Set the primal start value (MOI.ConstraintPrimalStart) of the constraint con_ref to value.

To remove a primal start value set it to nothing.

See also start_value.

Example

julia> model = Model();
+false
source

set_start_value

JuMP.set_start_valueFunction
set_start_value(con_ref::ConstraintRef, value)

Set the primal start value (MOI.ConstraintPrimalStart) of the constraint con_ref to value.

To remove a primal start value set it to nothing.

See also start_value.

Example

julia> model = Model();
 
 julia> @variable(model, x, start = 2.0);
 
@@ -2211,7 +2211,7 @@
 
 julia> set_start_value(c, nothing)
 
-julia> start_value(c)
source
set_start_value(variable::GenericVariableRef, value::Union{Real,Nothing})

Set the start value (MOI.VariablePrimalStart) of the variable to value.

Pass nothing to unset the start value.

Note: VariablePrimalStarts are sometimes called "MIP-starts" or "warmstarts".

See also: has_start_value, start_value.

Example

julia> model = Model();
+julia> start_value(c)
source
set_start_value(variable::GenericVariableRef, value::Union{Real,Nothing})

Set the start value (MOI.VariablePrimalStart) of the variable to value.

Pass nothing to unset the start value.

Note: VariablePrimalStarts are sometimes called "MIP-starts" or "warmstarts".

See also: has_start_value, start_value.

Example

julia> model = Model();
 
 julia> @variable(model, x, start = 1.5);
 
@@ -2237,13 +2237,13 @@
 true
 
 julia> start_value(y)
-2.0
source

set_start_values

JuMP.set_start_valuesFunction
set_start_values(
+2.0
source

set_start_values

JuMP.set_start_valuesFunction
set_start_values(
     model::GenericModel;
     variable_primal_start::Union{Nothing,Function} = value,
     constraint_primal_start::Union{Nothing,Function} = value,
     constraint_dual_start::Union{Nothing,Function} = dual,
     nonlinear_dual_start::Union{Nothing,Function} = nonlinear_dual_start_value,
-)

Set the primal and dual starting values in model using the functions provided.

If any keyword argument is nothing, the corresponding start value is skipped.

If the optimizer does not support setting the starting value, the value will be skipped.

variable_primal_start

This function controls the primal starting solution for the variables. It is equivalent to calling set_start_value for each variable, or setting the MOI.VariablePrimalStart attribute.

If it is a function, it must have the form variable_primal_start(x::VariableRef) that maps each variable x to the starting primal value.

The default is value.

constraint_primal_start

This function controls the primal starting solution for the constraints. It is equivalent to calling set_start_value for each constraint, or setting the MOI.ConstraintPrimalStart attribute.

If it is a function, it must have the form constraint_primal_start(ci::ConstraintRef) that maps each constraint ci to the starting primal value.

The default is value.

constraint_dual_start

This function controls the dual starting solution for the constraints. It is equivalent to calling set_dual_start_value for each constraint, or setting the MOI.ConstraintDualStart attribute.

If it is a function, it must have the form constraint_dual_start(ci::ConstraintRef) that maps each constraint ci to the starting dual value.

The default is dual.

nonlinear_dual_start

This function controls the dual starting solution for the nonlinear constraints It is equivalent to calling set_nonlinear_dual_start_value.

If it is a function, it must have the form nonlinear_dual_start(model::GenericModel) that returns a vector corresponding to the dual start of the constraints.

The default is nonlinear_dual_start_value.

source

set_string_names_on_creation

JuMP.set_string_names_on_creationFunction
set_string_names_on_creation(model::GenericModel, value::Bool)

Set the default argument of the set_string_name keyword in the @variable and @constraint macros to value.

The set_string_name keyword is used to determine whether to assign String names to all variables and constraints in model.

By default, value is true. However, for larger models calling set_string_names_on_creation(model, false) can improve performance at the cost of reducing the readability of printing and solver log messages.

Example

julia> import HiGHS
+)

Set the primal and dual starting values in model using the functions provided.

If any keyword argument is nothing, the corresponding start value is skipped.

If the optimizer does not support setting the starting value, the value will be skipped.

variable_primal_start

This function controls the primal starting solution for the variables. It is equivalent to calling set_start_value for each variable, or setting the MOI.VariablePrimalStart attribute.

If it is a function, it must have the form variable_primal_start(x::VariableRef) that maps each variable x to the starting primal value.

The default is value.

constraint_primal_start

This function controls the primal starting solution for the constraints. It is equivalent to calling set_start_value for each constraint, or setting the MOI.ConstraintPrimalStart attribute.

If it is a function, it must have the form constraint_primal_start(ci::ConstraintRef) that maps each constraint ci to the starting primal value.

The default is value.

constraint_dual_start

This function controls the dual starting solution for the constraints. It is equivalent to calling set_dual_start_value for each constraint, or setting the MOI.ConstraintDualStart attribute.

If it is a function, it must have the form constraint_dual_start(ci::ConstraintRef) that maps each constraint ci to the starting dual value.

The default is dual.

nonlinear_dual_start

This function controls the dual starting solution for the nonlinear constraints It is equivalent to calling set_nonlinear_dual_start_value.

If it is a function, it must have the form nonlinear_dual_start(model::GenericModel) that returns a vector corresponding to the dual start of the constraints.

The default is nonlinear_dual_start_value.

source

set_string_names_on_creation

JuMP.set_string_names_on_creationFunction
set_string_names_on_creation(model::GenericModel, value::Bool)

Set the default argument of the set_string_name keyword in the @variable and @constraint macros to value.

The set_string_name keyword is used to determine whether to assign String names to all variables and constraints in model.

By default, value is true. However, for larger models calling set_string_names_on_creation(model, false) can improve performance at the cost of reducing the readability of printing and solver log messages.

Example

julia> import HiGHS
 
 julia> model = Model(HiGHS.Optimizer);
 
@@ -2253,7 +2253,7 @@
 julia> set_string_names_on_creation(model, false)
 
 julia> set_string_names_on_creation(model)
-false
source

set_time_limit_sec

JuMP.set_time_limit_secFunction
set_time_limit_sec(model::GenericModel, limit::Float64)

Set the time limit (in seconds) of the solver.

Can be unset using unset_time_limit_sec or with limit set to nothing.

See also: unset_time_limit_sec, time_limit_sec.

Example

julia> import Ipopt
+false
source

set_time_limit_sec

JuMP.set_time_limit_secFunction
set_time_limit_sec(model::GenericModel, limit::Float64)

Set the time limit (in seconds) of the solver.

Can be unset using unset_time_limit_sec or with limit set to nothing.

See also: unset_time_limit_sec, time_limit_sec.

Example

julia> import Ipopt
 
 julia> model = Model(Ipopt.Optimizer);
 
@@ -2266,7 +2266,7 @@
 
 julia> unset_time_limit_sec(model)
 
-julia> time_limit_sec(model)
source

set_upper_bound

JuMP.set_upper_boundFunction
set_upper_bound(v::GenericVariableRef, upper::Number)

Set the upper bound of a variable. If one does not exist, create an upper bound constraint.

See also UpperBoundRef, has_upper_bound, upper_bound, delete_upper_bound.

Example

julia> model = Model();
+julia> time_limit_sec(model)
source

set_upper_bound

JuMP.set_upper_boundFunction
set_upper_bound(v::GenericVariableRef, upper::Number)

Set the upper bound of a variable. If one does not exist, create an upper bound constraint.

See also UpperBoundRef, has_upper_bound, upper_bound, delete_upper_bound.

Example

julia> model = Model();
 
 julia> @variable(model, x <= 1.0);
 
@@ -2276,7 +2276,7 @@
 julia> set_upper_bound(x, 2.0)
 
 julia> upper_bound(x)
-2.0
source

shadow_price

JuMP.shadow_priceFunction
shadow_price(con_ref::ConstraintRef)

Return the change in the objective from an infinitesimal relaxation of the constraint.

The shadow price is computed from dual and can be queried only when has_duals is true and the objective sense is MIN_SENSE or MAX_SENSE (not FEASIBILITY_SENSE).

See also reduced_cost.

Comparison to dual

The shadow prices differ at most in sign from the dual value depending on the objective sense. The differences are summarized in the table:

MinMax
f(x) <= b+1-1
f(x) >= b-1+1

Notes

  • The function simply translates signs from dual and does not validate the conditions needed to guarantee the sensitivity interpretation of the shadow price. The caller is responsible, for example, for checking whether the solver converged to an optimal primal-dual pair or a proof of infeasibility.
  • The computation is based on the current objective sense of the model. If this has changed since the last solve, the results will be incorrect.
  • Relaxation of equality constraints (and hence the shadow price) is defined based on which sense of the equality constraint is active.

Example

julia> import HiGHS
+2.0
source

shadow_price

JuMP.shadow_priceFunction
shadow_price(con_ref::ConstraintRef)

Return the change in the objective from an infinitesimal relaxation of the constraint.

The shadow price is computed from dual and can be queried only when has_duals is true and the objective sense is MIN_SENSE or MAX_SENSE (not FEASIBILITY_SENSE).

See also reduced_cost.

Comparison to dual

The shadow prices differ at most in sign from the dual value depending on the objective sense. The differences are summarized in the table:

MinMax
f(x) <= b+1-1
f(x) >= b-1+1

Notes

  • The function simply translates signs from dual and does not validate the conditions needed to guarantee the sensitivity interpretation of the shadow price. The caller is responsible, for example, for checking whether the solver converged to an optimal primal-dual pair or a proof of infeasibility.
  • The computation is based on the current objective sense of the model. If this has changed since the last solve, the results will be incorrect.
  • Relaxation of equality constraints (and hence the shadow price) is defined based on which sense of the equality constraint is active.

Example

julia> import HiGHS
 
 julia> model = Model(HiGHS.Optimizer);
 
@@ -2295,7 +2295,7 @@
 true
 
 julia> shadow_price(c)
-2.0
source

shape

JuMP.shapeFunction
shape(c::AbstractConstraint)::AbstractShape

Return the shape of the constraint c.

Example

julia> model = Model();
+2.0
source

shape

JuMP.shapeFunction
shape(c::AbstractConstraint)::AbstractShape

Return the shape of the constraint c.

Example

julia> model = Model();
 
 julia> @variable(model, x[1:2]);
 
@@ -2307,20 +2307,20 @@
 julia> d = @constraint(model, x in SOS1());
 
 julia> shape(constraint_object(d))
-VectorShape()
source

show_backend_summary

JuMP.show_backend_summaryFunction
show_backend_summary(io::IO, model::GenericModel)

Print a summary of the optimizer backing model.

Extensions

AbstractModels should implement this method.

Example

julia> model = Model();
+VectorShape()
source

show_backend_summary

JuMP.show_backend_summaryFunction
show_backend_summary(io::IO, model::GenericModel)

Print a summary of the optimizer backing model.

Extensions

AbstractModels should implement this method.

Example

julia> model = Model();
 
 julia> show_backend_summary(stdout, model)
 Model mode: AUTOMATIC
 CachingOptimizer state: NO_OPTIMIZER
-Solver name: No optimizer attached.
source

show_constraints_summary

JuMP.show_constraints_summaryFunction
show_constraints_summary(io::IO, model::AbstractModel)

Write to io a summary of the number of constraints.

Extensions

AbstractModels should implement this method.

Example

julia> model = Model();
+Solver name: No optimizer attached.
source

show_constraints_summary

JuMP.show_constraints_summaryFunction
show_constraints_summary(io::IO, model::AbstractModel)

Write to io a summary of the number of constraints.

Extensions

AbstractModels should implement this method.

Example

julia> model = Model();
 
 julia> @variable(model, x >= 0);
 
 julia> show_constraints_summary(stdout, model)
-`VariableRef`-in-`MathOptInterface.GreaterThan{Float64}`: 1 constraint
source

show_objective_function_summary

JuMP.show_objective_function_summaryFunction
show_objective_function_summary(io::IO, model::AbstractModel)

Write to io a summary of the objective function type.

Extensions

AbstractModels should implement this method.

Example

julia> model = Model();
+`VariableRef`-in-`MathOptInterface.GreaterThan{Float64}`: 1 constraint
source

show_objective_function_summary

JuMP.show_objective_function_summaryFunction
show_objective_function_summary(io::IO, model::AbstractModel)

Write to io a summary of the objective function type.

Extensions

AbstractModels should implement this method.

Example

julia> model = Model();
 
 julia> show_objective_function_summary(stdout, model)
-Objective function type: AffExpr
source

simplex_iterations

JuMP.simplex_iterationsFunction
simplex_iterations(model::GenericModel)

If available, returns the cumulative number of simplex iterations during the most-recent optimization (the MOI.SimplexIterations attribute).

Throws a MOI.GetAttributeNotAllowed error if the attribute is not implemented by the solver.

Example

julia> import HiGHS
+Objective function type: AffExpr
source

simplex_iterations

JuMP.simplex_iterationsFunction
simplex_iterations(model::GenericModel)

If available, returns the cumulative number of simplex iterations during the most-recent optimization (the MOI.SimplexIterations attribute).

Throws a MOI.GetAttributeNotAllowed error if the attribute is not implemented by the solver.

Example

julia> import HiGHS
 
 julia> model = Model(HiGHS.Optimizer);
 
@@ -2329,7 +2329,7 @@
 julia> optimize!(model)
 
 julia> simplex_iterations(model)
-0
source

solution_summary

JuMP.solution_summaryFunction
solution_summary(model::GenericModel; result::Int = 1, verbose::Bool = false)

Return a struct that can be used print a summary of the solution in result result.

If verbose=true, write out the primal solution for every variable and the dual solution for every constraint, excluding those with empty names.

Example

When called at the REPL, the summary is automatically printed:

julia> model = Model();
+0
source

solution_summary

JuMP.solution_summaryFunction
solution_summary(model::GenericModel; result::Int = 1, verbose::Bool = false)

Return a struct that can be used print a summary of the solution in result result.

If verbose=true, write out the primal solution for every variable and the dual solution for every constraint, excluding those with empty names.

Example

When called at the REPL, the summary is automatically printed:

julia> model = Model();
 
 julia> solution_summary(model)
 * Solver : No optimizer attached.
@@ -2365,7 +2365,7 @@
   Primal status      : NO_SOLUTION
   Dual status        : NO_SOLUTION
 
-* Work counters
source

solve_time

JuMP.solve_timeFunction
solve_time(model::GenericModel)

If available, returns the solve time in wall-clock seconds reported by the solver (the MOI.SolveTimeSec attribute).

Throws a MOI.GetAttributeNotAllowed error if the attribute is not implemented by the solver.

Example

julia> import HiGHS
+* Work counters
source

solve_time

JuMP.solve_timeFunction
solve_time(model::GenericModel)

If available, returns the solve time in wall-clock seconds reported by the solver (the MOI.SolveTimeSec attribute).

Throws a MOI.GetAttributeNotAllowed error if the attribute is not implemented by the solver.

Example

julia> import HiGHS
 
 julia> model = Model(HiGHS.Optimizer);
 
@@ -2374,7 +2374,7 @@
 julia> optimize!(model)
 
 julia> solve_time(model)
-1.0488089174032211e-5
source

solver_name

JuMP.solver_nameFunction
solver_name(model::GenericModel)

If available, returns the MOI.SolverName property of the underlying optimizer.

Returns "No optimizer attached." in AUTOMATIC or MANUAL modes when no optimizer is attached.

Returns "SolverName() attribute not implemented by the optimizer." if the attribute is not implemented.

Example

julia> import Ipopt
+1.0488089174032211e-5
source

solver_name

JuMP.solver_nameFunction
solver_name(model::GenericModel)

If available, returns the MOI.SolverName property of the underlying optimizer.

Returns "No optimizer attached." in AUTOMATIC or MANUAL modes when no optimizer is attached.

Returns "SolverName() attribute not implemented by the optimizer." if the attribute is not implemented.

Example

julia> import Ipopt
 
 julia> model = Model(Ipopt.Optimizer);
 
@@ -2389,7 +2389,7 @@
 julia> model = Model(MOI.FileFormats.MPS.Model);
 
 julia> solver_name(model)
-"SolverName() attribute not implemented by the optimizer."
source

start_value

JuMP.start_valueFunction
start_value(con_ref::ConstraintRef)

Return the primal start value (MOI.ConstraintPrimalStart) of the constraint con_ref.

If no primal start value has been set, start_value will return nothing.

See also set_start_value.

Example

julia> model = Model();
+"SolverName() attribute not implemented by the optimizer."
source

start_value

JuMP.start_valueFunction
start_value(con_ref::ConstraintRef)

Return the primal start value (MOI.ConstraintPrimalStart) of the constraint con_ref.

If no primal start value has been set, start_value will return nothing.

See also set_start_value.

Example

julia> model = Model();
 
 julia> @variable(model, x, start = 2.0);
 
@@ -2404,7 +2404,7 @@
 
 julia> set_start_value(c, nothing)
 
-julia> start_value(c)
source
start_value(v::GenericVariableRef)

Return the start value (MOI.VariablePrimalStart) of the variable v.

Note: VariablePrimalStarts are sometimes called "MIP-starts" or "warmstarts".

See also: has_start_value, set_start_value.

Example

julia> model = Model();
+julia> start_value(c)
source
start_value(v::GenericVariableRef)

Return the start value (MOI.VariablePrimalStart) of the variable v.

Note: VariablePrimalStarts are sometimes called "MIP-starts" or "warmstarts".

See also: has_start_value, set_start_value.

Example

julia> model = Model();
 
 julia> @variable(model, x, start = 1.5);
 
@@ -2425,12 +2425,12 @@
 true
 
 julia> start_value(y)
-2.0
source

termination_status

JuMP.termination_statusFunction
termination_status(model::GenericModel)

Return a MOI.TerminationStatusCode describing why the solver stopped (that is, the MOI.TerminationStatus attribute).

Example

julia> import Ipopt
+2.0
source

termination_status

JuMP.termination_statusFunction
termination_status(model::GenericModel)

Return a MOI.TerminationStatusCode describing why the solver stopped (that is, the MOI.TerminationStatus attribute).

Example

julia> import Ipopt
 
 julia> model = Model(Ipopt.Optimizer);
 
 julia> termination_status(model)
-OPTIMIZE_NOT_CALLED::TerminationStatusCode = 0
source

time_limit_sec

JuMP.time_limit_secFunction
time_limit_sec(model::GenericModel)

Return the time limit (in seconds) of the model.

Returns nothing if unset.

See also: set_time_limit_sec, unset_time_limit_sec.

Example

julia> import Ipopt
+OPTIMIZE_NOT_CALLED::TerminationStatusCode = 0
source

time_limit_sec

JuMP.time_limit_secFunction
time_limit_sec(model::GenericModel)

Return the time limit (in seconds) of the model.

Returns nothing if unset.

See also: set_time_limit_sec, unset_time_limit_sec.

Example

julia> import Ipopt
 
 julia> model = Model(Ipopt.Optimizer);
 
@@ -2443,7 +2443,7 @@
 
 julia> unset_time_limit_sec(model)
 
-julia> time_limit_sec(model)
source

triangle_vec

JuMP.triangle_vecFunction
triangle_vec(matrix::Matrix)

Return the upper triangle of a matrix concatenated into a vector in the order required by JuMP and MathOptInterface for Triangle sets.

Example

julia> model = Model();
+julia> time_limit_sec(model)
source

triangle_vec

JuMP.triangle_vecFunction
triangle_vec(matrix::Matrix)

Return the upper triangle of a matrix concatenated into a vector in the order required by JuMP and MathOptInterface for Triangle sets.

Example

julia> model = Model();
 
 julia> @variable(model, X[1:3, 1:3], Symmetric);
 
@@ -2451,7 +2451,7 @@
 t
 
 julia> @constraint(model, [t; triangle_vec(X)] in MOI.RootDetConeTriangle(3))
-[t, X[1,1], X[1,2], X[2,2], X[1,3], X[2,3], X[3,3]] ∈ MathOptInterface.RootDetConeTriangle(3)
source

unfix

JuMP.unfixFunction
unfix(v::GenericVariableRef)

Delete the fixing constraint of a variable.

Error if one does not exist.

See also FixRef, is_fixed, fix_value, fix.

Example

julia> model = Model();
+[t, X[1,1], X[1,2], X[2,2], X[1,3], X[2,3], X[3,3]] ∈ MathOptInterface.RootDetConeTriangle(3)
source

unfix

JuMP.unfixFunction
unfix(v::GenericVariableRef)

Delete the fixing constraint of a variable.

Error if one does not exist.

See also FixRef, is_fixed, fix_value, fix.

Example

julia> model = Model();
 
 julia> @variable(model, x == 1);
 
@@ -2461,7 +2461,7 @@
 julia> unfix(x)
 
 julia> is_fixed(x)
-false
source

unregister

JuMP.unregisterFunction
unregister(model::GenericModel, key::Symbol)

Unregister the name key from model so that a new variable, constraint, or expression can be created with the same key.

Note that this will not delete the object model[key]; it will just remove the reference at model[key]. To delete the object, use delete as well.

See also: delete, object_dictionary.

Example

julia> model = Model();
+false
source

unregister

JuMP.unregisterFunction
unregister(model::GenericModel, key::Symbol)

Unregister the name key from model so that a new variable, constraint, or expression can be created with the same key.

Note that this will not delete the object model[key]; it will just remove the reference at model[key]. To delete the object, use delete as well.

See also: delete, object_dictionary.

Example

julia> model = Model();
 
 julia> @variable(model, x)
 x
@@ -2488,7 +2488,7 @@
 x
 
 julia> num_variables(model)
-2
source

unsafe_backend

JuMP.unsafe_backendFunction
unsafe_backend(model::GenericModel)

Return the innermost optimizer associated with the JuMP model model.

This function should only be used by advanced users looking to access low-level solver-specific functionality. It has a high-risk of incorrect usage. We strongly suggest you use the alternative suggested below.

See also: backend.

To obtain the index of a variable or constraint in the unsafe backend, use optimizer_index.

Unsafe behavior

This function is unsafe for two main reasons.

First, the formulation and order of variables and constraints in the unsafe backend may be different to the variables and constraints in model. This can happen because of bridges, or because the solver requires the variables or constraints in a specific order. In addition, the variable or constraint index returned by index at the JuMP level may be different to the index of the corresponding variable or constraint in the unsafe_backend. There is no solution to this. Use the alternative suggested below instead.

Second, the unsafe_backend may be empty, or lack some modifications made to the JuMP model. Thus, before calling unsafe_backend you should first call MOI.Utilities.attach_optimizer to ensure that the backend is synchronized with the JuMP model.

julia> import HiGHS
+2
source

unsafe_backend

JuMP.unsafe_backendFunction
unsafe_backend(model::GenericModel)

Return the innermost optimizer associated with the JuMP model model.

This function should only be used by advanced users looking to access low-level solver-specific functionality. It has a high-risk of incorrect usage. We strongly suggest you use the alternative suggested below.

See also: backend.

To obtain the index of a variable or constraint in the unsafe backend, use optimizer_index.

Unsafe behavior

This function is unsafe for two main reasons.

First, the formulation and order of variables and constraints in the unsafe backend may be different to the variables and constraints in model. This can happen because of bridges, or because the solver requires the variables or constraints in a specific order. In addition, the variable or constraint index returned by index at the JuMP level may be different to the index of the corresponding variable or constraint in the unsafe_backend. There is no solution to this. Use the alternative suggested below instead.

Second, the unsafe_backend may be empty, or lack some modifications made to the JuMP model. Thus, before calling unsafe_backend you should first call MOI.Utilities.attach_optimizer to ensure that the backend is synchronized with the JuMP model.

julia> import HiGHS
 
 julia> model = Model(HiGHS.Optimizer)
 A JuMP Model
@@ -2529,7 +2529,7 @@
 A HiGHS model with 1 columns and 0 rows.
 
 julia> index(x)
-MOI.VariableIndex(1)
source

unset_binary

JuMP.unset_binaryFunction
unset_binary(variable_ref::GenericVariableRef)

Remove the binary constraint on the variable variable_ref.

See also BinaryRef, is_binary, set_binary.

Example

julia> model = Model();
+MOI.VariableIndex(1)
source

unset_binary

JuMP.unset_binaryFunction
unset_binary(variable_ref::GenericVariableRef)

Remove the binary constraint on the variable variable_ref.

See also BinaryRef, is_binary, set_binary.

Example

julia> model = Model();
 
 julia> @variable(model, x, Bin);
 
@@ -2539,7 +2539,7 @@
 julia> unset_binary(x)
 
 julia> is_binary(x)
-false
source

unset_integer

JuMP.unset_integerFunction
unset_integer(variable_ref::GenericVariableRef)

Remove the integrality constraint on the variable variable_ref.

Errors if one does not exist.

See also IntegerRef, is_integer, set_integer.

Example

julia> model = Model();
+false
source

unset_integer

JuMP.unset_integerFunction
unset_integer(variable_ref::GenericVariableRef)

Remove the integrality constraint on the variable variable_ref.

Errors if one does not exist.

See also IntegerRef, is_integer, set_integer.

Example

julia> model = Model();
 
 julia> @variable(model, x, Int);
 
@@ -2549,7 +2549,7 @@
 julia> unset_integer(x)
 
 julia> is_integer(x)
-false
source

unset_silent

JuMP.unset_silentFunction
unset_silent(model::GenericModel)

Neutralize the effect of the set_silent function and let the solver attributes control the verbosity.

See also: set_silent.

Example

julia> import Ipopt
+false
source

unset_silent

JuMP.unset_silentFunction
unset_silent(model::GenericModel)

Neutralize the effect of the set_silent function and let the solver attributes control the verbosity.

See also: set_silent.

Example

julia> import Ipopt
 
 julia> model = Model(Ipopt.Optimizer);
 
@@ -2561,7 +2561,7 @@
 julia> unset_silent(model)
 
 julia> get_attribute(model, MOI.Silent())
-false
source

unset_time_limit_sec

JuMP.unset_time_limit_secFunction
unset_time_limit_sec(model::GenericModel)

Unset the time limit of the solver.

See also: set_time_limit_sec, time_limit_sec.

Example

julia> import Ipopt
+false
source

unset_time_limit_sec

JuMP.unset_time_limit_secFunction
unset_time_limit_sec(model::GenericModel)

Unset the time limit of the solver.

See also: set_time_limit_sec, time_limit_sec.

Example

julia> import Ipopt
 
 julia> model = Model(Ipopt.Optimizer);
 
@@ -2574,19 +2574,19 @@
 
 julia> unset_time_limit_sec(model)
 
-julia> time_limit_sec(model)
source

upper_bound

JuMP.upper_boundFunction
upper_bound(v::GenericVariableRef)

Return the upper bound of a variable.

Error if one does not exist.

See also UpperBoundRef, has_upper_bound, set_upper_bound, delete_upper_bound.

Example

julia> model = Model();
+julia> time_limit_sec(model)
source

upper_bound

JuMP.upper_boundFunction
upper_bound(v::GenericVariableRef)

Return the upper bound of a variable.

Error if one does not exist.

See also UpperBoundRef, has_upper_bound, set_upper_bound, delete_upper_bound.

Example

julia> model = Model();
 
 julia> @variable(model, x <= 1.0);
 
 julia> upper_bound(x)
-1.0
source

value

JuMP.valueFunction
value(con_ref::ConstraintRef; result::Int = 1)

Return the primal value of constraint con_ref associated with result index result of the most-recent solution returned by the solver.

That is, if con_ref is the reference of a constraint func-in-set, it returns the value of func evaluated at the value of the variables (given by value(::GenericVariableRef)).

Use has_values to check if a result exists before asking for values.

See also: result_count.

Note

For scalar constraints, the constant is moved to the set so it is not taken into account in the primal value of the constraint. For instance, the constraint @constraint(model, 2x + 3y + 1 == 5) is transformed into 2x + 3y-in-MOI.EqualTo(4) so the value returned by this function is the evaluation of 2x + 3y.

source
value(var_value::Function, con_ref::ConstraintRef)

Evaluate the primal value of the constraint con_ref using var_value(v) as the value for each variable v.

source
value(v::GenericVariableRef; result = 1)

Return the value of variable v associated with result index result of the most-recent returned by the solver.

Use has_values to check if a result exists before asking for values.

See also: result_count.

source
value(var_value::Function, v::GenericVariableRef)

Evaluate the value of the variable v as var_value(v).

source
value(var_value::Function, ex::GenericAffExpr)

Evaluate ex using var_value(v) as the value for each variable v.

source
value(v::GenericAffExpr; result::Int = 1)

Return the value of the GenericAffExpr v associated with result index result of the most-recent solution returned by the solver.

See also: result_count.

source
value(var_value::Function, ex::GenericQuadExpr)

Evaluate ex using var_value(v) as the value for each variable v.

source
value(v::GenericQuadExpr; result::Int = 1)

Return the value of the GenericQuadExpr v associated with result index result of the most-recent solution returned by the solver.

Replaces getvalue for most use cases.

See also: result_count.

source
value(p::NonlinearParameter)

Return the current value stored in the nonlinear parameter p.

Example

julia> model = Model();
+1.0
source

value

JuMP.valueFunction
value(con_ref::ConstraintRef; result::Int = 1)

Return the primal value of constraint con_ref associated with result index result of the most-recent solution returned by the solver.

That is, if con_ref is the reference of a constraint func-in-set, it returns the value of func evaluated at the value of the variables (given by value(::GenericVariableRef)).

Use has_values to check if a result exists before asking for values.

See also: result_count.

Note

For scalar constraints, the constant is moved to the set so it is not taken into account in the primal value of the constraint. For instance, the constraint @constraint(model, 2x + 3y + 1 == 5) is transformed into 2x + 3y-in-MOI.EqualTo(4) so the value returned by this function is the evaluation of 2x + 3y.

source
value(var_value::Function, con_ref::ConstraintRef)

Evaluate the primal value of the constraint con_ref using var_value(v) as the value for each variable v.

source
value(v::GenericVariableRef; result = 1)

Return the value of variable v associated with result index result of the most-recent returned by the solver.

Use has_values to check if a result exists before asking for values.

See also: result_count.

source
value(var_value::Function, v::GenericVariableRef)

Evaluate the value of the variable v as var_value(v).

source
value(var_value::Function, ex::GenericAffExpr)

Evaluate ex using var_value(v) as the value for each variable v.

source
value(v::GenericAffExpr; result::Int = 1)

Return the value of the GenericAffExpr v associated with result index result of the most-recent solution returned by the solver.

See also: result_count.

source
value(var_value::Function, ex::GenericQuadExpr)

Evaluate ex using var_value(v) as the value for each variable v.

source
value(v::GenericQuadExpr; result::Int = 1)

Return the value of the GenericQuadExpr v associated with result index result of the most-recent solution returned by the solver.

Replaces getvalue for most use cases.

See also: result_count.

source
value(p::NonlinearParameter)

Return the current value stored in the nonlinear parameter p.

Example

julia> model = Model();
 
 julia> @NLparameter(model, p == 10)
 p == 10.0
 
 julia> value(p)
-10.0
source
value(ex::NonlinearExpression; result::Int = 1)

Return the value of the NonlinearExpression ex associated with result index result of the most-recent solution returned by the solver.

See also: result_count.

source
value(var_value::Function, ex::NonlinearExpression)

Evaluate ex using var_value(v) as the value for each variable v.

source
value(c::NonlinearConstraintRef; result::Int = 1)

Return the value of the NonlinearConstraintRef c associated with result index result of the most-recent solution returned by the solver.

See also: result_count.

source
value(var_value::Function, c::NonlinearConstraintRef)

Evaluate c using var_value(v) as the value for each variable v.

source

value_type

JuMP.value_typeFunction
value_type(::Type{<:Union{AbstractModel,AbstractVariableRef}})

Return the return type of value for variables of that model. It defaults to Float64 if it is not implemented.

Example

julia> value_type(GenericModel{BigFloat})
-BigFloat
source

variable_by_name

JuMP.variable_by_nameFunction
variable_by_name(
+10.0
source
value(ex::NonlinearExpression; result::Int = 1)

Return the value of the NonlinearExpression ex associated with result index result of the most-recent solution returned by the solver.

See also: result_count.

source
value(var_value::Function, ex::NonlinearExpression)

Evaluate ex using var_value(v) as the value for each variable v.

source
value(c::NonlinearConstraintRef; result::Int = 1)

Return the value of the NonlinearConstraintRef c associated with result index result of the most-recent solution returned by the solver.

See also: result_count.

source
value(var_value::Function, c::NonlinearConstraintRef)

Evaluate c using var_value(v) as the value for each variable v.

source

value_type

JuMP.value_typeFunction
value_type(::Type{<:Union{AbstractModel,AbstractVariableRef}})

Return the return type of value for variables of that model. It defaults to Float64 if it is not implemented.

Example

julia> value_type(GenericModel{BigFloat})
+BigFloat
source

variable_by_name

JuMP.variable_by_nameFunction
variable_by_name(
     model::AbstractModel,
     name::String,
 )::Union{AbstractVariableRef,Nothing}

Returns the reference of the variable with name attribute name or Nothing if no variable has this name attribute. Throws an error if several variables have name as their name attribute.

Example

julia> model = Model();
@@ -2629,12 +2629,12 @@
  u[2]
 
 julia> variable_by_name(model, "u[2]")
-u[2]
source

variable_ref_type

JuMP.variable_ref_typeFunction
variable_ref_type(::Union{F,Type{F}}) where {F}

A helper function used internally by JuMP and some JuMP extensions. Returns the variable type associated with the model or expression type F.

source

vectorize

JuMP.vectorizeFunction
vectorize(matrix::AbstractMatrix, ::Shape)

Convert the matrix into a vector according to Shape.

source

write_to_file

JuMP.write_to_fileFunction
write_to_file(
+u[2]
source

variable_ref_type

JuMP.variable_ref_typeFunction
variable_ref_type(::Union{F,Type{F}}) where {F}

A helper function used internally by JuMP and some JuMP extensions. Returns the variable type associated with the model or expression type F.

source

vectorize

JuMP.vectorizeFunction
vectorize(matrix::AbstractMatrix, ::Shape)

Convert the matrix into a vector according to Shape.

source

write_to_file

JuMP.write_to_fileFunction
write_to_file(
     model::GenericModel,
     filename::String;
     format::MOI.FileFormats.FileFormat = MOI.FileFormats.FORMAT_AUTOMATIC,
     kwargs...,
-)

Write the JuMP model model to filename in the format format.

If the filename ends in .gz, it will be compressed using GZip. If the filename ends in .bz2, it will be compressed using BZip2.

Other kwargs are passed to the Model constructor of the chosen format.

source

AbstractConstraint

JuMP.AbstractConstraintType
abstract type AbstractConstraint

An abstract base type for all constraint types. AbstractConstraints store the function and set directly, unlike ConstraintRefs that are merely references to constraints stored in a model. AbstractConstraints do not need to be attached to a model.

source

AbstractJuMPScalar

JuMP.AbstractJuMPScalarType
AbstractJuMPScalar <: MutableArithmetics.AbstractMutable

Abstract base type for all scalar types

The subtyping of AbstractMutable will allow calls of some Base functions to be redirected to a method in MA that handles type promotion more carefully (for example the promotion in sparse matrix products in SparseArrays usually does not work for JuMP types) and exploits the mutability of AffExpr and QuadExpr.

source

AbstractModel

JuMP.AbstractModelType
AbstractModel

An abstract type that should be subtyped for users creating JuMP extensions.

source

AbstractScalarSet

JuMP.AbstractScalarSetType
AbstractScalarSet

An abstract type for defining new scalar sets in JuMP.

Implement moi_set(::AbstractScalarSet) to convert the type into an MOI set.

See also: moi_set.

source

AbstractShape

JuMP.AbstractShapeType
AbstractShape

Abstract vectorizable shape. Given a flat vector form of an object of shape shape, the original object can be obtained by reshape_vector.

source

AbstractVariable

JuMP.AbstractVariableType
AbstractVariable

Variable returned by build_variable. It represents a variable that has not been added yet to any model. It can be added to a given model with add_variable.

source

AbstractVariableRef

JuMP.AbstractVariableRefType
AbstractVariableRef

Variable returned by add_variable. Affine (resp. quadratic) operations with variables of type V<:AbstractVariableRef and coefficients of type T create a GenericAffExpr{T,V} (resp. GenericQuadExpr{T,V}).

source

AbstractVectorSet

JuMP.AbstractVectorSetType
AbstractVectorSet

An abstract type for defining new sets in JuMP.

Implement moi_set(::AbstractVectorSet, dim::Int) to convert the type into an MOI set.

See also: moi_set.

source

AffExpr

JuMP.AffExprType
AffExpr

Alias for GenericAffExpr{Float64,VariableRef}, the specific GenericAffExpr used by JuMP.

source

ArrayShape

JuMP.ArrayShapeType
ArrayShape{N}(dims::NTuple{N,Int}) where {N}

An AbstractShape that represents array-valued constraints.

Example

julia> model = Model();
+)

Write the JuMP model model to filename in the format format.

If the filename ends in .gz, it will be compressed using GZip. If the filename ends in .bz2, it will be compressed using BZip2.

Other kwargs are passed to the Model constructor of the chosen format.

source

AbstractConstraint

JuMP.AbstractConstraintType
abstract type AbstractConstraint

An abstract base type for all constraint types. AbstractConstraints store the function and set directly, unlike ConstraintRefs that are merely references to constraints stored in a model. AbstractConstraints do not need to be attached to a model.

source

AbstractJuMPScalar

JuMP.AbstractJuMPScalarType
AbstractJuMPScalar <: MutableArithmetics.AbstractMutable

Abstract base type for all scalar types

The subtyping of AbstractMutable will allow calls of some Base functions to be redirected to a method in MA that handles type promotion more carefully (for example the promotion in sparse matrix products in SparseArrays usually does not work for JuMP types) and exploits the mutability of AffExpr and QuadExpr.

source

AbstractModel

JuMP.AbstractModelType
AbstractModel

An abstract type that should be subtyped for users creating JuMP extensions.

source

AbstractScalarSet

JuMP.AbstractScalarSetType
AbstractScalarSet

An abstract type for defining new scalar sets in JuMP.

Implement moi_set(::AbstractScalarSet) to convert the type into an MOI set.

See also: moi_set.

source

AbstractShape

JuMP.AbstractShapeType
AbstractShape

Abstract vectorizable shape. Given a flat vector form of an object of shape shape, the original object can be obtained by reshape_vector.

source

AbstractVariable

JuMP.AbstractVariableType
AbstractVariable

Variable returned by build_variable. It represents a variable that has not been added yet to any model. It can be added to a given model with add_variable.

source

AbstractVariableRef

JuMP.AbstractVariableRefType
AbstractVariableRef

Variable returned by add_variable. Affine (resp. quadratic) operations with variables of type V<:AbstractVariableRef and coefficients of type T create a GenericAffExpr{T,V} (resp. GenericQuadExpr{T,V}).

source

AbstractVectorSet

JuMP.AbstractVectorSetType
AbstractVectorSet

An abstract type for defining new sets in JuMP.

Implement moi_set(::AbstractVectorSet, dim::Int) to convert the type into an MOI set.

See also: moi_set.

source

AffExpr

JuMP.AffExprType
AffExpr

Alias for GenericAffExpr{Float64,VariableRef}, the specific GenericAffExpr used by JuMP.

source

ArrayShape

JuMP.ArrayShapeType
ArrayShape{N}(dims::NTuple{N,Int}) where {N}

An AbstractShape that represents array-valued constraints.

Example

julia> model = Model();
 
 julia> @variable(model, x[1:2, 1:3]);
 
@@ -2643,12 +2643,12 @@
  x[2,1]  x[2,2]  x[2,3]] ∈ Nonnegatives()
 
 julia> shape(constraint_object(c))
-ArrayShape{2}((2, 3))
source

BinaryRef

JuMP.BinaryRefFunction
BinaryRef(v::GenericVariableRef)

Return a constraint reference to the constraint constraining v to be binary. Errors if one does not exist.

See also is_binary, set_binary, unset_binary.

Example

julia> model = Model();
+ArrayShape{2}((2, 3))
source

BinaryRef

JuMP.BinaryRefFunction
BinaryRef(v::GenericVariableRef)

Return a constraint reference to the constraint constraining v to be binary. Errors if one does not exist.

See also is_binary, set_binary, unset_binary.

Example

julia> model = Model();
 
 julia> @variable(model, x, Bin);
 
 julia> BinaryRef(x)
-x binary
source

BridgeableConstraint

JuMP.BridgeableConstraintType
BridgeableConstraint(
+x binary
source

BridgeableConstraint

JuMP.BridgeableConstraintType
BridgeableConstraint(
     constraint::C,
     bridge_type::B;
     coefficient_type::Type{T} = Float64,
@@ -2663,7 +2663,7 @@
 )
     constraint = ScalarConstraint(func, set)
     return BridgeableConstraint(constraint, CustomBridge)
-end

Note

JuMP extensions should extend JuMP.build_constraint only if they also defined CustomSet, for three reasons:

  1. It is problematic if multiple extensions overload the same JuMP method.
  2. A missing method will not inform the users that they forgot to load the extension module defining the build_constraint method.
  3. Defining a method where neither the function nor any of the argument types are defined in the package is called type piracy and is discouraged in the Julia style guide.
source

ComplexPlane

JuMP.ComplexPlaneType
ComplexPlane

Complex plane object that can be used to create a complex variable in the @variable macro.

Example

Consider the following example:

julia> model = Model();
+end

Note

JuMP extensions should extend JuMP.build_constraint only if they also defined CustomSet, for three reasons:

  1. It is problematic if multiple extensions overload the same JuMP method.
  2. A missing method will not inform the users that they forgot to load the extension module defining the build_constraint method.
  3. Defining a method where neither the function nor any of the argument types are defined in the package is called type piracy and is discouraged in the Julia style guide.
source

ComplexPlane

JuMP.ComplexPlaneType
ComplexPlane

Complex plane object that can be used to create a complex variable in the @variable macro.

Example

Consider the following example:

julia> model = Model();
 
 julia> @variable(model, x in ComplexPlane())
 real(x) + imag(x) im
@@ -2671,7 +2671,7 @@
 julia> all_variables(model)
 2-element Vector{VariableRef}:
  real(x)
- imag(x)

We see in the output of the last command that two real variables were created. The Julia variable x binds to an affine expression in terms of these two variables that parametrize the complex plane.

source

ComplexVariable

JuMP.ComplexVariableType
ComplexVariable{S,T,U,V} <: AbstractVariable

A struct used when adding complex variables.

See also: ComplexPlane.

source

ConstraintNotOwned

JuMP.ConstraintNotOwnedType
struct ConstraintNotOwned{C<:ConstraintRef} <: Exception
+ imag(x)

We see in the output of the last command that two real variables were created. The Julia variable x binds to an affine expression in terms of these two variables that parametrize the complex plane.

source

ComplexVariable

JuMP.ComplexVariableType
ComplexVariable{S,T,U,V} <: AbstractVariable

A struct used when adding complex variables.

See also: ComplexPlane.

source

ConstraintNotOwned

JuMP.ConstraintNotOwnedType
struct ConstraintNotOwned{C<:ConstraintRef} <: Exception
     constraint_ref::C
 end

An error thrown when the constraint constraint_ref was used in a model different to owner_model(constraint_ref).

Example

julia> model = Model();
 
@@ -2685,12 +2685,12 @@
 julia> MOI.get(model_new, MOI.ConstraintName(), c)
 ERROR: ConstraintNotOwned{ConstraintRef{Model, MathOptInterface.ConstraintIndex{MathOptInterface.ScalarAffineFunction{Float64}, MathOptInterface.GreaterThan{Float64}}, ScalarShape}}(c : x ≥ 0)
 Stacktrace:
-[...]
source

ConstraintRef

JuMP.ConstraintRefType
ConstraintRef

Holds a reference to the model and the corresponding MOI.ConstraintIndex.

source

FixRef

JuMP.FixRefFunction
FixRef(v::GenericVariableRef)

Return a constraint reference to the constraint fixing the value of v.

Errors if one does not exist.

See also is_fixed, fix_value, fix, unfix.

Example

julia> model = Model();
+[...]
source

ConstraintRef

JuMP.ConstraintRefType
ConstraintRef

Holds a reference to the model and the corresponding MOI.ConstraintIndex.

source

FixRef

JuMP.FixRefFunction
FixRef(v::GenericVariableRef)

Return a constraint reference to the constraint fixing the value of v.

Errors if one does not exist.

See also is_fixed, fix_value, fix, unfix.

Example

julia> model = Model();
 
 julia> @variable(model, x == 1);
 
 julia> FixRef(x)
-x = 1
source

GenericAffExpr

JuMP.GenericAffExprType
mutable struct GenericAffExpr{CoefType,VarType} <: AbstractJuMPScalar
+x = 1
source

GenericAffExpr

JuMP.GenericAffExprType
mutable struct GenericAffExpr{CoefType,VarType} <: AbstractJuMPScalar
     constant::CoefType
     terms::OrderedDict{VarType,CoefType}
 end

An expression type representing an affine expression of the form: $\sum a_i x_i + c$.

Fields

  • .constant: the constant c in the expression.
  • .terms: an OrderedDict, with keys of VarType and values of CoefType describing the sparse vector a.

Example

julia> model = Model();
@@ -2706,13 +2706,13 @@
 julia> expr.terms
 OrderedCollections.OrderedDict{VariableRef, Float64} with 2 entries:
   x[2] => 1.0
-  x[1] => 3.0
source

GenericModel

JuMP.GenericModelType
GenericModel{T}(
+  x[1] => 3.0
source

GenericModel

JuMP.GenericModelType
GenericModel{T}(
     [optimizer_factory;]
     add_bridges::Bool = true,
 ) where {T<:Real}

Create a new instance of a JuMP model.

If optimizer_factory is provided, the model is initialized with the optimizer returned by MOI.instantiate(optimizer_factory).

If optimizer_factory is not provided, use set_optimizer to set the optimizer before calling optimize!.

If add_bridges, JuMP adds a MOI.Bridges.LazyBridgeOptimizer to automatically reformulate the problem into a form supported by the optimizer.

Value type T

Passing a type other than Float64 as the value type T is an advanced operation. The value type must match that expected by the chosen optimizer. Consult the optimizers documentation for details.

If not documented, assume that the optimizer supports only Float64.

Choosing an unsupported value type will throw an MOI.UnsupportedConstraint or an MOI.UnsupportedAttribute error, the timing of which (during the model construction or during a call to optimize!) depends on how the solver is interfaced to JuMP.

Example

julia> model = GenericModel{BigFloat}();
 
 julia> typeof(model)
-GenericModel{BigFloat}
source

GenericNonlinearExpr

JuMP.GenericNonlinearExprType
GenericNonlinearExpr{V}(head::Symbol, args::Vector{Any})
+GenericModel{BigFloat}
source

GenericNonlinearExpr

JuMP.GenericNonlinearExprType
GenericNonlinearExpr{V}(head::Symbol, args::Vector{Any})
 GenericNonlinearExpr{V}(head::Symbol, args::Any...)

The scalar-valued nonlinear function head(args...), represented as a symbolic expression tree, with the call operator head and ordered arguments in args.

V is the type of AbstractVariableRef present in the expression, and is used to help dispatch JuMP extensions.

head

The head::Symbol must be an operator supported by the model.

The default list of supported univariate operators is given by:

and the default list of supported multivariate operators is given by:

Additional operators can be add using @operator.

See the full list of operators supported by a MOI.ModelLike by querying the MOI.ListOfSupportedNonlinearOperators attribute.

args

The vector args contains the arguments to the nonlinear function. If the operator is univariate, it must contain one element. Otherwise, it may contain multiple elements.

Given a subtype of AbstractVariableRef, V, for GenericNonlinearExpr{V}, each element must be one of the following:

where T<:Real and T == value_type(V).

Unsupported operators

If the optimizer does not support head, an MOI.UnsupportedNonlinearOperator error will be thrown.

There is no guarantee about when this error will be thrown; it may be thrown when the function is first added to the model, or it may be thrown when optimize! is called.

Example

To represent the function $f(x) = sin(x)^2$, do:

julia> model = Model();
 
 julia> @variable(model, x)
@@ -2726,7 +2726,7 @@
            GenericNonlinearExpr{VariableRef}(:sin, x),
            2.0,
        )
-sin(x) ^ 2.0
source

GenericQuadExpr

JuMP.GenericQuadExprType
mutable struct GenericQuadExpr{CoefType,VarType} <: AbstractJuMPScalar
+sin(x) ^ 2.0
source

GenericQuadExpr

JuMP.GenericQuadExprType
mutable struct GenericQuadExpr{CoefType,VarType} <: AbstractJuMPScalar
     aff::GenericAffExpr{CoefType,VarType}
     terms::OrderedDict{UnorderedPair{VarType}, CoefType}
 end

An expression type representing an quadratic expression of the form: $\sum q_{i,j} x_i x_j + \sum a_i x_i + c$.

Fields

  • .aff: an GenericAffExpr representing the affine portion of the expression.
  • .terms: an OrderedDict, with keys of UnorderedPair{VarType} and values of CoefType, describing the sparse list of terms q.

Example

julia> model = Model();
@@ -2742,16 +2742,16 @@
 julia> expr.terms
 OrderedCollections.OrderedDict{UnorderedPair{VariableRef}, Float64} with 2 entries:
   UnorderedPair{VariableRef}(x[1], x[1]) => 2.0
-  UnorderedPair{VariableRef}(x[1], x[2]) => 1.0
source

GenericReferenceMap

JuMP.GenericReferenceMapType
GenericReferenceMap{T}

Mapping between variable and constraint reference of a model and its copy. The reference of the copied model can be obtained by indexing the map with the reference of the corresponding reference of the original model.

source

GenericVariableRef

JuMP.GenericVariableRefType
GenericVariableRef{T} <: AbstractVariableRef

Holds a reference to the model and the corresponding MOI.VariableIndex.

source

GreaterThanZero

JuMP.GreaterThanZeroType
GreaterThanZero()

A struct used to intercept when >= or is used in a macro via operator_to_set.

This struct is not the same as Nonnegatives so that we can disambiguate x >= y and x - y in Nonnegatives().

This struct is not intended for general usage, but it may be useful to some JuMP extensions.

Example

julia> operator_to_set(error, Val(:>=))
-GreaterThanZero()
source

HermitianMatrixAdjointShape

JuMP.HermitianMatrixAdjointShapeType
HermitianMatrixAdjointShape(side_dimension)

The dual_shape of HermitianMatrixShape.

This shape is not intended for regular use.

source

HermitianMatrixShape

JuMP.HermitianMatrixShapeType
HermitianMatrixShape(
+  UnorderedPair{VariableRef}(x[1], x[2]) => 1.0
source

GenericReferenceMap

JuMP.GenericReferenceMapType
GenericReferenceMap{T}

Mapping between variable and constraint reference of a model and its copy. The reference of the copied model can be obtained by indexing the map with the reference of the corresponding reference of the original model.

source

GenericVariableRef

JuMP.GenericVariableRefType
GenericVariableRef{T} <: AbstractVariableRef

Holds a reference to the model and the corresponding MOI.VariableIndex.

source

GreaterThanZero

JuMP.GreaterThanZeroType
GreaterThanZero()

A struct used to intercept when >= or is used in a macro via operator_to_set.

This struct is not the same as Nonnegatives so that we can disambiguate x >= y and x - y in Nonnegatives().

This struct is not intended for general usage, but it may be useful to some JuMP extensions.

Example

julia> operator_to_set(error, Val(:>=))
+GreaterThanZero()
source

HermitianMatrixAdjointShape

JuMP.HermitianMatrixAdjointShapeType
HermitianMatrixAdjointShape(side_dimension)

The dual_shape of HermitianMatrixShape.

This shape is not intended for regular use.

source

HermitianMatrixShape

JuMP.HermitianMatrixShapeType
HermitianMatrixShape(
     side_dimension::Int;
     needs_adjoint_dual::Bool = false,
-)

The shape object for a Hermitian square matrix of side_dimension rows and columns.

The vectorized form corresponds to MOI.HermitianPositiveSemidefiniteConeTriangle.

needs_adjoint_dual

By default, the dual_shape of HermitianMatrixShape is also HermitianMatrixShape. This is true for cases such as a LinearAlgebra.Hermitian matrix in HermitianPSDCone.

However, JuMP also supports LinearAlgebra.Hermitian matrix in Zeros, which is interpreted as an element-wise equality constraint. By exploiting symmetry, we pass only the upper triangle of the equality constraints. This works for the primal, but it leads to a factor of 2 difference in the off-diagonal dual elements. (The dual value of the (i, j) element in the triangle formulation should be divided by 2 when spread across the (i, j) and (j, i) elements in the square matrix formulation.) If the constraint has this dual inconsistency, set needs_adjoint_dual = true.

source

HermitianMatrixSpace

JuMP.HermitianMatrixSpaceType
HermitianMatrixSpace()

Use in the @variable macro to constrain a matrix of variables to be hermitian.

Example

julia> model = Model();
+)

The shape object for a Hermitian square matrix of side_dimension rows and columns.

The vectorized form corresponds to MOI.HermitianPositiveSemidefiniteConeTriangle.

needs_adjoint_dual

By default, the dual_shape of HermitianMatrixShape is also HermitianMatrixShape. This is true for cases such as a LinearAlgebra.Hermitian matrix in HermitianPSDCone.

However, JuMP also supports LinearAlgebra.Hermitian matrix in Zeros, which is interpreted as an element-wise equality constraint. By exploiting symmetry, we pass only the upper triangle of the equality constraints. This works for the primal, but it leads to a factor of 2 difference in the off-diagonal dual elements. (The dual value of the (i, j) element in the triangle formulation should be divided by 2 when spread across the (i, j) and (j, i) elements in the square matrix formulation.) If the constraint has this dual inconsistency, set needs_adjoint_dual = true.

source

HermitianMatrixSpace

JuMP.HermitianMatrixSpaceType
HermitianMatrixSpace()

Use in the @variable macro to constrain a matrix of variables to be hermitian.

Example

julia> model = Model();
 
 julia> @variable(model, Q[1:2, 1:2] in HermitianMatrixSpace())
 2×2 LinearAlgebra.Hermitian{GenericAffExpr{ComplexF64, VariableRef}, Matrix{GenericAffExpr{ComplexF64, VariableRef}}}:
  real(Q[1,1])                    real(Q[1,2]) + imag(Q[1,2]) im
- real(Q[1,2]) - imag(Q[1,2]) im  real(Q[2,2])
source

HermitianPSDCone

JuMP.HermitianPSDConeType
HermitianPSDCone

Hermitian positive semidefinite cone object that can be used to create a Hermitian positive semidefinite square matrix in the @variable and @constraint macros.

Example

Consider the following example:

julia> model = Model();
+ real(Q[1,2]) - imag(Q[1,2]) im  real(Q[2,2])
source

HermitianPSDCone

JuMP.HermitianPSDConeType
HermitianPSDCone

Hermitian positive semidefinite cone object that can be used to create a Hermitian positive semidefinite square matrix in the @variable and @constraint macros.

Example

Consider the following example:

julia> model = Model();
 
 julia> @variable(model, H[1:3, 1:3] in HermitianPSDCone())
 3×3 LinearAlgebra.Hermitian{GenericAffExpr{ComplexF64, VariableRef}, Matrix{GenericAffExpr{ComplexF64, VariableRef}}}:
@@ -2773,18 +2773,18 @@
 
 julia> all_constraints(model, Vector{VariableRef}, MOI.HermitianPositiveSemidefiniteConeTriangle)
 1-element Vector{ConstraintRef{Model, MathOptInterface.ConstraintIndex{MathOptInterface.VectorOfVariables, MathOptInterface.HermitianPositiveSemidefiniteConeTriangle}}}:
- [real(H[1,1]), real(H[1,2]), real(H[2,2]), real(H[1,3]), real(H[2,3]), real(H[3,3]), imag(H[1,2]), imag(H[1,3]), imag(H[2,3])] ∈ MathOptInterface.HermitianPositiveSemidefiniteConeTriangle(3)

We see in the output of the last commands that 9 real variables were created. The matrix H constrains affine expressions in terms of these 9 variables that parametrize a Hermitian matrix.

source

IntegerRef

JuMP.IntegerRefFunction
IntegerRef(v::GenericVariableRef)

Return a constraint reference to the constraint constraining v to be integer.

Errors if one does not exist.

See also is_integer, set_integer, unset_integer.

Example

julia> model = Model();
+ [real(H[1,1]), real(H[1,2]), real(H[2,2]), real(H[1,3]), real(H[2,3]), real(H[3,3]), imag(H[1,2]), imag(H[1,3]), imag(H[2,3])] ∈ MathOptInterface.HermitianPositiveSemidefiniteConeTriangle(3)

We see in the output of the last commands that 9 real variables were created. The matrix H constrains affine expressions in terms of these 9 variables that parametrize a Hermitian matrix.

source

IntegerRef

JuMP.IntegerRefFunction
IntegerRef(v::GenericVariableRef)

Return a constraint reference to the constraint constraining v to be integer.

Errors if one does not exist.

See also is_integer, set_integer, unset_integer.

Example

julia> model = Model();
 
 julia> @variable(model, x, Int);
 
 julia> IntegerRef(x)
-x integer
source

LPMatrixData

JuMP.LPMatrixDataType
LPMatrixData{T}

The struct returned by lp_matrix_data. See lp_matrix_data for a description of the public fields.

source

LessThanZero

JuMP.LessThanZeroType
GreaterThanZero()

A struct used to intercept when <= or is used in a macro via operator_to_set.

This struct is not the same as Nonpositives so that we can disambiguate x <= y and x - y in Nonpositives().

This struct is not intended for general usage, but it may be useful to some JuMP extensions.

Example

julia> operator_to_set(error, Val(:<=))
-LessThanZero()
source

LinearTermIterator

JuMP.LinearTermIteratorType
LinearTermIterator{GAE<:GenericAffExpr}

A struct that implements the iterate protocol in order to iterate over tuples of (coefficient, variable) in the GenericAffExpr.

source

LowerBoundRef

JuMP.LowerBoundRefFunction
LowerBoundRef(v::GenericVariableRef)

Return a constraint reference to the lower bound constraint of v.

Errors if one does not exist.

See also has_lower_bound, lower_bound, set_lower_bound, delete_lower_bound.

Example

julia> model = Model();
+x integer
source

LPMatrixData

JuMP.LPMatrixDataType
LPMatrixData{T}

The struct returned by lp_matrix_data. See lp_matrix_data for a description of the public fields.

source

LessThanZero

JuMP.LessThanZeroType
GreaterThanZero()

A struct used to intercept when <= or is used in a macro via operator_to_set.

This struct is not the same as Nonpositives so that we can disambiguate x <= y and x - y in Nonpositives().

This struct is not intended for general usage, but it may be useful to some JuMP extensions.

Example

julia> operator_to_set(error, Val(:<=))
+LessThanZero()
source

LinearTermIterator

JuMP.LinearTermIteratorType
LinearTermIterator{GAE<:GenericAffExpr}

A struct that implements the iterate protocol in order to iterate over tuples of (coefficient, variable) in the GenericAffExpr.

source

LowerBoundRef

JuMP.LowerBoundRefFunction
LowerBoundRef(v::GenericVariableRef)

Return a constraint reference to the lower bound constraint of v.

Errors if one does not exist.

See also has_lower_bound, lower_bound, set_lower_bound, delete_lower_bound.

Example

julia> model = Model();
 
 julia> @variable(model, x >= 1.0);
 
 julia> LowerBoundRef(x)
-x ≥ 1
source

Model

JuMP.ModelType
Model([optimizer_factory;] add_bridges::Bool = true)

Create a new instance of a JuMP model.

If optimizer_factory is provided, the model is initialized with thhe optimizer returned by MOI.instantiate(optimizer_factory).

If optimizer_factory is not provided, use set_optimizer to set the optimizer before calling optimize!.

If add_bridges, JuMP adds a MOI.Bridges.LazyBridgeOptimizer to automatically reformulate the problem into a form supported by the optimizer.

Example

julia> import Ipopt
+x ≥ 1
source

Model

JuMP.ModelType
Model([optimizer_factory;] add_bridges::Bool = true)

Create a new instance of a JuMP model.

If optimizer_factory is provided, the model is initialized with thhe optimizer returned by MOI.instantiate(optimizer_factory).

If optimizer_factory is not provided, use set_optimizer to set the optimizer before calling optimize!.

If add_bridges, JuMP adds a MOI.Bridges.LazyBridgeOptimizer to automatically reformulate the problem into a form supported by the optimizer.

Example

julia> import Ipopt
 
 julia> model = Model(Ipopt.Optimizer);
 
@@ -2795,16 +2795,16 @@
 
 julia> import MultiObjectiveAlgorithms as MOA
 
-julia> model = Model(() -> MOA.Optimizer(HiGHS.Optimizer); add_bridges = false);
source

ModelMode

JuMP.ModelModeType
ModelMode

An enum to describe the state of the CachingOptimizer inside a JuMP model.

See also: mode.

Values

Possible values are:

  • [AUTOMATIC]: moi_backend field holds a CachingOptimizer in AUTOMATIC mode.
  • [MANUAL]: moi_backend field holds a CachingOptimizer in MANUAL mode.
  • [DIRECT]: moi_backend field holds an AbstractOptimizer. No extra copy of the model is stored. The moi_backend must support add_constraint etc.
source

NLPEvaluator

JuMP.NLPEvaluatorFunction
NLPEvaluator(
+julia> model = Model(() -> MOA.Optimizer(HiGHS.Optimizer); add_bridges = false);
source

ModelMode

JuMP.ModelModeType
ModelMode

An enum to describe the state of the CachingOptimizer inside a JuMP model.

See also: mode.

Values

Possible values are:

  • [AUTOMATIC]: moi_backend field holds a CachingOptimizer in AUTOMATIC mode.
  • [MANUAL]: moi_backend field holds a CachingOptimizer in MANUAL mode.
  • [DIRECT]: moi_backend field holds an AbstractOptimizer. No extra copy of the model is stored. The moi_backend must support add_constraint etc.
source

NLPEvaluator

JuMP.NLPEvaluatorFunction
NLPEvaluator(
     model::Model,
     _differentiation_backend::MOI.Nonlinear.AbstractAutomaticDifferentiation =
         MOI.Nonlinear.SparseReverseMode(),
-)

Return an MOI.AbstractNLPEvaluator constructed from model

Warning

Before using, you must initialize the evaluator using MOI.initialize.

Experimental

These features may change or be removed in any future version of JuMP.

Pass _differentiation_backend to specify the differentiation backend used to compute derivatives.

source

NoOptimizer

JuMP.NoOptimizerType
struct NoOptimizer <: Exception end

An error thrown when no optimizer is set and one is required.

The optimizer can be provided to the Model constructor or by calling set_optimizer.

Example

julia> model = Model();
+)

Return an MOI.AbstractNLPEvaluator constructed from model

Warning

Before using, you must initialize the evaluator using MOI.initialize.

Experimental

These features may change or be removed in any future version of JuMP.

Pass _differentiation_backend to specify the differentiation backend used to compute derivatives.

source

NoOptimizer

JuMP.NoOptimizerType
struct NoOptimizer <: Exception end

An error thrown when no optimizer is set and one is required.

The optimizer can be provided to the Model constructor or by calling set_optimizer.

Example

julia> model = Model();
 
 julia> optimize!(model)
 ERROR: NoOptimizer()
 Stacktrace:
-[...]
source

NonlinearExpr

JuMP.NonlinearExprType
NonlinearExpr

Alias for GenericNonlinearExpr{VariableRef}, the specific GenericNonlinearExpr used by JuMP.

source

NonlinearOperator

JuMP.NonlinearOperatorType
NonlinearOperator(func::Function, head::Symbol)

A callable struct (functor) representing a function named head.

When called with AbstractJuMPScalars, the struct returns a GenericNonlinearExpr.

When called with non-JuMP types, the struct returns the evaluation of func(args...).

Unless head is special-cased by the optimizer, the operator must have already been added to the model using add_nonlinear_operator or @operator.

Example

julia> model = Model();
+[...]
source

NonlinearExpr

JuMP.NonlinearExprType
NonlinearExpr

Alias for GenericNonlinearExpr{VariableRef}, the specific GenericNonlinearExpr used by JuMP.

source

NonlinearOperator

JuMP.NonlinearOperatorType
NonlinearOperator(func::Function, head::Symbol)

A callable struct (functor) representing a function named head.

When called with AbstractJuMPScalars, the struct returns a GenericNonlinearExpr.

When called with non-JuMP types, the struct returns the evaluation of func(args...).

Unless head is special-cased by the optimizer, the operator must have already been added to the model using add_nonlinear_operator or @operator.

Example

julia> model = Model();
 
 julia> @variable(model, x)
 x
@@ -2828,7 +2828,7 @@
 op_f(x)
 
 julia> bar(2.0)
-4.0
source

Nonnegatives

JuMP.NonnegativesType
Nonnegatives()

The JuMP equivalent of the MOI.Nonnegatives set, in which the dimension is inferred from the corresponding function.

Example

julia> model = Model();
+4.0
source

Nonnegatives

JuMP.NonnegativesType
Nonnegatives()

The JuMP equivalent of the MOI.Nonnegatives set, in which the dimension is inferred from the corresponding function.

Example

julia> model = Model();
 
 julia> @variable(model, x[1:2])
 2-element Vector{VariableRef}:
@@ -2843,7 +2843,7 @@
 julia> b = [5, 6];
 
 julia> @constraint(model, A * x >= b)
-[x[1] + 2 x[2] - 5, 3 x[1] + 4 x[2] - 6] ∈ Nonnegatives()
source

Nonpositives

JuMP.NonpositivesType
Nonpositives()

The JuMP equivalent of the MOI.Nonpositives set, in which the dimension is inferred from the corresponding function.

Example

julia> model = Model();
+[x[1] + 2 x[2] - 5, 3 x[1] + 4 x[2] - 6] ∈ Nonnegatives()
source

Nonpositives

JuMP.NonpositivesType
Nonpositives()

The JuMP equivalent of the MOI.Nonpositives set, in which the dimension is inferred from the corresponding function.

Example

julia> model = Model();
 
 julia> @variable(model, x[1:2])
 2-element Vector{VariableRef}:
@@ -2858,14 +2858,14 @@
 julia> b = [5, 6];
 
 julia> @constraint(model, A * x <= b)
-[x[1] + 2 x[2] - 5, 3 x[1] + 4 x[2] - 6] ∈ Nonpositives()
source

OptimizationSense

JuMP.OptimizationSenseType
OptimizationSense

An enum for the value of the ObjectiveSense attribute.

Values

Possible values are:

  • MIN_SENSE: the goal is to minimize the objective function
  • MAX_SENSE: the goal is to maximize the objective function
  • FEASIBILITY_SENSE: the model does not have an objective function
source

OptimizeNotCalled

JuMP.OptimizeNotCalledType
struct OptimizeNotCalled <: Exception end

An error thrown when a result attribute cannot be queried before optimize! is called.

Example

julia> import Ipopt
+[x[1] + 2 x[2] - 5, 3 x[1] + 4 x[2] - 6] ∈ Nonpositives()
source

OptimizationSense

JuMP.OptimizationSenseType
OptimizationSense

An enum for the value of the ObjectiveSense attribute.

Values

Possible values are:

  • MIN_SENSE: the goal is to minimize the objective function
  • MAX_SENSE: the goal is to maximize the objective function
  • FEASIBILITY_SENSE: the model does not have an objective function
source

OptimizeNotCalled

JuMP.OptimizeNotCalledType
struct OptimizeNotCalled <: Exception end

An error thrown when a result attribute cannot be queried before optimize! is called.

Example

julia> import Ipopt
 
 julia> model = Model(Ipopt.Optimizer);
 
 julia> objective_value(model)
 ERROR: OptimizeNotCalled()
 Stacktrace:
-[...]
source

PSDCone

JuMP.PSDConeType
PSDCone

Positive semidefinite cone object that can be used to constrain a square matrix to be positive semidefinite in the @constraint macro.

If the matrix has type Symmetric then the columns vectorization (the vector obtained by concatenating the columns) of its upper triangular part is constrained to belong to the MOI.PositiveSemidefiniteConeTriangle set, otherwise its column vectorization is constrained to belong to the MOI.PositiveSemidefiniteConeSquare set.

Example

Non-symmetric case:

julia> model = Model();
+[...]
source

PSDCone

JuMP.PSDConeType
PSDCone

Positive semidefinite cone object that can be used to constrain a square matrix to be positive semidefinite in the @constraint macro.

If the matrix has type Symmetric then the columns vectorization (the vector obtained by concatenating the columns) of its upper triangular part is constrained to belong to the MOI.PositiveSemidefiniteConeTriangle set, otherwise its column vectorization is constrained to belong to the MOI.PositiveSemidefiniteConeSquare set.

Example

Non-symmetric case:

julia> model = Model();
 
 julia> @variable(model, x);
 
@@ -2906,7 +2906,7 @@
  x - 4
 
 julia> moi_set(constraint_object(cref))
-MathOptInterface.PositiveSemidefiniteConeTriangle(2)
source

Parameter

JuMP.ParameterType
Parameter(value)

A short-cut for the MOI.Parameter set.

Example

julia> model = Model();
+MathOptInterface.PositiveSemidefiniteConeTriangle(2)
source

Parameter

JuMP.ParameterType
Parameter(value)

A short-cut for the MOI.Parameter set.

Example

julia> model = Model();
 
 julia> @variable(model, x in Parameter(2))
 x
@@ -2914,7 +2914,7 @@
 julia> print(model)
 Feasibility
 Subject to
- x ∈ MathOptInterface.Parameter{Float64}(2.0)
source

ParameterRef

JuMP.ParameterRefFunction
ParameterRef(x::GenericVariableRef)

Return a constraint reference to the constraint constraining x to be a parameter.

Errors if one does not exist.

See also is_parameter, set_parameter_value, parameter_value.

Example

julia> model = Model();
+ x ∈ MathOptInterface.Parameter{Float64}(2.0)
source

ParameterRef

JuMP.ParameterRefFunction
ParameterRef(x::GenericVariableRef)

Return a constraint reference to the constraint constraining x to be a parameter.

Errors if one does not exist.

See also is_parameter, set_parameter_value, parameter_value.

Example

julia> model = Model();
 
 julia> @variable(model, p in Parameter(2))
 p
@@ -2927,7 +2927,7 @@
 julia> ParameterRef(x)
 ERROR: Variable x is not a parameter.
 Stacktrace:
-[...]
source

QuadExpr

JuMP.QuadExprType
QuadExpr

An alias for GenericQuadExpr{Float64,VariableRef}, the specific GenericQuadExpr used by JuMP.

source

QuadTermIterator

JuMP.QuadTermIteratorType
QuadTermIterator{GQE<:GenericQuadExpr}

A struct that implements the iterate protocol in order to iterate over tuples of (coefficient, variable, variable) in the GenericQuadExpr.

source

ReferenceMap

JuMP.ReferenceMapType
GenericReferenceMap{T}

Mapping between variable and constraint reference of a model and its copy. The reference of the copied model can be obtained by indexing the map with the reference of the corresponding reference of the original model.

source

ResultStatusCode

JuMP.ResultStatusCodeType
ResultStatusCode

An Enum of possible values for the PrimalStatus and DualStatus attributes.

The values indicate how to interpret the result vector.

Values

Possible values are:

  • NO_SOLUTION: the result vector is empty.
  • FEASIBLE_POINT: the result vector is a feasible point.
  • NEARLY_FEASIBLE_POINT: the result vector is feasible if some constraint tolerances are relaxed.
  • INFEASIBLE_POINT: the result vector is an infeasible point.
  • INFEASIBILITY_CERTIFICATE: the result vector is an infeasibility certificate. If the PrimalStatus is INFEASIBILITY_CERTIFICATE, then the primal result vector is a certificate of dual infeasibility. If the DualStatus is INFEASIBILITY_CERTIFICATE, then the dual result vector is a proof of primal infeasibility.
  • NEARLY_INFEASIBILITY_CERTIFICATE: the result satisfies a relaxed criterion for a certificate of infeasibility.
  • REDUCTION_CERTIFICATE: the result vector is an ill-posed certificate; see this article for details. If the PrimalStatus is REDUCTION_CERTIFICATE, then the primal result vector is a proof that the dual problem is ill-posed. If the DualStatus is REDUCTION_CERTIFICATE, then the dual result vector is a proof that the primal is ill-posed.
  • NEARLY_REDUCTION_CERTIFICATE: the result satisfies a relaxed criterion for an ill-posed certificate.
  • UNKNOWN_RESULT_STATUS: the result vector contains a solution with an unknown interpretation.
  • OTHER_RESULT_STATUS: the result vector contains a solution with an interpretation not covered by one of the statuses defined above
source

RotatedSecondOrderCone

JuMP.RotatedSecondOrderConeType
RotatedSecondOrderCone

Rotated second order cone object that can be used to constrain the square of the euclidean norm of a vector x to be less than or equal to $2tu$ where t and u are nonnegative scalars. This is a shortcut for the MOI.RotatedSecondOrderCone.

Example

The following constrains $\|(x-1, x-2)\|^2_2 \le 2tx$ and $t, x \ge 0$:

julia> model = Model();
+[...]
source

QuadExpr

JuMP.QuadExprType
QuadExpr

An alias for GenericQuadExpr{Float64,VariableRef}, the specific GenericQuadExpr used by JuMP.

source

QuadTermIterator

JuMP.QuadTermIteratorType
QuadTermIterator{GQE<:GenericQuadExpr}

A struct that implements the iterate protocol in order to iterate over tuples of (coefficient, variable, variable) in the GenericQuadExpr.

source

ReferenceMap

JuMP.ReferenceMapType
GenericReferenceMap{T}

Mapping between variable and constraint reference of a model and its copy. The reference of the copied model can be obtained by indexing the map with the reference of the corresponding reference of the original model.

source

ResultStatusCode

JuMP.ResultStatusCodeType
ResultStatusCode

An Enum of possible values for the PrimalStatus and DualStatus attributes.

The values indicate how to interpret the result vector.

Values

Possible values are:

  • NO_SOLUTION: the result vector is empty.
  • FEASIBLE_POINT: the result vector is a feasible point.
  • NEARLY_FEASIBLE_POINT: the result vector is feasible if some constraint tolerances are relaxed.
  • INFEASIBLE_POINT: the result vector is an infeasible point.
  • INFEASIBILITY_CERTIFICATE: the result vector is an infeasibility certificate. If the PrimalStatus is INFEASIBILITY_CERTIFICATE, then the primal result vector is a certificate of dual infeasibility. If the DualStatus is INFEASIBILITY_CERTIFICATE, then the dual result vector is a proof of primal infeasibility.
  • NEARLY_INFEASIBILITY_CERTIFICATE: the result satisfies a relaxed criterion for a certificate of infeasibility.
  • REDUCTION_CERTIFICATE: the result vector is an ill-posed certificate; see this article for details. If the PrimalStatus is REDUCTION_CERTIFICATE, then the primal result vector is a proof that the dual problem is ill-posed. If the DualStatus is REDUCTION_CERTIFICATE, then the dual result vector is a proof that the primal is ill-posed.
  • NEARLY_REDUCTION_CERTIFICATE: the result satisfies a relaxed criterion for an ill-posed certificate.
  • UNKNOWN_RESULT_STATUS: the result vector contains a solution with an unknown interpretation.
  • OTHER_RESULT_STATUS: the result vector contains a solution with an interpretation not covered by one of the statuses defined above
source

RotatedSecondOrderCone

JuMP.RotatedSecondOrderConeType
RotatedSecondOrderCone

Rotated second order cone object that can be used to constrain the square of the euclidean norm of a vector x to be less than or equal to $2tu$ where t and u are nonnegative scalars. This is a shortcut for the MOI.RotatedSecondOrderCone.

Example

The following constrains $\|(x-1, x-2)\|^2_2 \le 2tx$ and $t, x \ge 0$:

julia> model = Model();
 
 julia> @variable(model, x)
 x
@@ -2936,7 +2936,7 @@
 t
 
 julia> @constraint(model, [t, x, x-1, x-2] in RotatedSecondOrderCone())
-[t, x, x - 1, x - 2] ∈ MathOptInterface.RotatedSecondOrderCone(4)
source

SOS1

JuMP.SOS1Type
SOS1(weights = Real[])

The SOS1 (Special Ordered Set of Type 1) set constrains a vector x to the set where at most one variable can take a non-zero value, and all other elements are zero.

The weights vector, if specified, induces an ordering of the variables; as such, it should contain unique values. The weights vector must have the same number of elements as the vector x, and the element weights[i] corresponds to element x[i]. If not provided, the weights vector defaults to weights[i] = i.

This is a shortcut for the MOI.SOS1 set.

Example

julia> model = Model();
+[t, x, x - 1, x - 2] ∈ MathOptInterface.RotatedSecondOrderCone(4)
source

SOS1

JuMP.SOS1Type
SOS1(weights = Real[])

The SOS1 (Special Ordered Set of Type 1) set constrains a vector x to the set where at most one variable can take a non-zero value, and all other elements are zero.

The weights vector, if specified, induces an ordering of the variables; as such, it should contain unique values. The weights vector must have the same number of elements as the vector x, and the element weights[i] corresponds to element x[i]. If not provided, the weights vector defaults to weights[i] = i.

This is a shortcut for the MOI.SOS1 set.

Example

julia> model = Model();
 
 julia> @variable(model, x[1:3] in SOS1([4.1, 3.2, 5.0]))
 3-element Vector{VariableRef}:
@@ -2947,7 +2947,7 @@
 julia> print(model)
 Feasibility
 Subject to
- [x[1], x[2], x[3]] ∈ MathOptInterface.SOS1{Float64}([4.1, 3.2, 5.0])
source

SOS2

JuMP.SOS2Type
SOS2(weights = Real[])

The SOS2 (Special Ordered Set of Type 2) set constrains a vector x to the set where at most two variables can take a non-zero value, and all other elements are zero. In addition, the two non-zero values must be consecutive given the ordering of the x vector induced by weights.

The weights vector, if specified, induces an ordering of the variables; as such, it must contain unique values. The weights vector must have the same number of elements as the vector x, and the element weights[i] corresponds to element x[i]. If not provided, the weights vector defaults to weights[i] = i.

This is a shortcut for the MOI.SOS2 set.

Example

julia> model = Model();
+ [x[1], x[2], x[3]] ∈ MathOptInterface.SOS1{Float64}([4.1, 3.2, 5.0])
source

SOS2

JuMP.SOS2Type
SOS2(weights = Real[])

The SOS2 (Special Ordered Set of Type 2) set constrains a vector x to the set where at most two variables can take a non-zero value, and all other elements are zero. In addition, the two non-zero values must be consecutive given the ordering of the x vector induced by weights.

The weights vector, if specified, induces an ordering of the variables; as such, it must contain unique values. The weights vector must have the same number of elements as the vector x, and the element weights[i] corresponds to element x[i]. If not provided, the weights vector defaults to weights[i] = i.

This is a shortcut for the MOI.SOS2 set.

Example

julia> model = Model();
 
 julia> @variable(model, x[1:3] in SOS2([4.1, 3.2, 5.0]))
 3-element Vector{VariableRef}:
@@ -2958,7 +2958,7 @@
 julia> print(model)
 Feasibility
 Subject to
- [x[1], x[2], x[3]] ∈ MathOptInterface.SOS2{Float64}([4.1, 3.2, 5.0])
source

ScalarConstraint

JuMP.ScalarConstraintType
struct ScalarConstraint

The data for a scalar constraint.

See also the documentation on JuMP's representation of constraints for more background.

Fields

  • .func: field contains a JuMP object representing the function
  • .set: field contains the MOI set

Example

A scalar constraint:

julia> model = Model();
+ [x[1], x[2], x[3]] ∈ MathOptInterface.SOS2{Float64}([4.1, 3.2, 5.0])
source

ScalarConstraint

JuMP.ScalarConstraintType
struct ScalarConstraint

The data for a scalar constraint.

See also the documentation on JuMP's representation of constraints for more background.

Fields

  • .func: field contains a JuMP object representing the function
  • .set: field contains the MOI set

Example

A scalar constraint:

julia> model = Model();
 
 julia> @variable(model, x);
 
@@ -2975,14 +2975,14 @@
 2 x
 
 julia> object.set
-MathOptInterface.LessThan{Float64}(1.0)
source

ScalarShape

JuMP.ScalarShapeType
ScalarShape()

An AbstractShape that represents scalar constraints.

Example

julia> model = Model();
+MathOptInterface.LessThan{Float64}(1.0)
source

ScalarShape

JuMP.ScalarShapeType
ScalarShape()

An AbstractShape that represents scalar constraints.

Example

julia> model = Model();
 
 julia> @variable(model, x[1:2]);
 
 julia> c = @constraint(model, x[2] <= 1);
 
 julia> shape(constraint_object(c))
-ScalarShape()
source

ScalarVariable

JuMP.ScalarVariableType
ScalarVariable{S,T,U,V} <: AbstractVariable

A struct used when adding variables.

See also: add_variable.

source

SecondOrderCone

JuMP.SecondOrderConeType
SecondOrderCone

Second order cone object that can be used to constrain the euclidean norm of a vector x to be less than or equal to a nonnegative scalar t. This is a shortcut for the MOI.SecondOrderCone.

Example

The following constrains $\|(x-1, x-2)\|_2 \le t$ and $t \ge 0$:

julia> model = Model();
+ScalarShape()
source

ScalarVariable

JuMP.ScalarVariableType
ScalarVariable{S,T,U,V} <: AbstractVariable

A struct used when adding variables.

See also: add_variable.

source

SecondOrderCone

JuMP.SecondOrderConeType
SecondOrderCone

Second order cone object that can be used to constrain the euclidean norm of a vector x to be less than or equal to a nonnegative scalar t. This is a shortcut for the MOI.SecondOrderCone.

Example

The following constrains $\|(x-1, x-2)\|_2 \le t$ and $t \ge 0$:

julia> model = Model();
 
 julia> @variable(model, x)
 x
@@ -2991,7 +2991,7 @@
 t
 
 julia> @constraint(model, [t, x-1, x-2] in SecondOrderCone())
-[t, x - 1, x - 2] ∈ MathOptInterface.SecondOrderCone(3)
source

Semicontinuous

JuMP.SemicontinuousType
Semicontinuous(lower, upper)

A short-cut for the MOI.Semicontinuous set.

This short-cut is useful because it automatically promotes lower and upper to the same type, and converts them into the element type supported by the JuMP model.

Example

julia> model = Model();
+[t, x - 1, x - 2] ∈ MathOptInterface.SecondOrderCone(3)
source

Semicontinuous

JuMP.SemicontinuousType
Semicontinuous(lower, upper)

A short-cut for the MOI.Semicontinuous set.

This short-cut is useful because it automatically promotes lower and upper to the same type, and converts them into the element type supported by the JuMP model.

Example

julia> model = Model();
 
 julia> @variable(model, x in Semicontinuous(1, 2))
 x
@@ -2999,7 +2999,7 @@
 julia> print(model)
 Feasibility
 Subject to
- x ∈ MathOptInterface.Semicontinuous{Int64}(1, 2)
source

Semiinteger

JuMP.SemiintegerType
Semiinteger(lower, upper)

A short-cut for the MOI.Semiinteger set.

This short-cut is useful because it automatically promotes lower and upper to the same type, and converts them into the element type supported by the JuMP model.

Example

julia> model = Model();
+ x ∈ MathOptInterface.Semicontinuous{Int64}(1, 2)
source

Semiinteger

JuMP.SemiintegerType
Semiinteger(lower, upper)

A short-cut for the MOI.Semiinteger set.

This short-cut is useful because it automatically promotes lower and upper to the same type, and converts them into the element type supported by the JuMP model.

Example

julia> model = Model();
 
 julia> @variable(model, x in Semiinteger(3, 5))
 x
@@ -3007,12 +3007,12 @@
 julia> print(model)
 Feasibility
 Subject to
- x ∈ MathOptInterface.Semiinteger{Int64}(3, 5)
source

SensitivityReport

JuMP.SensitivityReportType
SensitivityReport

See lp_sensitivity_report.

source

SkewSymmetricMatrixShape

JuMP.SkewSymmetricMatrixShapeType
SkewSymmetricMatrixShape

Shape object for a skew symmetric square matrix of side_dimension rows and columns. The vectorized form contains the entries of the upper-right triangular part of the matrix (without the diagonal) given column by column (or equivalently, the entries of the lower-left triangular part given row by row). The diagonal is zero.

source

SkewSymmetricMatrixSpace

JuMP.SkewSymmetricMatrixSpaceType
SkewSymmetricMatrixSpace()

Use in the @variable macro to constrain a matrix of variables to be skew-symmetric.

Example

julia> model = Model();
+ x ∈ MathOptInterface.Semiinteger{Int64}(3, 5)
source

SensitivityReport

JuMP.SensitivityReportType
SensitivityReport

See lp_sensitivity_report.

source

SkewSymmetricMatrixShape

JuMP.SkewSymmetricMatrixShapeType
SkewSymmetricMatrixShape

Shape object for a skew symmetric square matrix of side_dimension rows and columns. The vectorized form contains the entries of the upper-right triangular part of the matrix (without the diagonal) given column by column (or equivalently, the entries of the lower-left triangular part given row by row). The diagonal is zero.

source

SkewSymmetricMatrixSpace

JuMP.SkewSymmetricMatrixSpaceType
SkewSymmetricMatrixSpace()

Use in the @variable macro to constrain a matrix of variables to be skew-symmetric.

Example

julia> model = Model();
 
 julia> @variable(model, Q[1:2, 1:2] in SkewSymmetricMatrixSpace())
 2×2 Matrix{AffExpr}:
  0        Q[1,2]
- -Q[1,2]  0
source

SkipModelConvertScalarSetWrapper

JuMP.SkipModelConvertScalarSetWrapperType
SkipModelConvertScalarSetWrapper(set::MOI.AbstractScalarSet)

JuMP uses model_convert to automatically promote MOI.AbstractScalarSet sets to the same value_type as the model.

In cases there this is undesirable, wrap the set in SkipModelConvertScalarSetWrapper to pass the set un-changed to the solver.

Warning

This struct is intended for use internally by JuMP extensions. You should not need to use it in regular JuMP code.

Example

julia> model = Model();
+ -Q[1,2]  0
source

SkipModelConvertScalarSetWrapper

JuMP.SkipModelConvertScalarSetWrapperType
SkipModelConvertScalarSetWrapper(set::MOI.AbstractScalarSet)

JuMP uses model_convert to automatically promote MOI.AbstractScalarSet sets to the same value_type as the model.

In cases there this is undesirable, wrap the set in SkipModelConvertScalarSetWrapper to pass the set un-changed to the solver.

Warning

This struct is intended for use internally by JuMP extensions. You should not need to use it in regular JuMP code.

Example

julia> model = Model();
 
 julia> @variable(model, x);
 
@@ -3020,15 +3020,15 @@
 x = 0.5
 
 julia> @constraint(model, x in SkipModelConvertScalarSetWrapper(MOI.EqualTo(1 // 2)))
-x = 1//2
source

SquareMatrixShape

JuMP.SquareMatrixShapeType
SquareMatrixShape

Shape object for a square matrix of side_dimension rows and columns. The vectorized form contains the entries of the matrix given column by column (or equivalently, the entries of the lower-left triangular part given row by row).

source

SymmetricMatrixAdjointShape

JuMP.SymmetricMatrixAdjointShapeType
SymmetricMatrixAdjointShape(side_dimension)

The dual_shape of SymmetricMatrixShape.

This shape is not intended for regular use.

source

SymmetricMatrixShape

JuMP.SymmetricMatrixShapeType
SymmetricMatrixShape(
+x = 1//2
source

SquareMatrixShape

JuMP.SquareMatrixShapeType
SquareMatrixShape

Shape object for a square matrix of side_dimension rows and columns. The vectorized form contains the entries of the matrix given column by column (or equivalently, the entries of the lower-left triangular part given row by row).

source

SymmetricMatrixAdjointShape

JuMP.SymmetricMatrixAdjointShapeType
SymmetricMatrixAdjointShape(side_dimension)

The dual_shape of SymmetricMatrixShape.

This shape is not intended for regular use.

source

SymmetricMatrixShape

JuMP.SymmetricMatrixShapeType
SymmetricMatrixShape(
     side_dimension::Int;
     needs_adjoint_dual::Bool = false,
-)

The shape object for a symmetric square matrix of side_dimension rows and columns.

The vectorized form contains the entries of the upper-right triangular part of the matrix given column by column (or equivalently, the entries of the lower-left triangular part given row by row).

needs_adjoint_dual

By default, the dual_shape of SymmetricMatrixShape is also SymmetricMatrixShape. This is true for cases such as a LinearAlgebra.Symmetric matrix in PSDCone.

However, JuMP also supports LinearAlgebra.Symmetric matrix in Zeros, which is interpreted as an element-wise equality constraint. By exploiting symmetry, we pass only the upper triangle of the equality constraints. This works for the primal, but it leads to a factor of 2 difference in the off-diagonal dual elements. (The dual value of the (i, j) element in the triangle formulation should be divided by 2 when spread across the (i, j) and (j, i) elements in the square matrix formulation.) If the constraint has this dual inconsistency, set needs_adjoint_dual = true.

source

SymmetricMatrixSpace

JuMP.SymmetricMatrixSpaceType
SymmetricMatrixSpace()

Use in the @variable macro to constrain a matrix of variables to be symmetric.

Example

julia> model = Model();
+)

The shape object for a symmetric square matrix of side_dimension rows and columns.

The vectorized form contains the entries of the upper-right triangular part of the matrix given column by column (or equivalently, the entries of the lower-left triangular part given row by row).

needs_adjoint_dual

By default, the dual_shape of SymmetricMatrixShape is also SymmetricMatrixShape. This is true for cases such as a LinearAlgebra.Symmetric matrix in PSDCone.

However, JuMP also supports LinearAlgebra.Symmetric matrix in Zeros, which is interpreted as an element-wise equality constraint. By exploiting symmetry, we pass only the upper triangle of the equality constraints. This works for the primal, but it leads to a factor of 2 difference in the off-diagonal dual elements. (The dual value of the (i, j) element in the triangle formulation should be divided by 2 when spread across the (i, j) and (j, i) elements in the square matrix formulation.) If the constraint has this dual inconsistency, set needs_adjoint_dual = true.

source

SymmetricMatrixSpace

JuMP.SymmetricMatrixSpaceType
SymmetricMatrixSpace()

Use in the @variable macro to constrain a matrix of variables to be symmetric.

Example

julia> model = Model();
 
 julia> @variable(model, Q[1:2, 1:2] in SymmetricMatrixSpace())
 2×2 LinearAlgebra.Symmetric{VariableRef, Matrix{VariableRef}}:
  Q[1,1]  Q[1,2]
- Q[1,2]  Q[2,2]
source

TerminationStatusCode

JuMP.TerminationStatusCodeType
TerminationStatusCode

An Enum of possible values for the TerminationStatus attribute. This attribute is meant to explain the reason why the optimizer stopped executing in the most recent call to optimize!.

Values

Possible values are:

  • OPTIMIZE_NOT_CALLED: The algorithm has not started.
  • OPTIMAL: The algorithm found a globally optimal solution.
  • INFEASIBLE: The algorithm concluded that no feasible solution exists.
  • DUAL_INFEASIBLE: The algorithm concluded that no dual bound exists for the problem. If, additionally, a feasible (primal) solution is known to exist, this status typically implies that the problem is unbounded, with some technical exceptions.
  • LOCALLY_SOLVED: The algorithm converged to a stationary point, local optimal solution, could not find directions for improvement, or otherwise completed its search without global guarantees.
  • LOCALLY_INFEASIBLE: The algorithm converged to an infeasible point or otherwise completed its search without finding a feasible solution, without guarantees that no feasible solution exists.
  • INFEASIBLE_OR_UNBOUNDED: The algorithm stopped because it decided that the problem is infeasible or unbounded; this occasionally happens during MIP presolve.
  • ALMOST_OPTIMAL: The algorithm found a globally optimal solution to relaxed tolerances.
  • ALMOST_INFEASIBLE: The algorithm concluded that no feasible solution exists within relaxed tolerances.
  • ALMOST_DUAL_INFEASIBLE: The algorithm concluded that no dual bound exists for the problem within relaxed tolerances.
  • ALMOST_LOCALLY_SOLVED: The algorithm converged to a stationary point, local optimal solution, or could not find directions for improvement within relaxed tolerances.
  • ITERATION_LIMIT: An iterative algorithm stopped after conducting the maximum number of iterations.
  • TIME_LIMIT: The algorithm stopped after a user-specified computation time.
  • NODE_LIMIT: A branch-and-bound algorithm stopped because it explored a maximum number of nodes in the branch-and-bound tree.
  • SOLUTION_LIMIT: The algorithm stopped because it found the required number of solutions. This is often used in MIPs to get the solver to return the first feasible solution it encounters.
  • MEMORY_LIMIT: The algorithm stopped because it ran out of memory.
  • OBJECTIVE_LIMIT: The algorithm stopped because it found a solution better than a minimum limit set by the user.
  • NORM_LIMIT: The algorithm stopped because the norm of an iterate became too large.
  • OTHER_LIMIT: The algorithm stopped due to a limit not covered by one of the _LIMIT_ statuses above.
  • SLOW_PROGRESS: The algorithm stopped because it was unable to continue making progress towards the solution.
  • NUMERICAL_ERROR: The algorithm stopped because it encountered unrecoverable numerical error.
  • INVALID_MODEL: The algorithm stopped because the model is invalid.
  • INVALID_OPTION: The algorithm stopped because it was provided an invalid option.
  • INTERRUPTED: The algorithm stopped because of an interrupt signal.
  • OTHER_ERROR: The algorithm stopped because of an error not covered by one of the statuses defined above.
source

UnorderedPair

JuMP.UnorderedPairType
UnorderedPair(a::T, b::T)

A wrapper type used by GenericQuadExpr with fields .a and .b.

Example

julia> model = Model();
+ Q[1,2]  Q[2,2]
source

TerminationStatusCode

JuMP.TerminationStatusCodeType
TerminationStatusCode

An Enum of possible values for the TerminationStatus attribute. This attribute is meant to explain the reason why the optimizer stopped executing in the most recent call to optimize!.

Values

Possible values are:

  • OPTIMIZE_NOT_CALLED: The algorithm has not started.
  • OPTIMAL: The algorithm found a globally optimal solution.
  • INFEASIBLE: The algorithm concluded that no feasible solution exists.
  • DUAL_INFEASIBLE: The algorithm concluded that no dual bound exists for the problem. If, additionally, a feasible (primal) solution is known to exist, this status typically implies that the problem is unbounded, with some technical exceptions.
  • LOCALLY_SOLVED: The algorithm converged to a stationary point, local optimal solution, could not find directions for improvement, or otherwise completed its search without global guarantees.
  • LOCALLY_INFEASIBLE: The algorithm converged to an infeasible point or otherwise completed its search without finding a feasible solution, without guarantees that no feasible solution exists.
  • INFEASIBLE_OR_UNBOUNDED: The algorithm stopped because it decided that the problem is infeasible or unbounded; this occasionally happens during MIP presolve.
  • ALMOST_OPTIMAL: The algorithm found a globally optimal solution to relaxed tolerances.
  • ALMOST_INFEASIBLE: The algorithm concluded that no feasible solution exists within relaxed tolerances.
  • ALMOST_DUAL_INFEASIBLE: The algorithm concluded that no dual bound exists for the problem within relaxed tolerances.
  • ALMOST_LOCALLY_SOLVED: The algorithm converged to a stationary point, local optimal solution, or could not find directions for improvement within relaxed tolerances.
  • ITERATION_LIMIT: An iterative algorithm stopped after conducting the maximum number of iterations.
  • TIME_LIMIT: The algorithm stopped after a user-specified computation time.
  • NODE_LIMIT: A branch-and-bound algorithm stopped because it explored a maximum number of nodes in the branch-and-bound tree.
  • SOLUTION_LIMIT: The algorithm stopped because it found the required number of solutions. This is often used in MIPs to get the solver to return the first feasible solution it encounters.
  • MEMORY_LIMIT: The algorithm stopped because it ran out of memory.
  • OBJECTIVE_LIMIT: The algorithm stopped because it found a solution better than a minimum limit set by the user.
  • NORM_LIMIT: The algorithm stopped because the norm of an iterate became too large.
  • OTHER_LIMIT: The algorithm stopped due to a limit not covered by one of the _LIMIT_ statuses above.
  • SLOW_PROGRESS: The algorithm stopped because it was unable to continue making progress towards the solution.
  • NUMERICAL_ERROR: The algorithm stopped because it encountered unrecoverable numerical error.
  • INVALID_MODEL: The algorithm stopped because the model is invalid.
  • INVALID_OPTION: The algorithm stopped because it was provided an invalid option.
  • INTERRUPTED: The algorithm stopped because of an interrupt signal.
  • OTHER_ERROR: The algorithm stopped because of an error not covered by one of the statuses defined above.
source

UnorderedPair

JuMP.UnorderedPairType
UnorderedPair(a::T, b::T)

A wrapper type used by GenericQuadExpr with fields .a and .b.

Example

julia> model = Model();
 
 julia> @variable(model, x[1:2]);
 
@@ -3037,12 +3037,12 @@
 
 julia> expr.terms
 OrderedCollections.OrderedDict{UnorderedPair{VariableRef}, Float64} with 1 entry:
-  UnorderedPair{VariableRef}(x[1], x[2]) => 2.0
source

UpperBoundRef

JuMP.UpperBoundRefFunction
UpperBoundRef(v::GenericVariableRef)

Return a constraint reference to the upper bound constraint of v.

Errors if one does not exist.

See also has_upper_bound, upper_bound, set_upper_bound, delete_upper_bound.

Example

julia> model = Model();
+  UnorderedPair{VariableRef}(x[1], x[2]) => 2.0
source

UpperBoundRef

JuMP.UpperBoundRefFunction
UpperBoundRef(v::GenericVariableRef)

Return a constraint reference to the upper bound constraint of v.

Errors if one does not exist.

See also has_upper_bound, upper_bound, set_upper_bound, delete_upper_bound.

Example

julia> model = Model();
 
 julia> @variable(model, x <= 1.0);
 
 julia> UpperBoundRef(x)
-x ≤ 1
source

VariableConstrainedOnCreation

JuMP.VariableConstrainedOnCreationType
VariableConstrainedOnCreation <: AbstractVariable

Variable scalar_variables constrained to belong to set.

Adding this variable can be understood as doing:

function JuMP.add_variable(
+x ≤ 1
source

VariableConstrainedOnCreation

JuMP.VariableConstrainedOnCreationType
VariableConstrainedOnCreation <: AbstractVariable

Variable scalar_variables constrained to belong to set.

Adding this variable can be understood as doing:

function JuMP.add_variable(
     model::GenericModel,
     variable::VariableConstrainedOnCreation,
     names,
@@ -3050,9 +3050,9 @@
     var_ref = add_variable(model, variable.scalar_variable, name)
     add_constraint(model, VectorConstraint(var_ref, variable.set))
     return var_ref
-end

but adds the variables with MOI.add_constrained_variable(model, variable.set) instead.

source

VariableInfo

JuMP.VariableInfoType
VariableInfo{S,T,U,V}

A struct by JuMP internally when creating variables. This may also be used by JuMP extensions to create new types of variables.

See also: ScalarVariable.

source

VariableNotOwned

JuMP.VariableNotOwnedType
struct VariableNotOwned{V<:AbstractVariableRef} <: Exception
+end

but adds the variables with MOI.add_constrained_variable(model, variable.set) instead.

source

VariableInfo

JuMP.VariableInfoType
VariableInfo{S,T,U,V}

A struct by JuMP internally when creating variables. This may also be used by JuMP extensions to create new types of variables.

See also: ScalarVariable.

source

VariableNotOwned

JuMP.VariableNotOwnedType
struct VariableNotOwned{V<:AbstractVariableRef} <: Exception
     variable::V
-end

The variable variable was used in a model different to owner_model(variable).

source

VariableRef

JuMP.VariableRefType
GenericVariableRef{T} <: AbstractVariableRef

Holds a reference to the model and the corresponding MOI.VariableIndex.

source

VariablesConstrainedOnCreation

JuMP.VariablesConstrainedOnCreationType
VariablesConstrainedOnCreation <: AbstractVariable

Vector of variables scalar_variables constrained to belong to set. Adding this variable can be thought as doing:

function JuMP.add_variable(
+end

The variable variable was used in a model different to owner_model(variable).

source

VariableRef

JuMP.VariableRefType
GenericVariableRef{T} <: AbstractVariableRef

Holds a reference to the model and the corresponding MOI.VariableIndex.

source

VariablesConstrainedOnCreation

JuMP.VariablesConstrainedOnCreationType
VariablesConstrainedOnCreation <: AbstractVariable

Vector of variables scalar_variables constrained to belong to set. Adding this variable can be thought as doing:

function JuMP.add_variable(
     model::GenericModel,
     variable::VariablesConstrainedOnCreation,
     names,
@@ -3061,7 +3061,7 @@
     var_refs = add_variable.(model, variable.scalar_variables, v_names)
     add_constraint(model, VectorConstraint(var_refs, variable.set))
     return reshape_vector(var_refs, variable.shape)
-end

but adds the variables with MOI.add_constrained_variables(model, variable.set) instead. See the MOI documentation for the difference between adding the variables with MOI.add_constrained_variables and adding them with MOI.add_variables and adding the constraint separately.

source

VectorConstraint

JuMP.VectorConstraintType
struct VectorConstraint

The data for a vector constraint.

See also the documentation on JuMP's representation of constraints.

Fields

  • func: field contains a JuMP object representing the function
  • set: field contains the MOI set.
  • shape: field contains an AbstractShape matching the form in which the constraint was constructed (for example, by using matrices or flat vectors).

Example

julia> model = Model();
+end

but adds the variables with MOI.add_constrained_variables(model, variable.set) instead. See the MOI documentation for the difference between adding the variables with MOI.add_constrained_variables and adding them with MOI.add_variables and adding the constraint separately.

source

VectorConstraint

JuMP.VectorConstraintType
struct VectorConstraint

The data for a vector constraint.

See also the documentation on JuMP's representation of constraints.

Fields

  • func: field contains a JuMP object representing the function
  • set: field contains the MOI set.
  • shape: field contains an AbstractShape matching the form in which the constraint was constructed (for example, by using matrices or flat vectors).

Example

julia> model = Model();
 
 julia> @variable(model, x[1:3]);
 
@@ -3084,14 +3084,14 @@
 MathOptInterface.SecondOrderCone(3)
 
 julia> object.shape
-VectorShape()
source

VectorShape

JuMP.VectorShapeType
VectorShape()

An AbstractShape that represents vector-valued constraints.

Example

julia> model = Model();
+VectorShape()
source

VectorShape

JuMP.VectorShapeType
VectorShape()

An AbstractShape that represents vector-valued constraints.

Example

julia> model = Model();
 
 julia> @variable(model, x[1:2]);
 
 julia> c = @constraint(model, x in SOS1());
 
 julia> shape(constraint_object(c))
-VectorShape()
source

Zeros

JuMP.ZerosType
Zeros()

The JuMP equivalent of the MOI.Zeros set, in which the dimension is inferred from the corresponding function.

Example

julia> model = Model();
+VectorShape()
source

Zeros

JuMP.ZerosType
Zeros()

The JuMP equivalent of the MOI.Zeros set, in which the dimension is inferred from the corresponding function.

Example

julia> model = Model();
 
 julia> @variable(model, x[1:2])
 2-element Vector{VariableRef}:
@@ -3106,7 +3106,7 @@
 julia> b = [5, 6];
 
 julia> @constraint(model, A * x == b)
-[x[1] + 2 x[2] - 5, 3 x[1] + 4 x[2] - 6] ∈ Zeros()
source

ALMOST_DUAL_INFEASIBLE

JuMP.ALMOST_DUAL_INFEASIBLEConstant
ALMOST_DUAL_INFEASIBLE::TerminationStatusCode

An instance of the TerminationStatusCode enum.

ALMOST_DUAL_INFEASIBLE: The algorithm concluded that no dual bound exists for the problem within relaxed tolerances.

source

ALMOST_INFEASIBLE

JuMP.ALMOST_INFEASIBLEConstant
ALMOST_INFEASIBLE::TerminationStatusCode

An instance of the TerminationStatusCode enum.

ALMOST_INFEASIBLE: The algorithm concluded that no feasible solution exists within relaxed tolerances.

source

ALMOST_LOCALLY_SOLVED

JuMP.ALMOST_LOCALLY_SOLVEDConstant
ALMOST_LOCALLY_SOLVED::TerminationStatusCode

An instance of the TerminationStatusCode enum.

ALMOST_LOCALLY_SOLVED: The algorithm converged to a stationary point, local optimal solution, or could not find directions for improvement within relaxed tolerances.

source

ALMOST_OPTIMAL

JuMP.ALMOST_OPTIMALConstant
ALMOST_OPTIMAL::TerminationStatusCode

An instance of the TerminationStatusCode enum.

ALMOST_OPTIMAL: The algorithm found a globally optimal solution to relaxed tolerances.

source

AUTOMATIC

JuMP.AUTOMATICConstant

moi_backend field holds a CachingOptimizer in AUTOMATIC mode.

source

DIRECT

JuMP.DIRECTConstant

moi_backend field holds an AbstractOptimizer. No extra copy of the model is stored. The moi_backend must support add_constraint etc.

source

DUAL_INFEASIBLE

JuMP.DUAL_INFEASIBLEConstant
DUAL_INFEASIBLE::TerminationStatusCode

An instance of the TerminationStatusCode enum.

DUAL_INFEASIBLE: The algorithm concluded that no dual bound exists for the problem. If, additionally, a feasible (primal) solution is known to exist, this status typically implies that the problem is unbounded, with some technical exceptions.

source

FEASIBILITY_SENSE

JuMP.FEASIBILITY_SENSEConstant
FEASIBILITY_SENSE::OptimizationSense

An instance of the OptimizationSense enum.

FEASIBILITY_SENSE: the model does not have an objective function

source

FEASIBLE_POINT

JuMP.FEASIBLE_POINTConstant
FEASIBLE_POINT::ResultStatusCode

An instance of the ResultStatusCode enum.

FEASIBLE_POINT: the result vector is a feasible point.

source

INFEASIBILITY_CERTIFICATE

JuMP.INFEASIBILITY_CERTIFICATEConstant
INFEASIBILITY_CERTIFICATE::ResultStatusCode

An instance of the ResultStatusCode enum.

INFEASIBILITY_CERTIFICATE: the result vector is an infeasibility certificate. If the PrimalStatus is INFEASIBILITY_CERTIFICATE, then the primal result vector is a certificate of dual infeasibility. If the DualStatus is INFEASIBILITY_CERTIFICATE, then the dual result vector is a proof of primal infeasibility.

source

INFEASIBLE

JuMP.INFEASIBLEConstant
INFEASIBLE::TerminationStatusCode

An instance of the TerminationStatusCode enum.

INFEASIBLE: The algorithm concluded that no feasible solution exists.

source

INFEASIBLE_OR_UNBOUNDED

JuMP.INFEASIBLE_OR_UNBOUNDEDConstant
INFEASIBLE_OR_UNBOUNDED::TerminationStatusCode

An instance of the TerminationStatusCode enum.

INFEASIBLE_OR_UNBOUNDED: The algorithm stopped because it decided that the problem is infeasible or unbounded; this occasionally happens during MIP presolve.

source

INFEASIBLE_POINT

JuMP.INFEASIBLE_POINTConstant
INFEASIBLE_POINT::ResultStatusCode

An instance of the ResultStatusCode enum.

INFEASIBLE_POINT: the result vector is an infeasible point.

source

INTERRUPTED

JuMP.INTERRUPTEDConstant
INTERRUPTED::TerminationStatusCode

An instance of the TerminationStatusCode enum.

INTERRUPTED: The algorithm stopped because of an interrupt signal.

source

INVALID_MODEL

JuMP.INVALID_MODELConstant
INVALID_MODEL::TerminationStatusCode

An instance of the TerminationStatusCode enum.

INVALID_MODEL: The algorithm stopped because the model is invalid.

source

INVALID_OPTION

JuMP.INVALID_OPTIONConstant
INVALID_OPTION::TerminationStatusCode

An instance of the TerminationStatusCode enum.

INVALID_OPTION: The algorithm stopped because it was provided an invalid option.

source

ITERATION_LIMIT

JuMP.ITERATION_LIMITConstant
ITERATION_LIMIT::TerminationStatusCode

An instance of the TerminationStatusCode enum.

ITERATION_LIMIT: An iterative algorithm stopped after conducting the maximum number of iterations.

source

LOCALLY_INFEASIBLE

JuMP.LOCALLY_INFEASIBLEConstant
LOCALLY_INFEASIBLE::TerminationStatusCode

An instance of the TerminationStatusCode enum.

LOCALLY_INFEASIBLE: The algorithm converged to an infeasible point or otherwise completed its search without finding a feasible solution, without guarantees that no feasible solution exists.

source

LOCALLY_SOLVED

JuMP.LOCALLY_SOLVEDConstant
LOCALLY_SOLVED::TerminationStatusCode

An instance of the TerminationStatusCode enum.

LOCALLY_SOLVED: The algorithm converged to a stationary point, local optimal solution, could not find directions for improvement, or otherwise completed its search without global guarantees.

source

MANUAL

JuMP.MANUALConstant

moi_backend field holds a CachingOptimizer in MANUAL mode.

source

MAX_SENSE

JuMP.MAX_SENSEConstant
MAX_SENSE::OptimizationSense

An instance of the OptimizationSense enum.

MAX_SENSE: the goal is to maximize the objective function

source

MEMORY_LIMIT

JuMP.MEMORY_LIMITConstant
MEMORY_LIMIT::TerminationStatusCode

An instance of the TerminationStatusCode enum.

MEMORY_LIMIT: The algorithm stopped because it ran out of memory.

source

MIN_SENSE

JuMP.MIN_SENSEConstant
MIN_SENSE::OptimizationSense

An instance of the OptimizationSense enum.

MIN_SENSE: the goal is to minimize the objective function

source

NEARLY_FEASIBLE_POINT

JuMP.NEARLY_FEASIBLE_POINTConstant
NEARLY_FEASIBLE_POINT::ResultStatusCode

An instance of the ResultStatusCode enum.

NEARLY_FEASIBLE_POINT: the result vector is feasible if some constraint tolerances are relaxed.

source

NEARLY_INFEASIBILITY_CERTIFICATE

JuMP.NEARLY_INFEASIBILITY_CERTIFICATEConstant
NEARLY_INFEASIBILITY_CERTIFICATE::ResultStatusCode

An instance of the ResultStatusCode enum.

NEARLY_INFEASIBILITY_CERTIFICATE: the result satisfies a relaxed criterion for a certificate of infeasibility.

source

NEARLY_REDUCTION_CERTIFICATE

JuMP.NEARLY_REDUCTION_CERTIFICATEConstant
NEARLY_REDUCTION_CERTIFICATE::ResultStatusCode

An instance of the ResultStatusCode enum.

NEARLY_REDUCTION_CERTIFICATE: the result satisfies a relaxed criterion for an ill-posed certificate.

source

NODE_LIMIT

JuMP.NODE_LIMITConstant
NODE_LIMIT::TerminationStatusCode

An instance of the TerminationStatusCode enum.

NODE_LIMIT: A branch-and-bound algorithm stopped because it explored a maximum number of nodes in the branch-and-bound tree.

source

NORM_LIMIT

JuMP.NORM_LIMITConstant
NORM_LIMIT::TerminationStatusCode

An instance of the TerminationStatusCode enum.

NORM_LIMIT: The algorithm stopped because the norm of an iterate became too large.

source

NO_SOLUTION

JuMP.NO_SOLUTIONConstant
NO_SOLUTION::ResultStatusCode

An instance of the ResultStatusCode enum.

NO_SOLUTION: the result vector is empty.

source

NUMERICAL_ERROR

JuMP.NUMERICAL_ERRORConstant
NUMERICAL_ERROR::TerminationStatusCode

An instance of the TerminationStatusCode enum.

NUMERICAL_ERROR: The algorithm stopped because it encountered unrecoverable numerical error.

source

OBJECTIVE_LIMIT

JuMP.OBJECTIVE_LIMITConstant
OBJECTIVE_LIMIT::TerminationStatusCode

An instance of the TerminationStatusCode enum.

OBJECTIVE_LIMIT: The algorithm stopped because it found a solution better than a minimum limit set by the user.

source

OPTIMAL

JuMP.OPTIMALConstant
OPTIMAL::TerminationStatusCode

An instance of the TerminationStatusCode enum.

OPTIMAL: The algorithm found a globally optimal solution.

source

OPTIMIZE_NOT_CALLED

JuMP.OPTIMIZE_NOT_CALLEDConstant
OPTIMIZE_NOT_CALLED::TerminationStatusCode

An instance of the TerminationStatusCode enum.

OPTIMIZE_NOT_CALLED: The algorithm has not started.

source

OTHER_ERROR

JuMP.OTHER_ERRORConstant
OTHER_ERROR::TerminationStatusCode

An instance of the TerminationStatusCode enum.

OTHER_ERROR: The algorithm stopped because of an error not covered by one of the statuses defined above.

source

OTHER_LIMIT

JuMP.OTHER_LIMITConstant
OTHER_LIMIT::TerminationStatusCode

An instance of the TerminationStatusCode enum.

OTHER_LIMIT: The algorithm stopped due to a limit not covered by one of the _LIMIT_ statuses above.

source

OTHER_RESULT_STATUS

JuMP.OTHER_RESULT_STATUSConstant
OTHER_RESULT_STATUS::ResultStatusCode

An instance of the ResultStatusCode enum.

OTHER_RESULT_STATUS: the result vector contains a solution with an interpretation not covered by one of the statuses defined above

source

REDUCTION_CERTIFICATE

JuMP.REDUCTION_CERTIFICATEConstant
REDUCTION_CERTIFICATE::ResultStatusCode

An instance of the ResultStatusCode enum.

REDUCTION_CERTIFICATE: the result vector is an ill-posed certificate; see this article for details. If the PrimalStatus is REDUCTION_CERTIFICATE, then the primal result vector is a proof that the dual problem is ill-posed. If the DualStatus is REDUCTION_CERTIFICATE, then the dual result vector is a proof that the primal is ill-posed.

source

SLOW_PROGRESS

JuMP.SLOW_PROGRESSConstant
SLOW_PROGRESS::TerminationStatusCode

An instance of the TerminationStatusCode enum.

SLOW_PROGRESS: The algorithm stopped because it was unable to continue making progress towards the solution.

source

SOLUTION_LIMIT

JuMP.SOLUTION_LIMITConstant
SOLUTION_LIMIT::TerminationStatusCode

An instance of the TerminationStatusCode enum.

SOLUTION_LIMIT: The algorithm stopped because it found the required number of solutions. This is often used in MIPs to get the solver to return the first feasible solution it encounters.

source

TIME_LIMIT

JuMP.TIME_LIMITConstant
TIME_LIMIT::TerminationStatusCode

An instance of the TerminationStatusCode enum.

TIME_LIMIT: The algorithm stopped after a user-specified computation time.

source

UNKNOWN_RESULT_STATUS

JuMP.UNKNOWN_RESULT_STATUSConstant
UNKNOWN_RESULT_STATUS::ResultStatusCode

An instance of the ResultStatusCode enum.

UNKNOWN_RESULT_STATUS: the result vector contains a solution with an unknown interpretation.

source

op_and

JuMP.op_andConstant
op_and(x, y)

A function that falls back to x & y, but when called with JuMP variables or expressions, returns a GenericNonlinearExpr.

Example

julia> model = Model();
+[x[1] + 2 x[2] - 5, 3 x[1] + 4 x[2] - 6] ∈ Zeros()
source

ALMOST_DUAL_INFEASIBLE

JuMP.ALMOST_DUAL_INFEASIBLEConstant
ALMOST_DUAL_INFEASIBLE::TerminationStatusCode

An instance of the TerminationStatusCode enum.

ALMOST_DUAL_INFEASIBLE: The algorithm concluded that no dual bound exists for the problem within relaxed tolerances.

source

ALMOST_INFEASIBLE

JuMP.ALMOST_INFEASIBLEConstant
ALMOST_INFEASIBLE::TerminationStatusCode

An instance of the TerminationStatusCode enum.

ALMOST_INFEASIBLE: The algorithm concluded that no feasible solution exists within relaxed tolerances.

source

ALMOST_LOCALLY_SOLVED

JuMP.ALMOST_LOCALLY_SOLVEDConstant
ALMOST_LOCALLY_SOLVED::TerminationStatusCode

An instance of the TerminationStatusCode enum.

ALMOST_LOCALLY_SOLVED: The algorithm converged to a stationary point, local optimal solution, or could not find directions for improvement within relaxed tolerances.

source

ALMOST_OPTIMAL

JuMP.ALMOST_OPTIMALConstant
ALMOST_OPTIMAL::TerminationStatusCode

An instance of the TerminationStatusCode enum.

ALMOST_OPTIMAL: The algorithm found a globally optimal solution to relaxed tolerances.

source

AUTOMATIC

JuMP.AUTOMATICConstant

moi_backend field holds a CachingOptimizer in AUTOMATIC mode.

source

DIRECT

JuMP.DIRECTConstant

moi_backend field holds an AbstractOptimizer. No extra copy of the model is stored. The moi_backend must support add_constraint etc.

source

DUAL_INFEASIBLE

JuMP.DUAL_INFEASIBLEConstant
DUAL_INFEASIBLE::TerminationStatusCode

An instance of the TerminationStatusCode enum.

DUAL_INFEASIBLE: The algorithm concluded that no dual bound exists for the problem. If, additionally, a feasible (primal) solution is known to exist, this status typically implies that the problem is unbounded, with some technical exceptions.

source

FEASIBILITY_SENSE

JuMP.FEASIBILITY_SENSEConstant
FEASIBILITY_SENSE::OptimizationSense

An instance of the OptimizationSense enum.

FEASIBILITY_SENSE: the model does not have an objective function

source

FEASIBLE_POINT

JuMP.FEASIBLE_POINTConstant
FEASIBLE_POINT::ResultStatusCode

An instance of the ResultStatusCode enum.

FEASIBLE_POINT: the result vector is a feasible point.

source

INFEASIBILITY_CERTIFICATE

JuMP.INFEASIBILITY_CERTIFICATEConstant
INFEASIBILITY_CERTIFICATE::ResultStatusCode

An instance of the ResultStatusCode enum.

INFEASIBILITY_CERTIFICATE: the result vector is an infeasibility certificate. If the PrimalStatus is INFEASIBILITY_CERTIFICATE, then the primal result vector is a certificate of dual infeasibility. If the DualStatus is INFEASIBILITY_CERTIFICATE, then the dual result vector is a proof of primal infeasibility.

source

INFEASIBLE

JuMP.INFEASIBLEConstant
INFEASIBLE::TerminationStatusCode

An instance of the TerminationStatusCode enum.

INFEASIBLE: The algorithm concluded that no feasible solution exists.

source

INFEASIBLE_OR_UNBOUNDED

JuMP.INFEASIBLE_OR_UNBOUNDEDConstant
INFEASIBLE_OR_UNBOUNDED::TerminationStatusCode

An instance of the TerminationStatusCode enum.

INFEASIBLE_OR_UNBOUNDED: The algorithm stopped because it decided that the problem is infeasible or unbounded; this occasionally happens during MIP presolve.

source

INFEASIBLE_POINT

JuMP.INFEASIBLE_POINTConstant
INFEASIBLE_POINT::ResultStatusCode

An instance of the ResultStatusCode enum.

INFEASIBLE_POINT: the result vector is an infeasible point.

source

INTERRUPTED

JuMP.INTERRUPTEDConstant
INTERRUPTED::TerminationStatusCode

An instance of the TerminationStatusCode enum.

INTERRUPTED: The algorithm stopped because of an interrupt signal.

source

INVALID_MODEL

JuMP.INVALID_MODELConstant
INVALID_MODEL::TerminationStatusCode

An instance of the TerminationStatusCode enum.

INVALID_MODEL: The algorithm stopped because the model is invalid.

source

INVALID_OPTION

JuMP.INVALID_OPTIONConstant
INVALID_OPTION::TerminationStatusCode

An instance of the TerminationStatusCode enum.

INVALID_OPTION: The algorithm stopped because it was provided an invalid option.

source

ITERATION_LIMIT

JuMP.ITERATION_LIMITConstant
ITERATION_LIMIT::TerminationStatusCode

An instance of the TerminationStatusCode enum.

ITERATION_LIMIT: An iterative algorithm stopped after conducting the maximum number of iterations.

source

LOCALLY_INFEASIBLE

JuMP.LOCALLY_INFEASIBLEConstant
LOCALLY_INFEASIBLE::TerminationStatusCode

An instance of the TerminationStatusCode enum.

LOCALLY_INFEASIBLE: The algorithm converged to an infeasible point or otherwise completed its search without finding a feasible solution, without guarantees that no feasible solution exists.

source

LOCALLY_SOLVED

JuMP.LOCALLY_SOLVEDConstant
LOCALLY_SOLVED::TerminationStatusCode

An instance of the TerminationStatusCode enum.

LOCALLY_SOLVED: The algorithm converged to a stationary point, local optimal solution, could not find directions for improvement, or otherwise completed its search without global guarantees.

source

MANUAL

JuMP.MANUALConstant

moi_backend field holds a CachingOptimizer in MANUAL mode.

source

MAX_SENSE

JuMP.MAX_SENSEConstant
MAX_SENSE::OptimizationSense

An instance of the OptimizationSense enum.

MAX_SENSE: the goal is to maximize the objective function

source

MEMORY_LIMIT

JuMP.MEMORY_LIMITConstant
MEMORY_LIMIT::TerminationStatusCode

An instance of the TerminationStatusCode enum.

MEMORY_LIMIT: The algorithm stopped because it ran out of memory.

source

MIN_SENSE

JuMP.MIN_SENSEConstant
MIN_SENSE::OptimizationSense

An instance of the OptimizationSense enum.

MIN_SENSE: the goal is to minimize the objective function

source

NEARLY_FEASIBLE_POINT

JuMP.NEARLY_FEASIBLE_POINTConstant
NEARLY_FEASIBLE_POINT::ResultStatusCode

An instance of the ResultStatusCode enum.

NEARLY_FEASIBLE_POINT: the result vector is feasible if some constraint tolerances are relaxed.

source

NEARLY_INFEASIBILITY_CERTIFICATE

JuMP.NEARLY_INFEASIBILITY_CERTIFICATEConstant
NEARLY_INFEASIBILITY_CERTIFICATE::ResultStatusCode

An instance of the ResultStatusCode enum.

NEARLY_INFEASIBILITY_CERTIFICATE: the result satisfies a relaxed criterion for a certificate of infeasibility.

source

NEARLY_REDUCTION_CERTIFICATE

JuMP.NEARLY_REDUCTION_CERTIFICATEConstant
NEARLY_REDUCTION_CERTIFICATE::ResultStatusCode

An instance of the ResultStatusCode enum.

NEARLY_REDUCTION_CERTIFICATE: the result satisfies a relaxed criterion for an ill-posed certificate.

source

NODE_LIMIT

JuMP.NODE_LIMITConstant
NODE_LIMIT::TerminationStatusCode

An instance of the TerminationStatusCode enum.

NODE_LIMIT: A branch-and-bound algorithm stopped because it explored a maximum number of nodes in the branch-and-bound tree.

source

NORM_LIMIT

JuMP.NORM_LIMITConstant
NORM_LIMIT::TerminationStatusCode

An instance of the TerminationStatusCode enum.

NORM_LIMIT: The algorithm stopped because the norm of an iterate became too large.

source

NO_SOLUTION

JuMP.NO_SOLUTIONConstant
NO_SOLUTION::ResultStatusCode

An instance of the ResultStatusCode enum.

NO_SOLUTION: the result vector is empty.

source

NUMERICAL_ERROR

JuMP.NUMERICAL_ERRORConstant
NUMERICAL_ERROR::TerminationStatusCode

An instance of the TerminationStatusCode enum.

NUMERICAL_ERROR: The algorithm stopped because it encountered unrecoverable numerical error.

source

OBJECTIVE_LIMIT

JuMP.OBJECTIVE_LIMITConstant
OBJECTIVE_LIMIT::TerminationStatusCode

An instance of the TerminationStatusCode enum.

OBJECTIVE_LIMIT: The algorithm stopped because it found a solution better than a minimum limit set by the user.

source

OPTIMAL

JuMP.OPTIMALConstant
OPTIMAL::TerminationStatusCode

An instance of the TerminationStatusCode enum.

OPTIMAL: The algorithm found a globally optimal solution.

source

OPTIMIZE_NOT_CALLED

JuMP.OPTIMIZE_NOT_CALLEDConstant
OPTIMIZE_NOT_CALLED::TerminationStatusCode

An instance of the TerminationStatusCode enum.

OPTIMIZE_NOT_CALLED: The algorithm has not started.

source

OTHER_ERROR

JuMP.OTHER_ERRORConstant
OTHER_ERROR::TerminationStatusCode

An instance of the TerminationStatusCode enum.

OTHER_ERROR: The algorithm stopped because of an error not covered by one of the statuses defined above.

source

OTHER_LIMIT

JuMP.OTHER_LIMITConstant
OTHER_LIMIT::TerminationStatusCode

An instance of the TerminationStatusCode enum.

OTHER_LIMIT: The algorithm stopped due to a limit not covered by one of the _LIMIT_ statuses above.

source

OTHER_RESULT_STATUS

JuMP.OTHER_RESULT_STATUSConstant
OTHER_RESULT_STATUS::ResultStatusCode

An instance of the ResultStatusCode enum.

OTHER_RESULT_STATUS: the result vector contains a solution with an interpretation not covered by one of the statuses defined above

source

REDUCTION_CERTIFICATE

JuMP.REDUCTION_CERTIFICATEConstant
REDUCTION_CERTIFICATE::ResultStatusCode

An instance of the ResultStatusCode enum.

REDUCTION_CERTIFICATE: the result vector is an ill-posed certificate; see this article for details. If the PrimalStatus is REDUCTION_CERTIFICATE, then the primal result vector is a proof that the dual problem is ill-posed. If the DualStatus is REDUCTION_CERTIFICATE, then the dual result vector is a proof that the primal is ill-posed.

source

SLOW_PROGRESS

JuMP.SLOW_PROGRESSConstant
SLOW_PROGRESS::TerminationStatusCode

An instance of the TerminationStatusCode enum.

SLOW_PROGRESS: The algorithm stopped because it was unable to continue making progress towards the solution.

source

SOLUTION_LIMIT

JuMP.SOLUTION_LIMITConstant
SOLUTION_LIMIT::TerminationStatusCode

An instance of the TerminationStatusCode enum.

SOLUTION_LIMIT: The algorithm stopped because it found the required number of solutions. This is often used in MIPs to get the solver to return the first feasible solution it encounters.

source

TIME_LIMIT

JuMP.TIME_LIMITConstant
TIME_LIMIT::TerminationStatusCode

An instance of the TerminationStatusCode enum.

TIME_LIMIT: The algorithm stopped after a user-specified computation time.

source

UNKNOWN_RESULT_STATUS

JuMP.UNKNOWN_RESULT_STATUSConstant
UNKNOWN_RESULT_STATUS::ResultStatusCode

An instance of the ResultStatusCode enum.

UNKNOWN_RESULT_STATUS: the result vector contains a solution with an unknown interpretation.

source

op_and

JuMP.op_andConstant
op_and(x, y)

A function that falls back to x & y, but when called with JuMP variables or expressions, returns a GenericNonlinearExpr.

Example

julia> model = Model();
 
 julia> @variable(model, x);
 
@@ -3114,7 +3114,7 @@
 false
 
 julia> op_and(true, x)
-true && x
source

op_equal_to

JuMP.op_equal_toConstant
op_equal_to(x, y)

A function that falls back to x == y, but when called with JuMP variables or expressions, returns a GenericNonlinearExpr.

Example

julia> model = Model();
+true && x
source

op_equal_to

JuMP.op_equal_toConstant
op_equal_to(x, y)

A function that falls back to x == y, but when called with JuMP variables or expressions, returns a GenericNonlinearExpr.

Example

julia> model = Model();
 
 julia> @variable(model, x);
 
@@ -3122,7 +3122,7 @@
 true
 
 julia> op_equal_to(x, 2)
-x == 2
source

op_greater_than_or_equal_to

JuMP.op_greater_than_or_equal_toConstant
op_greater_than_or_equal_to(x, y)

A function that falls back to x >= y, but when called with JuMP variables or expressions, returns a GenericNonlinearExpr.

Example

julia> model = Model();
+x == 2
source

op_greater_than_or_equal_to

JuMP.op_greater_than_or_equal_toConstant
op_greater_than_or_equal_to(x, y)

A function that falls back to x >= y, but when called with JuMP variables or expressions, returns a GenericNonlinearExpr.

Example

julia> model = Model();
 
 julia> @variable(model, x);
 
@@ -3130,7 +3130,7 @@
 true
 
 julia> op_greater_than_or_equal_to(x, 2)
-x >= 2
source

op_less_than_or_equal_to

JuMP.op_less_than_or_equal_toConstant
op_less_than_or_equal_to(x, y)

A function that falls back to x <= y, but when called with JuMP variables or expressions, returns a GenericNonlinearExpr.

Example

julia> model = Model();
+x >= 2
source

op_less_than_or_equal_to

JuMP.op_less_than_or_equal_toConstant
op_less_than_or_equal_to(x, y)

A function that falls back to x <= y, but when called with JuMP variables or expressions, returns a GenericNonlinearExpr.

Example

julia> model = Model();
 
 julia> @variable(model, x);
 
@@ -3138,7 +3138,7 @@
 true
 
 julia> op_less_than_or_equal_to(x, 2)
-x <= 2
source

op_or

JuMP.op_orConstant
op_or(x, y)

A function that falls back to x | y, but when called with JuMP variables or expressions, returns a GenericNonlinearExpr.

Example

julia> model = Model();
+x <= 2
source

op_or

JuMP.op_orConstant
op_or(x, y)

A function that falls back to x | y, but when called with JuMP variables or expressions, returns a GenericNonlinearExpr.

Example

julia> model = Model();
 
 julia> @variable(model, x);
 
@@ -3146,7 +3146,7 @@
 true
 
 julia> op_or(true, x)
-true || x
source

op_strictly_greater_than

JuMP.op_strictly_greater_thanConstant
op_strictly_greater_than(x, y)

A function that falls back to x > y, but when called with JuMP variables or expressions, returns a GenericNonlinearExpr.

Example

julia> model = Model();
+true || x
source

op_strictly_greater_than

JuMP.op_strictly_greater_thanConstant
op_strictly_greater_than(x, y)

A function that falls back to x > y, but when called with JuMP variables or expressions, returns a GenericNonlinearExpr.

Example

julia> model = Model();
 
 julia> @variable(model, x);
 
@@ -3154,7 +3154,7 @@
 false
 
 julia> op_strictly_greater_than(x, 2)
-x > 2
source

op_strictly_less_than

JuMP.op_strictly_less_thanConstant
op_strictly_less_than(x, y)

A function that falls back to x < y, but when called with JuMP variables or expressions, returns a GenericNonlinearExpr.

Example

julia> model = Model();
+x > 2
source

op_strictly_less_than

JuMP.op_strictly_less_thanConstant
op_strictly_less_than(x, y)

A function that falls back to x < y, but when called with JuMP variables or expressions, returns a GenericNonlinearExpr.

Example

julia> model = Model();
 
 julia> @variable(model, x);
 
@@ -3162,7 +3162,7 @@
 true
 
 julia> op_strictly_less_than(x, 2)
-x < 2
source

Base.empty!(::GenericModel)

Base.empty!Method
empty!(model::GenericModel)::GenericModel

Empty the model, that is, remove all variables, constraints and model attributes but not optimizer attributes. Always return the argument.

Note: removes extensions data.

Example

julia> model = Model();
+x < 2
source

Base.empty!(::GenericModel)

Base.empty!Method
empty!(model::GenericModel)::GenericModel

Empty the model, that is, remove all variables, constraints and model attributes but not optimizer attributes. Always return the argument.

Note: removes extensions data.

Example

julia> model = Model();
 
 julia> @variable(model, x[1:2]);
 
@@ -3182,7 +3182,7 @@
 Subject to
 
 julia> isempty(model)
-true
source

Base.isempty(::GenericModel)

Base.isemptyMethod
isempty(model::GenericModel)

Verifies whether the model is empty, that is, whether the MOI backend is empty and whether the model is in the same state as at its creation, apart from optimizer attributes.

Example

julia> model = Model();
+true
source

Base.isempty(::GenericModel)

Base.isemptyMethod
isempty(model::GenericModel)

Verifies whether the model is empty, that is, whether the MOI backend is empty and whether the model is in the same state as at its creation, apart from optimizer attributes.

Example

julia> model = Model();
 
 julia> isempty(model)
 true
@@ -3190,7 +3190,7 @@
 julia> @variable(model, x[1:2]);
 
 julia> isempty(model)
-false
source

Base.copy(::AbstractModel)

Base.copyMethod
copy(model::AbstractModel)

Return a copy of the model model. It is similar to copy_model except that it does not return the mapping between the references of model and its copy.

Note

Model copy is not supported in DIRECT mode, that is, when a model is constructed using the direct_model constructor instead of the Model constructor. Moreover, independently on whether an optimizer was provided at model construction, the new model will have no optimizer, that is, an optimizer will have to be provided to the new model in the optimize! call.

Example

In the following example, a model model is constructed with a variable x and a constraint cref. It is then copied into a model new_model with the new references assigned to x_new and cref_new.

julia> model = Model();
+false
source

Base.copy(::AbstractModel)

Base.copyMethod
copy(model::AbstractModel)

Return a copy of the model model. It is similar to copy_model except that it does not return the mapping between the references of model and its copy.

Note

Model copy is not supported in DIRECT mode, that is, when a model is constructed using the direct_model constructor instead of the Model constructor. Moreover, independently on whether an optimizer was provided at model construction, the new model will have no optimizer, that is, an optimizer will have to be provided to the new model in the optimize! call.

Example

In the following example, a model model is constructed with a variable x and a constraint cref. It is then copied into a model new_model with the new references assigned to x_new and cref_new.

julia> model = Model();
 
 julia> @variable(model, x)
 x
@@ -3204,12 +3204,12 @@
 x
 
 julia> cref_new = model[:cref]
-cref : x = 2
source

Base.write(::IO, ::GenericModel; ::MOI.FileFormats.FileFormat)

Base.writeMethod
Base.write(
+cref : x = 2
source

Base.write(::IO, ::GenericModel; ::MOI.FileFormats.FileFormat)

Base.writeMethod
Base.write(
     io::IO,
     model::GenericModel;
     format::MOI.FileFormats.FileFormat = MOI.FileFormats.FORMAT_MOF,
     kwargs...,
-)

Write the JuMP model model to io in the format format.

Other kwargs are passed to the Model constructor of the chosen format.

source

MOI.Utilities.reset_optimizer(::GenericModel)

MathOptInterface.Utilities.reset_optimizerMethod
MOIU.reset_optimizer(model::GenericModel)

Call MOIU.reset_optimizer on the backend of model.

Cannot be called in direct mode.

source

MOI.Utilities.drop_optimizer(::GenericModel)

MathOptInterface.Utilities.drop_optimizerMethod
MOIU.drop_optimizer(model::GenericModel)

Call MOIU.drop_optimizer on the backend of model.

Cannot be called in direct mode.

source

MOI.Utilities.attach_optimizer(::GenericModel)

MathOptInterface.Utilities.attach_optimizerMethod
MOIU.attach_optimizer(model::GenericModel)

Call MOIU.attach_optimizer on the backend of model.

Cannot be called in direct mode.

source

@NLconstraint

JuMP.@NLconstraintMacro
@NLconstraint(model::GenericModel, expr)

Add a constraint described by the nonlinear expression expr. See also @constraint.

Compat

This macro is part of the legacy nonlinear interface. Consider using the new nonlinear interface documented in Nonlinear Modeling. In most cases, you can replace @NLconstraint with @constraint.

Example

julia> model = Model();
+)

Write the JuMP model model to io in the format format.

Other kwargs are passed to the Model constructor of the chosen format.

source

MOI.Utilities.reset_optimizer(::GenericModel)

MathOptInterface.Utilities.reset_optimizerMethod
MOIU.reset_optimizer(model::GenericModel)

Call MOIU.reset_optimizer on the backend of model.

Cannot be called in direct mode.

source

MOI.Utilities.drop_optimizer(::GenericModel)

MathOptInterface.Utilities.drop_optimizerMethod
MOIU.drop_optimizer(model::GenericModel)

Call MOIU.drop_optimizer on the backend of model.

Cannot be called in direct mode.

source

MOI.Utilities.attach_optimizer(::GenericModel)

MathOptInterface.Utilities.attach_optimizerMethod
MOIU.attach_optimizer(model::GenericModel)

Call MOIU.attach_optimizer on the backend of model.

Cannot be called in direct mode.

source

@NLconstraint

JuMP.@NLconstraintMacro
@NLconstraint(model::GenericModel, expr)

Add a constraint described by the nonlinear expression expr. See also @constraint.

Compat

This macro is part of the legacy nonlinear interface. Consider using the new nonlinear interface documented in Nonlinear Modeling. In most cases, you can replace @NLconstraint with @constraint.

Example

julia> model = Model();
 
 julia> @variable(model, x)
 x
@@ -3221,7 +3221,7 @@
 3-element Vector{NonlinearConstraintRef{ScalarShape}}:
  (sin(1.0 * x) - 1.0 / 1.0) - 0.0 ≤ 0
  (sin(2.0 * x) - 1.0 / 2.0) - 0.0 ≤ 0
- (sin(3.0 * x) - 1.0 / 3.0) - 0.0 ≤ 0
source

@NLconstraints

JuMP.@NLconstraintsMacro
@NLconstraints(model, args...)

Adds multiple nonlinear constraints to model at once, in the same fashion as the @NLconstraint macro.

The model must be the first argument, and multiple constraints can be added on multiple lines wrapped in a begin ... end block.

The macro returns a tuple containing the constraints that were defined.

Compat

This macro is part of the legacy nonlinear interface. Consider using the new nonlinear interface documented in Nonlinear Modeling. In most cases, you can replace @NLconstraints with @constraints.

Example

julia> model = Model();
+ (sin(3.0 * x) - 1.0 / 3.0) - 0.0 ≤ 0
source

@NLconstraints

JuMP.@NLconstraintsMacro
@NLconstraints(model, args...)

Adds multiple nonlinear constraints to model at once, in the same fashion as the @NLconstraint macro.

The model must be the first argument, and multiple constraints can be added on multiple lines wrapped in a begin ... end block.

The macro returns a tuple containing the constraints that were defined.

Compat

This macro is part of the legacy nonlinear interface. Consider using the new nonlinear interface documented in Nonlinear Modeling. In most cases, you can replace @NLconstraints with @constraints.

Example

julia> model = Model();
 
 julia> @variable(model, x);
 
@@ -3237,7 +3237,7 @@
            t >= sqrt(x^2 + y^2)
            [i = 1:2], z[i] <= log(a[i])
        end)
-((t - sqrt(x ^ 2.0 + y ^ 2.0)) - 0.0 ≥ 0, NonlinearConstraintRef{ScalarShape}[(z[1] - log(4.0)) - 0.0 ≤ 0, (z[2] - log(5.0)) - 0.0 ≤ 0])
source

@NLexpression

JuMP.@NLexpressionMacro
@NLexpression(args...)

Efficiently build a nonlinear expression which can then be inserted in other nonlinear constraints and the objective. See also [@expression].

Compat

This macro is part of the legacy nonlinear interface. Consider using the new nonlinear interface documented in Nonlinear Modeling. In most cases, you can replace @NLexpression with @expression.

Example

julia> model = Model();
+((t - sqrt(x ^ 2.0 + y ^ 2.0)) - 0.0 ≥ 0, NonlinearConstraintRef{ScalarShape}[(z[1] - log(4.0)) - 0.0 ≤ 0, (z[2] - log(5.0)) - 0.0 ≤ 0])
source

@NLexpression

JuMP.@NLexpressionMacro
@NLexpression(args...)

Efficiently build a nonlinear expression which can then be inserted in other nonlinear constraints and the objective. See also [@expression].

Compat

This macro is part of the legacy nonlinear interface. Consider using the new nonlinear interface documented in Nonlinear Modeling. In most cases, you can replace @NLexpression with @expression.

Example

julia> model = Model();
 
 julia> @variable(model, x)
 x
@@ -3258,7 +3258,7 @@
  subexpression[4]: sin(3.0 * x)
 
 julia> my_expr_2 = @NLexpression(model, log(1 + sum(exp(my_expr_1[i]) for i in 1:2)))
-subexpression[5]: log(1.0 + (exp(subexpression[2]) + exp(subexpression[3])))
source

@NLexpressions

JuMP.@NLexpressionsMacro
@NLexpressions(model, args...)

Adds multiple nonlinear expressions to model at once, in the same fashion as the @NLexpression macro.

The model must be the first argument, and multiple expressions can be added on multiple lines wrapped in a begin ... end block.

The macro returns a tuple containing the expressions that were defined.

Compat

This macro is part of the legacy nonlinear interface. Consider using the new nonlinear interface documented in Nonlinear Modeling. In most cases, you can replace @NLexpressions with @expressions.

Example

julia> model = Model();
+subexpression[5]: log(1.0 + (exp(subexpression[2]) + exp(subexpression[3])))
source

@NLexpressions

JuMP.@NLexpressionsMacro
@NLexpressions(model, args...)

Adds multiple nonlinear expressions to model at once, in the same fashion as the @NLexpression macro.

The model must be the first argument, and multiple expressions can be added on multiple lines wrapped in a begin ... end block.

The macro returns a tuple containing the expressions that were defined.

Compat

This macro is part of the legacy nonlinear interface. Consider using the new nonlinear interface documented in Nonlinear Modeling. In most cases, you can replace @NLexpressions with @expressions.

Example

julia> model = Model();
 
 julia> @variable(model, x);
 
@@ -3272,7 +3272,7 @@
            my_expr, sqrt(x^2 + y^2)
            my_expr_1[i = 1:2], log(a[i]) - z[i]
        end)
-(subexpression[1]: sqrt(x ^ 2.0 + y ^ 2.0), NonlinearExpression[subexpression[2]: log(4.0) - z[1], subexpression[3]: log(5.0) - z[2]])
source

@NLobjective

JuMP.@NLobjectiveMacro
@NLobjective(model, sense, expression)

Add a nonlinear objective to model with optimization sense sense. sense must be Max or Min.

Compat

This macro is part of the legacy nonlinear interface. Consider using the new nonlinear interface documented in Nonlinear Modeling. In most cases, you can replace @NLobjective with @objective.

Example

julia> model = Model();
+(subexpression[1]: sqrt(x ^ 2.0 + y ^ 2.0), NonlinearExpression[subexpression[2]: log(4.0) - z[1], subexpression[3]: log(5.0) - z[2]])
source

@NLobjective

JuMP.@NLobjectiveMacro
@NLobjective(model, sense, expression)

Add a nonlinear objective to model with optimization sense sense. sense must be Max or Min.

Compat

This macro is part of the legacy nonlinear interface. Consider using the new nonlinear interface documented in Nonlinear Modeling. In most cases, you can replace @NLobjective with @objective.

Example

julia> model = Model();
 
 julia> @variable(model, x)
 x
@@ -3281,7 +3281,7 @@
 
 julia> print(model)
 Max 2.0 * x + 1.0 + sin(x)
-Subject to
source

@NLparameter

JuMP.@NLparameterMacro
@NLparameter(model, param == value)

Create and return a nonlinear parameter param attached to the model model with initial value set to value. Nonlinear parameters may be used only in nonlinear expressions.

Example

julia> model = Model();
+Subject to
source

@NLparameter

JuMP.@NLparameterMacro
@NLparameter(model, param == value)

Create and return a nonlinear parameter param attached to the model model with initial value set to value. Nonlinear parameters may be used only in nonlinear expressions.

Example

julia> model = Model();
 
 julia> @NLparameter(model, x == 10)
 x == 10.0
@@ -3311,7 +3311,7 @@
  parameter[3] == 6.0
 
 julia> value(y[2])
-4.0
source

@NLparameters

JuMP.@NLparametersMacro
 @NLparameters(model, args...)

Create and return multiple nonlinear parameters attached to model model, in the same fashion as @NLparameter macro.

The model must be the first argument, and multiple parameters can be added on multiple lines wrapped in a begin ... end block. Distinct parameters need to be placed on separate lines as in the following example.

The macro returns a tuple containing the parameters that were defined.

Compat

This macro is part of the legacy nonlinear interface. Consider using the new nonlinear interface documented in Nonlinear Modeling. In most cases, you can replace a call like

@NLparameters(model, begin
+4.0
source

@NLparameters

JuMP.@NLparametersMacro
 @NLparameters(model, args...)

Create and return multiple nonlinear parameters attached to model model, in the same fashion as @NLparameter macro.

The model must be the first argument, and multiple parameters can be added on multiple lines wrapped in a begin ... end block. Distinct parameters need to be placed on separate lines as in the following example.

The macro returns a tuple containing the parameters that were defined.

Compat

This macro is part of the legacy nonlinear interface. Consider using the new nonlinear interface documented in Nonlinear Modeling. In most cases, you can replace a call like

@NLparameters(model, begin
     p == value
 end)

with

@variables(model, begin
     p in Parameter(value)
@@ -3323,17 +3323,17 @@
        end);
 
 julia> value(x)
-10.0
source

add_nonlinear_constraint

JuMP.add_nonlinear_constraintFunction
add_nonlinear_constraint(model::Model, expr::Expr)

Add a nonlinear constraint described by the Julia expression ex to model.

This function is most useful if the expression ex is generated programmatically, and you cannot use @NLconstraint.

Compat

This function is part of the legacy nonlinear interface. Consider using the new nonlinear interface documented in Nonlinear Modeling.

Notes

  • You must interpolate the variables directly into the expression expr.

Example

julia> model = Model();
+10.0
source

add_nonlinear_constraint

JuMP.add_nonlinear_constraintFunction
add_nonlinear_constraint(model::Model, expr::Expr)

Add a nonlinear constraint described by the Julia expression ex to model.

This function is most useful if the expression ex is generated programmatically, and you cannot use @NLconstraint.

Compat

This function is part of the legacy nonlinear interface. Consider using the new nonlinear interface documented in Nonlinear Modeling.

Notes

  • You must interpolate the variables directly into the expression expr.

Example

julia> model = Model();
 
 julia> @variable(model, x);
 
 julia> add_nonlinear_constraint(model, :($(x) + $(x)^2 <= 1))
-(x + x ^ 2.0) - 1.0 ≤ 0
source

add_nonlinear_expression

JuMP.add_nonlinear_expressionFunction
add_nonlinear_expression(model::Model, expr::Expr)

Add a nonlinear expression expr to model.

This function is most useful if the expression expr is generated programmatically, and you cannot use @NLexpression.

Compat

This function is part of the legacy nonlinear interface. Consider using the new nonlinear interface documented in Nonlinear Modeling.

Notes

  • You must interpolate the variables directly into the expression expr.

Example

julia> model = Model();
+(x + x ^ 2.0) - 1.0 ≤ 0
source

add_nonlinear_expression

JuMP.add_nonlinear_expressionFunction
add_nonlinear_expression(model::Model, expr::Expr)

Add a nonlinear expression expr to model.

This function is most useful if the expression expr is generated programmatically, and you cannot use @NLexpression.

Compat

This function is part of the legacy nonlinear interface. Consider using the new nonlinear interface documented in Nonlinear Modeling.

Notes

  • You must interpolate the variables directly into the expression expr.

Example

julia> model = Model();
 
 julia> @variable(model, x);
 
 julia> add_nonlinear_expression(model, :($(x) + $(x)^2))
-subexpression[1]: x + x ^ 2.0
source

add_nonlinear_parameter

JuMP.add_nonlinear_parameterFunction
add_nonlinear_parameter(model::Model, value::Real)

Add an anonymous parameter to the model.

Compat

This function is part of the legacy nonlinear interface. Consider using the new nonlinear interface documented in Nonlinear Modeling.

source

all_nonlinear_constraints

JuMP.all_nonlinear_constraintsFunction
all_nonlinear_constraints(model::GenericModel)

Return a vector of all nonlinear constraint references in the model in the order they were added to the model.

Compat

This function is part of the legacy nonlinear interface. Consider using the new nonlinear interface documented in Nonlinear Modeling.

This function returns only the constraints added with @NLconstraint and add_nonlinear_constraint. It does not return GenericNonlinearExpr constraints.

source

get_optimizer_attribute

JuMP.get_optimizer_attributeFunction
get_optimizer_attribute(
+subexpression[1]: x + x ^ 2.0
source

add_nonlinear_parameter

JuMP.add_nonlinear_parameterFunction
add_nonlinear_parameter(model::Model, value::Real)

Add an anonymous parameter to the model.

Compat

This function is part of the legacy nonlinear interface. Consider using the new nonlinear interface documented in Nonlinear Modeling.

source

all_nonlinear_constraints

JuMP.all_nonlinear_constraintsFunction
all_nonlinear_constraints(model::GenericModel)

Return a vector of all nonlinear constraint references in the model in the order they were added to the model.

Compat

This function is part of the legacy nonlinear interface. Consider using the new nonlinear interface documented in Nonlinear Modeling.

This function returns only the constraints added with @NLconstraint and add_nonlinear_constraint. It does not return GenericNonlinearExpr constraints.

source

get_optimizer_attribute

JuMP.get_optimizer_attributeFunction
get_optimizer_attribute(
     model::Union{GenericModel,MOI.OptimizerWithAttributes},
     attr::Union{AbstractString,MOI.AbstractOptimizerAttribute},
 )

Return the value associated with the solver-specific attribute attr.

If attr is an AbstractString, this is equivalent to get_optimizer_attribute(model, MOI.RawOptimizerAttribute(name)).

Compat

This method will remain in all v1.X releases of JuMP, but it may be removed in a future v2.0 release. We recommend using get_attribute instead.

See also: set_optimizer_attribute, set_optimizer_attributes.

Example

julia> import Ipopt
@@ -3341,18 +3341,18 @@
 julia> model = Model(Ipopt.Optimizer);
 
 julia> get_optimizer_attribute(model, MOI.Silent())
-false
source

nonlinear_constraint_string

JuMP.nonlinear_constraint_stringFunction
nonlinear_constraint_string(
+false
source

nonlinear_constraint_string

JuMP.nonlinear_constraint_stringFunction
nonlinear_constraint_string(
     model::GenericModel,
     mode::MIME,
     c::_NonlinearConstraint,
-)

Return a string representation of the nonlinear constraint c belonging to model, given the mode.

Compat

This function is part of the legacy nonlinear interface. Consider using the new nonlinear interface documented in Nonlinear Modeling.

source

nonlinear_dual_start_value

JuMP.nonlinear_dual_start_valueFunction
nonlinear_dual_start_value(model::Model)

Return the current value of the MOI attribute MOI.NLPBlockDualStart.

Compat

This function is part of the legacy nonlinear interface. Consider using the new nonlinear interface documented in Nonlinear Modeling.

source

nonlinear_expr_string

JuMP.nonlinear_expr_stringFunction
nonlinear_expr_string(
+)

Return a string representation of the nonlinear constraint c belonging to model, given the mode.

Compat

This function is part of the legacy nonlinear interface. Consider using the new nonlinear interface documented in Nonlinear Modeling.

source

nonlinear_dual_start_value

JuMP.nonlinear_dual_start_valueFunction
nonlinear_dual_start_value(model::Model)

Return the current value of the MOI attribute MOI.NLPBlockDualStart.

Compat

This function is part of the legacy nonlinear interface. Consider using the new nonlinear interface documented in Nonlinear Modeling.

source

nonlinear_expr_string

JuMP.nonlinear_expr_stringFunction
nonlinear_expr_string(
     model::GenericModel,
     mode::MIME,
     c::MOI.Nonlinear.Expression,
-)

Return a string representation of the nonlinear expression c belonging to model, given the mode.

Compat

This function is part of the legacy nonlinear interface. Consider using the new nonlinear interface documented in Nonlinear Modeling.

source

nonlinear_model

JuMP.nonlinear_modelFunction
nonlinear_model(
+)

Return a string representation of the nonlinear expression c belonging to model, given the mode.

Compat

This function is part of the legacy nonlinear interface. Consider using the new nonlinear interface documented in Nonlinear Modeling.

source

nonlinear_model

JuMP.nonlinear_modelFunction
nonlinear_model(
     model::GenericModel;
     force::Bool = false,
-)::Union{MOI.Nonlinear.Model,Nothing}

If model has nonlinear components, return a MOI.Nonlinear.Model, otherwise return nothing.

If force, always return a MOI.Nonlinear.Model, and if one does not exist for the model, create an empty one.

Compat

This function is part of the legacy nonlinear interface. Consider using the new nonlinear interface documented in Nonlinear Modeling.

source

num_nonlinear_constraints

JuMP.num_nonlinear_constraintsFunction
num_nonlinear_constraints(model::GenericModel)

Returns the number of nonlinear constraints associated with the model.

Compat

This function is part of the legacy nonlinear interface. Consider using the new nonlinear interface documented in Nonlinear Modeling.

This function counts only the constraints added with @NLconstraint and add_nonlinear_constraint. It does not count GenericNonlinearExpr constraints.

source

register

JuMP.registerFunction
register(
+)::Union{MOI.Nonlinear.Model,Nothing}

If model has nonlinear components, return a MOI.Nonlinear.Model, otherwise return nothing.

If force, always return a MOI.Nonlinear.Model, and if one does not exist for the model, create an empty one.

Compat

This function is part of the legacy nonlinear interface. Consider using the new nonlinear interface documented in Nonlinear Modeling.

source

num_nonlinear_constraints

JuMP.num_nonlinear_constraintsFunction
num_nonlinear_constraints(model::GenericModel)

Returns the number of nonlinear constraints associated with the model.

Compat

This function is part of the legacy nonlinear interface. Consider using the new nonlinear interface documented in Nonlinear Modeling.

This function counts only the constraints added with @NLconstraint and add_nonlinear_constraint. It does not count GenericNonlinearExpr constraints.

source

register

JuMP.registerFunction
register(
     model::Model,
     op::Symbol,
     dimension::Integer,
@@ -3380,7 +3380,7 @@
 
 julia> register(model, :g, 2, g; autodiff = true)
 
-julia> @NLobjective(model, Min, g(x[1], x[2]))
source
register(
+julia> @NLobjective(model, Min, g(x[1], x[2]))
source
register(
     model::Model,
     s::Symbol,
     dimension::Integer,
@@ -3419,7 +3419,7 @@
 
 julia> register(model, :g, 2, g, ∇g)
 
-julia> @NLobjective(model, Min, g(x[1], x[2]))
source
register(
+julia> @NLobjective(model, Min, g(x[1], x[2]))
source
register(
     model::Model,
     s::Symbol,
     dimension::Integer,
@@ -3443,7 +3443,7 @@
 julia> register(model, :foo, 1, f, ∇f, ∇²f)
 
 julia> @NLobjective(model, Min, foo(x))
-
source

set_nonlinear_dual_start_value

JuMP.set_nonlinear_dual_start_valueFunction
set_nonlinear_dual_start_value(
+
source

set_nonlinear_dual_start_value

JuMP.set_nonlinear_dual_start_valueFunction
set_nonlinear_dual_start_value(
     model::Model,
     start::Union{Nothing,Vector{Float64}},
 )

Set the value of the MOI attribute MOI.NLPBlockDualStart.

Compat

This function is part of the legacy nonlinear interface. Consider using the new nonlinear interface documented in Nonlinear Modeling.

The start vector corresponds to the Lagrangian duals of the nonlinear constraints, in the order given by all_nonlinear_constraints. That is, you must pass a single start vector corresponding to all of the nonlinear constraints in a single function call; you cannot set the dual start value of nonlinear constraints one-by-one. The example below demonstrates how to use all_nonlinear_constraints to create a mapping between the nonlinear constraint references and the start vector.

Pass nothing to unset a previous start.

Example

julia> model = Model();
@@ -3466,7 +3466,7 @@
 julia> nonlinear_dual_start_value(model)
 2-element Vector{Float64}:
  -1.0
-  1.0
source

set_nonlinear_objective

JuMP.set_nonlinear_objectiveFunction
set_nonlinear_objective(
+  1.0
source

set_nonlinear_objective

JuMP.set_nonlinear_objectiveFunction
set_nonlinear_objective(
     model::Model,
     sense::MOI.OptimizationSense,
     expr::Expr,
@@ -3474,17 +3474,17 @@
 
 julia> @variable(model, x);
 
-julia> set_nonlinear_objective(model, MIN_SENSE, :($(x) + $(x)^2))
source

set_normalized_coefficients

JuMP.set_normalized_coefficientsFunction
set_normalized_coefficients(
+julia> set_nonlinear_objective(model, MIN_SENSE, :($(x) + $(x)^2))
source

set_normalized_coefficients

JuMP.set_normalized_coefficientsFunction
set_normalized_coefficients(
     constraint::ConstraintRef{<:AbstractModel,<:MOI.ConstraintIndex{F}},
     variable::AbstractVariableRef,
     new_coefficients::Vector{Tuple{Int64,T}},
-) where {T,F<:Union{MOI.VectorAffineFunction{T},MOI.VectorQuadraticFunction{T}}}

A deprecated method that now redirects to set_normalized_coefficient.

source

set_optimizer_attribute

JuMP.set_optimizer_attributeFunction
set_optimizer_attribute(
+) where {T,F<:Union{MOI.VectorAffineFunction{T},MOI.VectorQuadraticFunction{T}}}

A deprecated method that now redirects to set_normalized_coefficient.

source

set_optimizer_attribute

JuMP.set_optimizer_attributeFunction
set_optimizer_attribute(
     model::Union{GenericModel,MOI.OptimizerWithAttributes},
     attr::Union{AbstractString,MOI.AbstractOptimizerAttribute},
     value,
 )

Set the solver-specific attribute attr in model to value.

If attr is an AbstractString, this is equivalent to set_optimizer_attribute(model, MOI.RawOptimizerAttribute(name), value).

Compat

This method will remain in all v1.X releases of JuMP, but it may be removed in a future v2.0 release. We recommend using set_attribute instead.

See also: set_optimizer_attributes, get_optimizer_attribute.

Example

julia> model = Model();
 
-julia> set_optimizer_attribute(model, MOI.Silent(), true)
source

set_optimizer_attributes

JuMP.set_optimizer_attributesFunction
set_optimizer_attributes(
+julia> set_optimizer_attribute(model, MOI.Silent(), true)
source

set_optimizer_attributes

JuMP.set_optimizer_attributesFunction
set_optimizer_attributes(
     model::Union{GenericModel,MOI.OptimizerWithAttributes},
     pairs::Pair...,
 )

Given a list of attribute => value pairs, calls set_optimizer_attribute(model, attribute, value) for each pair.

Compat

This method will remain in all v1.X releases of JuMP, but it may be removed in a future v2.0 release. We recommend using set_attributes instead.

See also: set_optimizer_attribute, get_optimizer_attribute.

Example

julia> import Ipopt
@@ -3497,7 +3497,7 @@
 
 julia> set_optimizer_attribute(model, "tol", 1e-4)
 
-julia> set_optimizer_attribute(model, "max_iter", 100)
source

set_value

JuMP.set_valueFunction
set_value(p::NonlinearParameter, v::Number)

Store the value v in the nonlinear parameter p.

Compat

This function is part of the legacy nonlinear interface. Consider using the new nonlinear interface documented in Nonlinear Modeling.

Example

julia> model = Model();
+julia> set_optimizer_attribute(model, "max_iter", 100)
source

set_value

JuMP.set_valueFunction
set_value(p::NonlinearParameter, v::Number)

Store the value v in the nonlinear parameter p.

Compat

This function is part of the legacy nonlinear interface. Consider using the new nonlinear interface documented in Nonlinear Modeling.

Example

julia> model = Model();
 
 julia> @NLparameter(model, p == 0)
 p == 0.0
@@ -3506,4 +3506,4 @@
 5
 
 julia> value(p)
-5.0
source

NonlinearConstraintIndex

JuMP.NonlinearConstraintIndexType
ConstraintIndex

An index to a nonlinear constraint that is returned by add_constraint.

Given data::Model and c::ConstraintIndex, use data[c] to retrieve the corresponding Constraint.

source

NonlinearConstraintRef

JuMP.NonlinearConstraintRefType
NonlinearConstraintRef
Compat

This type is part of the legacy nonlinear interface. Consider using the new nonlinear interface documented in Nonlinear Modeling.

source

NonlinearExpression

JuMP.NonlinearExpressionType
NonlinearExpression <: AbstractJuMPScalar

A struct to represent a nonlinear expression.

Create an expression using @NLexpression.

Compat

This type is part of the legacy nonlinear interface. Consider using the new nonlinear interface documented in Nonlinear Modeling.

source

NonlinearParameter

JuMP.NonlinearParameterType
NonlinearParameter <: AbstractJuMPScalar

A struct to represent a nonlinear parameter.

Create a parameter using @NLparameter.

Compat

This type is part of the legacy nonlinear interface. Consider using the new nonlinear interface documented in Nonlinear Modeling.

source
+5.0source

NonlinearConstraintIndex

JuMP.NonlinearConstraintIndexType
ConstraintIndex

An index to a nonlinear constraint that is returned by add_constraint.

Given data::Model and c::ConstraintIndex, use data[c] to retrieve the corresponding Constraint.

source

NonlinearConstraintRef

JuMP.NonlinearConstraintRefType
NonlinearConstraintRef
Compat

This type is part of the legacy nonlinear interface. Consider using the new nonlinear interface documented in Nonlinear Modeling.

source

NonlinearExpression

JuMP.NonlinearExpressionType
NonlinearExpression <: AbstractJuMPScalar

A struct to represent a nonlinear expression.

Create an expression using @NLexpression.

Compat

This type is part of the legacy nonlinear interface. Consider using the new nonlinear interface documented in Nonlinear Modeling.

source

NonlinearParameter

JuMP.NonlinearParameterType
NonlinearParameter <: AbstractJuMPScalar

A struct to represent a nonlinear parameter.

Create a parameter using @NLparameter.

Compat

This type is part of the legacy nonlinear interface. Consider using the new nonlinear interface documented in Nonlinear Modeling.

source
diff --git a/previews/PR3778/background/algebraic_modeling_languages/index.html b/previews/PR3778/background/algebraic_modeling_languages/index.html index b4a4e60206d..41cba114197 100644 --- a/previews/PR3778/background/algebraic_modeling_languages/index.html +++ b/previews/PR3778/background/algebraic_modeling_languages/index.html @@ -138,4 +138,4 @@ julia> highs_knapsack([1.0, 2.0], [0.5, 0.5], 1.25) 2-element Vector{Float64}: 0.0 - 2.0

We've now gone from a algebraic model that looked identical to the mathematical model we started with, to a verbose function that uses HiGHS-specific functionality.

The difference between algebraic_knapsack and highs_knapsack highlights the benefit that algebraic modeling languages provide to users. Moreover, if we used a different solver, the solver-specific function would be entirely different. A key benefit of an algebraic modeling language is that you can change the solver without needing to rewrite the model.

+ 2.0

We've now gone from a algebraic model that looked identical to the mathematical model we started with, to a verbose function that uses HiGHS-specific functionality.

The difference between algebraic_knapsack and highs_knapsack highlights the benefit that algebraic modeling languages provide to users. Moreover, if we used a different solver, the solver-specific function would be entirely different. A key benefit of an algebraic modeling language is that you can change the solver without needing to rewrite the model.

diff --git a/previews/PR3778/background/bibliography/index.html b/previews/PR3778/background/bibliography/index.html index 4a3092a1451..fe7331335df 100644 --- a/previews/PR3778/background/bibliography/index.html +++ b/previews/PR3778/background/bibliography/index.html @@ -3,4 +3,4 @@ function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-0RZ8X3D3D0', {'page_path': location.pathname + location.search + location.hash}); -

Bibliography

+

Bibliography

diff --git a/previews/PR3778/changelog/index.html b/previews/PR3778/changelog/index.html index 757f47c038b..6af1d54220a 100644 --- a/previews/PR3778/changelog/index.html +++ b/previews/PR3778/changelog/index.html @@ -12,4 +12,4 @@ new_b = backend(model)
  • All usages of @SDconstraint are deprecated. The new syntax is @constraint(model, X >= Y, PSDCone()).
  • Creating a DenseAxisArray with a Number as an axis will now display a warning. This catches a common error in which users write @variable(model, x[length(S)]) instead of @variable(model, x[1:length(S)]).
  • The caching_mode argument to Model, for example, Model(caching_mode = MOIU.MANUAL) mode has been removed. For more control over the optimizer, use direct_model instead.
  • The previously deprecated lp_objective_perturbation_range and lp_rhs_perturbation_range functions have been removed. Use lp_sensitivity_report instead.
  • The .m fields of NonlinearExpression and NonlinearParameter have been renamed to .model.
  • Infinite variable bounds are now ignored. Thus, @variable(model, x <= Inf) will show has_upper_bound(x) == false. Previously, these bounds were passed through to the solvers which caused numerical issues for solvers expecting finite bounds.
  • The variable_type and constraint_type functions were removed. This should only affect users who previously wrote JuMP extensions. The functions can be deleted without consequence.
  • The internal functions moi_mode, moi_bridge_constraints, moi_add_constraint, and moi_add_to_function_constant are no longer exported.
  • The un-used method Containers.generate_container has been deleted.
  • The Containers API has been refactored, and _build_ref_sets is now public as Containers.build_ref_sets.
  • The parse_constraint_ methods for extending @constraint at parse time have been refactored in a breaking way. Consult the Extensions documentation for more details and examples.
  • Added

    Fixed

    Other

    Version 0.21.10 (September 4, 2021)

    Added

    Fixed

    Other

    Version 0.21.9 (August 1, 2021)

    Added

    Other

    Version 0.21.8 (May 8, 2021)

    Added

    Fixed

    Version 0.21.7 (April 12, 2021)

    Added

    Fixed

    Other

    Version 0.21.6 (January 29, 2021)

    Added

    Fixed

    Other

    Version 0.21.5 (September 18, 2020)

    Fixed

    Version 0.21.4 (September 14, 2020)

    Added

    Fixed

    Version 0.21.3 (June 18, 2020)

    Version 0.21.2 (April 2, 2020)

    Fixed

    Version 0.21.1 (Feb 18, 2020)

    Version 0.21.0 (Feb 16, 2020)

    Breaking

    Added

    Fixed

    Version 0.20.1 (Oct 18, 2019)

    Version 0.20.0 (Aug 24, 2019)

    Version 0.19.2 (June 8, 2019)

    Version 0.19.1 (May 12, 2019)

    Version 0.19.0 (February 15, 2019)

    JuMP 0.19 contains significant breaking changes.

    Breaking

    Added

    Regressions

    There are known regressions from JuMP 0.18 that will be addressed in a future release (0.19.x or later):

    Version 0.18.5 (December 1, 2018)

    Version 0.18.4 (October 8, 2018)

    Version 0.18.3 (October 1, 2018)

    Version 0.18.2 (June 10, 2018)

    Version 0.18.1 (April 9, 2018)

    Version 0.18.0 (July 27, 2017)

    Version 0.17.1 (June 9, 2017)

    Version 0.17.0 (May 27, 2017)

    The following changes are primarily of interest to developers of JuMP extensions:

    Version 0.16.2 (March 28, 2017)

    Version 0.16.1 (March 7, 2017)

    Version 0.16.0 (February 23, 2017)

    Version 0.15.1 (January 31, 2017)

    Version 0.15.0 (December 22, 2016)

    Version 0.14.2 (December 12, 2016)

    Version 0.14.1 (September 12, 2016)

    Version 0.14.0 (August 7, 2016)

    Version 0.13.2 (May 16, 2016)

    Version 0.13.1 (May 3, 2016)

    Version 0.13.0 (April 29, 2016)

    Version 0.12.2 (March 9, 2016)

    Version 0.12.1 (March 1, 2016)

    Version 0.12.0 (February 27, 2016)

    Version 0.11.3 (February 4, 2016)

    Version 0.11.2 (January 14, 2016)

    Version 0.11.1 (December 1, 2015)

    Version 0.11.0 (November 30, 2015)

    Version 0.10.3 (November 20, 2015)

    Version 0.10.2 (September 28, 2015)

    Version 0.10.1 (September 3, 2015)

    Version 0.10.0 (August 31, 2015)

    Version 0.9.3 (August 11, 2015)

    Version 0.9.2 (June 27, 2015)

    Version 0.9.1 (April 25, 2015)

    Version 0.9.0 (April 18, 2015)

    Version 0.8.0 (February 17, 2015)

    Version 0.7.4 (February 4, 2015)

    Version 0.7.3 (January 14, 2015)

    Version 0.7.2 (January 9, 2015)

    after construction, and getCategory to retrieve the variable category.

    Version 0.7.1 (January 2, 2015)

    Version 0.7.0 (December 29, 2014)

    Linear/quadratic/conic programming

    Nonlinear programming

    General

    Version 0.6.3 (October 19, 2014)

    Version 0.6.2 (October 11, 2014)

    Version 0.6.1 (September 19, 2014)

    Version 0.6.0 (September 9, 2014)

    Version 0.5.8 (September 24, 2014)

    Version 0.5.7 (September 5, 2014)

    Version 0.5.6 (September 2, 2014)

    Version 0.5.5 (July 6, 2014)

    Version 0.5.4 (June 19, 2014)

    Version 0.5.3 (May 21, 2014)

    Version 0.5.2 (May 9, 2014)

    Version 0.5.1 (May 5, 2014)

    Version 0.5.0 (May 2, 2014)

    Version 0.4.1 (March 24, 2014)

    Version 0.4.0 (March 10, 2014)

    Version 0.3.2 (February 17, 2014)

    Version 0.3.1 (January 30, 2014)

    Version 0.3.0 (January 21, 2014)

    Version 0.2.0 (December 15, 2013)

    Breaking

    Added

    Version 0.1.2 (November 16, 2013)

    Version 0.1.1 (October 23, 2013)

    Version 0.1.0 (October 3, 2013)

    +end
  • The lowerbound, upperbound, and basename keyword arguments to the @variable macro have been renamed to lower_bound, upper_bound, and base_name, for consistency with JuMP's new style recommendations.

  • We rely on broadcasting syntax to apply accessors to collections of variables, for example, value.(x) instead of getvalue(x) for collections. (Use value(x) when x is a scalar object.)

  • Added

    Regressions

    There are known regressions from JuMP 0.18 that will be addressed in a future release (0.19.x or later):

    Version 0.18.5 (December 1, 2018)

    Version 0.18.4 (October 8, 2018)

    Version 0.18.3 (October 1, 2018)

    Version 0.18.2 (June 10, 2018)

    Version 0.18.1 (April 9, 2018)

    Version 0.18.0 (July 27, 2017)

    Version 0.17.1 (June 9, 2017)

    Version 0.17.0 (May 27, 2017)

    The following changes are primarily of interest to developers of JuMP extensions:

    Version 0.16.2 (March 28, 2017)

    Version 0.16.1 (March 7, 2017)

    Version 0.16.0 (February 23, 2017)

    Version 0.15.1 (January 31, 2017)

    Version 0.15.0 (December 22, 2016)

    Version 0.14.2 (December 12, 2016)

    Version 0.14.1 (September 12, 2016)

    Version 0.14.0 (August 7, 2016)

    Version 0.13.2 (May 16, 2016)

    Version 0.13.1 (May 3, 2016)

    Version 0.13.0 (April 29, 2016)

    Version 0.12.2 (March 9, 2016)

    Version 0.12.1 (March 1, 2016)

    Version 0.12.0 (February 27, 2016)

    Version 0.11.3 (February 4, 2016)

    Version 0.11.2 (January 14, 2016)

    Version 0.11.1 (December 1, 2015)

    Version 0.11.0 (November 30, 2015)

    Version 0.10.3 (November 20, 2015)

    Version 0.10.2 (September 28, 2015)

    Version 0.10.1 (September 3, 2015)

    Version 0.10.0 (August 31, 2015)

    Version 0.9.3 (August 11, 2015)

    Version 0.9.2 (June 27, 2015)

    Version 0.9.1 (April 25, 2015)

    Version 0.9.0 (April 18, 2015)

    Version 0.8.0 (February 17, 2015)

    Version 0.7.4 (February 4, 2015)

    Version 0.7.3 (January 14, 2015)

    Version 0.7.2 (January 9, 2015)

    after construction, and getCategory to retrieve the variable category.

    Version 0.7.1 (January 2, 2015)

    Version 0.7.0 (December 29, 2014)

    Linear/quadratic/conic programming

    Nonlinear programming

    General

    Version 0.6.3 (October 19, 2014)

    Version 0.6.2 (October 11, 2014)

    Version 0.6.1 (September 19, 2014)

    Version 0.6.0 (September 9, 2014)

    Version 0.5.8 (September 24, 2014)

    Version 0.5.7 (September 5, 2014)

    Version 0.5.6 (September 2, 2014)

    Version 0.5.5 (July 6, 2014)

    Version 0.5.4 (June 19, 2014)

    Version 0.5.3 (May 21, 2014)

    Version 0.5.2 (May 9, 2014)

    Version 0.5.1 (May 5, 2014)

    Version 0.5.0 (May 2, 2014)

    Version 0.4.1 (March 24, 2014)

    Version 0.4.0 (March 10, 2014)

    Version 0.3.2 (February 17, 2014)

    Version 0.3.1 (January 30, 2014)

    Version 0.3.0 (January 21, 2014)

    Version 0.2.0 (December 15, 2013)

    Breaking

    Added

    Version 0.1.2 (November 16, 2013)

    Version 0.1.1 (October 23, 2013)

    Version 0.1.0 (October 3, 2013)

    diff --git a/previews/PR3778/developers/checklists/index.html b/previews/PR3778/developers/checklists/index.html index 41803a95c0b..ec1c6145879 100644 --- a/previews/PR3778/developers/checklists/index.html +++ b/previews/PR3778/developers/checklists/index.html @@ -63,4 +63,4 @@ ## Optional - - [ ] Add package metadata to `docs/packages.toml` + - [ ] Add package metadata to `docs/packages.toml` diff --git a/previews/PR3778/developers/contributing/index.html b/previews/PR3778/developers/contributing/index.html index f5753a3cd09..09b1b2a6519 100644 --- a/previews/PR3778/developers/contributing/index.html +++ b/previews/PR3778/developers/contributing/index.html @@ -25,4 +25,4 @@ $ git checkout master -$ git pull
    Note

    If you have suggestions to improve this guide, please make a pull request. It's particularly helpful if you do this after your first pull request because you'll know all the parts that could be explained better.

    +$ git pull
    Note

    If you have suggestions to improve this guide, please make a pull request. It's particularly helpful if you do this after your first pull request because you'll know all the parts that could be explained better.

    diff --git a/previews/PR3778/developers/custom_solver_binaries/index.html b/previews/PR3778/developers/custom_solver_binaries/index.html index 313d1ac18e9..cfb1664753f 100644 --- a/previews/PR3778/developers/custom_solver_binaries/index.html +++ b/previews/PR3778/developers/custom_solver_binaries/index.html @@ -90,4 +90,4 @@ libCbc_path = "/usr/local/Cellar/cbc/2.10.5/lib/libCbc.3.10.5" libOsiCbc_path = "/usr/local/Cellar/cbc/2.10.5/lib/libOsiCbc.3.10.5" libcbcsolver_path = "/usr/local/Cellar/cbc/2.10.5/lib/libCbcSolver.3.10.5"
    Info

    Note that capitalization matters, so libcbcsolver_path corresponds to libCbcSolver.3.10.5.

    Override entire artifact

    To use the homebrew install as our custom binary we add the following to ~/.julia/artifacts/Overrides.toml:

    # Override for Cbc_jll
    -e481bc81db5e229ba1f52b2b4bd57484204b1b06 = "/usr/local/Cellar/cbc/2.10.5"
    +e481bc81db5e229ba1f52b2b4bd57484204b1b06 = "/usr/local/Cellar/cbc/2.10.5" diff --git a/previews/PR3778/developers/extensions/index.html b/previews/PR3778/developers/extensions/index.html index 7a0e170adec..396f47d4d8b 100644 --- a/previews/PR3778/developers/extensions/index.html +++ b/previews/PR3778/developers/extensions/index.html @@ -305,4 +305,4 @@ _function_barrier(names, model, F, S) end return names -end
    Note

    It is important to explicitly type the F and S arguments. If you leave them untyped, for example, function _function_barrier(names, model, F, S), Julia will not specialize the function calls and performance will not be improved.

    +end
    Note

    It is important to explicitly type the F and S arguments. If you leave them untyped, for example, function _function_barrier(names, model, F, S), Julia will not specialize the function calls and performance will not be improved.

    diff --git a/previews/PR3778/developers/roadmap/index.html b/previews/PR3778/developers/roadmap/index.html index 16339b8f092..91da345c4ee 100644 --- a/previews/PR3778/developers/roadmap/index.html +++ b/previews/PR3778/developers/roadmap/index.html @@ -3,4 +3,4 @@ function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-0RZ8X3D3D0', {'page_path': location.pathname + location.search + location.hash}); -

    Development roadmap

    The JuMP developers have compiled this roadmap document to share their plans and goals with the JuMP community. Contributions to roadmap issues are especially invited.

    Most of these issues will require changes to both JuMP and MathOptInterface, and are non-trivial in their implementation. They are in no particular order, but represent broad themes that we see as areas in which JuMP could be improved.

    • Support nonlinear expressions with vector-valued inputs and outputs. There are a few related components:
      • Representing terms like log(det(X)) as necessary for Convex.jl
      • Automatic differentiation of terms with vector inputs and outputs
      • User-defined functions with vector–as opposed to scalar–inputs, which is particularly useful for optimal control problems
      • User-defined functions with vector outputs, avoiding the need for User-defined operators with vector outputs
    • Add support for modeling with SI units. The UnitJuMP.jl extension is a good proof of concept for what this would look like. We want to make units a first-class concept in JuMP. See #1350 for more details.

    Completed

    +

    Development roadmap

    The JuMP developers have compiled this roadmap document to share their plans and goals with the JuMP community. Contributions to roadmap issues are especially invited.

    Most of these issues will require changes to both JuMP and MathOptInterface, and are non-trivial in their implementation. They are in no particular order, but represent broad themes that we see as areas in which JuMP could be improved.

    • Support nonlinear expressions with vector-valued inputs and outputs. There are a few related components:
      • Representing terms like log(det(X)) as necessary for Convex.jl
      • Automatic differentiation of terms with vector inputs and outputs
      • User-defined functions with vector–as opposed to scalar–inputs, which is particularly useful for optimal control problems
      • User-defined functions with vector outputs, avoiding the need for User-defined operators with vector outputs
    • Add support for modeling with SI units. The UnitJuMP.jl extension is a good proof of concept for what this would look like. We want to make units a first-class concept in JuMP. See #1350 for more details.

    Completed

    diff --git a/previews/PR3778/developers/style/index.html b/previews/PR3778/developers/style/index.html index 18bd27e6262..78109d7bc09 100644 --- a/previews/PR3778/developers/style/index.html +++ b/previews/PR3778/developers/style/index.html @@ -182,4 +182,4 @@ end # module TestPkg -TestPkg.runtests()

    Break the tests into multiple files, with one module per file, so that subsets of the codebase can be tested by calling include with the relevant file.

    +TestPkg.runtests()

    Break the tests into multiple files, with one module per file, so that subsets of the codebase can be tested by calling include with the relevant file.

    diff --git a/previews/PR3778/extensions/DimensionalData/index.html b/previews/PR3778/extensions/DimensionalData/index.html index 583647f1f43..8ddd67edc16 100644 --- a/previews/PR3778/extensions/DimensionalData/index.html +++ b/previews/PR3778/extensions/DimensionalData/index.html @@ -48,4 +48,4 @@ ↓ j Categorical{String} ["a", "b"] ForwardOrdered └──────────────────────────────────────────────────────────────────────────────┘ "a" x[2,a] + x[3,a] + x[4,a] ≤ 1 - "b" x[2,b] + x[3,b] + x[4,b] ≤ 1

    Documentation

    See the DimensionalData.jl documentation for more details on the syntax and features of DimensionalData.DimArray.

    + "b" x[2,b] + x[3,b] + x[4,b] ≤ 1

    Documentation

    See the DimensionalData.jl documentation for more details on the syntax and features of DimensionalData.DimArray.

    diff --git a/previews/PR3778/extensions/introduction/index.html b/previews/PR3778/extensions/introduction/index.html index fdb850988f9..4f3cada6ab2 100644 --- a/previews/PR3778/extensions/introduction/index.html +++ b/previews/PR3778/extensions/introduction/index.html @@ -3,4 +3,4 @@ function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-0RZ8X3D3D0', {'page_path': location.pathname + location.search + location.hash}); -

    Introduction

    This section of the documentation contains brief documentation for some popular JuMP extensions. The list of extensions is not exhaustive, but instead is intended to help you discover popular JuMP extensions, and to give you an overview of the types of extensions that are possible to write with JuMP.

    Affiliation

    Packages beginning with jump-dev/ are developed and maintained by the JuMP developers.

    Packages that do not begin with jump-dev/ are developed independently. The developers of these packages requested or consented to the inclusion of their README contents in the JuMP documentation for the benefit of users.

    Adding new extensions

    Written an extension? Add it to this section of the JuMP documentation by making a pull request to the docs/packages.toml file.

    Weak dependencies

    Some extensions listed in this section are implemented using the weak dependency feature added to Julia in v1.9. These extensions are activated if and only if you have JuMP and the other package loaded into your current scope with using or import.

    Compat

    Using a weak dependency requires Julia v1.9 or later.

    +

    Introduction

    This section of the documentation contains brief documentation for some popular JuMP extensions. The list of extensions is not exhaustive, but instead is intended to help you discover popular JuMP extensions, and to give you an overview of the types of extensions that are possible to write with JuMP.

    Affiliation

    Packages beginning with jump-dev/ are developed and maintained by the JuMP developers.

    Packages that do not begin with jump-dev/ are developed independently. The developers of these packages requested or consented to the inclusion of their README contents in the JuMP documentation for the benefit of users.

    Adding new extensions

    Written an extension? Add it to this section of the JuMP documentation by making a pull request to the docs/packages.toml file.

    Weak dependencies

    Some extensions listed in this section are implemented using the weak dependency feature added to Julia in v1.9. These extensions are activated if and only if you have JuMP and the other package loaded into your current scope with using or import.

    Compat

    Using a weak dependency requires Julia v1.9 or later.

    diff --git a/previews/PR3778/index.html b/previews/PR3778/index.html index 0e9811831a2..c6db4247f31 100644 --- a/previews/PR3778/index.html +++ b/previews/PR3778/index.html @@ -10,4 +10,4 @@ journal = {Mathematical Programming Computation}, year = {2023}, doi = {10.1007/s12532-023-00239-3} -}

    NumFOCUS

    NumFOCUS logo

    JuMP is a Sponsored Project of NumFOCUS, a 501(c)(3) nonprofit charity in the United States. NumFOCUS provides JuMP with fiscal, legal, and administrative support to help ensure the health and sustainability of the project. Visit numfocus.org for more information.

    You can support JuMP by donating.

    Donations to JuMP are managed by NumFOCUS. For donors in the United States, your gift is tax-deductible to the extent provided by law. As with any donation, you should consult with your tax adviser about your particular tax situation.

    JuMP's largest expense is the annual JuMP-dev workshop. Donations will help us provide travel support for JuMP-dev attendees and take advantage of other opportunities that arise to support JuMP development.

    License

    JuMP is licensed under the MPL-2.0 software license. Consult the license and the Mozilla FAQ for more information. In addition, JuMP is typically used in conjunction with solver packages and extensions which have their own licences. Consult their package repositories for the specific licenses that apply.

    +}

    NumFOCUS

    NumFOCUS logo

    JuMP is a Sponsored Project of NumFOCUS, a 501(c)(3) nonprofit charity in the United States. NumFOCUS provides JuMP with fiscal, legal, and administrative support to help ensure the health and sustainability of the project. Visit numfocus.org for more information.

    You can support JuMP by donating.

    Donations to JuMP are managed by NumFOCUS. For donors in the United States, your gift is tax-deductible to the extent provided by law. As with any donation, you should consult with your tax adviser about your particular tax situation.

    JuMP's largest expense is the annual JuMP-dev workshop. Donations will help us provide travel support for JuMP-dev attendees and take advantage of other opportunities that arise to support JuMP development.

    License

    JuMP is licensed under the MPL-2.0 software license. Consult the license and the Mozilla FAQ for more information. In addition, JuMP is typically used in conjunction with solver packages and extensions which have their own licences. Consult their package repositories for the specific licenses that apply.

    diff --git a/previews/PR3778/installation/index.html b/previews/PR3778/installation/index.html index 2e4e994de3a..533d4001f1e 100644 --- a/previews/PR3778/installation/index.html +++ b/previews/PR3778/installation/index.html @@ -28,4 +28,4 @@ [4076af6c] ↓ JuMP v0.21.5 ⇒ v0.18.6 [707a9f91] + JuMPeR v0.6.0 Updating `~/jump_example/Manifest.toml` - ... lines omitted ...

    JuMPeR gets added at version 0.6.0 (+ JuMPeR v0.6.0), but JuMP gets downgraded from 0.21.5 to 0.18.6 (↓ JuMP v0.21.5 ⇒ v0.18.6)! The reason for this is that JuMPeR doesn't support a version of JuMP newer than 0.18.6.

    Tip

    Pay careful attention to the output of the package manager when adding new packages, especially when you see a package being downgraded.

    + ... lines omitted ...

    JuMPeR gets added at version 0.6.0 (+ JuMPeR v0.6.0), but JuMP gets downgraded from 0.21.5 to 0.18.6 (↓ JuMP v0.21.5 ⇒ v0.18.6)! The reason for this is that JuMPeR doesn't support a version of JuMP newer than 0.18.6.

    Tip

    Pay careful attention to the output of the package manager when adding new packages, especially when you see a package being downgraded.

    diff --git a/previews/PR3778/manual/callbacks/index.html b/previews/PR3778/manual/callbacks/index.html index 40b5d9611f0..7c4875479c7 100644 --- a/previews/PR3778/manual/callbacks/index.html +++ b/previews/PR3778/manual/callbacks/index.html @@ -84,4 +84,4 @@ end my_callback_function (generic function with 1 method) -julia> set_attribute(model, MOI.HeuristicCallback(), my_callback_function)

    The third argument to submit is a vector of JuMP variables, and the fourth argument is a vector of values corresponding to each variable.

    MOI.submit returns an enum that depends on whether the solver accepted the solution. The possible return codes are:

    Warning

    Some solvers may accept partial solutions. Others require a feasible integer solution for every variable. If in doubt, provide a complete solution.

    Info

    The heuristic solution callback may be called at fractional nodes in the branch-and-bound tree. There is no guarantee that the callback is called at every fractional primal solution.

    +julia> set_attribute(model, MOI.HeuristicCallback(), my_callback_function)

    The third argument to submit is a vector of JuMP variables, and the fourth argument is a vector of values corresponding to each variable.

    MOI.submit returns an enum that depends on whether the solver accepted the solution. The possible return codes are:

    Warning

    Some solvers may accept partial solutions. Others require a feasible integer solution for every variable. If in doubt, provide a complete solution.

    Info

    The heuristic solution callback may be called at fractional nodes in the branch-and-bound tree. There is no guarantee that the callback is called at every fractional primal solution.

    diff --git a/previews/PR3778/manual/complex/index.html b/previews/PR3778/manual/complex/index.html index 2c3ded24fcf..5cd3d047ba7 100644 --- a/previews/PR3778/manual/complex/index.html +++ b/previews/PR3778/manual/complex/index.html @@ -197,4 +197,4 @@ julia> @constraint(model, H in HermitianPSDCone()) [x[1] im - -im -x[2]] ∈ HermitianPSDCone()
    Note

    The matrix H in H in HermitianPSDCone() must be a LinearAlgebra.Hermitian matrix type. A build_constraint error will be thrown if the matrix is a different matrix type.

    + -im -x[2]] ∈ HermitianPSDCone()
    Note

    The matrix H in H in HermitianPSDCone() must be a LinearAlgebra.Hermitian matrix type. A build_constraint error will be thrown if the matrix is a different matrix type.

    diff --git a/previews/PR3778/manual/constraints/index.html b/previews/PR3778/manual/constraints/index.html index 7cda3bba386..1389bd341c2 100644 --- a/previews/PR3778/manual/constraints/index.html +++ b/previews/PR3778/manual/constraints/index.html @@ -800,4 +800,4 @@ (x[1] == x[2]) - 0.0 = 0 julia> @constraint(model, x[1] == x[2] := rhs) -x[1] == x[2] = false +x[1] == x[2] = false diff --git a/previews/PR3778/manual/containers/index.html b/previews/PR3778/manual/containers/index.html index 9db2e60aa43..a4578ef318c 100644 --- a/previews/PR3778/manual/containers/index.html +++ b/previews/PR3778/manual/containers/index.html @@ -232,4 +232,4 @@ julia> Containers.@container([i = 1:2, j = 1:4; condition(i, j)], i + j) JuMP.Containers.SparseAxisArray{Int64, 2, Tuple{Int64, Int64}} with 2 entries: [1, 2] = 3 - [1, 4] = 5 + [1, 4] = 5 diff --git a/previews/PR3778/manual/expressions/index.html b/previews/PR3778/manual/expressions/index.html index ee8b29d18df..151205972dc 100644 --- a/previews/PR3778/manual/expressions/index.html +++ b/previews/PR3778/manual/expressions/index.html @@ -227,4 +227,4 @@ julia> x 2-element Vector{AffExpr}: 1.1 - 0

    Note that for large expressions this will be slower due to the allocation of additional temporary objects.

    + 0

    Note that for large expressions this will be slower due to the allocation of additional temporary objects.

    diff --git a/previews/PR3778/manual/models/index.html b/previews/PR3778/manual/models/index.html index 2c5f922cf97..a239b53ef5e 100644 --- a/previews/PR3778/manual/models/index.html +++ b/previews/PR3778/manual/models/index.html @@ -299,4 +299,4 @@ If you expected the solver to support your problem, you may have an error in your formulation. Otherwise, consider using a different solver. The list of available solvers, along with the problem types they support, is available at https://jump.dev/JuMP.jl/stable/installation/#Supported-solvers. -Stacktrace:
    Warning

    Another downside of direct mode is that the behavior of querying solution information after modifying the problem is solver-specific. This can lead to errors, or the solver silently returning an incorrect value. See OptimizeNotCalled errors for more information.

    +Stacktrace:
    Warning

    Another downside of direct mode is that the behavior of querying solution information after modifying the problem is solver-specific. This can lead to errors, or the solver silently returning an incorrect value. See OptimizeNotCalled errors for more information.

    diff --git a/previews/PR3778/manual/nlp/index.html b/previews/PR3778/manual/nlp/index.html index 245ef151c10..fa85cdc5773 100644 --- a/previews/PR3778/manual/nlp/index.html +++ b/previews/PR3778/manual/nlp/index.html @@ -344,4 +344,4 @@ f1(x[1]) - 1.0 ≤ 0 f2(x[1], x[2]) - 1.0 ≤ 0 f3(x[2], x[3], x[4]) - 1.0 ≤ 0 - f4(x[1], x[3], x[4], x[5]) - 1.0 ≤ 0

    Known performance issues

    The macro-based input to JuMP's nonlinear interface can cause a performance issue if you:

    1. write a macro with a large number (hundreds) of terms
    2. call that macro from within a function instead of from the top-level in global scope.

    The first issue does not depend on the number of resulting terms in the mathematical expression, but rather the number of terms in the Julia Expr representation of that expression. For example, the expression sum(x[i] for i in 1:1_000_000) contains one million mathematical terms, but the Expr representation is just a single sum.

    The most common cause, other than a lot of tedious typing, is if you write a program that automatically writes a JuMP model as a text file, which you later execute. One example is MINLPlib.jl which automatically transpiled models in the GAMS scalar format into JuMP examples.

    As a rule of thumb, if you are writing programs to automatically generate expressions for the JuMP macros, you should target the Raw expression input instead. For more information, read MathOptInterface Issue#1997.

    + f4(x[1], x[3], x[4], x[5]) - 1.0 ≤ 0

    Known performance issues

    The macro-based input to JuMP's nonlinear interface can cause a performance issue if you:

    1. write a macro with a large number (hundreds) of terms
    2. call that macro from within a function instead of from the top-level in global scope.

    The first issue does not depend on the number of resulting terms in the mathematical expression, but rather the number of terms in the Julia Expr representation of that expression. For example, the expression sum(x[i] for i in 1:1_000_000) contains one million mathematical terms, but the Expr representation is just a single sum.

    The most common cause, other than a lot of tedious typing, is if you write a program that automatically writes a JuMP model as a text file, which you later execute. One example is MINLPlib.jl which automatically transpiled models in the GAMS scalar format into JuMP examples.

    As a rule of thumb, if you are writing programs to automatically generate expressions for the JuMP macros, you should target the Raw expression input instead. For more information, read MathOptInterface Issue#1997.

    diff --git a/previews/PR3778/manual/nonlinear/index.html b/previews/PR3778/manual/nonlinear/index.html index c97272b0522..368d20182e7 100644 --- a/previews/PR3778/manual/nonlinear/index.html +++ b/previews/PR3778/manual/nonlinear/index.html @@ -301,4 +301,4 @@ julia> ForwardDiff.gradient(x -> my_operator_good(x...), [1.0, 2.0]) 2-element Vector{Float64}: 2.0 - 4.0 + 4.0 diff --git a/previews/PR3778/manual/objective/index.html b/previews/PR3778/manual/objective/index.html index 1b44dc4c0c5..5d0704973db 100644 --- a/previews/PR3778/manual/objective/index.html +++ b/previews/PR3778/manual/objective/index.html @@ -179,4 +179,4 @@ 2 x[1] julia> @constraint(model, obj3 <= 2.0) -x[1] + x[2] ≤ 2 +x[1] + x[2] ≤ 2 diff --git a/previews/PR3778/manual/solutions/index.html b/previews/PR3778/manual/solutions/index.html index 92b072914a5..1332315f752 100644 --- a/previews/PR3778/manual/solutions/index.html +++ b/previews/PR3778/manual/solutions/index.html @@ -440,4 +440,4 @@ x integer => 0.1

    You can also use the functional form, where the first argument is a function that maps variables to their primal values:

    julia> optimize!(model)
     
     julia> primal_feasibility_report(v -> value(v), model)
    -Dict{Any, Float64}()
    +Dict{Any, Float64}() diff --git a/previews/PR3778/manual/variables/index.html b/previews/PR3778/manual/variables/index.html index ff9b319e6ae..1df144b2afa 100644 --- a/previews/PR3778/manual/variables/index.html +++ b/previews/PR3778/manual/variables/index.html @@ -632,4 +632,4 @@ p*x julia> typeof(px) -QuadExpr (alias for GenericQuadExpr{Float64, GenericVariableRef{Float64}})

    When to use a parameter

    Parameters are most useful when solving nonlinear models in a sequence:

    julia> using JuMP, Ipopt
    julia> model = Model(Ipopt.Optimizer);
    julia> set_silent(model)
    julia> @variable(model, x)x
    julia> @variable(model, p in Parameter(1.0))p
    julia> @objective(model, Min, (x - p)^2)x² - 2 p*x + p²
    julia> optimize!(model)
    julia> value(x)1.0
    julia> set_parameter_value(p, 5.0)
    julia> optimize!(model)
    julia> value(x)5.0

    Using parameters can be faster than creating a new model from scratch with updated data because JuMP is able to avoid repeating a number of steps in processing the model before handing it off to the solver.

    +QuadExpr (alias for GenericQuadExpr{Float64, GenericVariableRef{Float64}})

    When to use a parameter

    Parameters are most useful when solving nonlinear models in a sequence:

    julia> using JuMP, Ipopt
    julia> model = Model(Ipopt.Optimizer);
    julia> set_silent(model)
    julia> @variable(model, x)x
    julia> @variable(model, p in Parameter(1.0))p
    julia> @objective(model, Min, (x - p)^2)x² - 2 p*x + p²
    julia> optimize!(model)
    julia> value(x)1.0
    julia> set_parameter_value(p, 5.0)
    julia> optimize!(model)
    julia> value(x)5.0

    Using parameters can be faster than creating a new model from scratch with updated data because JuMP is able to avoid repeating a number of steps in processing the model before handing it off to the solver.

    diff --git a/previews/PR3778/moi/background/duality/index.html b/previews/PR3778/moi/background/duality/index.html index 17f5578ebcf..80c4cff14aa 100644 --- a/previews/PR3778/moi/background/duality/index.html +++ b/previews/PR3778/moi/background/duality/index.html @@ -81,4 +81,4 @@ \max & \sum b_k y_k \\ \text{s.t.} \;\; & C+C^\top - \sum (A_k+A_k^\top) y_k \in \mathcal{S}_+ \\ & C-C^\top - \sum(A_k-A_k^\top) y_k = 0 -\end{align}\]

    and we recover $Z = X + X^\top$.

    +\end{align}\]

    and we recover $Z = X + X^\top$.

    diff --git a/previews/PR3778/moi/background/infeasibility_certificates/index.html b/previews/PR3778/moi/background/infeasibility_certificates/index.html index 686a5bf9be1..aba385ee034 100644 --- a/previews/PR3778/moi/background/infeasibility_certificates/index.html +++ b/previews/PR3778/moi/background/infeasibility_certificates/index.html @@ -29,4 +29,4 @@ \end{align}\]

    and:

    \[-\sum_{i=1}^m b_i^\top (y_i + \eta d_i) > -\sum_{i=1}^m b_i^\top y_i,\]

    for any feasible dual solution $y$. The latter simplifies to $-\sum_{i=1}^m b_i^\top d_i > 0$. For a maximization problem, the inequality is $\sum_{i=1}^m b_i^\top d_i < 0$. (Note that these are the same inequality, modulo a - sign.)

    If the solver has found a certificate of primal infeasibility:

    Note

    The choice of whether to scale the ray $d$ to have magnitude 1 is left to the solver.

    Infeasibility certificates of variable bounds

    Many linear solvers (for example, Gurobi) do not provide explicit access to the primal infeasibility certificate of a variable bound. However, given a set of linear constraints:

    \[\begin{align} l_A \le A x \le u_A \\ l_x \le x \le u_x, -\end{align}\]

    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.)

    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\}$, and a certificate for the upper variable bound is $\min\{\bar{d}_i, 0\}$.

    +\end{align}\]

    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.)

    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\}$, and a certificate for the upper variable bound is $\min\{\bar{d}_i, 0\}$.

    diff --git a/previews/PR3778/moi/background/motivation/index.html b/previews/PR3778/moi/background/motivation/index.html index 2e5b02cf256..d310e2af70c 100644 --- a/previews/PR3778/moi/background/motivation/index.html +++ b/previews/PR3778/moi/background/motivation/index.html @@ -3,4 +3,4 @@ function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-0RZ8X3D3D0', {'page_path': location.pathname + location.search + location.hash}); -

    Motivation

    MathOptInterface (MOI) is a replacement for MathProgBase, the first-generation abstraction layer for mathematical optimization previously used by JuMP and Convex.jl.

    To address a number of limitations of MathProgBase, MOI is designed to:

    • Be simple and extensible
      • unifying linear, quadratic, and conic optimization,
      • seamlessly facilitating extensions to essentially arbitrary constraints and functions (for example, indicator constraints, complementarity constraints, and piecewise-linear functions)
    • Be fast
      • by allowing access to a solver's in-memory representation of a problem without writing intermediate files (when possible)
      • by using multiple dispatch and avoiding requiring containers of non-concrete types
    • Allow a solver to return multiple results (for example, a pool of solutions)
    • Allow a solver to return extra arbitrary information via attributes (for example, variable- and constraint-wise membership in an irreducible inconsistent subset for infeasibility analysis)
    • Provide a greatly expanded set of status codes explaining what happened during the optimization procedure
    • Enable a solver to more precisely specify which problem classes it supports
    • Enable both primal and dual warm starts
    • Enable adding and removing both variables and constraints by indices that are not required to be consecutive
    • Enable any modification that the solver supports to an existing model
    • Avoid requiring the solver wrapper to store an additional copy of the problem data
    +

    Motivation

    MathOptInterface (MOI) is a replacement for MathProgBase, the first-generation abstraction layer for mathematical optimization previously used by JuMP and Convex.jl.

    To address a number of limitations of MathProgBase, MOI is designed to:

    • Be simple and extensible
      • unifying linear, quadratic, and conic optimization,
      • seamlessly facilitating extensions to essentially arbitrary constraints and functions (for example, indicator constraints, complementarity constraints, and piecewise-linear functions)
    • Be fast
      • by allowing access to a solver's in-memory representation of a problem without writing intermediate files (when possible)
      • by using multiple dispatch and avoiding requiring containers of non-concrete types
    • Allow a solver to return multiple results (for example, a pool of solutions)
    • Allow a solver to return extra arbitrary information via attributes (for example, variable- and constraint-wise membership in an irreducible inconsistent subset for infeasibility analysis)
    • Provide a greatly expanded set of status codes explaining what happened during the optimization procedure
    • Enable a solver to more precisely specify which problem classes it supports
    • Enable both primal and dual warm starts
    • Enable adding and removing both variables and constraints by indices that are not required to be consecutive
    • Enable any modification that the solver supports to an existing model
    • Avoid requiring the solver wrapper to store an additional copy of the problem data
    diff --git a/previews/PR3778/moi/background/naming_conventions/index.html b/previews/PR3778/moi/background/naming_conventions/index.html index 2d9a50678b1..848bf668209 100644 --- a/previews/PR3778/moi/background/naming_conventions/index.html +++ b/previews/PR3778/moi/background/naming_conventions/index.html @@ -3,4 +3,4 @@ function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-0RZ8X3D3D0', {'page_path': location.pathname + location.search + location.hash}); -

    Naming conventions

    MOI follows several conventions for naming functions and structures. These should also be followed by packages extending MOI.

    Sets

    Sets encode the structure of constraints. Their names should follow the following conventions:

    • Abstract types in the set hierarchy should begin with Abstract and end in Set, for example, AbstractScalarSet, AbstractVectorSet.
    • Vector-valued conic sets should end with Cone, for example, NormInfinityCone, SecondOrderCone.
    • Vector-valued Cartesian products should be plural and not end in Cone, for example, Nonnegatives, not NonnegativeCone.
    • Matrix-valued conic sets should provide two representations: ConeSquare and ConeTriangle, for example, RootDetConeTriangle and RootDetConeSquare. See Matrix cones for more details.
    • Scalar sets should be singular, not plural, for example, Integer, not Integers.
    • As much as possible, the names should follow established conventions in the domain where this set is used: for instance, convex sets should have names close to those of CVX, and constraint-programming sets should follow MiniZinc's constraints.
    +

    Naming conventions

    MOI follows several conventions for naming functions and structures. These should also be followed by packages extending MOI.

    Sets

    Sets encode the structure of constraints. Their names should follow the following conventions:

    • Abstract types in the set hierarchy should begin with Abstract and end in Set, for example, AbstractScalarSet, AbstractVectorSet.
    • Vector-valued conic sets should end with Cone, for example, NormInfinityCone, SecondOrderCone.
    • Vector-valued Cartesian products should be plural and not end in Cone, for example, Nonnegatives, not NonnegativeCone.
    • Matrix-valued conic sets should provide two representations: ConeSquare and ConeTriangle, for example, RootDetConeTriangle and RootDetConeSquare. See Matrix cones for more details.
    • Scalar sets should be singular, not plural, for example, Integer, not Integers.
    • As much as possible, the names should follow established conventions in the domain where this set is used: for instance, convex sets should have names close to those of CVX, and constraint-programming sets should follow MiniZinc's constraints.
    diff --git a/previews/PR3778/moi/changelog/index.html b/previews/PR3778/moi/changelog/index.html index ff4077c7cc1..efd1ddfeaa3 100644 --- a/previews/PR3778/moi/changelog/index.html +++ b/previews/PR3778/moi/changelog/index.html @@ -31,4 +31,4 @@ end write(path, s) end -end

    v0.9.22 (May 22, 2021)

    This release contains backports from the ongoing development of the v0.10 release.

    v0.9.21 (April 23, 2021)

    v0.9.20 (February 20, 2021)

    v0.9.19 (December 1, 2020)

    v0.9.18 (November 3, 2020)

    v0.9.17 (September 21, 2020)

    v0.9.16 (September 17, 2020)

    v0.9.15 (September 14, 2020)

    v0.9.14 (May 30, 2020)

    v0.9.13 (March 24, 2020)

    v0.9.12 (February 28, 2020)

    v0.9.11 (February 21, 2020)

    v0.9.10 (January 31, 2020)

    v0.9.9 (December 29, 2019)

    v0.9.8 (December 19, 2019)

    v0.9.7 (October 30, 2019)

    v0.9.6 (October 25, 2019)

    v0.9.5 (October 9, 2019)

    v0.9.4 (October 2, 2019)

    v0.9.3 (September 20, 2019)

    v0.9.2 (September 5, 2019)

    v0.9.1 (August 22, 2019)

    v0.9.0 (August 13, 2019)

    v0.8.4 (March 13, 2019)

    v0.8.3 (March 6, 2019)

    v0.8.2 (February 7, 2019)

    v0.8.1 (January 7, 2019)

    v0.8.0 (December 18, 2018)

    v0.7.0 (December 13, 2018)

    v0.6.4 (November 27, 2018)

    v0.6.3 (November 16, 2018)

    v0.6.2 (October 26, 2018)

    v0.6.1 (September 22, 2018)

    v0.6.0 (August 30, 2018)

    v0.5.0 (August 5, 2018)

    v0.4.1 (June 28, 2018)

    v0.4.0 (June 23, 2018)

    v0.3.0 (May 25, 2018)

    v0.2.0 (April 24, 2018)

    v0.1.0 (February 28, 2018)

    +end

    v0.9.22 (May 22, 2021)

    This release contains backports from the ongoing development of the v0.10 release.

    v0.9.21 (April 23, 2021)

    v0.9.20 (February 20, 2021)

    v0.9.19 (December 1, 2020)

    v0.9.18 (November 3, 2020)

    v0.9.17 (September 21, 2020)

    v0.9.16 (September 17, 2020)

    v0.9.15 (September 14, 2020)

    v0.9.14 (May 30, 2020)

    v0.9.13 (March 24, 2020)

    v0.9.12 (February 28, 2020)

    v0.9.11 (February 21, 2020)

    v0.9.10 (January 31, 2020)

    v0.9.9 (December 29, 2019)

    v0.9.8 (December 19, 2019)

    v0.9.7 (October 30, 2019)

    v0.9.6 (October 25, 2019)

    v0.9.5 (October 9, 2019)

    v0.9.4 (October 2, 2019)

    v0.9.3 (September 20, 2019)

    v0.9.2 (September 5, 2019)

    v0.9.1 (August 22, 2019)

    v0.9.0 (August 13, 2019)

    v0.8.4 (March 13, 2019)

    v0.8.3 (March 6, 2019)

    v0.8.2 (February 7, 2019)

    v0.8.1 (January 7, 2019)

    v0.8.0 (December 18, 2018)

    v0.7.0 (December 13, 2018)

    v0.6.4 (November 27, 2018)

    v0.6.3 (November 16, 2018)

    v0.6.2 (October 26, 2018)

    v0.6.1 (September 22, 2018)

    v0.6.0 (August 30, 2018)

    v0.5.0 (August 5, 2018)

    v0.4.1 (June 28, 2018)

    v0.4.0 (June 23, 2018)

    v0.3.0 (May 25, 2018)

    v0.2.0 (April 24, 2018)

    v0.1.0 (February 28, 2018)

    diff --git a/previews/PR3778/moi/developer/checklists/index.html b/previews/PR3778/moi/developer/checklists/index.html index 6e3ca029b13..cc9bdb0f4af 100644 --- a/previews/PR3778/moi/developer/checklists/index.html +++ b/previews/PR3778/moi/developer/checklists/index.html @@ -112,4 +112,4 @@ ## Documentation - - [ ] The version fields are updated in `docs/src/submodules/FileFormats/overview.md` + - [ ] The version fields are updated in `docs/src/submodules/FileFormats/overview.md` diff --git a/previews/PR3778/moi/index.html b/previews/PR3778/moi/index.html index 3b6c6dcf0c4..cd943cfdd29 100644 --- a/previews/PR3778/moi/index.html +++ b/previews/PR3778/moi/index.html @@ -10,4 +10,4 @@ year={2021}, doi={10.1287/ijoc.2021.1067}, publisher={INFORMS} -}

    A preprint of this paper is freely available.

    +}

    A preprint of this paper is freely available.

    diff --git a/previews/PR3778/moi/manual/constraints/index.html b/previews/PR3778/moi/manual/constraints/index.html index abd45040331..39266acd20e 100644 --- a/previews/PR3778/moi/manual/constraints/index.html +++ b/previews/PR3778/moi/manual/constraints/index.html @@ -23,4 +23,4 @@ false

    Constraint attributes

    The following attributes are available for constraints:

    Get and set these attributes using get and set.

    julia> MOI.set(model, MOI.ConstraintName(), c, "con_c")
     
     julia> MOI.get(model, MOI.ConstraintName(), c)
    -"con_c"

    Constraints by function-set pairs

    Below is a list of common constraint types and how they are represented as function-set pairs in MOI. In the notation below, $x$ is a vector of decision variables, $x_i$ is a scalar decision variable, $\alpha, \beta$ are scalar constants, $a, b$ are constant vectors, A is a constant matrix and $\mathbb{R}_+$ (resp. $\mathbb{R}_-$) is the set of non-negative (resp. non-positive) real numbers.

    Linear constraints

    Mathematical ConstraintMOI FunctionMOI Set
    $a^Tx \le \beta$ScalarAffineFunctionLessThan
    $a^Tx \ge \alpha$ScalarAffineFunctionGreaterThan
    $a^Tx = \beta$ScalarAffineFunctionEqualTo
    $\alpha \le a^Tx \le \beta$ScalarAffineFunctionInterval
    $x_i \le \beta$VariableIndexLessThan
    $x_i \ge \alpha$VariableIndexGreaterThan
    $x_i = \beta$VariableIndexEqualTo
    $\alpha \le x_i \le \beta$VariableIndexInterval
    $Ax + b \in \mathbb{R}_+^n$VectorAffineFunctionNonnegatives
    $Ax + b \in \mathbb{R}_-^n$VectorAffineFunctionNonpositives
    $Ax + b = 0$VectorAffineFunctionZeros

    By convention, solvers are not expected to support nonzero constant terms in the ScalarAffineFunctions the first four rows of the preceding table because they are redundant with the parameters of the sets. For example, encode $2x + 1 \le 2$ as $2x \le 1$.

    Constraints with VariableIndex in LessThan, GreaterThan, EqualTo, or Interval sets have a natural interpretation as variable bounds. As such, it is typically not natural to impose multiple lower- or upper-bounds on the same variable, and the solver interfaces will throw respectively LowerBoundAlreadySet or UpperBoundAlreadySet.

    Moreover, adding two VariableIndex constraints on the same variable with the same set is impossible because they share the same index as it is the index of the variable, see ConstraintIndex.

    It is natural, however, to impose upper- and lower-bounds separately as two different constraints on a single variable. The difference between imposing bounds by using a single Interval constraint and by using separate LessThan and GreaterThan constraints is that the latter will allow the solver to return separate dual multipliers for the two bounds, while the former will allow the solver to return only a single dual for the interval constraint.

    Conic constraints

    Mathematical ConstraintMOI FunctionMOI Set
    $\lVert Ax + b\rVert_2 \le c^Tx + d$VectorAffineFunctionSecondOrderCone
    $y \ge \lVert x \rVert_2$VectorOfVariablesSecondOrderCone
    $2yz \ge \lVert x \rVert_2^2, y,z \ge 0$VectorOfVariablesRotatedSecondOrderCone
    $(a_1^Tx + b_1,a_2^Tx + b_2,a_3^Tx + b_3) \in \mathcal{E}$VectorAffineFunctionExponentialCone
    $A(x) \in \mathcal{S}_+$VectorAffineFunctionPositiveSemidefiniteConeTriangle
    $B(x) \in \mathcal{S}_+$VectorAffineFunctionPositiveSemidefiniteConeSquare
    $x \in \mathcal{S}_+$VectorOfVariablesPositiveSemidefiniteConeTriangle
    $x \in \mathcal{S}_+$VectorOfVariablesPositiveSemidefiniteConeSquare

    where $\mathcal{E}$ is the exponential cone (see ExponentialCone), $\mathcal{S}_+$ is the set of positive semidefinite symmetric matrices, $A$ is an affine map that outputs symmetric matrices and $B$ is an affine map that outputs square matrices.

    Quadratic constraints

    Mathematical ConstraintMOI FunctionMOI Set
    $\frac{1}{2}x^TQx + a^Tx + b \ge 0$ScalarQuadraticFunctionGreaterThan
    $\frac{1}{2}x^TQx + a^Tx + b \le 0$ScalarQuadraticFunctionLessThan
    $\frac{1}{2}x^TQx + a^Tx + b = 0$ScalarQuadraticFunctionEqualTo
    Bilinear matrix inequalityVectorQuadraticFunctionPositiveSemidefiniteCone...
    Note

    For more details on the internal format of the quadratic functions see ScalarQuadraticFunction or VectorQuadraticFunction.

    Discrete and logical constraints

    Mathematical ConstraintMOI FunctionMOI Set
    $x_i \in \mathbb{Z}$VariableIndexInteger
    $x_i \in \{0,1\}$VariableIndexZeroOne
    $x_i \in \{0\} \cup [l,u]$VariableIndexSemicontinuous
    $x_i \in \{0\} \cup \{l,l+1,\ldots,u-1,u\}$VariableIndexSemiinteger
    At most one component of $x$ can be nonzeroVectorOfVariablesSOS1
    At most two components of $x$ can be nonzero, and if so they must be adjacent componentsVectorOfVariablesSOS2
    $y = 1 \implies a^T x \in S$VectorAffineFunctionIndicator

    JuMP mapping

    The following bullet points show examples of how JuMP constraints are translated into MOI function-set pairs:

    Variable bounds are handled in a similar fashion:

    One notable difference is that a variable with an upper and lower bound is translated into two constraints, rather than an interval, that is:

    +"con_c"

    Constraints by function-set pairs

    Below is a list of common constraint types and how they are represented as function-set pairs in MOI. In the notation below, $x$ is a vector of decision variables, $x_i$ is a scalar decision variable, $\alpha, \beta$ are scalar constants, $a, b$ are constant vectors, A is a constant matrix and $\mathbb{R}_+$ (resp. $\mathbb{R}_-$) is the set of non-negative (resp. non-positive) real numbers.

    Linear constraints

    Mathematical ConstraintMOI FunctionMOI Set
    $a^Tx \le \beta$ScalarAffineFunctionLessThan
    $a^Tx \ge \alpha$ScalarAffineFunctionGreaterThan
    $a^Tx = \beta$ScalarAffineFunctionEqualTo
    $\alpha \le a^Tx \le \beta$ScalarAffineFunctionInterval
    $x_i \le \beta$VariableIndexLessThan
    $x_i \ge \alpha$VariableIndexGreaterThan
    $x_i = \beta$VariableIndexEqualTo
    $\alpha \le x_i \le \beta$VariableIndexInterval
    $Ax + b \in \mathbb{R}_+^n$VectorAffineFunctionNonnegatives
    $Ax + b \in \mathbb{R}_-^n$VectorAffineFunctionNonpositives
    $Ax + b = 0$VectorAffineFunctionZeros

    By convention, solvers are not expected to support nonzero constant terms in the ScalarAffineFunctions the first four rows of the preceding table because they are redundant with the parameters of the sets. For example, encode $2x + 1 \le 2$ as $2x \le 1$.

    Constraints with VariableIndex in LessThan, GreaterThan, EqualTo, or Interval sets have a natural interpretation as variable bounds. As such, it is typically not natural to impose multiple lower- or upper-bounds on the same variable, and the solver interfaces will throw respectively LowerBoundAlreadySet or UpperBoundAlreadySet.

    Moreover, adding two VariableIndex constraints on the same variable with the same set is impossible because they share the same index as it is the index of the variable, see ConstraintIndex.

    It is natural, however, to impose upper- and lower-bounds separately as two different constraints on a single variable. The difference between imposing bounds by using a single Interval constraint and by using separate LessThan and GreaterThan constraints is that the latter will allow the solver to return separate dual multipliers for the two bounds, while the former will allow the solver to return only a single dual for the interval constraint.

    Conic constraints

    Mathematical ConstraintMOI FunctionMOI Set
    $\lVert Ax + b\rVert_2 \le c^Tx + d$VectorAffineFunctionSecondOrderCone
    $y \ge \lVert x \rVert_2$VectorOfVariablesSecondOrderCone
    $2yz \ge \lVert x \rVert_2^2, y,z \ge 0$VectorOfVariablesRotatedSecondOrderCone
    $(a_1^Tx + b_1,a_2^Tx + b_2,a_3^Tx + b_3) \in \mathcal{E}$VectorAffineFunctionExponentialCone
    $A(x) \in \mathcal{S}_+$VectorAffineFunctionPositiveSemidefiniteConeTriangle
    $B(x) \in \mathcal{S}_+$VectorAffineFunctionPositiveSemidefiniteConeSquare
    $x \in \mathcal{S}_+$VectorOfVariablesPositiveSemidefiniteConeTriangle
    $x \in \mathcal{S}_+$VectorOfVariablesPositiveSemidefiniteConeSquare

    where $\mathcal{E}$ is the exponential cone (see ExponentialCone), $\mathcal{S}_+$ is the set of positive semidefinite symmetric matrices, $A$ is an affine map that outputs symmetric matrices and $B$ is an affine map that outputs square matrices.

    Quadratic constraints

    Mathematical ConstraintMOI FunctionMOI Set
    $\frac{1}{2}x^TQx + a^Tx + b \ge 0$ScalarQuadraticFunctionGreaterThan
    $\frac{1}{2}x^TQx + a^Tx + b \le 0$ScalarQuadraticFunctionLessThan
    $\frac{1}{2}x^TQx + a^Tx + b = 0$ScalarQuadraticFunctionEqualTo
    Bilinear matrix inequalityVectorQuadraticFunctionPositiveSemidefiniteCone...
    Note

    For more details on the internal format of the quadratic functions see ScalarQuadraticFunction or VectorQuadraticFunction.

    Discrete and logical constraints

    Mathematical ConstraintMOI FunctionMOI Set
    $x_i \in \mathbb{Z}$VariableIndexInteger
    $x_i \in \{0,1\}$VariableIndexZeroOne
    $x_i \in \{0\} \cup [l,u]$VariableIndexSemicontinuous
    $x_i \in \{0\} \cup \{l,l+1,\ldots,u-1,u\}$VariableIndexSemiinteger
    At most one component of $x$ can be nonzeroVectorOfVariablesSOS1
    At most two components of $x$ can be nonzero, and if so they must be adjacent componentsVectorOfVariablesSOS2
    $y = 1 \implies a^T x \in S$VectorAffineFunctionIndicator

    JuMP mapping

    The following bullet points show examples of how JuMP constraints are translated into MOI function-set pairs:

    Variable bounds are handled in a similar fashion:

    One notable difference is that a variable with an upper and lower bound is translated into two constraints, rather than an interval, that is:

    diff --git a/previews/PR3778/moi/manual/models/index.html b/previews/PR3778/moi/manual/models/index.html index dd76165850a..68e6dec45cd 100644 --- a/previews/PR3778/moi/manual/models/index.html +++ b/previews/PR3778/moi/manual/models/index.html @@ -3,4 +3,4 @@ function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-0RZ8X3D3D0', {'page_path': location.pathname + location.search + location.hash}); -

    Models

    The most significant part of MOI is the definition of the model API that is used to specify an instance of an optimization problem (for example, by adding variables and constraints). Objects that implement the model API must inherit from the ModelLike abstract type.

    Notably missing from the model API is the method to solve an optimization problem. ModelLike objects may store an instance (for example, in memory or backed by a file format) without being linked to a particular solver. In addition to the model API, MOI defines AbstractOptimizer and provides methods to solve the model and interact with solutions. See the Solutions section for more details.

    Info

    Throughout the rest of the manual, model is used as a generic ModelLike, and optimizer is used as a generic AbstractOptimizer.

    Tip

    MOI does not export functions, but for brevity we often omit qualifying names with the MOI module. Best practice is to have

    import MathOptInterface as MOI

    and prefix all MOI methods with MOI. in user code. If a name is also available in base Julia, we always explicitly use the module prefix, for example, with MOI.get.

    Attributes

    Attributes are properties of the model that can be queried and modified. These include constants such as the number of variables in a model NumberOfVariables), and properties of variables and constraints such as the name of a variable (VariableName).

    There are four types of attributes:

    Some attributes are values that can be queried by the user but not modified, while other attributes can be modified by the user.

    All interactions with attributes occur through the get and set functions.

    Consult the docstrings of each attribute for information on what it represents.

    ModelLike API

    The following attributes are available:

    AbstractOptimizer API

    The following attributes are available:

    +

    Models

    The most significant part of MOI is the definition of the model API that is used to specify an instance of an optimization problem (for example, by adding variables and constraints). Objects that implement the model API must inherit from the ModelLike abstract type.

    Notably missing from the model API is the method to solve an optimization problem. ModelLike objects may store an instance (for example, in memory or backed by a file format) without being linked to a particular solver. In addition to the model API, MOI defines AbstractOptimizer and provides methods to solve the model and interact with solutions. See the Solutions section for more details.

    Info

    Throughout the rest of the manual, model is used as a generic ModelLike, and optimizer is used as a generic AbstractOptimizer.

    Tip

    MOI does not export functions, but for brevity we often omit qualifying names with the MOI module. Best practice is to have

    import MathOptInterface as MOI

    and prefix all MOI methods with MOI. in user code. If a name is also available in base Julia, we always explicitly use the module prefix, for example, with MOI.get.

    Attributes

    Attributes are properties of the model that can be queried and modified. These include constants such as the number of variables in a model NumberOfVariables), and properties of variables and constraints such as the name of a variable (VariableName).

    There are four types of attributes:

    Some attributes are values that can be queried by the user but not modified, while other attributes can be modified by the user.

    All interactions with attributes occur through the get and set functions.

    Consult the docstrings of each attribute for information on what it represents.

    ModelLike API

    The following attributes are available:

    AbstractOptimizer API

    The following attributes are available:

    diff --git a/previews/PR3778/moi/manual/modification/index.html b/previews/PR3778/moi/manual/modification/index.html index 71167165305..01cc40a9c89 100644 --- a/previews/PR3778/moi/manual/modification/index.html +++ b/previews/PR3778/moi/manual/modification/index.html @@ -152,4 +152,4 @@ ); julia> MOI.get(model, MOI.ConstraintFunction(), c) ≈ new_f -true +true diff --git a/previews/PR3778/moi/manual/solutions/index.html b/previews/PR3778/moi/manual/solutions/index.html index 5b99de61493..603ee332ade 100644 --- a/previews/PR3778/moi/manual/solutions/index.html +++ b/previews/PR3778/moi/manual/solutions/index.html @@ -36,4 +36,4 @@ end rethrow(err) # Something else went wrong. Rethrow the error end -end +end diff --git a/previews/PR3778/moi/manual/standard_form/index.html b/previews/PR3778/moi/manual/standard_form/index.html index 9112285f560..ad6de3bd21f 100644 --- a/previews/PR3778/moi/manual/standard_form/index.html +++ b/previews/PR3778/moi/manual/standard_form/index.html @@ -7,4 +7,4 @@ & \min_{x \in \mathbb{R}^n} & f_0(x) \\ & \;\;\text{s.t.} & f_i(x) & \in \mathcal{S}_i & i = 1 \ldots m -\end{align}\]

    where:

    Tip

    For more information on this standard form, read our paper.

    MOI defines some commonly used functions and sets, but the interface is extensible to other sets recognized by the solver.

    Functions

    The function types implemented in MathOptInterface.jl are:

    FunctionDescription
    VariableIndex$x_j$, the projection onto a single coordinate defined by a variable index $j$.
    VectorOfVariablesThe projection onto multiple coordinates (that is, extracting a sub-vector).
    ScalarAffineFunction$a^T x + b$, where $a$ is a vector and $b$ scalar.
    ScalarNonlinearFunction$f(x)$, where $f$ is a nonlinear function.
    VectorAffineFunction$A x + b$, where $A$ is a matrix and $b$ is a vector.
    ScalarQuadraticFunction$\frac{1}{2} x^T Q x + a^T x + b$, where $Q$ is a symmetric matrix, $a$ is a vector, and $b$ is a constant.
    VectorQuadraticFunctionA vector of scalar-valued quadratic functions.
    VectorNonlinearFunction$f(x)$, where $f$ is a vector-valued nonlinear function.

    Extensions for nonlinear programming are present but not yet well documented.

    One-dimensional sets

    The one-dimensional set types implemented in MathOptInterface.jl are:

    SetDescription
    LessThan(u)$(-\infty, u]$
    GreaterThan(l)$[l, \infty)$
    EqualTo(v)$\{v\}$
    Interval(l, u)$[l, u]$
    Integer()$\mathbb{Z}$
    ZeroOne()$\{ 0, 1 \}$
    Semicontinuous(l, u)$\{ 0\} \cup [l, u]$
    Semiinteger(l, u)$\{ 0\} \cup \{l,l+1,\ldots,u-1,u\}$

    Vector cones

    The vector-valued set types implemented in MathOptInterface.jl are:

    SetDescription
    Reals(d)$\mathbb{R}^{d}$
    Zeros(d)$0^{d}$
    Nonnegatives(d)$\{ x \in \mathbb{R}^{d} : x \ge 0 \}$
    Nonpositives(d)$\{ x \in \mathbb{R}^{d} : x \le 0 \}$
    SecondOrderCone(d)$\{ (t,x) \in \mathbb{R}^{d} : t \ge \lVert x \rVert_2 \}$
    RotatedSecondOrderCone(d)$\{ (t,u,x) \in \mathbb{R}^{d} : 2tu \ge \lVert x \rVert_2^2, t \ge 0,u \ge 0 \}$
    ExponentialCone()$\{ (x,y,z) \in \mathbb{R}^3 : y \exp (x/y) \le z, y > 0 \}$
    DualExponentialCone()$\{ (u,v,w) \in \mathbb{R}^3 : -u \exp (v/u) \le \exp(1) w, u < 0 \}$
    GeometricMeanCone(d)$\{ (t,x) \in \mathbb{R}^{1+n} : x \ge 0, t \le \sqrt[n]{x_1 x_2 \cdots x_n} \}$ where $n$ is $d - 1$
    PowerCone(α)$\{ (x,y,z) \in \mathbb{R}^3 : x^{\alpha} y^{1-\alpha} \ge |z|, x \ge 0,y \ge 0 \}$
    DualPowerCone(α)$\{ (u,v,w) \in \mathbb{R}^3 : \left(\frac{u}{\alpha}\right)^{\alpha}\left(\frac{v}{1-\alpha}\right)^{1-\alpha} \ge |w|, u,v \ge 0 \}$
    NormOneCone(d)$\{ (t,x) \in \mathbb{R}^{d} : t \ge \sum_i \lvert x_i \rvert \}$
    NormInfinityCone(d)$\{ (t,x) \in \mathbb{R}^{d} : t \ge \max_i \lvert x_i \rvert \}$
    RelativeEntropyCone(d)$\{ (u, v, w) \in \mathbb{R}^{d} : u \ge \sum_i w_i \log (\frac{w_i}{v_i}), v_i \ge 0, w_i \ge 0 \}$
    HyperRectangle(l, u)$\{x \in \bar{\mathbb{R}}^d: x_i \in [l_i, u_i] \forall i=1,\ldots,d\}$
    NormCone(p, d)$\{ (t,x) \in \mathbb{R}^{d} : t \ge \left(\sum\limits_i \lvert x_i \rvert^p\right)^{\frac{1}{p}} \}$

    Matrix cones

    The matrix-valued set types implemented in MathOptInterface.jl are:

    SetDescription
    RootDetConeTriangle(d)$\{ (t,X) \in \mathbb{R}^{1+d(1+d)/2} : t \le \det(X)^{1/d}, X \mbox{ is the upper triangle of a PSD matrix} \}$
    RootDetConeSquare(d)$\{ (t,X) \in \mathbb{R}^{1+d^2} : t \le \det(X)^{1/d}, X \mbox{ is a PSD matrix} \}$
    PositiveSemidefiniteConeTriangle(d)$\{ X \in \mathbb{R}^{d(d+1)/2} : X \mbox{ is the upper triangle of a PSD matrix} \}$
    PositiveSemidefiniteConeSquare(d)$\{ X \in \mathbb{R}^{d^2} : X \mbox{ is a PSD matrix} \}$
    LogDetConeTriangle(d)$\{ (t,u,X) \in \mathbb{R}^{2+d(1+d)/2} : t \le u\log(\det(X/u)), X \mbox{ is the upper triangle of a PSD matrix}, u > 0 \}$
    LogDetConeSquare(d)$\{ (t,u,X) \in \mathbb{R}^{2+d^2} : t \le u \log(\det(X/u)), X \mbox{ is a PSD matrix}, u > 0 \}$
    NormSpectralCone(r, c)$\{ (t, X) \in \mathbb{R}^{1 + r \times c} : t \ge \sigma_1(X), X \mbox{ is a } r\times c\mbox{ matrix} \}$
    NormNuclearCone(r, c)$\{ (t, X) \in \mathbb{R}^{1 + r \times c} : t \ge \sum_i \sigma_i(X), X \mbox{ is a } r\times c\mbox{ matrix} \}$
    HermitianPositiveSemidefiniteConeTriangle(d)The cone of Hermitian positive semidefinite matrices, with
    side_dimension rows and columns.
    Scaled(S)The set S scaled so that Utilities.set_dot corresponds to LinearAlgebra.dot

    Some of these cones can take two forms: XXXConeTriangle and XXXConeSquare.

    In XXXConeTriangle sets, the matrix is assumed to be symmetric, and the elements are provided by a vector, in which the entries of the upper-right triangular part of the matrix are given column by column (or equivalently, the entries of the lower-left triangular part are given row by row).

    In XXXConeSquare sets, the entries of the matrix are given column by column (or equivalently, row by row), and the matrix is constrained to be symmetric. As an example, given a 2-by-2 matrix of variables X and a one-dimensional variable t, we can specify a root-det constraint as [t, X11, X12, X22] ∈ RootDetConeTriangle or [t, X11, X12, X21, X22] ∈ RootDetConeSquare.

    We provide both forms to enable flexibility for solvers who may natively support one or the other. Transformations between XXXConeTriangle and XXXConeSquare are handled by bridges, which removes the chance of conversion mistakes by users or solver developers.

    Multi-dimensional sets with combinatorial structure

    Other sets are vector-valued, with a particular combinatorial structure. Read their docstrings for more information on how to interpret them.

    SetDescription
    SOS1A Special Ordered Set (SOS) of Type I
    SOS2A Special Ordered Set (SOS) of Type II
    IndicatorA set to specify an indicator constraint
    ComplementsA set to specify a mixed complementarity constraint
    AllDifferentThe all_different global constraint
    BinPackingThe bin_packing global constraint
    CircuitThe circuit global constraint
    CountAtLeastThe at_least global constraint
    CountBelongsThe nvalue global constraint
    CountDistinctThe distinct global constraint
    CountGreaterThanThe count_gt global constraint
    CumulativeThe cumulative global constraint
    PathThe path global constraint
    TableThe table global constraint
    +\end{align}\]

    where:

    Tip

    For more information on this standard form, read our paper.

    MOI defines some commonly used functions and sets, but the interface is extensible to other sets recognized by the solver.

    Functions

    The function types implemented in MathOptInterface.jl are:

    FunctionDescription
    VariableIndex$x_j$, the projection onto a single coordinate defined by a variable index $j$.
    VectorOfVariablesThe projection onto multiple coordinates (that is, extracting a sub-vector).
    ScalarAffineFunction$a^T x + b$, where $a$ is a vector and $b$ scalar.
    ScalarNonlinearFunction$f(x)$, where $f$ is a nonlinear function.
    VectorAffineFunction$A x + b$, where $A$ is a matrix and $b$ is a vector.
    ScalarQuadraticFunction$\frac{1}{2} x^T Q x + a^T x + b$, where $Q$ is a symmetric matrix, $a$ is a vector, and $b$ is a constant.
    VectorQuadraticFunctionA vector of scalar-valued quadratic functions.
    VectorNonlinearFunction$f(x)$, where $f$ is a vector-valued nonlinear function.

    Extensions for nonlinear programming are present but not yet well documented.

    One-dimensional sets

    The one-dimensional set types implemented in MathOptInterface.jl are:

    SetDescription
    LessThan(u)$(-\infty, u]$
    GreaterThan(l)$[l, \infty)$
    EqualTo(v)$\{v\}$
    Interval(l, u)$[l, u]$
    Integer()$\mathbb{Z}$
    ZeroOne()$\{ 0, 1 \}$
    Semicontinuous(l, u)$\{ 0\} \cup [l, u]$
    Semiinteger(l, u)$\{ 0\} \cup \{l,l+1,\ldots,u-1,u\}$

    Vector cones

    The vector-valued set types implemented in MathOptInterface.jl are:

    SetDescription
    Reals(d)$\mathbb{R}^{d}$
    Zeros(d)$0^{d}$
    Nonnegatives(d)$\{ x \in \mathbb{R}^{d} : x \ge 0 \}$
    Nonpositives(d)$\{ x \in \mathbb{R}^{d} : x \le 0 \}$
    SecondOrderCone(d)$\{ (t,x) \in \mathbb{R}^{d} : t \ge \lVert x \rVert_2 \}$
    RotatedSecondOrderCone(d)$\{ (t,u,x) \in \mathbb{R}^{d} : 2tu \ge \lVert x \rVert_2^2, t \ge 0,u \ge 0 \}$
    ExponentialCone()$\{ (x,y,z) \in \mathbb{R}^3 : y \exp (x/y) \le z, y > 0 \}$
    DualExponentialCone()$\{ (u,v,w) \in \mathbb{R}^3 : -u \exp (v/u) \le \exp(1) w, u < 0 \}$
    GeometricMeanCone(d)$\{ (t,x) \in \mathbb{R}^{1+n} : x \ge 0, t \le \sqrt[n]{x_1 x_2 \cdots x_n} \}$ where $n$ is $d - 1$
    PowerCone(α)$\{ (x,y,z) \in \mathbb{R}^3 : x^{\alpha} y^{1-\alpha} \ge |z|, x \ge 0,y \ge 0 \}$
    DualPowerCone(α)$\{ (u,v,w) \in \mathbb{R}^3 : \left(\frac{u}{\alpha}\right)^{\alpha}\left(\frac{v}{1-\alpha}\right)^{1-\alpha} \ge |w|, u,v \ge 0 \}$
    NormOneCone(d)$\{ (t,x) \in \mathbb{R}^{d} : t \ge \sum_i \lvert x_i \rvert \}$
    NormInfinityCone(d)$\{ (t,x) \in \mathbb{R}^{d} : t \ge \max_i \lvert x_i \rvert \}$
    RelativeEntropyCone(d)$\{ (u, v, w) \in \mathbb{R}^{d} : u \ge \sum_i w_i \log (\frac{w_i}{v_i}), v_i \ge 0, w_i \ge 0 \}$
    HyperRectangle(l, u)$\{x \in \bar{\mathbb{R}}^d: x_i \in [l_i, u_i] \forall i=1,\ldots,d\}$
    NormCone(p, d)$\{ (t,x) \in \mathbb{R}^{d} : t \ge \left(\sum\limits_i \lvert x_i \rvert^p\right)^{\frac{1}{p}} \}$

    Matrix cones

    The matrix-valued set types implemented in MathOptInterface.jl are:

    SetDescription
    RootDetConeTriangle(d)$\{ (t,X) \in \mathbb{R}^{1+d(1+d)/2} : t \le \det(X)^{1/d}, X \mbox{ is the upper triangle of a PSD matrix} \}$
    RootDetConeSquare(d)$\{ (t,X) \in \mathbb{R}^{1+d^2} : t \le \det(X)^{1/d}, X \mbox{ is a PSD matrix} \}$
    PositiveSemidefiniteConeTriangle(d)$\{ X \in \mathbb{R}^{d(d+1)/2} : X \mbox{ is the upper triangle of a PSD matrix} \}$
    PositiveSemidefiniteConeSquare(d)$\{ X \in \mathbb{R}^{d^2} : X \mbox{ is a PSD matrix} \}$
    LogDetConeTriangle(d)$\{ (t,u,X) \in \mathbb{R}^{2+d(1+d)/2} : t \le u\log(\det(X/u)), X \mbox{ is the upper triangle of a PSD matrix}, u > 0 \}$
    LogDetConeSquare(d)$\{ (t,u,X) \in \mathbb{R}^{2+d^2} : t \le u \log(\det(X/u)), X \mbox{ is a PSD matrix}, u > 0 \}$
    NormSpectralCone(r, c)$\{ (t, X) \in \mathbb{R}^{1 + r \times c} : t \ge \sigma_1(X), X \mbox{ is a } r\times c\mbox{ matrix} \}$
    NormNuclearCone(r, c)$\{ (t, X) \in \mathbb{R}^{1 + r \times c} : t \ge \sum_i \sigma_i(X), X \mbox{ is a } r\times c\mbox{ matrix} \}$
    HermitianPositiveSemidefiniteConeTriangle(d)The cone of Hermitian positive semidefinite matrices, with
    side_dimension rows and columns.
    Scaled(S)The set S scaled so that Utilities.set_dot corresponds to LinearAlgebra.dot

    Some of these cones can take two forms: XXXConeTriangle and XXXConeSquare.

    In XXXConeTriangle sets, the matrix is assumed to be symmetric, and the elements are provided by a vector, in which the entries of the upper-right triangular part of the matrix are given column by column (or equivalently, the entries of the lower-left triangular part are given row by row).

    In XXXConeSquare sets, the entries of the matrix are given column by column (or equivalently, row by row), and the matrix is constrained to be symmetric. As an example, given a 2-by-2 matrix of variables X and a one-dimensional variable t, we can specify a root-det constraint as [t, X11, X12, X22] ∈ RootDetConeTriangle or [t, X11, X12, X21, X22] ∈ RootDetConeSquare.

    We provide both forms to enable flexibility for solvers who may natively support one or the other. Transformations between XXXConeTriangle and XXXConeSquare are handled by bridges, which removes the chance of conversion mistakes by users or solver developers.

    Multi-dimensional sets with combinatorial structure

    Other sets are vector-valued, with a particular combinatorial structure. Read their docstrings for more information on how to interpret them.

    SetDescription
    SOS1A Special Ordered Set (SOS) of Type I
    SOS2A Special Ordered Set (SOS) of Type II
    IndicatorA set to specify an indicator constraint
    ComplementsA set to specify a mixed complementarity constraint
    AllDifferentThe all_different global constraint
    BinPackingThe bin_packing global constraint
    CircuitThe circuit global constraint
    CountAtLeastThe at_least global constraint
    CountBelongsThe nvalue global constraint
    CountDistinctThe distinct global constraint
    CountGreaterThanThe count_gt global constraint
    CumulativeThe cumulative global constraint
    PathThe path global constraint
    TableThe table global constraint
    diff --git a/previews/PR3778/moi/manual/variables/index.html b/previews/PR3778/moi/manual/variables/index.html index e043115d729..bc32eefca6d 100644 --- a/previews/PR3778/moi/manual/variables/index.html +++ b/previews/PR3778/moi/manual/variables/index.html @@ -14,4 +14,4 @@ false
    Warning

    Not all ModelLike models support deleting variables. A DeleteNotAllowed error is thrown if this is not supported.

    Variable attributes

    The following attributes are available for variables:

    Get and set these attributes using get and set.

    julia> MOI.set(model, MOI.VariableName(), x, "var_x")
     
     julia> MOI.get(model, MOI.VariableName(), x)
    -"var_x"
    +"var_x" diff --git a/previews/PR3778/moi/reference/callbacks/index.html b/previews/PR3778/moi/reference/callbacks/index.html index 2ae00e63f7c..0b4b2b4499a 100644 --- a/previews/PR3778/moi/reference/callbacks/index.html +++ b/previews/PR3778/moi/reference/callbacks/index.html @@ -33,4 +33,4 @@ MOI.submit(optimizer, MOI.HeuristicSolution(callback_data), x, values) end -endsource
    MathOptInterface.HeuristicSolutionType
    HeuristicSolution(callback_data)

    Heuristically obtained feasible solution. The solution is submitted as variables, values where values[i] gives the value of variables[i], similarly to set. The submit call returns a HeuristicSolutionStatus indicating whether the provided solution was accepted or rejected.

    This can be submitted only from the HeuristicCallback. The field callback_data is a solver-specific callback type that is passed as the argument to the heuristic callback.

    Some solvers require a complete solution, others only partial solutions.

    source
    MathOptInterface.HeuristicSolutionStatusType
    HeuristicSolutionStatus

    An Enum of possible return values for submit with HeuristicSolution. This informs whether the heuristic solution was accepted or rejected.

    Values

    Possible values are:

    source
    MathOptInterface.HEURISTIC_SOLUTION_ACCEPTEDConstant
    HEURISTIC_SOLUTION_ACCEPTED::HeuristicSolutionStatus

    An instance of the HeuristicSolutionStatus enum.

    HEURISTIC_SOLUTION_ACCEPTED: The heuristic solution was accepted

    source
    MathOptInterface.HEURISTIC_SOLUTION_REJECTEDConstant
    HEURISTIC_SOLUTION_REJECTED::HeuristicSolutionStatus

    An instance of the HeuristicSolutionStatus enum.

    HEURISTIC_SOLUTION_REJECTED: The heuristic solution was rejected

    source
    MathOptInterface.HEURISTIC_SOLUTION_UNKNOWNConstant
    HEURISTIC_SOLUTION_UNKNOWN::HeuristicSolutionStatus

    An instance of the HeuristicSolutionStatus enum.

    HEURISTIC_SOLUTION_UNKNOWN: No information available on the acceptance

    source
    +endsource
    MathOptInterface.HeuristicSolutionType
    HeuristicSolution(callback_data)

    Heuristically obtained feasible solution. The solution is submitted as variables, values where values[i] gives the value of variables[i], similarly to set. The submit call returns a HeuristicSolutionStatus indicating whether the provided solution was accepted or rejected.

    This can be submitted only from the HeuristicCallback. The field callback_data is a solver-specific callback type that is passed as the argument to the heuristic callback.

    Some solvers require a complete solution, others only partial solutions.

    source
    MathOptInterface.HeuristicSolutionStatusType
    HeuristicSolutionStatus

    An Enum of possible return values for submit with HeuristicSolution. This informs whether the heuristic solution was accepted or rejected.

    Values

    Possible values are:

    source
    MathOptInterface.HEURISTIC_SOLUTION_ACCEPTEDConstant
    HEURISTIC_SOLUTION_ACCEPTED::HeuristicSolutionStatus

    An instance of the HeuristicSolutionStatus enum.

    HEURISTIC_SOLUTION_ACCEPTED: The heuristic solution was accepted

    source
    MathOptInterface.HEURISTIC_SOLUTION_REJECTEDConstant
    HEURISTIC_SOLUTION_REJECTED::HeuristicSolutionStatus

    An instance of the HeuristicSolutionStatus enum.

    HEURISTIC_SOLUTION_REJECTED: The heuristic solution was rejected

    source
    MathOptInterface.HEURISTIC_SOLUTION_UNKNOWNConstant
    HEURISTIC_SOLUTION_UNKNOWN::HeuristicSolutionStatus

    An instance of the HeuristicSolutionStatus enum.

    HEURISTIC_SOLUTION_UNKNOWN: No information available on the acceptance

    source
    diff --git a/previews/PR3778/moi/reference/constraints/index.html b/previews/PR3778/moi/reference/constraints/index.html index b72cf7d6e85..51910757c09 100644 --- a/previews/PR3778/moi/reference/constraints/index.html +++ b/previews/PR3778/moi/reference/constraints/index.html @@ -13,4 +13,4 @@ model::ModelLike, ::Type{F}, ::Type{S}, -)::Bool where {F<:AbstractFunction,S<:AbstractSet}

    Return a Bool indicating whether model supports F-in-S constraints, that is, copy_to(model, src) does not throw UnsupportedConstraint when src contains F-in-S constraints. If F-in-S constraints are only not supported in specific circumstances, for example, F-in-S constraints cannot be combined with another type of constraint, it should still return true.

    source

    Attributes

    MathOptInterface.AbstractConstraintAttributeType
    AbstractConstraintAttribute

    Abstract supertype for attribute objects that can be used to set or get attributes (properties) of constraints in the model.

    source
    MathOptInterface.ConstraintNameType
    ConstraintName()

    A constraint attribute for a string identifying the constraint.

    It is valid for constraints variables to have the same name; however, constraints with duplicate names cannot be looked up using get, regardless of whether they have the same F-in-S type.

    ConstraintName has a default value of "" if not set.

    Notes

    You should not implement ConstraintName for VariableIndex constraints.

    source
    MathOptInterface.ConstraintPrimalStartType
    ConstraintPrimalStart()

    A constraint attribute for the initial assignment to some constraint's ConstraintPrimal that the optimizer may use to warm-start the solve.

    May be nothing (unset), a number for AbstractScalarFunction, or a vector for AbstractVectorFunction.

    source
    MathOptInterface.ConstraintDualStartType
    ConstraintDualStart()

    A constraint attribute for the initial assignment to some constraint's ConstraintDual that the optimizer may use to warm-start the solve.

    May be nothing (unset), a number for AbstractScalarFunction, or a vector for AbstractVectorFunction.

    source
    MathOptInterface.ConstraintPrimalType
    ConstraintPrimal(result_index::Int = 1)

    A constraint attribute for the assignment to some constraint's primal value in result result_index.

    If the constraint is f(x) in S, then in most cases the ConstraintPrimal is the value of f, evaluated at the corresponding VariablePrimal solution.

    However, some conic solvers reformulate b - Ax in S to s = b - Ax, s in S. These solvers may return the value of s for ConstraintPrimal, rather than b - Ax. (Although these are constrained by an equality constraint, due to numerical tolerances they may not be identical.)

    If the solver does not have a primal value for the constraint because the result_index is beyond the available solutions (whose number is indicated by the ResultCount attribute), getting this attribute must throw a ResultIndexBoundsError. Otherwise, if the result is unavailable for another reason (for instance, only a dual solution is available), the result is undefined. Users should first check PrimalStatus before accessing the ConstraintPrimal attribute.

    If result_index is omitted, it is 1 by default. See ResultCount for information on how the results are ordered.

    source
    MathOptInterface.ConstraintDualType
    ConstraintDual(result_index::Int = 1)

    A constraint attribute for the assignment to some constraint's dual value in result result_index. If result_index is omitted, it is 1 by default.

    If the solver does not have a dual value for the variable because the result_index is beyond the available solutions (whose number is indicated by the ResultCount attribute), getting this attribute must throw a ResultIndexBoundsError. Otherwise, if the result is unavailable for another reason (for instance, only a primal solution is available), the result is undefined. Users should first check DualStatus before accessing the ConstraintDual attribute.

    See ResultCount for information on how the results are ordered.

    source
    MathOptInterface.ConstraintBasisStatusType
    ConstraintBasisStatus(result_index::Int = 1)

    A constraint attribute for the BasisStatusCode of some constraint in result result_index, with respect to an available optimal solution basis. If result_index is omitted, it is 1 by default.

    If the solver does not have a basis status for the constraint because the result_index is beyond the available solutions (whose number is indicated by the ResultCount attribute), getting this attribute must throw a ResultIndexBoundsError. Otherwise, if the result is unavailable for another reason (for instance, only a dual solution is available), the result is undefined. Users should first check PrimalStatus before accessing the ConstraintBasisStatus attribute.

    See ResultCount for information on how the results are ordered.

    Notes

    For the basis status of a variable, query VariableBasisStatus.

    ConstraintBasisStatus does not apply to VariableIndex constraints. You can infer the basis status of a VariableIndex constraint by looking at the result of VariableBasisStatus.

    source
    MathOptInterface.ConstraintFunctionType
    ConstraintFunction()

    A constraint attribute for the AbstractFunction object used to define the constraint.

    It is guaranteed to be equivalent but not necessarily identical to the function provided by the user.

    source
    MathOptInterface.CanonicalConstraintFunctionType
    CanonicalConstraintFunction()

    A constraint attribute for a canonical representation of the AbstractFunction object used to define the constraint.

    Getting this attribute is guaranteed to return a function that is equivalent but not necessarily identical to the function provided by the user.

    By default, MOI.get(model, MOI.CanonicalConstraintFunction(), ci) fallbacks to MOI.Utilities.canonical(MOI.get(model, MOI.ConstraintFunction(), ci)). However, if model knows that the constraint function is canonical then it can implement a specialized method that directly return the function without calling Utilities.canonical. Therefore, the value returned cannot be assumed to be a copy of the function stored in model. Moreover, Utilities.Model checks with Utilities.is_canonical whether the function stored internally is already canonical and if it's the case, then it returns the function stored internally instead of a copy.

    source
    MathOptInterface.ConstraintSetType
    ConstraintSet()

    A constraint attribute for the AbstractSet object used to define the constraint.

    source
    MathOptInterface.BasisStatusCodeType
    BasisStatusCode

    An Enum of possible values for the ConstraintBasisStatus and VariableBasisStatus attributes, explaining the status of a given element with respect to an optimal solution basis.

    Notes

    • NONBASIC_AT_LOWER and NONBASIC_AT_UPPER should be used only for constraints with the Interval set. In this case, they are necessary to distinguish which side of the constraint is active. One-sided constraints (for example, LessThan and GreaterThan) should use NONBASIC instead of the NONBASIC_AT_* values. This restriction does not apply to VariableBasisStatus, which should return NONBASIC_AT_* regardless of whether the alternative bound exists.

    • In linear programs, SUPER_BASIC occurs when a variable with no bounds is not in the basis.

    Values

    Possible values are:

    source
    MathOptInterface.BASICConstant
    BASIC::BasisStatusCode

    An instance of the BasisStatusCode enum.

    BASIC: element is in the basis

    source
    MathOptInterface.NONBASICConstant
    NONBASIC::BasisStatusCode

    An instance of the BasisStatusCode enum.

    NONBASIC: element is not in the basis

    source
    MathOptInterface.NONBASIC_AT_LOWERConstant
    NONBASIC_AT_LOWER::BasisStatusCode

    An instance of the BasisStatusCode enum.

    NONBASIC_AT_LOWER: element is not in the basis and is at its lower bound

    source
    MathOptInterface.NONBASIC_AT_UPPERConstant
    NONBASIC_AT_UPPER::BasisStatusCode

    An instance of the BasisStatusCode enum.

    NONBASIC_AT_UPPER: element is not in the basis and is at its upper bound

    source
    MathOptInterface.SUPER_BASICConstant
    SUPER_BASIC::BasisStatusCode

    An instance of the BasisStatusCode enum.

    SUPER_BASIC: element is not in the basis but is also not at one of its bounds

    source
    +)::Bool where {F<:AbstractFunction,S<:AbstractSet}

    Return a Bool indicating whether model supports F-in-S constraints, that is, copy_to(model, src) does not throw UnsupportedConstraint when src contains F-in-S constraints. If F-in-S constraints are only not supported in specific circumstances, for example, F-in-S constraints cannot be combined with another type of constraint, it should still return true.

    source

    Attributes

    MathOptInterface.AbstractConstraintAttributeType
    AbstractConstraintAttribute

    Abstract supertype for attribute objects that can be used to set or get attributes (properties) of constraints in the model.

    source
    MathOptInterface.ConstraintNameType
    ConstraintName()

    A constraint attribute for a string identifying the constraint.

    It is valid for constraints variables to have the same name; however, constraints with duplicate names cannot be looked up using get, regardless of whether they have the same F-in-S type.

    ConstraintName has a default value of "" if not set.

    Notes

    You should not implement ConstraintName for VariableIndex constraints.

    source
    MathOptInterface.ConstraintPrimalStartType
    ConstraintPrimalStart()

    A constraint attribute for the initial assignment to some constraint's ConstraintPrimal that the optimizer may use to warm-start the solve.

    May be nothing (unset), a number for AbstractScalarFunction, or a vector for AbstractVectorFunction.

    source
    MathOptInterface.ConstraintDualStartType
    ConstraintDualStart()

    A constraint attribute for the initial assignment to some constraint's ConstraintDual that the optimizer may use to warm-start the solve.

    May be nothing (unset), a number for AbstractScalarFunction, or a vector for AbstractVectorFunction.

    source
    MathOptInterface.ConstraintPrimalType
    ConstraintPrimal(result_index::Int = 1)

    A constraint attribute for the assignment to some constraint's primal value in result result_index.

    If the constraint is f(x) in S, then in most cases the ConstraintPrimal is the value of f, evaluated at the corresponding VariablePrimal solution.

    However, some conic solvers reformulate b - Ax in S to s = b - Ax, s in S. These solvers may return the value of s for ConstraintPrimal, rather than b - Ax. (Although these are constrained by an equality constraint, due to numerical tolerances they may not be identical.)

    If the solver does not have a primal value for the constraint because the result_index is beyond the available solutions (whose number is indicated by the ResultCount attribute), getting this attribute must throw a ResultIndexBoundsError. Otherwise, if the result is unavailable for another reason (for instance, only a dual solution is available), the result is undefined. Users should first check PrimalStatus before accessing the ConstraintPrimal attribute.

    If result_index is omitted, it is 1 by default. See ResultCount for information on how the results are ordered.

    source
    MathOptInterface.ConstraintDualType
    ConstraintDual(result_index::Int = 1)

    A constraint attribute for the assignment to some constraint's dual value in result result_index. If result_index is omitted, it is 1 by default.

    If the solver does not have a dual value for the variable because the result_index is beyond the available solutions (whose number is indicated by the ResultCount attribute), getting this attribute must throw a ResultIndexBoundsError. Otherwise, if the result is unavailable for another reason (for instance, only a primal solution is available), the result is undefined. Users should first check DualStatus before accessing the ConstraintDual attribute.

    See ResultCount for information on how the results are ordered.

    source
    MathOptInterface.ConstraintBasisStatusType
    ConstraintBasisStatus(result_index::Int = 1)

    A constraint attribute for the BasisStatusCode of some constraint in result result_index, with respect to an available optimal solution basis. If result_index is omitted, it is 1 by default.

    If the solver does not have a basis status for the constraint because the result_index is beyond the available solutions (whose number is indicated by the ResultCount attribute), getting this attribute must throw a ResultIndexBoundsError. Otherwise, if the result is unavailable for another reason (for instance, only a dual solution is available), the result is undefined. Users should first check PrimalStatus before accessing the ConstraintBasisStatus attribute.

    See ResultCount for information on how the results are ordered.

    Notes

    For the basis status of a variable, query VariableBasisStatus.

    ConstraintBasisStatus does not apply to VariableIndex constraints. You can infer the basis status of a VariableIndex constraint by looking at the result of VariableBasisStatus.

    source
    MathOptInterface.ConstraintFunctionType
    ConstraintFunction()

    A constraint attribute for the AbstractFunction object used to define the constraint.

    It is guaranteed to be equivalent but not necessarily identical to the function provided by the user.

    source
    MathOptInterface.CanonicalConstraintFunctionType
    CanonicalConstraintFunction()

    A constraint attribute for a canonical representation of the AbstractFunction object used to define the constraint.

    Getting this attribute is guaranteed to return a function that is equivalent but not necessarily identical to the function provided by the user.

    By default, MOI.get(model, MOI.CanonicalConstraintFunction(), ci) fallbacks to MOI.Utilities.canonical(MOI.get(model, MOI.ConstraintFunction(), ci)). However, if model knows that the constraint function is canonical then it can implement a specialized method that directly return the function without calling Utilities.canonical. Therefore, the value returned cannot be assumed to be a copy of the function stored in model. Moreover, Utilities.Model checks with Utilities.is_canonical whether the function stored internally is already canonical and if it's the case, then it returns the function stored internally instead of a copy.

    source
    MathOptInterface.ConstraintSetType
    ConstraintSet()

    A constraint attribute for the AbstractSet object used to define the constraint.

    source
    MathOptInterface.BasisStatusCodeType
    BasisStatusCode

    An Enum of possible values for the ConstraintBasisStatus and VariableBasisStatus attributes, explaining the status of a given element with respect to an optimal solution basis.

    Notes

    • NONBASIC_AT_LOWER and NONBASIC_AT_UPPER should be used only for constraints with the Interval set. In this case, they are necessary to distinguish which side of the constraint is active. One-sided constraints (for example, LessThan and GreaterThan) should use NONBASIC instead of the NONBASIC_AT_* values. This restriction does not apply to VariableBasisStatus, which should return NONBASIC_AT_* regardless of whether the alternative bound exists.

    • In linear programs, SUPER_BASIC occurs when a variable with no bounds is not in the basis.

    Values

    Possible values are:

    source
    MathOptInterface.BASICConstant
    BASIC::BasisStatusCode

    An instance of the BasisStatusCode enum.

    BASIC: element is in the basis

    source
    MathOptInterface.NONBASICConstant
    NONBASIC::BasisStatusCode

    An instance of the BasisStatusCode enum.

    NONBASIC: element is not in the basis

    source
    MathOptInterface.NONBASIC_AT_LOWERConstant
    NONBASIC_AT_LOWER::BasisStatusCode

    An instance of the BasisStatusCode enum.

    NONBASIC_AT_LOWER: element is not in the basis and is at its lower bound

    source
    MathOptInterface.NONBASIC_AT_UPPERConstant
    NONBASIC_AT_UPPER::BasisStatusCode

    An instance of the BasisStatusCode enum.

    NONBASIC_AT_UPPER: element is not in the basis and is at its upper bound

    source
    MathOptInterface.SUPER_BASICConstant
    SUPER_BASIC::BasisStatusCode

    An instance of the BasisStatusCode enum.

    SUPER_BASIC: element is not in the basis but is also not at one of its bounds

    source
    diff --git a/previews/PR3778/moi/reference/errors/index.html b/previews/PR3778/moi/reference/errors/index.html index e49ad8b9733..c84b8a3adcd 100644 --- a/previews/PR3778/moi/reference/errors/index.html +++ b/previews/PR3778/moi/reference/errors/index.html @@ -49,4 +49,4 @@ julia> throw(MOI.UnsupportedNonlinearOperator(:black_box)) ERROR: MathOptInterface.UnsupportedNonlinearOperator: The nonlinear operator `:black_box` is not supported by the model. Stacktrace: -[...]source

    Note that setting the ConstraintFunction of a VariableIndex constraint is not allowed:

    MathOptInterface.SettingVariableIndexNotAllowedType
    SettingVariableIndexNotAllowed()

    Error type that should be thrown when the user calls set to change the ConstraintFunction of a VariableIndex constraint.

    source
    +[...]source

    Note that setting the ConstraintFunction of a VariableIndex constraint is not allowed:

    MathOptInterface.SettingVariableIndexNotAllowedType
    SettingVariableIndexNotAllowed()

    Error type that should be thrown when the user calls set to change the ConstraintFunction of a VariableIndex constraint.

    source
    diff --git a/previews/PR3778/moi/reference/models/index.html b/previews/PR3778/moi/reference/models/index.html index 2cf4515488e..9c96e193a08 100644 --- a/previews/PR3778/moi/reference/models/index.html +++ b/previews/PR3778/moi/reference/models/index.html @@ -7,7 +7,7 @@ model::MOI.ModelLike, attr::MOI.AbstractConstraintAttribute, bridge::AbstractBridge, -)

    Return the value of the attribute attr of the model model for the constraint bridged by bridge.

    source
    get(model::GenericModel, attr::MathOptInterface.AbstractOptimizerAttribute)

    Return the value of the attribute attr from the model's MOI backend.

    source
    get(model::GenericModel, attr::MathOptInterface.AbstractModelAttribute)

    Return the value of the attribute attr from the model's MOI backend.

    source
    get(optimizer::AbstractOptimizer, attr::AbstractOptimizerAttribute)

    Return an attribute attr of the optimizer optimizer.

    get(model::ModelLike, attr::AbstractModelAttribute)

    Return an attribute attr of the model model.

    get(model::ModelLike, attr::AbstractVariableAttribute, v::VariableIndex)

    If the attribute attr is set for the variable v in the model model, return its value, return nothing otherwise. If the attribute attr is not supported by model then an error should be thrown instead of returning nothing.

    get(model::ModelLike, attr::AbstractVariableAttribute, v::Vector{VariableIndex})

    Return a vector of attributes corresponding to each variable in the collection v in the model model.

    get(model::ModelLike, attr::AbstractConstraintAttribute, c::ConstraintIndex)

    If the attribute attr is set for the constraint c in the model model, return its value, return nothing otherwise. If the attribute attr is not supported by model then an error should be thrown instead of returning nothing.

    get(
    +)

    Return the value of the attribute attr of the model model for the constraint bridged by bridge.

    source
    get(model::GenericModel, attr::MathOptInterface.AbstractOptimizerAttribute)

    Return the value of the attribute attr from the model's MOI backend.

    source
    get(model::GenericModel, attr::MathOptInterface.AbstractModelAttribute)

    Return the value of the attribute attr from the model's MOI backend.

    source
    get(optimizer::AbstractOptimizer, attr::AbstractOptimizerAttribute)

    Return an attribute attr of the optimizer optimizer.

    get(model::ModelLike, attr::AbstractModelAttribute)

    Return an attribute attr of the model model.

    get(model::ModelLike, attr::AbstractVariableAttribute, v::VariableIndex)

    If the attribute attr is set for the variable v in the model model, return its value, return nothing otherwise. If the attribute attr is not supported by model then an error should be thrown instead of returning nothing.

    get(model::ModelLike, attr::AbstractVariableAttribute, v::Vector{VariableIndex})

    Return a vector of attributes corresponding to each variable in the collection v in the model model.

    get(model::ModelLike, attr::AbstractConstraintAttribute, c::ConstraintIndex)

    If the attribute attr is set for the constraint c in the model model, return its value, return nothing otherwise. If the attribute attr is not supported by model then an error should be thrown instead of returning nothing.

    get(
         model::ModelLike,
         attr::AbstractConstraintAttribute,
         c::Vector{ConstraintIndex{F,S}},
    @@ -133,4 +133,4 @@
     MOI.get(model, MOI.RelativeGapTolerance())  # returns 1e-3
     # ... and the relative gap of the obtained solution is smaller or equal to the
     # tolerance
    -MOI.get(model, MOI.RelativeGap())  # should return something ≤ 1e-3
    Warning

    The mathematical definition of "relative gap", and its allowed range, are solver-dependent. Typically, solvers expect a value between 0.0 and 1.0.

    source
    MathOptInterface.AutomaticDifferentiationBackendType
    AutomaticDifferentiationBackend() <: AbstractOptimizerAttribute

    An AbstractOptimizerAttribute for setting the automatic differentiation backend used by the solver.

    The value must be a subtype of Nonlinear.AbstractAutomaticDifferentiation.

    source

    List of attributes useful for optimizers

    MathOptInterface.TerminationStatusType
    TerminationStatus()

    A model attribute for the TerminationStatusCode explaining why the optimizer stopped.

    source
    MathOptInterface.TerminationStatusCodeType
    TerminationStatusCode

    An Enum of possible values for the TerminationStatus attribute. This attribute is meant to explain the reason why the optimizer stopped executing in the most recent call to optimize!.

    Values

    Possible values are:

    • OPTIMIZE_NOT_CALLED: The algorithm has not started.
    • OPTIMAL: The algorithm found a globally optimal solution.
    • INFEASIBLE: The algorithm concluded that no feasible solution exists.
    • DUAL_INFEASIBLE: The algorithm concluded that no dual bound exists for the problem. If, additionally, a feasible (primal) solution is known to exist, this status typically implies that the problem is unbounded, with some technical exceptions.
    • LOCALLY_SOLVED: The algorithm converged to a stationary point, local optimal solution, could not find directions for improvement, or otherwise completed its search without global guarantees.
    • LOCALLY_INFEASIBLE: The algorithm converged to an infeasible point or otherwise completed its search without finding a feasible solution, without guarantees that no feasible solution exists.
    • INFEASIBLE_OR_UNBOUNDED: The algorithm stopped because it decided that the problem is infeasible or unbounded; this occasionally happens during MIP presolve.
    • ALMOST_OPTIMAL: The algorithm found a globally optimal solution to relaxed tolerances.
    • ALMOST_INFEASIBLE: The algorithm concluded that no feasible solution exists within relaxed tolerances.
    • ALMOST_DUAL_INFEASIBLE: The algorithm concluded that no dual bound exists for the problem within relaxed tolerances.
    • ALMOST_LOCALLY_SOLVED: The algorithm converged to a stationary point, local optimal solution, or could not find directions for improvement within relaxed tolerances.
    • ITERATION_LIMIT: An iterative algorithm stopped after conducting the maximum number of iterations.
    • TIME_LIMIT: The algorithm stopped after a user-specified computation time.
    • NODE_LIMIT: A branch-and-bound algorithm stopped because it explored a maximum number of nodes in the branch-and-bound tree.
    • SOLUTION_LIMIT: The algorithm stopped because it found the required number of solutions. This is often used in MIPs to get the solver to return the first feasible solution it encounters.
    • MEMORY_LIMIT: The algorithm stopped because it ran out of memory.
    • OBJECTIVE_LIMIT: The algorithm stopped because it found a solution better than a minimum limit set by the user.
    • NORM_LIMIT: The algorithm stopped because the norm of an iterate became too large.
    • OTHER_LIMIT: The algorithm stopped due to a limit not covered by one of the _LIMIT_ statuses above.
    • SLOW_PROGRESS: The algorithm stopped because it was unable to continue making progress towards the solution.
    • NUMERICAL_ERROR: The algorithm stopped because it encountered unrecoverable numerical error.
    • INVALID_MODEL: The algorithm stopped because the model is invalid.
    • INVALID_OPTION: The algorithm stopped because it was provided an invalid option.
    • INTERRUPTED: The algorithm stopped because of an interrupt signal.
    • OTHER_ERROR: The algorithm stopped because of an error not covered by one of the statuses defined above.
    source
    MathOptInterface.OPTIMIZE_NOT_CALLEDConstant
    OPTIMIZE_NOT_CALLED::TerminationStatusCode

    An instance of the TerminationStatusCode enum.

    OPTIMIZE_NOT_CALLED: The algorithm has not started.

    source
    MathOptInterface.OPTIMALConstant
    OPTIMAL::TerminationStatusCode

    An instance of the TerminationStatusCode enum.

    OPTIMAL: The algorithm found a globally optimal solution.

    source
    MathOptInterface.INFEASIBLEConstant
    INFEASIBLE::TerminationStatusCode

    An instance of the TerminationStatusCode enum.

    INFEASIBLE: The algorithm concluded that no feasible solution exists.

    source
    MathOptInterface.DUAL_INFEASIBLEConstant
    DUAL_INFEASIBLE::TerminationStatusCode

    An instance of the TerminationStatusCode enum.

    DUAL_INFEASIBLE: The algorithm concluded that no dual bound exists for the problem. If, additionally, a feasible (primal) solution is known to exist, this status typically implies that the problem is unbounded, with some technical exceptions.

    source
    MathOptInterface.LOCALLY_SOLVEDConstant
    LOCALLY_SOLVED::TerminationStatusCode

    An instance of the TerminationStatusCode enum.

    LOCALLY_SOLVED: The algorithm converged to a stationary point, local optimal solution, could not find directions for improvement, or otherwise completed its search without global guarantees.

    source
    MathOptInterface.LOCALLY_INFEASIBLEConstant
    LOCALLY_INFEASIBLE::TerminationStatusCode

    An instance of the TerminationStatusCode enum.

    LOCALLY_INFEASIBLE: The algorithm converged to an infeasible point or otherwise completed its search without finding a feasible solution, without guarantees that no feasible solution exists.

    source
    MathOptInterface.INFEASIBLE_OR_UNBOUNDEDConstant
    INFEASIBLE_OR_UNBOUNDED::TerminationStatusCode

    An instance of the TerminationStatusCode enum.

    INFEASIBLE_OR_UNBOUNDED: The algorithm stopped because it decided that the problem is infeasible or unbounded; this occasionally happens during MIP presolve.

    source
    MathOptInterface.ALMOST_OPTIMALConstant
    ALMOST_OPTIMAL::TerminationStatusCode

    An instance of the TerminationStatusCode enum.

    ALMOST_OPTIMAL: The algorithm found a globally optimal solution to relaxed tolerances.

    source
    MathOptInterface.ALMOST_INFEASIBLEConstant
    ALMOST_INFEASIBLE::TerminationStatusCode

    An instance of the TerminationStatusCode enum.

    ALMOST_INFEASIBLE: The algorithm concluded that no feasible solution exists within relaxed tolerances.

    source
    MathOptInterface.ALMOST_DUAL_INFEASIBLEConstant
    ALMOST_DUAL_INFEASIBLE::TerminationStatusCode

    An instance of the TerminationStatusCode enum.

    ALMOST_DUAL_INFEASIBLE: The algorithm concluded that no dual bound exists for the problem within relaxed tolerances.

    source
    MathOptInterface.ALMOST_LOCALLY_SOLVEDConstant
    ALMOST_LOCALLY_SOLVED::TerminationStatusCode

    An instance of the TerminationStatusCode enum.

    ALMOST_LOCALLY_SOLVED: The algorithm converged to a stationary point, local optimal solution, or could not find directions for improvement within relaxed tolerances.

    source
    MathOptInterface.ITERATION_LIMITConstant
    ITERATION_LIMIT::TerminationStatusCode

    An instance of the TerminationStatusCode enum.

    ITERATION_LIMIT: An iterative algorithm stopped after conducting the maximum number of iterations.

    source
    MathOptInterface.TIME_LIMITConstant
    TIME_LIMIT::TerminationStatusCode

    An instance of the TerminationStatusCode enum.

    TIME_LIMIT: The algorithm stopped after a user-specified computation time.

    source
    MathOptInterface.NODE_LIMITConstant
    NODE_LIMIT::TerminationStatusCode

    An instance of the TerminationStatusCode enum.

    NODE_LIMIT: A branch-and-bound algorithm stopped because it explored a maximum number of nodes in the branch-and-bound tree.

    source
    MathOptInterface.SOLUTION_LIMITConstant
    SOLUTION_LIMIT::TerminationStatusCode

    An instance of the TerminationStatusCode enum.

    SOLUTION_LIMIT: The algorithm stopped because it found the required number of solutions. This is often used in MIPs to get the solver to return the first feasible solution it encounters.

    source
    MathOptInterface.MEMORY_LIMITConstant
    MEMORY_LIMIT::TerminationStatusCode

    An instance of the TerminationStatusCode enum.

    MEMORY_LIMIT: The algorithm stopped because it ran out of memory.

    source
    MathOptInterface.OBJECTIVE_LIMITConstant
    OBJECTIVE_LIMIT::TerminationStatusCode

    An instance of the TerminationStatusCode enum.

    OBJECTIVE_LIMIT: The algorithm stopped because it found a solution better than a minimum limit set by the user.

    source
    MathOptInterface.NORM_LIMITConstant
    NORM_LIMIT::TerminationStatusCode

    An instance of the TerminationStatusCode enum.

    NORM_LIMIT: The algorithm stopped because the norm of an iterate became too large.

    source
    MathOptInterface.OTHER_LIMITConstant
    OTHER_LIMIT::TerminationStatusCode

    An instance of the TerminationStatusCode enum.

    OTHER_LIMIT: The algorithm stopped due to a limit not covered by one of the _LIMIT_ statuses above.

    source
    MathOptInterface.SLOW_PROGRESSConstant
    SLOW_PROGRESS::TerminationStatusCode

    An instance of the TerminationStatusCode enum.

    SLOW_PROGRESS: The algorithm stopped because it was unable to continue making progress towards the solution.

    source
    MathOptInterface.NUMERICAL_ERRORConstant
    NUMERICAL_ERROR::TerminationStatusCode

    An instance of the TerminationStatusCode enum.

    NUMERICAL_ERROR: The algorithm stopped because it encountered unrecoverable numerical error.

    source
    MathOptInterface.INVALID_MODELConstant
    INVALID_MODEL::TerminationStatusCode

    An instance of the TerminationStatusCode enum.

    INVALID_MODEL: The algorithm stopped because the model is invalid.

    source
    MathOptInterface.INVALID_OPTIONConstant
    INVALID_OPTION::TerminationStatusCode

    An instance of the TerminationStatusCode enum.

    INVALID_OPTION: The algorithm stopped because it was provided an invalid option.

    source
    MathOptInterface.INTERRUPTEDConstant
    INTERRUPTED::TerminationStatusCode

    An instance of the TerminationStatusCode enum.

    INTERRUPTED: The algorithm stopped because of an interrupt signal.

    source
    MathOptInterface.OTHER_ERRORConstant
    OTHER_ERROR::TerminationStatusCode

    An instance of the TerminationStatusCode enum.

    OTHER_ERROR: The algorithm stopped because of an error not covered by one of the statuses defined above.

    source
    MathOptInterface.PrimalStatusType
    PrimalStatus(result_index::Int = 1)

    A model attribute for the ResultStatusCode of the primal result result_index. If result_index is omitted, it defaults to 1.

    See ResultCount for information on how the results are ordered.

    If result_index is larger than the value of ResultCount then NO_SOLUTION is returned.

    source
    MathOptInterface.DualStatusType
    DualStatus(result_index::Int = 1)

    A model attribute for the ResultStatusCode of the dual result result_index. If result_index is omitted, it defaults to 1.

    See ResultCount for information on how the results are ordered.

    If result_index is larger than the value of ResultCount then NO_SOLUTION is returned.

    source
    MathOptInterface.RawStatusStringType
    RawStatusString()

    A model attribute for a solver specific string explaining why the optimizer stopped.

    source
    MathOptInterface.ResultCountType
    ResultCount()

    A model attribute for the number of results available.

    Order of solutions

    A number of attributes contain an index, result_index, which is used to refer to one of the available results. Thus, result_index must be an integer between 1 and the number of available results.

    As a general rule, the first result (result_index=1) is the most important result (for example, an optimal solution or an infeasibility certificate). Other results will typically be alternate solutions that the solver found during the search for the first result.

    If a (local) optimal solution is available, that is, TerminationStatus is OPTIMAL or LOCALLY_SOLVED, the first result must correspond to the (locally) optimal solution. Other results may be alternative optimal solutions, or they may be other suboptimal solutions; use ObjectiveValue to distinguish between them.

    If a primal or dual infeasibility certificate is available, that is, TerminationStatus is INFEASIBLE or DUAL_INFEASIBLE and the corresponding PrimalStatus or DualStatus is INFEASIBILITY_CERTIFICATE, then the first result must be a certificate. Other results may be alternate certificates, or infeasible points.

    source
    MathOptInterface.ObjectiveValueType
    ObjectiveValue(result_index::Int = 1)

    A model attribute for the objective value of the primal solution result_index.

    If the solver does not have a primal value for the objective because the result_index is beyond the available solutions (whose number is indicated by the ResultCount attribute), getting this attribute must throw a ResultIndexBoundsError. Otherwise, if the result is unavailable for another reason (for instance, only a dual solution is available), the result is undefined. Users should first check PrimalStatus before accessing the ObjectiveValue attribute.

    See ResultCount for information on how the results are ordered.

    source
    MathOptInterface.DualObjectiveValueType
    DualObjectiveValue(result_index::Int = 1)

    A model attribute for the value of the objective function of the dual problem for the result_indexth dual result.

    If the solver does not have a dual value for the objective because the result_index is beyond the available solutions (whose number is indicated by the ResultCount attribute), getting this attribute must throw a ResultIndexBoundsError. Otherwise, if the result is unavailable for another reason (for instance, only a primal solution is available), the result is undefined. Users should first check DualStatus before accessing the DualObjectiveValue attribute.

    See ResultCount for information on how the results are ordered.

    source
    MathOptInterface.ObjectiveBoundType
    ObjectiveBound()

    A model attribute for the best known bound on the optimal objective value.

    source
    MathOptInterface.RelativeGapType
    RelativeGap()

    A model attribute for the final relative optimality gap.

    Warning

    The definition of this gap is solver-dependent. However, most solvers implementing this attribute define the relative gap as some variation of $\frac{|b-f|}{|f|}$, where $b$ is the best bound and $f$ is the best feasible objective value.

    source
    MathOptInterface.SolveTimeSecType
    SolveTimeSec()

    A model attribute for the total elapsed solution time (in seconds) as reported by the optimizer.

    source
    MathOptInterface.SimplexIterationsType
    SimplexIterations()

    A model attribute for the cumulative number of simplex iterations during the optimization process.

    For a mixed-integer program (MIP), the return value is the total simplex iterations for all nodes.

    source
    MathOptInterface.BarrierIterationsType
    BarrierIterations()

    A model attribute for the cumulative number of barrier iterations while solving a problem.

    source
    MathOptInterface.NodeCountType
    NodeCount()

    A model attribute for the total number of branch-and-bound nodes explored while solving a mixed-integer program (MIP).

    source

    ResultStatusCode

    MathOptInterface.ResultStatusCodeType
    ResultStatusCode

    An Enum of possible values for the PrimalStatus and DualStatus attributes.

    The values indicate how to interpret the result vector.

    Values

    Possible values are:

    • NO_SOLUTION: the result vector is empty.
    • FEASIBLE_POINT: the result vector is a feasible point.
    • NEARLY_FEASIBLE_POINT: the result vector is feasible if some constraint tolerances are relaxed.
    • INFEASIBLE_POINT: the result vector is an infeasible point.
    • INFEASIBILITY_CERTIFICATE: the result vector is an infeasibility certificate. If the PrimalStatus is INFEASIBILITY_CERTIFICATE, then the primal result vector is a certificate of dual infeasibility. If the DualStatus is INFEASIBILITY_CERTIFICATE, then the dual result vector is a proof of primal infeasibility.
    • NEARLY_INFEASIBILITY_CERTIFICATE: the result satisfies a relaxed criterion for a certificate of infeasibility.
    • REDUCTION_CERTIFICATE: the result vector is an ill-posed certificate; see this article for details. If the PrimalStatus is REDUCTION_CERTIFICATE, then the primal result vector is a proof that the dual problem is ill-posed. If the DualStatus is REDUCTION_CERTIFICATE, then the dual result vector is a proof that the primal is ill-posed.
    • NEARLY_REDUCTION_CERTIFICATE: the result satisfies a relaxed criterion for an ill-posed certificate.
    • UNKNOWN_RESULT_STATUS: the result vector contains a solution with an unknown interpretation.
    • OTHER_RESULT_STATUS: the result vector contains a solution with an interpretation not covered by one of the statuses defined above
    source
    MathOptInterface.NO_SOLUTIONConstant
    NO_SOLUTION::ResultStatusCode

    An instance of the ResultStatusCode enum.

    NO_SOLUTION: the result vector is empty.

    source
    MathOptInterface.FEASIBLE_POINTConstant
    FEASIBLE_POINT::ResultStatusCode

    An instance of the ResultStatusCode enum.

    FEASIBLE_POINT: the result vector is a feasible point.

    source
    MathOptInterface.NEARLY_FEASIBLE_POINTConstant
    NEARLY_FEASIBLE_POINT::ResultStatusCode

    An instance of the ResultStatusCode enum.

    NEARLY_FEASIBLE_POINT: the result vector is feasible if some constraint tolerances are relaxed.

    source
    MathOptInterface.INFEASIBLE_POINTConstant
    INFEASIBLE_POINT::ResultStatusCode

    An instance of the ResultStatusCode enum.

    INFEASIBLE_POINT: the result vector is an infeasible point.

    source
    MathOptInterface.INFEASIBILITY_CERTIFICATEConstant
    INFEASIBILITY_CERTIFICATE::ResultStatusCode

    An instance of the ResultStatusCode enum.

    INFEASIBILITY_CERTIFICATE: the result vector is an infeasibility certificate. If the PrimalStatus is INFEASIBILITY_CERTIFICATE, then the primal result vector is a certificate of dual infeasibility. If the DualStatus is INFEASIBILITY_CERTIFICATE, then the dual result vector is a proof of primal infeasibility.

    source
    MathOptInterface.NEARLY_INFEASIBILITY_CERTIFICATEConstant
    NEARLY_INFEASIBILITY_CERTIFICATE::ResultStatusCode

    An instance of the ResultStatusCode enum.

    NEARLY_INFEASIBILITY_CERTIFICATE: the result satisfies a relaxed criterion for a certificate of infeasibility.

    source
    MathOptInterface.REDUCTION_CERTIFICATEConstant
    REDUCTION_CERTIFICATE::ResultStatusCode

    An instance of the ResultStatusCode enum.

    REDUCTION_CERTIFICATE: the result vector is an ill-posed certificate; see this article for details. If the PrimalStatus is REDUCTION_CERTIFICATE, then the primal result vector is a proof that the dual problem is ill-posed. If the DualStatus is REDUCTION_CERTIFICATE, then the dual result vector is a proof that the primal is ill-posed.

    source
    MathOptInterface.NEARLY_REDUCTION_CERTIFICATEConstant
    NEARLY_REDUCTION_CERTIFICATE::ResultStatusCode

    An instance of the ResultStatusCode enum.

    NEARLY_REDUCTION_CERTIFICATE: the result satisfies a relaxed criterion for an ill-posed certificate.

    source
    MathOptInterface.UNKNOWN_RESULT_STATUSConstant
    UNKNOWN_RESULT_STATUS::ResultStatusCode

    An instance of the ResultStatusCode enum.

    UNKNOWN_RESULT_STATUS: the result vector contains a solution with an unknown interpretation.

    source
    MathOptInterface.OTHER_RESULT_STATUSConstant
    OTHER_RESULT_STATUS::ResultStatusCode

    An instance of the ResultStatusCode enum.

    OTHER_RESULT_STATUS: the result vector contains a solution with an interpretation not covered by one of the statuses defined above

    source

    Conflict Status

    MathOptInterface.compute_conflict!Function
    compute_conflict!(optimizer::AbstractOptimizer)

    Computes a minimal subset of constraints such that the model with the other constraint removed is still infeasible.

    Some solvers call a set of conflicting constraints an Irreducible Inconsistent Subsystem (IIS).

    See also ConflictStatus and ConstraintConflictStatus.

    Note

    If the model is modified after a call to compute_conflict!, the implementor is not obliged to purge the conflict. Any calls to the above attributes may return values for the original conflict without a warning. Similarly, when modifying the model, the conflict can be discarded.

    source
    MathOptInterface.ConflictStatusType
    ConflictStatus()

    A model attribute for the ConflictStatusCode explaining why the conflict refiner stopped when computing the conflict.

    source
    MathOptInterface.ConstraintConflictStatusType
    ConstraintConflictStatus()

    A constraint attribute indicating whether the constraint participates in the conflict. Its type is ConflictParticipationStatusCode.

    source
    MathOptInterface.ConflictStatusCodeType
    ConflictStatusCode

    An Enum of possible values for the ConflictStatus attribute. This attribute is meant to explain the reason why the conflict finder stopped executing in the most recent call to compute_conflict!.

    Possible values are:

    • COMPUTE_CONFLICT_NOT_CALLED: the function compute_conflict! has not yet been called
    • NO_CONFLICT_EXISTS: there is no conflict because the problem is feasible
    • NO_CONFLICT_FOUND: the solver could not find a conflict
    • CONFLICT_FOUND: at least one conflict could be found
    source
    MathOptInterface.ConflictParticipationStatusCodeType
    ConflictParticipationStatusCode

    An Enum of possible values for the ConstraintConflictStatus attribute. This attribute is meant to indicate whether a given constraint participates or not in the last computed conflict.

    Values

    Possible values are:

    • NOT_IN_CONFLICT: the constraint does not participate in the conflict
    • IN_CONFLICT: the constraint participates in the conflict
    • MAYBE_IN_CONFLICT: the constraint may participate in the conflict, the solver was not able to prove that the constraint can be excluded from the conflict
    source
    MathOptInterface.NOT_IN_CONFLICTConstant
    NOT_IN_CONFLICT::ConflictParticipationStatusCode

    An instance of the ConflictParticipationStatusCode enum.

    NOT_IN_CONFLICT: the constraint does not participate in the conflict

    source
    MathOptInterface.IN_CONFLICTConstant
    IN_CONFLICT::ConflictParticipationStatusCode

    An instance of the ConflictParticipationStatusCode enum.

    IN_CONFLICT: the constraint participates in the conflict

    source
    MathOptInterface.MAYBE_IN_CONFLICTConstant
    MAYBE_IN_CONFLICT::ConflictParticipationStatusCode

    An instance of the ConflictParticipationStatusCode enum.

    MAYBE_IN_CONFLICT: the constraint may participate in the conflict, the solver was not able to prove that the constraint can be excluded from the conflict

    source
    +MOI.get(model, MOI.RelativeGap()) # should return something ≤ 1e-3
    Warning

    The mathematical definition of "relative gap", and its allowed range, are solver-dependent. Typically, solvers expect a value between 0.0 and 1.0.

    source
    MathOptInterface.AutomaticDifferentiationBackendType
    AutomaticDifferentiationBackend() <: AbstractOptimizerAttribute

    An AbstractOptimizerAttribute for setting the automatic differentiation backend used by the solver.

    The value must be a subtype of Nonlinear.AbstractAutomaticDifferentiation.

    source

    List of attributes useful for optimizers

    MathOptInterface.TerminationStatusType
    TerminationStatus()

    A model attribute for the TerminationStatusCode explaining why the optimizer stopped.

    source
    MathOptInterface.TerminationStatusCodeType
    TerminationStatusCode

    An Enum of possible values for the TerminationStatus attribute. This attribute is meant to explain the reason why the optimizer stopped executing in the most recent call to optimize!.

    Values

    Possible values are:

    • OPTIMIZE_NOT_CALLED: The algorithm has not started.
    • OPTIMAL: The algorithm found a globally optimal solution.
    • INFEASIBLE: The algorithm concluded that no feasible solution exists.
    • DUAL_INFEASIBLE: The algorithm concluded that no dual bound exists for the problem. If, additionally, a feasible (primal) solution is known to exist, this status typically implies that the problem is unbounded, with some technical exceptions.
    • LOCALLY_SOLVED: The algorithm converged to a stationary point, local optimal solution, could not find directions for improvement, or otherwise completed its search without global guarantees.
    • LOCALLY_INFEASIBLE: The algorithm converged to an infeasible point or otherwise completed its search without finding a feasible solution, without guarantees that no feasible solution exists.
    • INFEASIBLE_OR_UNBOUNDED: The algorithm stopped because it decided that the problem is infeasible or unbounded; this occasionally happens during MIP presolve.
    • ALMOST_OPTIMAL: The algorithm found a globally optimal solution to relaxed tolerances.
    • ALMOST_INFEASIBLE: The algorithm concluded that no feasible solution exists within relaxed tolerances.
    • ALMOST_DUAL_INFEASIBLE: The algorithm concluded that no dual bound exists for the problem within relaxed tolerances.
    • ALMOST_LOCALLY_SOLVED: The algorithm converged to a stationary point, local optimal solution, or could not find directions for improvement within relaxed tolerances.
    • ITERATION_LIMIT: An iterative algorithm stopped after conducting the maximum number of iterations.
    • TIME_LIMIT: The algorithm stopped after a user-specified computation time.
    • NODE_LIMIT: A branch-and-bound algorithm stopped because it explored a maximum number of nodes in the branch-and-bound tree.
    • SOLUTION_LIMIT: The algorithm stopped because it found the required number of solutions. This is often used in MIPs to get the solver to return the first feasible solution it encounters.
    • MEMORY_LIMIT: The algorithm stopped because it ran out of memory.
    • OBJECTIVE_LIMIT: The algorithm stopped because it found a solution better than a minimum limit set by the user.
    • NORM_LIMIT: The algorithm stopped because the norm of an iterate became too large.
    • OTHER_LIMIT: The algorithm stopped due to a limit not covered by one of the _LIMIT_ statuses above.
    • SLOW_PROGRESS: The algorithm stopped because it was unable to continue making progress towards the solution.
    • NUMERICAL_ERROR: The algorithm stopped because it encountered unrecoverable numerical error.
    • INVALID_MODEL: The algorithm stopped because the model is invalid.
    • INVALID_OPTION: The algorithm stopped because it was provided an invalid option.
    • INTERRUPTED: The algorithm stopped because of an interrupt signal.
    • OTHER_ERROR: The algorithm stopped because of an error not covered by one of the statuses defined above.
    source
    MathOptInterface.OPTIMIZE_NOT_CALLEDConstant
    OPTIMIZE_NOT_CALLED::TerminationStatusCode

    An instance of the TerminationStatusCode enum.

    OPTIMIZE_NOT_CALLED: The algorithm has not started.

    source
    MathOptInterface.OPTIMALConstant
    OPTIMAL::TerminationStatusCode

    An instance of the TerminationStatusCode enum.

    OPTIMAL: The algorithm found a globally optimal solution.

    source
    MathOptInterface.INFEASIBLEConstant
    INFEASIBLE::TerminationStatusCode

    An instance of the TerminationStatusCode enum.

    INFEASIBLE: The algorithm concluded that no feasible solution exists.

    source
    MathOptInterface.DUAL_INFEASIBLEConstant
    DUAL_INFEASIBLE::TerminationStatusCode

    An instance of the TerminationStatusCode enum.

    DUAL_INFEASIBLE: The algorithm concluded that no dual bound exists for the problem. If, additionally, a feasible (primal) solution is known to exist, this status typically implies that the problem is unbounded, with some technical exceptions.

    source
    MathOptInterface.LOCALLY_SOLVEDConstant
    LOCALLY_SOLVED::TerminationStatusCode

    An instance of the TerminationStatusCode enum.

    LOCALLY_SOLVED: The algorithm converged to a stationary point, local optimal solution, could not find directions for improvement, or otherwise completed its search without global guarantees.

    source
    MathOptInterface.LOCALLY_INFEASIBLEConstant
    LOCALLY_INFEASIBLE::TerminationStatusCode

    An instance of the TerminationStatusCode enum.

    LOCALLY_INFEASIBLE: The algorithm converged to an infeasible point or otherwise completed its search without finding a feasible solution, without guarantees that no feasible solution exists.

    source
    MathOptInterface.INFEASIBLE_OR_UNBOUNDEDConstant
    INFEASIBLE_OR_UNBOUNDED::TerminationStatusCode

    An instance of the TerminationStatusCode enum.

    INFEASIBLE_OR_UNBOUNDED: The algorithm stopped because it decided that the problem is infeasible or unbounded; this occasionally happens during MIP presolve.

    source
    MathOptInterface.ALMOST_OPTIMALConstant
    ALMOST_OPTIMAL::TerminationStatusCode

    An instance of the TerminationStatusCode enum.

    ALMOST_OPTIMAL: The algorithm found a globally optimal solution to relaxed tolerances.

    source
    MathOptInterface.ALMOST_INFEASIBLEConstant
    ALMOST_INFEASIBLE::TerminationStatusCode

    An instance of the TerminationStatusCode enum.

    ALMOST_INFEASIBLE: The algorithm concluded that no feasible solution exists within relaxed tolerances.

    source
    MathOptInterface.ALMOST_DUAL_INFEASIBLEConstant
    ALMOST_DUAL_INFEASIBLE::TerminationStatusCode

    An instance of the TerminationStatusCode enum.

    ALMOST_DUAL_INFEASIBLE: The algorithm concluded that no dual bound exists for the problem within relaxed tolerances.

    source
    MathOptInterface.ALMOST_LOCALLY_SOLVEDConstant
    ALMOST_LOCALLY_SOLVED::TerminationStatusCode

    An instance of the TerminationStatusCode enum.

    ALMOST_LOCALLY_SOLVED: The algorithm converged to a stationary point, local optimal solution, or could not find directions for improvement within relaxed tolerances.

    source
    MathOptInterface.ITERATION_LIMITConstant
    ITERATION_LIMIT::TerminationStatusCode

    An instance of the TerminationStatusCode enum.

    ITERATION_LIMIT: An iterative algorithm stopped after conducting the maximum number of iterations.

    source
    MathOptInterface.TIME_LIMITConstant
    TIME_LIMIT::TerminationStatusCode

    An instance of the TerminationStatusCode enum.

    TIME_LIMIT: The algorithm stopped after a user-specified computation time.

    source
    MathOptInterface.NODE_LIMITConstant
    NODE_LIMIT::TerminationStatusCode

    An instance of the TerminationStatusCode enum.

    NODE_LIMIT: A branch-and-bound algorithm stopped because it explored a maximum number of nodes in the branch-and-bound tree.

    source
    MathOptInterface.SOLUTION_LIMITConstant
    SOLUTION_LIMIT::TerminationStatusCode

    An instance of the TerminationStatusCode enum.

    SOLUTION_LIMIT: The algorithm stopped because it found the required number of solutions. This is often used in MIPs to get the solver to return the first feasible solution it encounters.

    source
    MathOptInterface.MEMORY_LIMITConstant
    MEMORY_LIMIT::TerminationStatusCode

    An instance of the TerminationStatusCode enum.

    MEMORY_LIMIT: The algorithm stopped because it ran out of memory.

    source
    MathOptInterface.OBJECTIVE_LIMITConstant
    OBJECTIVE_LIMIT::TerminationStatusCode

    An instance of the TerminationStatusCode enum.

    OBJECTIVE_LIMIT: The algorithm stopped because it found a solution better than a minimum limit set by the user.

    source
    MathOptInterface.NORM_LIMITConstant
    NORM_LIMIT::TerminationStatusCode

    An instance of the TerminationStatusCode enum.

    NORM_LIMIT: The algorithm stopped because the norm of an iterate became too large.

    source
    MathOptInterface.OTHER_LIMITConstant
    OTHER_LIMIT::TerminationStatusCode

    An instance of the TerminationStatusCode enum.

    OTHER_LIMIT: The algorithm stopped due to a limit not covered by one of the _LIMIT_ statuses above.

    source
    MathOptInterface.SLOW_PROGRESSConstant
    SLOW_PROGRESS::TerminationStatusCode

    An instance of the TerminationStatusCode enum.

    SLOW_PROGRESS: The algorithm stopped because it was unable to continue making progress towards the solution.

    source
    MathOptInterface.NUMERICAL_ERRORConstant
    NUMERICAL_ERROR::TerminationStatusCode

    An instance of the TerminationStatusCode enum.

    NUMERICAL_ERROR: The algorithm stopped because it encountered unrecoverable numerical error.

    source
    MathOptInterface.INVALID_MODELConstant
    INVALID_MODEL::TerminationStatusCode

    An instance of the TerminationStatusCode enum.

    INVALID_MODEL: The algorithm stopped because the model is invalid.

    source
    MathOptInterface.INVALID_OPTIONConstant
    INVALID_OPTION::TerminationStatusCode

    An instance of the TerminationStatusCode enum.

    INVALID_OPTION: The algorithm stopped because it was provided an invalid option.

    source
    MathOptInterface.INTERRUPTEDConstant
    INTERRUPTED::TerminationStatusCode

    An instance of the TerminationStatusCode enum.

    INTERRUPTED: The algorithm stopped because of an interrupt signal.

    source
    MathOptInterface.OTHER_ERRORConstant
    OTHER_ERROR::TerminationStatusCode

    An instance of the TerminationStatusCode enum.

    OTHER_ERROR: The algorithm stopped because of an error not covered by one of the statuses defined above.

    source
    MathOptInterface.PrimalStatusType
    PrimalStatus(result_index::Int = 1)

    A model attribute for the ResultStatusCode of the primal result result_index. If result_index is omitted, it defaults to 1.

    See ResultCount for information on how the results are ordered.

    If result_index is larger than the value of ResultCount then NO_SOLUTION is returned.

    source
    MathOptInterface.DualStatusType
    DualStatus(result_index::Int = 1)

    A model attribute for the ResultStatusCode of the dual result result_index. If result_index is omitted, it defaults to 1.

    See ResultCount for information on how the results are ordered.

    If result_index is larger than the value of ResultCount then NO_SOLUTION is returned.

    source
    MathOptInterface.RawStatusStringType
    RawStatusString()

    A model attribute for a solver specific string explaining why the optimizer stopped.

    source
    MathOptInterface.ResultCountType
    ResultCount()

    A model attribute for the number of results available.

    Order of solutions

    A number of attributes contain an index, result_index, which is used to refer to one of the available results. Thus, result_index must be an integer between 1 and the number of available results.

    As a general rule, the first result (result_index=1) is the most important result (for example, an optimal solution or an infeasibility certificate). Other results will typically be alternate solutions that the solver found during the search for the first result.

    If a (local) optimal solution is available, that is, TerminationStatus is OPTIMAL or LOCALLY_SOLVED, the first result must correspond to the (locally) optimal solution. Other results may be alternative optimal solutions, or they may be other suboptimal solutions; use ObjectiveValue to distinguish between them.

    If a primal or dual infeasibility certificate is available, that is, TerminationStatus is INFEASIBLE or DUAL_INFEASIBLE and the corresponding PrimalStatus or DualStatus is INFEASIBILITY_CERTIFICATE, then the first result must be a certificate. Other results may be alternate certificates, or infeasible points.

    source
    MathOptInterface.ObjectiveValueType
    ObjectiveValue(result_index::Int = 1)

    A model attribute for the objective value of the primal solution result_index.

    If the solver does not have a primal value for the objective because the result_index is beyond the available solutions (whose number is indicated by the ResultCount attribute), getting this attribute must throw a ResultIndexBoundsError. Otherwise, if the result is unavailable for another reason (for instance, only a dual solution is available), the result is undefined. Users should first check PrimalStatus before accessing the ObjectiveValue attribute.

    See ResultCount for information on how the results are ordered.

    source
    MathOptInterface.DualObjectiveValueType
    DualObjectiveValue(result_index::Int = 1)

    A model attribute for the value of the objective function of the dual problem for the result_indexth dual result.

    If the solver does not have a dual value for the objective because the result_index is beyond the available solutions (whose number is indicated by the ResultCount attribute), getting this attribute must throw a ResultIndexBoundsError. Otherwise, if the result is unavailable for another reason (for instance, only a primal solution is available), the result is undefined. Users should first check DualStatus before accessing the DualObjectiveValue attribute.

    See ResultCount for information on how the results are ordered.

    source
    MathOptInterface.ObjectiveBoundType
    ObjectiveBound()

    A model attribute for the best known bound on the optimal objective value.

    source
    MathOptInterface.RelativeGapType
    RelativeGap()

    A model attribute for the final relative optimality gap.

    Warning

    The definition of this gap is solver-dependent. However, most solvers implementing this attribute define the relative gap as some variation of $\frac{|b-f|}{|f|}$, where $b$ is the best bound and $f$ is the best feasible objective value.

    source
    MathOptInterface.SolveTimeSecType
    SolveTimeSec()

    A model attribute for the total elapsed solution time (in seconds) as reported by the optimizer.

    source
    MathOptInterface.SimplexIterationsType
    SimplexIterations()

    A model attribute for the cumulative number of simplex iterations during the optimization process.

    For a mixed-integer program (MIP), the return value is the total simplex iterations for all nodes.

    source
    MathOptInterface.BarrierIterationsType
    BarrierIterations()

    A model attribute for the cumulative number of barrier iterations while solving a problem.

    source
    MathOptInterface.NodeCountType
    NodeCount()

    A model attribute for the total number of branch-and-bound nodes explored while solving a mixed-integer program (MIP).

    source

    ResultStatusCode

    MathOptInterface.ResultStatusCodeType
    ResultStatusCode

    An Enum of possible values for the PrimalStatus and DualStatus attributes.

    The values indicate how to interpret the result vector.

    Values

    Possible values are:

    • NO_SOLUTION: the result vector is empty.
    • FEASIBLE_POINT: the result vector is a feasible point.
    • NEARLY_FEASIBLE_POINT: the result vector is feasible if some constraint tolerances are relaxed.
    • INFEASIBLE_POINT: the result vector is an infeasible point.
    • INFEASIBILITY_CERTIFICATE: the result vector is an infeasibility certificate. If the PrimalStatus is INFEASIBILITY_CERTIFICATE, then the primal result vector is a certificate of dual infeasibility. If the DualStatus is INFEASIBILITY_CERTIFICATE, then the dual result vector is a proof of primal infeasibility.
    • NEARLY_INFEASIBILITY_CERTIFICATE: the result satisfies a relaxed criterion for a certificate of infeasibility.
    • REDUCTION_CERTIFICATE: the result vector is an ill-posed certificate; see this article for details. If the PrimalStatus is REDUCTION_CERTIFICATE, then the primal result vector is a proof that the dual problem is ill-posed. If the DualStatus is REDUCTION_CERTIFICATE, then the dual result vector is a proof that the primal is ill-posed.
    • NEARLY_REDUCTION_CERTIFICATE: the result satisfies a relaxed criterion for an ill-posed certificate.
    • UNKNOWN_RESULT_STATUS: the result vector contains a solution with an unknown interpretation.
    • OTHER_RESULT_STATUS: the result vector contains a solution with an interpretation not covered by one of the statuses defined above
    source
    MathOptInterface.NO_SOLUTIONConstant
    NO_SOLUTION::ResultStatusCode

    An instance of the ResultStatusCode enum.

    NO_SOLUTION: the result vector is empty.

    source
    MathOptInterface.FEASIBLE_POINTConstant
    FEASIBLE_POINT::ResultStatusCode

    An instance of the ResultStatusCode enum.

    FEASIBLE_POINT: the result vector is a feasible point.

    source
    MathOptInterface.NEARLY_FEASIBLE_POINTConstant
    NEARLY_FEASIBLE_POINT::ResultStatusCode

    An instance of the ResultStatusCode enum.

    NEARLY_FEASIBLE_POINT: the result vector is feasible if some constraint tolerances are relaxed.

    source
    MathOptInterface.INFEASIBLE_POINTConstant
    INFEASIBLE_POINT::ResultStatusCode

    An instance of the ResultStatusCode enum.

    INFEASIBLE_POINT: the result vector is an infeasible point.

    source
    MathOptInterface.INFEASIBILITY_CERTIFICATEConstant
    INFEASIBILITY_CERTIFICATE::ResultStatusCode

    An instance of the ResultStatusCode enum.

    INFEASIBILITY_CERTIFICATE: the result vector is an infeasibility certificate. If the PrimalStatus is INFEASIBILITY_CERTIFICATE, then the primal result vector is a certificate of dual infeasibility. If the DualStatus is INFEASIBILITY_CERTIFICATE, then the dual result vector is a proof of primal infeasibility.

    source
    MathOptInterface.NEARLY_INFEASIBILITY_CERTIFICATEConstant
    NEARLY_INFEASIBILITY_CERTIFICATE::ResultStatusCode

    An instance of the ResultStatusCode enum.

    NEARLY_INFEASIBILITY_CERTIFICATE: the result satisfies a relaxed criterion for a certificate of infeasibility.

    source
    MathOptInterface.REDUCTION_CERTIFICATEConstant
    REDUCTION_CERTIFICATE::ResultStatusCode

    An instance of the ResultStatusCode enum.

    REDUCTION_CERTIFICATE: the result vector is an ill-posed certificate; see this article for details. If the PrimalStatus is REDUCTION_CERTIFICATE, then the primal result vector is a proof that the dual problem is ill-posed. If the DualStatus is REDUCTION_CERTIFICATE, then the dual result vector is a proof that the primal is ill-posed.

    source
    MathOptInterface.NEARLY_REDUCTION_CERTIFICATEConstant
    NEARLY_REDUCTION_CERTIFICATE::ResultStatusCode

    An instance of the ResultStatusCode enum.

    NEARLY_REDUCTION_CERTIFICATE: the result satisfies a relaxed criterion for an ill-posed certificate.

    source
    MathOptInterface.UNKNOWN_RESULT_STATUSConstant
    UNKNOWN_RESULT_STATUS::ResultStatusCode

    An instance of the ResultStatusCode enum.

    UNKNOWN_RESULT_STATUS: the result vector contains a solution with an unknown interpretation.

    source
    MathOptInterface.OTHER_RESULT_STATUSConstant
    OTHER_RESULT_STATUS::ResultStatusCode

    An instance of the ResultStatusCode enum.

    OTHER_RESULT_STATUS: the result vector contains a solution with an interpretation not covered by one of the statuses defined above

    source

    Conflict Status

    MathOptInterface.compute_conflict!Function
    compute_conflict!(optimizer::AbstractOptimizer)

    Computes a minimal subset of constraints such that the model with the other constraint removed is still infeasible.

    Some solvers call a set of conflicting constraints an Irreducible Inconsistent Subsystem (IIS).

    See also ConflictStatus and ConstraintConflictStatus.

    Note

    If the model is modified after a call to compute_conflict!, the implementor is not obliged to purge the conflict. Any calls to the above attributes may return values for the original conflict without a warning. Similarly, when modifying the model, the conflict can be discarded.

    source
    MathOptInterface.ConflictStatusType
    ConflictStatus()

    A model attribute for the ConflictStatusCode explaining why the conflict refiner stopped when computing the conflict.

    source
    MathOptInterface.ConstraintConflictStatusType
    ConstraintConflictStatus()

    A constraint attribute indicating whether the constraint participates in the conflict. Its type is ConflictParticipationStatusCode.

    source
    MathOptInterface.ConflictStatusCodeType
    ConflictStatusCode

    An Enum of possible values for the ConflictStatus attribute. This attribute is meant to explain the reason why the conflict finder stopped executing in the most recent call to compute_conflict!.

    Possible values are:

    • COMPUTE_CONFLICT_NOT_CALLED: the function compute_conflict! has not yet been called
    • NO_CONFLICT_EXISTS: there is no conflict because the problem is feasible
    • NO_CONFLICT_FOUND: the solver could not find a conflict
    • CONFLICT_FOUND: at least one conflict could be found
    source
    MathOptInterface.ConflictParticipationStatusCodeType
    ConflictParticipationStatusCode

    An Enum of possible values for the ConstraintConflictStatus attribute. This attribute is meant to indicate whether a given constraint participates or not in the last computed conflict.

    Values

    Possible values are:

    • NOT_IN_CONFLICT: the constraint does not participate in the conflict
    • IN_CONFLICT: the constraint participates in the conflict
    • MAYBE_IN_CONFLICT: the constraint may participate in the conflict, the solver was not able to prove that the constraint can be excluded from the conflict
    source
    MathOptInterface.NOT_IN_CONFLICTConstant
    NOT_IN_CONFLICT::ConflictParticipationStatusCode

    An instance of the ConflictParticipationStatusCode enum.

    NOT_IN_CONFLICT: the constraint does not participate in the conflict

    source
    MathOptInterface.IN_CONFLICTConstant
    IN_CONFLICT::ConflictParticipationStatusCode

    An instance of the ConflictParticipationStatusCode enum.

    IN_CONFLICT: the constraint participates in the conflict

    source
    MathOptInterface.MAYBE_IN_CONFLICTConstant
    MAYBE_IN_CONFLICT::ConflictParticipationStatusCode

    An instance of the ConflictParticipationStatusCode enum.

    MAYBE_IN_CONFLICT: the constraint may participate in the conflict, the solver was not able to prove that the constraint can be excluded from the conflict

    source
    diff --git a/previews/PR3778/moi/reference/modification/index.html b/previews/PR3778/moi/reference/modification/index.html index 42bb4bac872..5ce1cf148fe 100644 --- a/previews/PR3778/moi/reference/modification/index.html +++ b/previews/PR3778/moi/reference/modification/index.html @@ -32,4 +32,4 @@ )

    A struct used to request a change in the quadratic coefficient of a ScalarQuadraticFunction.

    Scaling factors

    A ScalarQuadraticFunction has an implicit 0.5 scaling factor in front of the Q matrix. This modification applies to terms in the Q matrix.

    If variable_1 == variable_2, this modification sets the corresponding diagonal element of the Q matrix to new_coefficient.

    If variable_1 != variable_2, this modification is equivalent to setting both the corresponding upper- and lower-triangular elements of the Q matrix to new_coefficient.

    As a consequence:

    source
    MathOptInterface.MultirowChangeType
    MultirowChange{T}(
         variable::VariableIndex,
         new_coefficients::Vector{Tuple{Int64,T}},
    -) where {T}

    A struct used to request a change in the linear coefficients of a single variable in a vector-valued function.

    New coefficients are specified by (output_index, coefficient) tuples.

    Applicable to VectorAffineFunction and VectorQuadraticFunction.

    source
    +) where {T}

    A struct used to request a change in the linear coefficients of a single variable in a vector-valued function.

    New coefficients are specified by (output_index, coefficient) tuples.

    Applicable to VectorAffineFunction and VectorQuadraticFunction.

    source diff --git a/previews/PR3778/moi/reference/nonlinear/index.html b/previews/PR3778/moi/reference/nonlinear/index.html index ed0d1a07a36..21bbf08c746 100644 --- a/previews/PR3778/moi/reference/nonlinear/index.html +++ b/previews/PR3778/moi/reference/nonlinear/index.html @@ -79,4 +79,4 @@ )source
    MathOptInterface.constraint_exprFunction
    constraint_expr(d::AbstractNLPEvaluator, i::Integer)::Expr

    Returns a Julia Expr object representing the expression graph for the $i\text{th}$ nonlinear constraint.

    Format

    The format is the same as objective_expr, with an additional comparison operator indicating the sense of and bounds on the constraint.

    For single-sided comparisons, the body of the constraint must be on the left-hand side, and the right-hand side must be a constant.

    For double-sided comparisons (that is, $l \le f(x) \le u$), the body of the constraint must be in the middle, and the left- and right-hand sides must be constants.

    The bounds on the constraints must match the NLPBoundsPairs passed to NLPBlockData.

    Examples

    :(x[MOI.VariableIndex(1)]^2 <= 1.0)
     :(x[MOI.VariableIndex(1)]^2 >= 2.0)
     :(x[MOI.VariableIndex(1)]^2 == 3.0)
    -:(4.0 <= x[MOI.VariableIndex(1)]^2 <= 5.0)
    source
    +:(4.0 <= x[MOI.VariableIndex(1)]^2 <= 5.0)source diff --git a/previews/PR3778/moi/reference/standard_form/index.html b/previews/PR3778/moi/reference/standard_form/index.html index cff87b37d6e..95d314f9258 100644 --- a/previews/PR3778/moi/reference/standard_form/index.html +++ b/previews/PR3778/moi/reference/standard_form/index.html @@ -993,4 +993,4 @@ MOI.VectorOfVariables([t; vec(X)]), MOI.RootDetConeSquare(2), ) -MathOptInterface.ConstraintIndex{MathOptInterface.VectorOfVariables, MathOptInterface.RootDetConeSquare}(1)source +MathOptInterface.ConstraintIndex{MathOptInterface.VectorOfVariables, MathOptInterface.RootDetConeSquare}(1)source diff --git a/previews/PR3778/moi/reference/variables/index.html b/previews/PR3778/moi/reference/variables/index.html index 14d6f15eaf8..026f3ce7701 100644 --- a/previews/PR3778/moi/reference/variables/index.html +++ b/previews/PR3778/moi/reference/variables/index.html @@ -25,4 +25,4 @@ )::Bool

    Return a Bool indicating whether model supports constraining a variable to belong to a set of type S either on creation of the variable with add_constrained_variable or after the variable is created with add_constraint.

    By default, this function falls back to supports_add_constrained_variables(model, Reals) && supports_constraint(model, MOI.VariableIndex, S) which is the correct definition for most models.

    Example

    Suppose that a solver supports only two kind of variables: binary variables and continuous variables with a lower bound. If the solver decides not to support VariableIndex-in-Binary and VariableIndex-in-GreaterThan constraints, it only has to implement add_constrained_variable for these two sets which prevents the user to add both a binary constraint and a lower bound on the same variable. Moreover, if the user adds a VariableIndex-in-GreaterThan constraint, implementing this interface (that is, supports_add_constrained_variables) enables the constraint to be transparently bridged into a supported constraint.

    source
    MathOptInterface.supports_add_constrained_variablesFunction
    supports_add_constrained_variables(
         model::ModelLike,
         S::Type{<:AbstractVectorSet}
    -)::Bool

    Return a Bool indicating whether model supports constraining a vector of variables to belong to a set of type S either on creation of the vector of variables with add_constrained_variables or after the variable is created with add_constraint.

    By default, if S is Reals then this function returns true and otherwise, it falls back to supports_add_constrained_variables(model, Reals) && supports_constraint(model, MOI.VectorOfVariables, S) which is the correct definition for most models.

    Example

    In the standard conic form (see Duality), the variables are grouped into several cones and the constraints are affine equality constraints. If Reals is not one of the cones supported by the solvers then it needs to implement supports_add_constrained_variables(::Optimizer, ::Type{Reals}) = false as free variables are not supported. The solvers should then implement supports_add_constrained_variables(::Optimizer, ::Type{<:SupportedCones}) = true where SupportedCones is the union of all cone types that are supported; it does not have to implement the method supports_constraint(::Type{VectorOfVariables}, Type{<:SupportedCones}) as it should return false and it's the default. This prevents the user to constrain the same variable in two different cones. When a VectorOfVariables-in-S is added, the variables of the vector have already been created so they already belong to given cones. If bridges are enabled, the constraint will therefore be bridged by adding slack variables in S and equality constraints ensuring that the slack variables are equal to the corresponding variables of the given constraint function.

    Note that there may also be sets for which !supports_add_constrained_variables(model, S) and supports_constraint(model, MOI.VectorOfVariables, S). For instance, suppose a solver supports positive semidefinite variable constraints and two types of variables: binary variables and nonnegative variables. Then the solver should support adding VectorOfVariables-in-PositiveSemidefiniteConeTriangle constraints, but it should not support creating variables constrained to belong to the PositiveSemidefiniteConeTriangle because the variables in PositiveSemidefiniteConeTriangle should first be created as either binary or non-negative.

    source
    MathOptInterface.is_validMethod
    is_valid(model::ModelLike, index::Index)::Bool

    Return a Bool indicating whether this index refers to a valid object in the model model.

    source
    MathOptInterface.deleteMethod
    delete(model::ModelLike, index::Index)

    Delete the referenced object from the model. Throw DeleteNotAllowed if if index cannot be deleted.

    The following modifications also take effect if Index is VariableIndex:

    • If index used in the objective function, it is removed from the function, that is, it is substituted for zero.
    • For each func-in-set constraint of the model:
      • If func isa VariableIndex and func == index then the constraint is deleted.
      • If func isa VectorOfVariables and index in func.variables then
        • if length(func.variables) == 1 is one, the constraint is deleted;
        • if length(func.variables) > 1 and supports_dimension_update(set) then then the variable is removed from func and set is replaced by update_dimension(set, MOI.dimension(set) - 1).
        • Otherwise, a DeleteNotAllowed error is thrown.
      • Otherwise, the variable is removed from func, that is, it is substituted for zero.
    source
    MathOptInterface.deleteMethod
    delete(model::ModelLike, indices::Vector{R<:Index}) where {R}

    Delete the referenced objects in the vector indices from the model. It may be assumed that R is a concrete type. The default fallback sequentially deletes the individual items in indices, although specialized implementations may be more efficient.

    source

    Attributes

    MathOptInterface.AbstractVariableAttributeType
    AbstractVariableAttribute

    Abstract supertype for attribute objects that can be used to set or get attributes (properties) of variables in the model.

    source
    MathOptInterface.VariableNameType
    VariableName()

    A variable attribute for a string identifying the variable. It is valid for two variables to have the same name; however, variables with duplicate names cannot be looked up using get. It has a default value of "" if not set`.

    source
    MathOptInterface.VariablePrimalStartType
    VariablePrimalStart()

    A variable attribute for the initial assignment to some primal variable's value that the optimizer may use to warm-start the solve. May be a number or nothing (unset).

    source
    MathOptInterface.VariablePrimalType
    VariablePrimal(result_index::Int = 1)

    A variable attribute for the assignment to some primal variable's value in result result_index. If result_index is omitted, it is 1 by default.

    If the solver does not have a primal value for the variable because the result_index is beyond the available solutions (whose number is indicated by the ResultCount attribute), getting this attribute must throw a ResultIndexBoundsError. Otherwise, if the result is unavailable for another reason (for instance, only a dual solution is available), the result is undefined. Users should first check PrimalStatus before accessing the VariablePrimal attribute.

    See ResultCount for information on how the results are ordered.

    source
    MathOptInterface.VariableBasisStatusType
    VariableBasisStatus(result_index::Int = 1)

    A variable attribute for the BasisStatusCode of a variable in result result_index, with respect to an available optimal solution basis.

    If the solver does not have a basis status for the variable because the result_index is beyond the available solutions (whose number is indicated by the ResultCount attribute), getting this attribute must throw a ResultIndexBoundsError. Otherwise, if the result is unavailable for another reason (for instance, only a dual solution is available), the result is undefined. Users should first check PrimalStatus before accessing the VariableBasisStatus attribute.

    See ResultCount for information on how the results are ordered.

    source
    +)::Bool

    Return a Bool indicating whether model supports constraining a vector of variables to belong to a set of type S either on creation of the vector of variables with add_constrained_variables or after the variable is created with add_constraint.

    By default, if S is Reals then this function returns true and otherwise, it falls back to supports_add_constrained_variables(model, Reals) && supports_constraint(model, MOI.VectorOfVariables, S) which is the correct definition for most models.

    Example

    In the standard conic form (see Duality), the variables are grouped into several cones and the constraints are affine equality constraints. If Reals is not one of the cones supported by the solvers then it needs to implement supports_add_constrained_variables(::Optimizer, ::Type{Reals}) = false as free variables are not supported. The solvers should then implement supports_add_constrained_variables(::Optimizer, ::Type{<:SupportedCones}) = true where SupportedCones is the union of all cone types that are supported; it does not have to implement the method supports_constraint(::Type{VectorOfVariables}, Type{<:SupportedCones}) as it should return false and it's the default. This prevents the user to constrain the same variable in two different cones. When a VectorOfVariables-in-S is added, the variables of the vector have already been created so they already belong to given cones. If bridges are enabled, the constraint will therefore be bridged by adding slack variables in S and equality constraints ensuring that the slack variables are equal to the corresponding variables of the given constraint function.

    Note that there may also be sets for which !supports_add_constrained_variables(model, S) and supports_constraint(model, MOI.VectorOfVariables, S). For instance, suppose a solver supports positive semidefinite variable constraints and two types of variables: binary variables and nonnegative variables. Then the solver should support adding VectorOfVariables-in-PositiveSemidefiniteConeTriangle constraints, but it should not support creating variables constrained to belong to the PositiveSemidefiniteConeTriangle because the variables in PositiveSemidefiniteConeTriangle should first be created as either binary or non-negative.

    source
    MathOptInterface.is_validMethod
    is_valid(model::ModelLike, index::Index)::Bool

    Return a Bool indicating whether this index refers to a valid object in the model model.

    source
    MathOptInterface.deleteMethod
    delete(model::ModelLike, index::Index)

    Delete the referenced object from the model. Throw DeleteNotAllowed if if index cannot be deleted.

    The following modifications also take effect if Index is VariableIndex:

    • If index used in the objective function, it is removed from the function, that is, it is substituted for zero.
    • For each func-in-set constraint of the model:
      • If func isa VariableIndex and func == index then the constraint is deleted.
      • If func isa VectorOfVariables and index in func.variables then
        • if length(func.variables) == 1 is one, the constraint is deleted;
        • if length(func.variables) > 1 and supports_dimension_update(set) then then the variable is removed from func and set is replaced by update_dimension(set, MOI.dimension(set) - 1).
        • Otherwise, a DeleteNotAllowed error is thrown.
      • Otherwise, the variable is removed from func, that is, it is substituted for zero.
    source
    MathOptInterface.deleteMethod
    delete(model::ModelLike, indices::Vector{R<:Index}) where {R}

    Delete the referenced objects in the vector indices from the model. It may be assumed that R is a concrete type. The default fallback sequentially deletes the individual items in indices, although specialized implementations may be more efficient.

    source

    Attributes

    MathOptInterface.AbstractVariableAttributeType
    AbstractVariableAttribute

    Abstract supertype for attribute objects that can be used to set or get attributes (properties) of variables in the model.

    source
    MathOptInterface.VariableNameType
    VariableName()

    A variable attribute for a string identifying the variable. It is valid for two variables to have the same name; however, variables with duplicate names cannot be looked up using get. It has a default value of "" if not set`.

    source
    MathOptInterface.VariablePrimalStartType
    VariablePrimalStart()

    A variable attribute for the initial assignment to some primal variable's value that the optimizer may use to warm-start the solve. May be a number or nothing (unset).

    source
    MathOptInterface.VariablePrimalType
    VariablePrimal(result_index::Int = 1)

    A variable attribute for the assignment to some primal variable's value in result result_index. If result_index is omitted, it is 1 by default.

    If the solver does not have a primal value for the variable because the result_index is beyond the available solutions (whose number is indicated by the ResultCount attribute), getting this attribute must throw a ResultIndexBoundsError. Otherwise, if the result is unavailable for another reason (for instance, only a dual solution is available), the result is undefined. Users should first check PrimalStatus before accessing the VariablePrimal attribute.

    See ResultCount for information on how the results are ordered.

    source
    MathOptInterface.VariableBasisStatusType
    VariableBasisStatus(result_index::Int = 1)

    A variable attribute for the BasisStatusCode of a variable in result result_index, with respect to an available optimal solution basis.

    If the solver does not have a basis status for the variable because the result_index is beyond the available solutions (whose number is indicated by the ResultCount attribute), getting this attribute must throw a ResultIndexBoundsError. Otherwise, if the result is unavailable for another reason (for instance, only a dual solution is available), the result is undefined. Users should first check PrimalStatus before accessing the VariableBasisStatus attribute.

    See ResultCount for information on how the results are ordered.

    source
    diff --git a/previews/PR3778/moi/release_notes/index.html b/previews/PR3778/moi/release_notes/index.html index 47d3defd747..0ad520f5831 100644 --- a/previews/PR3778/moi/release_notes/index.html +++ b/previews/PR3778/moi/release_notes/index.html @@ -31,4 +31,4 @@ end write(path, s) end -end

    v0.9.22 (May 22, 2021)

    This release contains backports from the ongoing development of the v0.10 release.

    v0.9.21 (April 23, 2021)

    v0.9.20 (February 20, 2021)

    v0.9.19 (December 1, 2020)

    v0.9.18 (November 3, 2020)

    v0.9.17 (September 21, 2020)

    v0.9.16 (September 17, 2020)

    v0.9.15 (September 14, 2020)

    v0.9.14 (May 30, 2020)

    v0.9.13 (March 24, 2020)

    v0.9.12 (February 28, 2020)

    v0.9.11 (February 21, 2020)

    v0.9.10 (January 31, 2020)

    v0.9.9 (December 29, 2019)

    v0.9.8 (December 19, 2019)

    v0.9.7 (October 30, 2019)

    v0.9.6 (October 25, 2019)

    v0.9.5 (October 9, 2019)

    v0.9.4 (October 2, 2019)

    v0.9.3 (September 20, 2019)

    v0.9.2 (September 5, 2019)

    v0.9.1 (August 22, 2019)

    v0.9.0 (August 13, 2019)

    v0.8.4 (March 13, 2019)

    v0.8.3 (March 6, 2019)

    v0.8.2 (February 7, 2019)

    v0.8.1 (January 7, 2019)

    v0.8.0 (December 18, 2018)

    v0.7.0 (December 13, 2018)

    v0.6.4 (November 27, 2018)

    v0.6.3 (November 16, 2018)

    v0.6.2 (October 26, 2018)

    v0.6.1 (September 22, 2018)

    v0.6.0 (August 30, 2018)

    v0.5.0 (August 5, 2018)

    v0.4.1 (June 28, 2018)

    v0.4.0 (June 23, 2018)

    v0.3.0 (May 25, 2018)

    v0.2.0 (April 24, 2018)

    v0.1.0 (February 28, 2018)

    +end

    v0.9.22 (May 22, 2021)

    This release contains backports from the ongoing development of the v0.10 release.

    v0.9.21 (April 23, 2021)

    v0.9.20 (February 20, 2021)

    v0.9.19 (December 1, 2020)

    v0.9.18 (November 3, 2020)

    v0.9.17 (September 21, 2020)

    v0.9.16 (September 17, 2020)

    v0.9.15 (September 14, 2020)

    v0.9.14 (May 30, 2020)

    v0.9.13 (March 24, 2020)

    v0.9.12 (February 28, 2020)

    v0.9.11 (February 21, 2020)

    v0.9.10 (January 31, 2020)

    v0.9.9 (December 29, 2019)

    v0.9.8 (December 19, 2019)

    v0.9.7 (October 30, 2019)

    v0.9.6 (October 25, 2019)

    v0.9.5 (October 9, 2019)

    v0.9.4 (October 2, 2019)

    v0.9.3 (September 20, 2019)

    v0.9.2 (September 5, 2019)

    v0.9.1 (August 22, 2019)

    v0.9.0 (August 13, 2019)

    v0.8.4 (March 13, 2019)

    v0.8.3 (March 6, 2019)

    v0.8.2 (February 7, 2019)

    v0.8.1 (January 7, 2019)

    v0.8.0 (December 18, 2018)

    v0.7.0 (December 13, 2018)

    v0.6.4 (November 27, 2018)

    v0.6.3 (November 16, 2018)

    v0.6.2 (October 26, 2018)

    v0.6.1 (September 22, 2018)

    v0.6.0 (August 30, 2018)

    v0.5.0 (August 5, 2018)

    v0.4.1 (June 28, 2018)

    v0.4.0 (June 23, 2018)

    v0.3.0 (May 25, 2018)

    v0.2.0 (April 24, 2018)

    v0.1.0 (February 28, 2018)

    diff --git a/previews/PR3778/moi/submodules/Benchmarks/overview/index.html b/previews/PR3778/moi/submodules/Benchmarks/overview/index.html index ac406b36f73..a8462c1fb68 100644 --- a/previews/PR3778/moi/submodules/Benchmarks/overview/index.html +++ b/previews/PR3778/moi/submodules/Benchmarks/overview/index.html @@ -21,4 +21,4 @@ MOI.Benchmarks.compare_against_baseline( suite, "current"; directory = "/tmp", verbose = true -)

    This comparison will create a report detailing improvements and regressions.

    +)

    This comparison will create a report detailing improvements and regressions.

    diff --git a/previews/PR3778/moi/submodules/Benchmarks/reference/index.html b/previews/PR3778/moi/submodules/Benchmarks/reference/index.html index d0fec0afa51..46bb27364ed 100644 --- a/previews/PR3778/moi/submodules/Benchmarks/reference/index.html +++ b/previews/PR3778/moi/submodules/Benchmarks/reference/index.html @@ -18,4 +18,4 @@ )

    Run all benchmarks in suite and compare against files called name in directory that were created by a call to create_baseline.

    A report summarizing the comparison is written to report_filename in directory.

    Extra kwargs are based to BenchmarkTools.run.

    Examples

    my_suite = suite(() -> GLPK.Optimizer())
     compare_against_baseline(
         my_suite, "glpk_master"; directory = "/tmp", verbose = true
    -)
    source +)source diff --git a/previews/PR3778/moi/submodules/Bridges/implementation/index.html b/previews/PR3778/moi/submodules/Bridges/implementation/index.html index 2435bd44773..4f895ae9678 100644 --- a/previews/PR3778/moi/submodules/Bridges/implementation/index.html +++ b/previews/PR3778/moi/submodules/Bridges/implementation/index.html @@ -33,4 +33,4 @@ Subject to: ScalarAffineFunction{Int64}-in-LessThan{Int64} - (0) - (1) x <= (-1) + (0) - (1) x <= (-1) diff --git a/previews/PR3778/moi/submodules/Bridges/list_of_bridges/index.html b/previews/PR3778/moi/submodules/Bridges/list_of_bridges/index.html index 4c0e18534ad..cb2393a634d 100644 --- a/previews/PR3778/moi/submodules/Bridges/list_of_bridges/index.html +++ b/previews/PR3778/moi/submodules/Bridges/list_of_bridges/index.html @@ -128,4 +128,4 @@ & & & x_{11} & x_{12} & x_{13} \\ & & & & x_{22} & x_{23} \\ & & & & & x_{33} -\end{bmatrix}\]

    is positive semidefinite.

    The bridge achieves this reformulation by adding a new set of variables in MOI.PositiveSemidefiniteConeTriangle(6), and then adding three groups of equality constraints to:

    source
    MathOptInterface.Bridges.Variable.NonposToNonnegBridgeType
    NonposToNonnegBridge{T} <: Bridges.Variable.AbstractBridge

    NonposToNonnegBridge implements the following reformulation:

    • $x \in \mathbb{R}_-$ into $y \in \mathbb{R}_+$ with the substitution rule $x = -y$,

    where T is the coefficient type of -y.

    Source node

    NonposToNonnegBridge supports:

    Target nodes

    NonposToNonnegBridge creates:

    source
    MathOptInterface.Bridges.Variable.ParameterToEqualToBridgeType
    ParameterToEqualToBridge{T} <: Bridges.Variable.AbstractBridge

    ParameterToEqualToBridge implements the following reformulation:

    • $x \in Parameter(v)$ into $x == v$

    Source node

    ParameterToEqualToBridge supports:

    Target nodes

    ParameterToEqualToBridge creates:

    source
    MathOptInterface.Bridges.Variable.RSOCtoPSDBridgeType
    RSOCtoPSDBridge{T} <: Bridges.Variable.AbstractBridge

    RSOCtoPSDBridge implements the following reformulation:

    • $||x||_2^2 \le 2tu$ where $t, u \ge 0$ into $Y \succeq 0$, with the substitution rule: $Y = \left[\begin{array}{c c}t & x^\top \\ x & 2u \mathbf{I}\end{array}\right].$

    Additional bounds are added to ensure the off-diagonals of the $2uI$ submatrix are 0, and linear constraints are added to ensure the diagonal of $2uI$ takes the same values.

    As a special case, if $|x|| = 0$, then RSOCtoPSDBridge reformulates into $(t, u) \in \mathbb{R}_+$.

    Source node

    RSOCtoPSDBridge supports:

    Target nodes

    RSOCtoPSDBridge creates:

    source
    MathOptInterface.Bridges.Variable.RSOCtoSOCBridgeType
    RSOCtoSOCBridge{T} <: Bridges.Variable.AbstractBridge

    RSOCtoSOCBridge implements the following reformulation:

    • $||x||_2^2 \le 2tu$ into $||v||_2 \le w$, with the substitution rules $t = \frac{w}{\sqrt 2} + \frac{v_1}{\sqrt 2}$, $u = \frac{w}{\sqrt 2} - \frac{v_1}{\sqrt 2}$, and $x = (v_2,\ldots,v_N)$.

    Source node

    RSOCtoSOCBridge supports:

    Target node

    RSOCtoSOCBridge creates:

    source
    MathOptInterface.Bridges.Variable.SOCtoRSOCBridgeType
    SOCtoRSOCBridge{T} <: Bridges.Variable.AbstractBridge

    SOCtoRSOCBridge implements the following reformulation:

    • $||x||_2 \le t$ into $2uv \ge ||w||_2^2$, with the substitution rules $t = \frac{u}{\sqrt 2} + \frac{v}{\sqrt 2}$, $x = (\frac{u}{\sqrt 2} - \frac{v}{\sqrt 2}, w)$.

    Assumptions

    • SOCtoRSOCBridge assumes that $|x| \ge 1$.

    Source node

    SOCtoRSOCBridge supports:

    Target node

    SOCtoRSOCBridge creates:

    source
    MathOptInterface.Bridges.Variable.SetMapBridgeType
    abstract type SetMapBridge{T,S1,S2} <: AbstractBridge end

    Consider two type of sets, S1 and S2, and a linear mapping A such that the image of a set of type S1 under A is a set of type S2.

    A SetMapBridge{T,S1,S2} is a bridge that substitutes constrained variables in S2 into the image through A of constrained variables in S1.

    The linear map A is described by:

    Implementing a method for these two functions is sufficient to bridge constrained variables. However, in order for the getters and setters of attributes such as dual solutions and starting values to work as well, a method for the following functions must be implemented:

    See the docstrings of each function to see which feature would be missing if it was not implemented for a given bridge.

    source
    MathOptInterface.Bridges.Variable.VectorizeBridgeType
    VectorizeBridge{T,S} <: Bridges.Variable.AbstractBridge

    VectorizeBridge implements the following reformulations:

    • $x \ge a$ into $[y] \in \mathbb{R}_+$ with the substitution rule $x = a + y$
    • $x \le a$ into $[y] \in \mathbb{R}_-$ with the substitution rule $x = a + y$
    • $x == a$ into $[y] \in \{0\}$ with the substitution rule $x = a + y$

    where T is the coefficient type of a + y.

    Source node

    VectorizeBridge supports:

    Target nodes

    VectorizeBridge creates:

    source
    MathOptInterface.Bridges.Variable.ZerosBridgeType
    ZerosBridge{T} <: Bridges.Variable.AbstractBridge

    ZerosBridge implements the following reformulation:

    • $x \in \{0\}$ into the substitution rule $x = 0$,

    where T is the coefficient type of 0.

    Source node

    ZerosBridge supports:

    Target nodes

    ZerosBridge does not create target nodes. It replaces all instances of x with 0 via substitution. This means that no variables are created in the underlying model.

    Caveats

    The bridged variables are similar to parameters with zero values. Parameters with non-zero values can be created with constrained variables in MOI.EqualTo by combining a VectorizeBridge and this bridge.

    However, functions modified by ZerosBridge cannot be unbridged. That is, for a given function, we cannot determine if the bridged variables were used.

    A related implication is that this bridge does not support MOI.ConstraintDual. However, if a MOI.Utilities.CachingOptimizer is used, the dual can be determined by the bridged optimizer using MOI.Utilities.get_fallback because the caching optimizer records the unbridged function.

    source
    +\end{bmatrix}\]

    is positive semidefinite.

    The bridge achieves this reformulation by adding a new set of variables in MOI.PositiveSemidefiniteConeTriangle(6), and then adding three groups of equality constraints to:

    source
    MathOptInterface.Bridges.Variable.NonposToNonnegBridgeType
    NonposToNonnegBridge{T} <: Bridges.Variable.AbstractBridge

    NonposToNonnegBridge implements the following reformulation:

    • $x \in \mathbb{R}_-$ into $y \in \mathbb{R}_+$ with the substitution rule $x = -y$,

    where T is the coefficient type of -y.

    Source node

    NonposToNonnegBridge supports:

    Target nodes

    NonposToNonnegBridge creates:

    source
    MathOptInterface.Bridges.Variable.ParameterToEqualToBridgeType
    ParameterToEqualToBridge{T} <: Bridges.Variable.AbstractBridge

    ParameterToEqualToBridge implements the following reformulation:

    • $x \in Parameter(v)$ into $x == v$

    Source node

    ParameterToEqualToBridge supports:

    Target nodes

    ParameterToEqualToBridge creates:

    source
    MathOptInterface.Bridges.Variable.RSOCtoPSDBridgeType
    RSOCtoPSDBridge{T} <: Bridges.Variable.AbstractBridge

    RSOCtoPSDBridge implements the following reformulation:

    • $||x||_2^2 \le 2tu$ where $t, u \ge 0$ into $Y \succeq 0$, with the substitution rule: $Y = \left[\begin{array}{c c}t & x^\top \\ x & 2u \mathbf{I}\end{array}\right].$

    Additional bounds are added to ensure the off-diagonals of the $2uI$ submatrix are 0, and linear constraints are added to ensure the diagonal of $2uI$ takes the same values.

    As a special case, if $|x|| = 0$, then RSOCtoPSDBridge reformulates into $(t, u) \in \mathbb{R}_+$.

    Source node

    RSOCtoPSDBridge supports:

    Target nodes

    RSOCtoPSDBridge creates:

    source
    MathOptInterface.Bridges.Variable.RSOCtoSOCBridgeType
    RSOCtoSOCBridge{T} <: Bridges.Variable.AbstractBridge

    RSOCtoSOCBridge implements the following reformulation:

    • $||x||_2^2 \le 2tu$ into $||v||_2 \le w$, with the substitution rules $t = \frac{w}{\sqrt 2} + \frac{v_1}{\sqrt 2}$, $u = \frac{w}{\sqrt 2} - \frac{v_1}{\sqrt 2}$, and $x = (v_2,\ldots,v_N)$.

    Source node

    RSOCtoSOCBridge supports:

    Target node

    RSOCtoSOCBridge creates:

    source
    MathOptInterface.Bridges.Variable.SOCtoRSOCBridgeType
    SOCtoRSOCBridge{T} <: Bridges.Variable.AbstractBridge

    SOCtoRSOCBridge implements the following reformulation:

    • $||x||_2 \le t$ into $2uv \ge ||w||_2^2$, with the substitution rules $t = \frac{u}{\sqrt 2} + \frac{v}{\sqrt 2}$, $x = (\frac{u}{\sqrt 2} - \frac{v}{\sqrt 2}, w)$.

    Assumptions

    • SOCtoRSOCBridge assumes that $|x| \ge 1$.

    Source node

    SOCtoRSOCBridge supports:

    Target node

    SOCtoRSOCBridge creates:

    source
    MathOptInterface.Bridges.Variable.SetMapBridgeType
    abstract type SetMapBridge{T,S1,S2} <: AbstractBridge end

    Consider two type of sets, S1 and S2, and a linear mapping A such that the image of a set of type S1 under A is a set of type S2.

    A SetMapBridge{T,S1,S2} is a bridge that substitutes constrained variables in S2 into the image through A of constrained variables in S1.

    The linear map A is described by:

    Implementing a method for these two functions is sufficient to bridge constrained variables. However, in order for the getters and setters of attributes such as dual solutions and starting values to work as well, a method for the following functions must be implemented:

    See the docstrings of each function to see which feature would be missing if it was not implemented for a given bridge.

    source
    MathOptInterface.Bridges.Variable.VectorizeBridgeType
    VectorizeBridge{T,S} <: Bridges.Variable.AbstractBridge

    VectorizeBridge implements the following reformulations:

    • $x \ge a$ into $[y] \in \mathbb{R}_+$ with the substitution rule $x = a + y$
    • $x \le a$ into $[y] \in \mathbb{R}_-$ with the substitution rule $x = a + y$
    • $x == a$ into $[y] \in \{0\}$ with the substitution rule $x = a + y$

    where T is the coefficient type of a + y.

    Source node

    VectorizeBridge supports:

    Target nodes

    VectorizeBridge creates:

    source
    MathOptInterface.Bridges.Variable.ZerosBridgeType
    ZerosBridge{T} <: Bridges.Variable.AbstractBridge

    ZerosBridge implements the following reformulation:

    • $x \in \{0\}$ into the substitution rule $x = 0$,

    where T is the coefficient type of 0.

    Source node

    ZerosBridge supports:

    Target nodes

    ZerosBridge does not create target nodes. It replaces all instances of x with 0 via substitution. This means that no variables are created in the underlying model.

    Caveats

    The bridged variables are similar to parameters with zero values. Parameters with non-zero values can be created with constrained variables in MOI.EqualTo by combining a VectorizeBridge and this bridge.

    However, functions modified by ZerosBridge cannot be unbridged. That is, for a given function, we cannot determine if the bridged variables were used.

    A related implication is that this bridge does not support MOI.ConstraintDual. However, if a MOI.Utilities.CachingOptimizer is used, the dual can be determined by the bridged optimizer using MOI.Utilities.get_fallback because the caching optimizer records the unbridged function.

    source
    diff --git a/previews/PR3778/moi/submodules/Bridges/overview/index.html b/previews/PR3778/moi/submodules/Bridges/overview/index.html index 3d381cddef4..7bbac1724ce 100644 --- a/previews/PR3778/moi/submodules/Bridges/overview/index.html +++ b/previews/PR3778/moi/submodules/Bridges/overview/index.html @@ -54,4 +54,4 @@ julia> MOI.get(inner_optimizer, MOI.ListOfConstraintTypesPresent()) 1-element Vector{Tuple{Type, Type}}: - (MathOptInterface.VariableIndex, MathOptInterface.Interval{Float64}) + (MathOptInterface.VariableIndex, MathOptInterface.Interval{Float64}) diff --git a/previews/PR3778/moi/submodules/Bridges/reference/index.html b/previews/PR3778/moi/submodules/Bridges/reference/index.html index b6267f67f68..cfcaba6a51d 100644 --- a/previews/PR3778/moi/submodules/Bridges/reference/index.html +++ b/previews/PR3778/moi/submodules/Bridges/reference/index.html @@ -228,4 +228,4 @@ cost::Int, )

    As an alternative to variable_node, add a virtual edge to graph that represents adding a free variable, followed by a constraint of type constraint_node, with bridging cost cost.

    Why is this needed?

    Variables can either be added as a variable constrained on creation, or as a free variable which then has a constraint added to it.

    source
    MathOptInterface.Bridges.bridge_indexFunction
    bridge_index(graph::Graph, node::VariableNode)::Int
     bridge_index(graph::Graph, node::ConstraintNode)::Int
    -bridge_index(graph::Graph, node::ObjectiveNode)::Int

    Return the optimal index of the bridge to chose from node.

    source
    MathOptInterface.Bridges.is_variable_edge_bestFunction
    is_variable_edge_best(graph::Graph, node::VariableNode)::Bool

    Return a Bool indicating whether node should be added as a variable constrained on creation, or as a free variable followed by a constraint.

    source
    +bridge_index(graph::Graph, node::ObjectiveNode)::Int

    Return the optimal index of the bridge to chose from node.

    source
    MathOptInterface.Bridges.is_variable_edge_bestFunction
    is_variable_edge_best(graph::Graph, node::VariableNode)::Bool

    Return a Bool indicating whether node should be added as a variable constrained on creation, or as a free variable followed by a constraint.

    source
    diff --git a/previews/PR3778/moi/submodules/FileFormats/overview/index.html b/previews/PR3778/moi/submodules/FileFormats/overview/index.html index 2382b9ebc6e..c8f90c54e42 100644 --- a/previews/PR3778/moi/submodules/FileFormats/overview/index.html +++ b/previews/PR3778/moi/submodules/FileFormats/overview/index.html @@ -148,4 +148,4 @@ path: [variables][1] instance: Dict{String, Any}("NaMe" => "x") schema key: required -schema value: Any["name"] +schema value: Any["name"] diff --git a/previews/PR3778/moi/submodules/FileFormats/reference/index.html b/previews/PR3778/moi/submodules/FileFormats/reference/index.html index 88f427a0c58..b75a20c2757 100644 --- a/previews/PR3778/moi/submodules/FileFormats/reference/index.html +++ b/previews/PR3778/moi/submodules/FileFormats/reference/index.html @@ -19,4 +19,4 @@ \end{align}\]

    In other words, the standard conic form contains nonnegative and positive semidefinite variables with equality constraints. That is, in the MathOptInterface's terminology, MOI.VectorOfVariables-in-MOI.Nonnegatives, MOI.VectorOfVariables-in-MOI.PositiveSemidefiniteConeTriangle and MOI.ScalarAffineFunction-in-MOI.EqualTo constraints.

    If a model is in standard conic form, use Dualization.jl to transform it into the geometric conic form before writting it. Otherwise, the nonnegative (resp. positive semidefinite) variables will be bridged into free variables with affine constraints constraining them to belong to the nonnegative orthant (resp. positive semidefinite cone) by the MOI.Bridges.Constraint.VectorFunctionizeBridge. Moreover, equality constraints will be bridged into pairs of affine constraints in the nonnegative orthant by the MOI.Bridges.Constraint.SplitIntervalBridge and then the MOI.Bridges.Constraint.VectorizeBridge.

    If a solver is in standard conic form, use Dualization.jl to transform the model read into standard conic form before copying it to the solver. Otherwise, the free variables will be bridged into pairs of variables in the nonnegative orthant by the MOI.Bridges.Variable.FreeBridge and affine constraints will be bridged into equality constraints by creating a slack variable by the MOI.Bridges.Constraint.VectorSlackBridge.

    source

    Other helpers

    MathOptInterface.FileFormats.NL.SolFileResultsType
    SolFileResults(filename::String, model::Model)

    Parse the .sol file filename created by solving model and return a SolFileResults struct.

    The returned struct supports the MOI.get API for querying result attributes such as MOI.TerminationStatus, MOI.VariablePrimal, and MOI.ConstraintDual.

    source
    SolFileResults(
         raw_status::String,
         termination_status::MOI.TerminationStatusCode,
    -)

    Return a SolFileResults struct with MOI.RawStatusString set to raw_status, MOI.TerminationStatus set to termination_status, and MOI.PrimalStatus and MOI.DualStatus set to NO_SOLUTION.

    All other attributes are un-set.

    source
    +)

    Return a SolFileResults struct with MOI.RawStatusString set to raw_status, MOI.TerminationStatus set to termination_status, and MOI.PrimalStatus and MOI.DualStatus set to NO_SOLUTION.

    All other attributes are un-set.

    source diff --git a/previews/PR3778/moi/submodules/Nonlinear/overview/index.html b/previews/PR3778/moi/submodules/Nonlinear/overview/index.html index ffaff408497..6a6217b4689 100644 --- a/previews/PR3778/moi/submodules/Nonlinear/overview/index.html +++ b/previews/PR3778/moi/submodules/Nonlinear/overview/index.html @@ -184,4 +184,4 @@ Node(NODE_VARIABLE, 1, 1), ], [2.0], - );

    The ordering of the nodes in the tape must satisfy two rules:

    Design goals

    This is less readable than the other options, but does this data structure meet our design goals?

    Instead of a heap-allocated object for each node, we only have two Vectors for each expression, nodes and values, as well as two constant vectors for the OPERATORS. In addition, all fields are concretely typed, and there are no Union or Any types.

    For our third goal, it is not easy to identify the children of a node, but it is easy to identify the parent of any node. Therefore, we can use Nonlinear.adjacency_matrix to compute a sparse matrix that maps parents to their children.

    The design in practice

    In practice, Node and Expression are exactly Nonlinear.Node and Nonlinear.Expression. However, Nonlinear.NodeType has more fields to account for comparison operators such as :>= and :<=, logic operators such as :&& and :||, nonlinear parameters, and nested subexpressions.

    Moreover, instead of storing the operators as global constants, they are stored in Nonlinear.OperatorRegistry, and it also stores a vector of logic operators and a vector of comparison operators. In addition to Nonlinear.DEFAULT_UNIVARIATE_OPERATORS and Nonlinear.DEFAULT_MULTIVARIATE_OPERATORS, you can register user-defined functions using Nonlinear.register_operator.

    Nonlinear.Model is a struct that stores the Nonlinear.OperatorRegistry, as well as a list of parameters and subexpressions in the model.

    ReverseAD

    Nonlinear.ReverseAD is a submodule for computing derivatives of a nonlinear optimization problem using sparse reverse-mode automatic differentiation (AD).

    This section does not attempt to explain how sparse reverse-mode AD works, but instead explains why MOI contains its own implementation, and highlights notable differences from similar packages.

    Warning

    Don't use the API in ReverseAD to compute derivatives. Instead, create a Nonlinear.Evaluator object with Nonlinear.SparseReverseMode as the backend, and then query the MOI API methods.

    Design goals

    The JuliaDiff organization maintains a list of packages for doing AD in Julia. At last count, there were at least ten packages——not including ReverseAD——for reverse-mode AD in Julia. ReverseAD exists because it has a different set of design goals.

    History

    ReverseAD started life as ReverseDiffSparse.jl, development of which began in early 2014(!). This was well before the other AD packages started development. Because we had a well-tested, working AD in JuMP, there was less motivation to contribute to and explore other AD packages. The lack of historical interaction also meant that other packages were not optimized for the types of problems that JuMP is built for (that is, large-scale sparse problems). When we first created MathOptInterface, we kept the AD in JuMP to simplify the transition, and post-poned the development of a first-class nonlinear interface in MathOptInterface.

    Prior to the introduction of Nonlinear, JuMP's nonlinear implementation was a confusing mix of functions and types spread across the code base and in the private _Derivatives submodule. This made it hard to swap the AD system for another. The main motivation for refactoring JuMP to create the Nonlinear submodule in MathOptInterface was to abstract the interface between JuMP and the AD system, allowing us to swap-in and test new AD systems in the future.

    + );

    The ordering of the nodes in the tape must satisfy two rules:

    Design goals

    This is less readable than the other options, but does this data structure meet our design goals?

    Instead of a heap-allocated object for each node, we only have two Vectors for each expression, nodes and values, as well as two constant vectors for the OPERATORS. In addition, all fields are concretely typed, and there are no Union or Any types.

    For our third goal, it is not easy to identify the children of a node, but it is easy to identify the parent of any node. Therefore, we can use Nonlinear.adjacency_matrix to compute a sparse matrix that maps parents to their children.

    The design in practice

    In practice, Node and Expression are exactly Nonlinear.Node and Nonlinear.Expression. However, Nonlinear.NodeType has more fields to account for comparison operators such as :>= and :<=, logic operators such as :&& and :||, nonlinear parameters, and nested subexpressions.

    Moreover, instead of storing the operators as global constants, they are stored in Nonlinear.OperatorRegistry, and it also stores a vector of logic operators and a vector of comparison operators. In addition to Nonlinear.DEFAULT_UNIVARIATE_OPERATORS and Nonlinear.DEFAULT_MULTIVARIATE_OPERATORS, you can register user-defined functions using Nonlinear.register_operator.

    Nonlinear.Model is a struct that stores the Nonlinear.OperatorRegistry, as well as a list of parameters and subexpressions in the model.

    ReverseAD

    Nonlinear.ReverseAD is a submodule for computing derivatives of a nonlinear optimization problem using sparse reverse-mode automatic differentiation (AD).

    This section does not attempt to explain how sparse reverse-mode AD works, but instead explains why MOI contains its own implementation, and highlights notable differences from similar packages.

    Warning

    Don't use the API in ReverseAD to compute derivatives. Instead, create a Nonlinear.Evaluator object with Nonlinear.SparseReverseMode as the backend, and then query the MOI API methods.

    Design goals

    The JuliaDiff organization maintains a list of packages for doing AD in Julia. At last count, there were at least ten packages——not including ReverseAD——for reverse-mode AD in Julia. ReverseAD exists because it has a different set of design goals.

    History

    ReverseAD started life as ReverseDiffSparse.jl, development of which began in early 2014(!). This was well before the other AD packages started development. Because we had a well-tested, working AD in JuMP, there was less motivation to contribute to and explore other AD packages. The lack of historical interaction also meant that other packages were not optimized for the types of problems that JuMP is built for (that is, large-scale sparse problems). When we first created MathOptInterface, we kept the AD in JuMP to simplify the transition, and post-poned the development of a first-class nonlinear interface in MathOptInterface.

    Prior to the introduction of Nonlinear, JuMP's nonlinear implementation was a confusing mix of functions and types spread across the code base and in the private _Derivatives submodule. This made it hard to swap the AD system for another. The main motivation for refactoring JuMP to create the Nonlinear submodule in MathOptInterface was to abstract the interface between JuMP and the AD system, allowing us to swap-in and test new AD systems in the future.

    diff --git a/previews/PR3778/moi/submodules/Nonlinear/reference/index.html b/previews/PR3778/moi/submodules/Nonlinear/reference/index.html index 1747a1e322c..f896b10d2c1 100644 --- a/previews/PR3778/moi/submodules/Nonlinear/reference/index.html +++ b/previews/PR3778/moi/submodules/Nonlinear/reference/index.html @@ -148,4 +148,4 @@ delete(model, c1) evaluator = Evaluator(model) MOI.initialize(evaluator, Symbol[]) -ordinal_index(model, c2) # Returns 1source +ordinal_index(model, c2) # Returns 1source diff --git a/previews/PR3778/moi/submodules/Test/overview/index.html b/previews/PR3778/moi/submodules/Test/overview/index.html index 615a48d0fe5..8c8f246d5f4 100644 --- a/previews/PR3778/moi/submodules/Test/overview/index.html +++ b/previews/PR3778/moi/submodules/Test/overview/index.html @@ -167,4 +167,4 @@ ), ) return -end

    Finally, you also need to implement Test.version_added. If we added this test when the latest released version of MOI was v0.10.5, define:

    version_added(::typeof(test_unit_optimize!_twice)) = v"0.10.6"

    Step 6

    Commit the changes to git from ~/.julia/dev/MathOptInterface and submit the PR for review.

    Tip

    If you need help writing a test, open an issue on GitHub, or ask the Developer Chatroom.

    +end

    Finally, you also need to implement Test.version_added. If we added this test when the latest released version of MOI was v0.10.5, define:

    version_added(::typeof(test_unit_optimize!_twice)) = v"0.10.6"

    Step 6

    Commit the changes to git from ~/.julia/dev/MathOptInterface and submit the PR for review.

    Tip

    If you need help writing a test, open an issue on GitHub, or ask the Developer Chatroom.

    diff --git a/previews/PR3778/moi/submodules/Test/reference/index.html b/previews/PR3778/moi/submodules/Test/reference/index.html index 408328cc101..a09285bb6ea 100644 --- a/previews/PR3778/moi/submodules/Test/reference/index.html +++ b/previews/PR3778/moi/submodules/Test/reference/index.html @@ -53,4 +53,4 @@ end return reset_function endsource
    MathOptInterface.Test.version_addedFunction
    version_added(::typeof(function_name))

    Returns the version of MOI in which the test function_name was added.

    This method should be implemented for all new tests.

    See the exclude_tests_after keyword of runtests for more details.

    source
    MathOptInterface.Test.@requiresMacro
    @requires(x)

    Check that the condition x is true. Otherwise, throw an RequirementUnmet error to indicate that the model does not support something required by the test function.

    Examples

    @requires MOI.supports(model, MOI.Silent())
    -@test MOI.get(model, MOI.Silent())
    source
    MathOptInterface.Test.RequirementUnmetType
    RequirementUnmet(msg::String) <: Exception

    An error for throwing in tests to indicate that the model does not support some requirement expected by the test function.

    source
    +@test MOI.get(model, MOI.Silent())source
    MathOptInterface.Test.RequirementUnmetType
    RequirementUnmet(msg::String) <: Exception

    An error for throwing in tests to indicate that the model does not support some requirement expected by the test function.

    source
    diff --git a/previews/PR3778/moi/submodules/Utilities/overview/index.html b/previews/PR3778/moi/submodules/Utilities/overview/index.html index b7505fa6550..77599bd20de 100644 --- a/previews/PR3778/moi/submodules/Utilities/overview/index.html +++ b/previews/PR3778/moi/submodules/Utilities/overview/index.html @@ -337,4 +337,4 @@ index_map = MOI.copy_to(dest, src) for (F, S) in MOI.get(src, MOI.ListOfConstraintTypesPresent()) function_barrier(dest, src, index_map[F, S]) -end +end diff --git a/previews/PR3778/moi/submodules/Utilities/reference/index.html b/previews/PR3778/moi/submodules/Utilities/reference/index.html index 8c4244228b1..5808dcb57fc 100644 --- a/previews/PR3778/moi/submodules/Utilities/reference/index.html +++ b/previews/PR3778/moi/submodules/Utilities/reference/index.html @@ -87,7 +87,7 @@ typeof(CleverDicts.key_to_index), typeof(CleverDicts.index_to_key), } -end

    A struct storing F-in-S constraints as a mapping between the constraint indices to the corresponding tuple of function and set.

    source
    MathOptInterface.Utilities.StructOfConstraintsType
    abstract type StructOfConstraints <: MOI.ModelLike end

    A struct storing a subfields other structs storing constraints of different types.

    See Utilities.@struct_of_constraints_by_function_types and Utilities.@struct_of_constraints_by_set_types.

    source
    MathOptInterface.Utilities.@struct_of_constraints_by_function_typesMacro
    Utilities.@struct_of_constraints_by_function_types(name, func_types...)

    Given a vector of n function types (F1, F2,..., Fn) in func_types, defines a subtype of StructOfConstraints of name name and which type parameters {T, C1, C2, ..., Cn}. It contains n field where the ith field has type Ci and stores the constraints of function type Fi.

    The expression Fi can also be a union in which case any constraint for which the function type is in the union is stored in the field with type Ci.

    source
    MathOptInterface.Utilities.@struct_of_constraints_by_set_typesMacro
    Utilities.@struct_of_constraints_by_set_types(name, func_types...)

    Given a vector of n set types (S1, S2,..., Sn) in func_types, defines a subtype of StructOfConstraints of name name and which type parameters {T, C1, C2, ..., Cn}. It contains n field where the ith field has type Ci and stores the constraints of set type Si. The expression Si can also be a union in which case any constraint for which the set type is in the union is stored in the field with type Ci. This can be useful if Ci is a MatrixOfConstraints in order to concatenate the coefficients of constraints of several different set types in the same matrix.

    source
    MathOptInterface.Utilities.struct_of_constraint_codeFunction
    struct_of_constraint_code(struct_name, types, field_types = nothing)

    Given a vector of n Union{SymbolFun,_UnionSymbolFS{SymbolFun}} or Union{SymbolSet,_UnionSymbolFS{SymbolSet}} in types, defines a subtype of StructOfConstraints of name name and which type parameters {T, F1, F2, ..., Fn} if field_types is nothing and a {T} otherwise. It contains n field where the ith field has type Ci if field_types is nothing and type field_types[i] otherwise. If types is vector of Union{SymbolFun,_UnionSymbolFS{SymbolFun}} (resp. Union{SymbolSet,_UnionSymbolFS{SymbolSet}}) then the constraints of that function (resp. set) type are stored in the corresponding field.

    This function is used by the macros @model, @struct_of_constraints_by_function_types and @struct_of_constraints_by_set_types.

    source

    Caching optimizer

    MathOptInterface.Utilities.CachingOptimizerType
    CachingOptimizer

    CachingOptimizer is an intermediate layer that stores a cache of the model and links it with an optimizer. It supports incremental model construction and modification even when the optimizer doesn't.

    Constructors

        CachingOptimizer(cache::MOI.ModelLike, optimizer::AbstractOptimizer)

    Creates a CachingOptimizer in AUTOMATIC mode, with the optimizer optimizer.

    The type of the optimizer returned is CachingOptimizer{typeof(optimizer), typeof(cache)} so it does not support the function reset_optimizer(::CachingOptimizer, new_optimizer) if the type of new_optimizer is different from the type of optimizer.

        CachingOptimizer(cache::MOI.ModelLike, mode::CachingOptimizerMode)

    Creates a CachingOptimizer in the NO_OPTIMIZER state and mode mode.

    The type of the optimizer returned is CachingOptimizer{MOI.AbstractOptimizer,typeof(cache)} so it does support the function reset_optimizer(::CachingOptimizer, new_optimizer) if the type of new_optimizer is different from the type of optimizer.

    About the type

    States

    A CachingOptimizer may be in one of three possible states (CachingOptimizerState):

    • NO_OPTIMIZER: The CachingOptimizer does not have any optimizer.
    • EMPTY_OPTIMIZER: The CachingOptimizer has an empty optimizer. The optimizer is not synchronized with the cached model.
    • ATTACHED_OPTIMIZER: The CachingOptimizer has an optimizer, and it is synchronized with the cached model.

    Modes

    A CachingOptimizer has two modes of operation (CachingOptimizerMode):

    • MANUAL: The only methods that change the state of the CachingOptimizer are Utilities.reset_optimizer, Utilities.drop_optimizer, and Utilities.attach_optimizer. Attempting to perform an operation in the incorrect state results in an error.
    • AUTOMATIC: The CachingOptimizer changes its state when necessary. For example, optimize! will automatically call attach_optimizer (an optimizer must have been previously set). Attempting to add a constraint or perform a modification not supported by the optimizer results in a drop to EMPTY_OPTIMIZER mode.
    source
    MathOptInterface.Utilities.attach_optimizerFunction
    attach_optimizer(model::CachingOptimizer)

    Attaches the optimizer to model, copying all model data into it. Can be called only from the EMPTY_OPTIMIZER state. If the copy succeeds, the CachingOptimizer will be in state ATTACHED_OPTIMIZER after the call, otherwise an error is thrown; see MOI.copy_to for more details on which errors can be thrown.

    source
    MOIU.attach_optimizer(model::GenericModel)

    Call MOIU.attach_optimizer on the backend of model.

    Cannot be called in direct mode.

    source
    MathOptInterface.Utilities.reset_optimizerFunction
    reset_optimizer(m::CachingOptimizer, optimizer::MOI.AbstractOptimizer)

    Sets or resets m to have the given empty optimizer optimizer.

    Can be called from any state. An assertion error will be thrown if optimizer is not empty.

    The CachingOptimizer m will be in state EMPTY_OPTIMIZER after the call.

    source
    reset_optimizer(m::CachingOptimizer)

    Detaches and empties the current optimizer. Can be called from ATTACHED_OPTIMIZER or EMPTY_OPTIMIZER state. The CachingOptimizer will be in state EMPTY_OPTIMIZER after the call.

    source
    MOIU.reset_optimizer(model::GenericModel, optimizer::MOI.AbstractOptimizer)

    Call MOIU.reset_optimizer on the backend of model.

    Cannot be called in direct mode.

    source
    MOIU.reset_optimizer(model::GenericModel)

    Call MOIU.reset_optimizer on the backend of model.

    Cannot be called in direct mode.

    source
    MathOptInterface.Utilities.drop_optimizerFunction
    drop_optimizer(m::CachingOptimizer)

    Drops the optimizer, if one is present. Can be called from any state. The CachingOptimizer will be in state NO_OPTIMIZER after the call.

    source
    MOIU.drop_optimizer(model::GenericModel)

    Call MOIU.drop_optimizer on the backend of model.

    Cannot be called in direct mode.

    source
    MathOptInterface.Utilities.stateFunction
    state(m::CachingOptimizer)::CachingOptimizerState

    Returns the state of the CachingOptimizer m. See Utilities.CachingOptimizer.

    source
    MathOptInterface.Utilities.modeFunction
    mode(m::CachingOptimizer)::CachingOptimizerMode

    Returns the operating mode of the CachingOptimizer m. See Utilities.CachingOptimizer.

    source

    Mock optimizer

    MathOptInterface.Utilities.MockOptimizerType
    MockOptimizer

    MockOptimizer is a fake optimizer especially useful for testing. Its main feature is that it can store the values that should be returned for each attribute.

    source

    Printing

    MathOptInterface.Utilities.latex_formulationFunction
    latex_formulation(model::MOI.ModelLike; kwargs...)

    Wrap model in a type so that it can be pretty-printed as text/latex in a notebook like IJulia, or in Documenter.

    To render the model, end the cell with latex_formulation(model), or call display(latex_formulation(model)) in to force the display of the model from inside a function.

    Possible keyword arguments are:

    • simplify_coefficients : Simplify coefficients if possible by omitting them or removing trailing zeros.
    • default_name : The name given to variables with an empty name.
    • print_types : Print the MOI type of each function and set for clarity.
    source

    Copy utilities

    MathOptInterface.Utilities.default_copy_toFunction
    default_copy_to(dest::MOI.ModelLike, src::MOI.ModelLike)

    A default implementation of MOI.copy_to(dest, src) for models that implement the incremental interface, that is, MOI.supports_incremental_interface returns true.

    source
    MathOptInterface.Utilities.IndexMapType
    IndexMap()

    The dictionary-like object returned by MOI.copy_to.

    source
    MathOptInterface.Utilities.identity_index_mapFunction
    identity_index_map(model::MOI.ModelLike)

    Return an IndexMap that maps all variable and constraint indices of model to themselves.

    source
    MathOptInterface.Utilities.ModelFilterType
    ModelFilter(filter::Function, model::MOI.ModelLike)

    A layer to filter out various components of model.

    The filter function takes a single argument, which is each element from the list returned by the attributes below. It returns true if the element should be visible in the filtered model and false otherwise.

    The components that are filtered are:

    • Entire constraint types via:
      • MOI.ListOfConstraintTypesPresent
    • Individual constraints via:
      • MOI.ListOfConstraintIndices{F,S}
    • Specific attributes via:
      • MOI.ListOfModelAttributesSet
      • MOI.ListOfConstraintAttributesSet
      • MOI.ListOfVariableAttributesSet
    Warning

    The list of attributes filtered may change in a future release. You should write functions that are generic and not limited to the five types listed above. Thus, you should probably define a fallback filter(::Any) = true.

    See below for examples of how this works.

    Note

    This layer has a limited scope. It is intended by be used in conjunction with MOI.copy_to.

    Example: copy model excluding integer constraints

    Use the do syntax to provide a single function.

    filtered_src = MOI.Utilities.ModelFilter(src) do item
    +end

    A struct storing F-in-S constraints as a mapping between the constraint indices to the corresponding tuple of function and set.

    source
    MathOptInterface.Utilities.StructOfConstraintsType
    abstract type StructOfConstraints <: MOI.ModelLike end

    A struct storing a subfields other structs storing constraints of different types.

    See Utilities.@struct_of_constraints_by_function_types and Utilities.@struct_of_constraints_by_set_types.

    source
    MathOptInterface.Utilities.@struct_of_constraints_by_function_typesMacro
    Utilities.@struct_of_constraints_by_function_types(name, func_types...)

    Given a vector of n function types (F1, F2,..., Fn) in func_types, defines a subtype of StructOfConstraints of name name and which type parameters {T, C1, C2, ..., Cn}. It contains n field where the ith field has type Ci and stores the constraints of function type Fi.

    The expression Fi can also be a union in which case any constraint for which the function type is in the union is stored in the field with type Ci.

    source
    MathOptInterface.Utilities.@struct_of_constraints_by_set_typesMacro
    Utilities.@struct_of_constraints_by_set_types(name, func_types...)

    Given a vector of n set types (S1, S2,..., Sn) in func_types, defines a subtype of StructOfConstraints of name name and which type parameters {T, C1, C2, ..., Cn}. It contains n field where the ith field has type Ci and stores the constraints of set type Si. The expression Si can also be a union in which case any constraint for which the set type is in the union is stored in the field with type Ci. This can be useful if Ci is a MatrixOfConstraints in order to concatenate the coefficients of constraints of several different set types in the same matrix.

    source
    MathOptInterface.Utilities.struct_of_constraint_codeFunction
    struct_of_constraint_code(struct_name, types, field_types = nothing)

    Given a vector of n Union{SymbolFun,_UnionSymbolFS{SymbolFun}} or Union{SymbolSet,_UnionSymbolFS{SymbolSet}} in types, defines a subtype of StructOfConstraints of name name and which type parameters {T, F1, F2, ..., Fn} if field_types is nothing and a {T} otherwise. It contains n field where the ith field has type Ci if field_types is nothing and type field_types[i] otherwise. If types is vector of Union{SymbolFun,_UnionSymbolFS{SymbolFun}} (resp. Union{SymbolSet,_UnionSymbolFS{SymbolSet}}) then the constraints of that function (resp. set) type are stored in the corresponding field.

    This function is used by the macros @model, @struct_of_constraints_by_function_types and @struct_of_constraints_by_set_types.

    source

    Caching optimizer

    MathOptInterface.Utilities.CachingOptimizerType
    CachingOptimizer

    CachingOptimizer is an intermediate layer that stores a cache of the model and links it with an optimizer. It supports incremental model construction and modification even when the optimizer doesn't.

    Constructors

        CachingOptimizer(cache::MOI.ModelLike, optimizer::AbstractOptimizer)

    Creates a CachingOptimizer in AUTOMATIC mode, with the optimizer optimizer.

    The type of the optimizer returned is CachingOptimizer{typeof(optimizer), typeof(cache)} so it does not support the function reset_optimizer(::CachingOptimizer, new_optimizer) if the type of new_optimizer is different from the type of optimizer.

        CachingOptimizer(cache::MOI.ModelLike, mode::CachingOptimizerMode)

    Creates a CachingOptimizer in the NO_OPTIMIZER state and mode mode.

    The type of the optimizer returned is CachingOptimizer{MOI.AbstractOptimizer,typeof(cache)} so it does support the function reset_optimizer(::CachingOptimizer, new_optimizer) if the type of new_optimizer is different from the type of optimizer.

    About the type

    States

    A CachingOptimizer may be in one of three possible states (CachingOptimizerState):

    • NO_OPTIMIZER: The CachingOptimizer does not have any optimizer.
    • EMPTY_OPTIMIZER: The CachingOptimizer has an empty optimizer. The optimizer is not synchronized with the cached model.
    • ATTACHED_OPTIMIZER: The CachingOptimizer has an optimizer, and it is synchronized with the cached model.

    Modes

    A CachingOptimizer has two modes of operation (CachingOptimizerMode):

    • MANUAL: The only methods that change the state of the CachingOptimizer are Utilities.reset_optimizer, Utilities.drop_optimizer, and Utilities.attach_optimizer. Attempting to perform an operation in the incorrect state results in an error.
    • AUTOMATIC: The CachingOptimizer changes its state when necessary. For example, optimize! will automatically call attach_optimizer (an optimizer must have been previously set). Attempting to add a constraint or perform a modification not supported by the optimizer results in a drop to EMPTY_OPTIMIZER mode.
    source
    MathOptInterface.Utilities.attach_optimizerFunction
    attach_optimizer(model::CachingOptimizer)

    Attaches the optimizer to model, copying all model data into it. Can be called only from the EMPTY_OPTIMIZER state. If the copy succeeds, the CachingOptimizer will be in state ATTACHED_OPTIMIZER after the call, otherwise an error is thrown; see MOI.copy_to for more details on which errors can be thrown.

    source
    MOIU.attach_optimizer(model::GenericModel)

    Call MOIU.attach_optimizer on the backend of model.

    Cannot be called in direct mode.

    source
    MathOptInterface.Utilities.reset_optimizerFunction
    reset_optimizer(m::CachingOptimizer, optimizer::MOI.AbstractOptimizer)

    Sets or resets m to have the given empty optimizer optimizer.

    Can be called from any state. An assertion error will be thrown if optimizer is not empty.

    The CachingOptimizer m will be in state EMPTY_OPTIMIZER after the call.

    source
    reset_optimizer(m::CachingOptimizer)

    Detaches and empties the current optimizer. Can be called from ATTACHED_OPTIMIZER or EMPTY_OPTIMIZER state. The CachingOptimizer will be in state EMPTY_OPTIMIZER after the call.

    source
    MOIU.reset_optimizer(model::GenericModel, optimizer::MOI.AbstractOptimizer)

    Call MOIU.reset_optimizer on the backend of model.

    Cannot be called in direct mode.

    source
    MOIU.reset_optimizer(model::GenericModel)

    Call MOIU.reset_optimizer on the backend of model.

    Cannot be called in direct mode.

    source
    MathOptInterface.Utilities.drop_optimizerFunction
    drop_optimizer(m::CachingOptimizer)

    Drops the optimizer, if one is present. Can be called from any state. The CachingOptimizer will be in state NO_OPTIMIZER after the call.

    source
    MOIU.drop_optimizer(model::GenericModel)

    Call MOIU.drop_optimizer on the backend of model.

    Cannot be called in direct mode.

    source
    MathOptInterface.Utilities.stateFunction
    state(m::CachingOptimizer)::CachingOptimizerState

    Returns the state of the CachingOptimizer m. See Utilities.CachingOptimizer.

    source
    MathOptInterface.Utilities.modeFunction
    mode(m::CachingOptimizer)::CachingOptimizerMode

    Returns the operating mode of the CachingOptimizer m. See Utilities.CachingOptimizer.

    source

    Mock optimizer

    MathOptInterface.Utilities.MockOptimizerType
    MockOptimizer

    MockOptimizer is a fake optimizer especially useful for testing. Its main feature is that it can store the values that should be returned for each attribute.

    source

    Printing

    MathOptInterface.Utilities.latex_formulationFunction
    latex_formulation(model::MOI.ModelLike; kwargs...)

    Wrap model in a type so that it can be pretty-printed as text/latex in a notebook like IJulia, or in Documenter.

    To render the model, end the cell with latex_formulation(model), or call display(latex_formulation(model)) in to force the display of the model from inside a function.

    Possible keyword arguments are:

    • simplify_coefficients : Simplify coefficients if possible by omitting them or removing trailing zeros.
    • default_name : The name given to variables with an empty name.
    • print_types : Print the MOI type of each function and set for clarity.
    source

    Copy utilities

    MathOptInterface.Utilities.default_copy_toFunction
    default_copy_to(dest::MOI.ModelLike, src::MOI.ModelLike)

    A default implementation of MOI.copy_to(dest, src) for models that implement the incremental interface, that is, MOI.supports_incremental_interface returns true.

    source
    MathOptInterface.Utilities.IndexMapType
    IndexMap()

    The dictionary-like object returned by MOI.copy_to.

    source
    MathOptInterface.Utilities.identity_index_mapFunction
    identity_index_map(model::MOI.ModelLike)

    Return an IndexMap that maps all variable and constraint indices of model to themselves.

    source
    MathOptInterface.Utilities.ModelFilterType
    ModelFilter(filter::Function, model::MOI.ModelLike)

    A layer to filter out various components of model.

    The filter function takes a single argument, which is each element from the list returned by the attributes below. It returns true if the element should be visible in the filtered model and false otherwise.

    The components that are filtered are:

    • Entire constraint types via:
      • MOI.ListOfConstraintTypesPresent
    • Individual constraints via:
      • MOI.ListOfConstraintIndices{F,S}
    • Specific attributes via:
      • MOI.ListOfModelAttributesSet
      • MOI.ListOfConstraintAttributesSet
      • MOI.ListOfVariableAttributesSet
    Warning

    The list of attributes filtered may change in a future release. You should write functions that are generic and not limited to the five types listed above. Thus, you should probably define a fallback filter(::Any) = true.

    See below for examples of how this works.

    Note

    This layer has a limited scope. It is intended by be used in conjunction with MOI.copy_to.

    Example: copy model excluding integer constraints

    Use the do syntax to provide a single function.

    filtered_src = MOI.Utilities.ModelFilter(src) do item
         return item != (MOI.VariableIndex, MOI.Integer)
     end
     MOI.copy_to(dest, filtered_src)

    Example: copy model excluding names

    Use type dispatch to simplify the implementation:

    my_filter(::Any) = true  # Note the generic fallback
    @@ -312,4 +312,4 @@
     For performance, it is recommended that the inner loop lies in a separate
     function to guarantee type-stability.
     
    -If you want an iterator of all current outer keys, use [`outer_keys`](@ref).
    source
    +If you want an iterator of all current outer keys, use [`outer_keys`](@ref).source diff --git a/previews/PR3778/moi/tutorials/bridging_constraint/index.html b/previews/PR3778/moi/tutorials/bridging_constraint/index.html index 551e83644b0..f427188775d 100644 --- a/previews/PR3778/moi/tutorials/bridging_constraint/index.html +++ b/previews/PR3778/moi/tutorials/bridging_constraint/index.html @@ -103,4 +103,4 @@ end

    Bridge deletion

    When a bridge is deleted, the constraints it added must be deleted too.

    function delete(model::ModelLike, bridge::SignBridge)
         delete(model, bridge.constraint)
         return
    -end
    +end diff --git a/previews/PR3778/moi/tutorials/example/index.html b/previews/PR3778/moi/tutorials/example/index.html index d6f6533471d..24e399038e9 100644 --- a/previews/PR3778/moi/tutorials/example/index.html +++ b/previews/PR3778/moi/tutorials/example/index.html @@ -46,4 +46,4 @@ 3-element Vector{Float64}: 1.0 1.0 - 1.0 + 1.0 diff --git a/previews/PR3778/moi/tutorials/implementing/index.html b/previews/PR3778/moi/tutorials/implementing/index.html index fd510889808..c41ce443655 100644 --- a/previews/PR3778/moi/tutorials/implementing/index.html +++ b/previews/PR3778/moi/tutorials/implementing/index.html @@ -115,4 +115,4 @@ n = # Code to get NumberOfObjectives return n end

    Then, the user can write:

    model = Gurobi.Optimizer()
    -MOI.set(model, Gurobi.NumberofObjectives(), 3)
    +MOI.set(model, Gurobi.NumberofObjectives(), 3) diff --git a/previews/PR3778/moi/tutorials/latency/index.html b/previews/PR3778/moi/tutorials/latency/index.html index 8a6a15b78d9..8149244683a 100644 --- a/previews/PR3778/moi/tutorials/latency/index.html +++ b/previews/PR3778/moi/tutorials/latency/index.html @@ -130,4 +130,4 @@ end

    You can create a flame-graph via

    using SnoopCompile
     tinf = @snoopi_deep example_diet(GLPK.Optimizer, true)
     using ProfileView
    -ProfileView.view(flamegraph(tinf))

    Here's how things looked in mid-August 2021: flamegraph

    There are a few opportunities for improvement (non-red flames, particularly on the right). But the main problem is a large red (non-precompilable due to method ownership) flame.

    +ProfileView.view(flamegraph(tinf))

    Here's how things looked in mid-August 2021: flamegraph

    There are a few opportunities for improvement (non-red flames, particularly on the right). But the main problem is a large red (non-precompilable due to method ownership) flame.

    diff --git a/previews/PR3778/moi/tutorials/manipulating_expressions/index.html b/previews/PR3778/moi/tutorials/manipulating_expressions/index.html index a50fd96282f..36c65561720 100644 --- a/previews/PR3778/moi/tutorials/manipulating_expressions/index.html +++ b/previews/PR3778/moi/tutorials/manipulating_expressions/index.html @@ -23,4 +23,4 @@ 2-element Vector{MathOptInterface.ScalarAffineFunction{Int64}}: (2) + (1) MOI.VariableIndex(1) (4) + (2) MOI.VariableIndex(1)
    Note

    Utilities.eachscalar returns an iterator on the dimensions, which serves the same purpose as Utilities.scalarize.

    output_dimension returns the number of dimensions of the output of a function:

    julia> MOI.output_dimension(g)
    -2
    +2 diff --git a/previews/PR3778/moi/tutorials/mathprogbase/index.html b/previews/PR3778/moi/tutorials/mathprogbase/index.html index 90521295de4..c24a9db6d56 100644 --- a/previews/PR3778/moi/tutorials/mathprogbase/index.html +++ b/previews/PR3778/moi/tutorials/mathprogbase/index.html @@ -55,4 +55,4 @@ objval = objective_value(model), sol = value.(x) ) -end +end diff --git a/previews/PR3778/packages/Alpine/index.html b/previews/PR3778/packages/Alpine/index.html index a142355b884..f14ec8ddd63 100644 --- a/previews/PR3778/packages/Alpine/index.html +++ b/previews/PR3778/packages/Alpine/index.html @@ -46,4 +46,4 @@ author={Kim, Jongeun and Richard, Jean-Philippe P. and Tawarmalani, Mohit}, eprinttype={Optimization Online}, date={2022} -} +} diff --git a/previews/PR3778/packages/AmplNLWriter/index.html b/previews/PR3778/packages/AmplNLWriter/index.html index ff96d7d973d..b4b4144c1f3 100644 --- a/previews/PR3778/packages/AmplNLWriter/index.html +++ b/previews/PR3778/packages/AmplNLWriter/index.html @@ -12,4 +12,4 @@ import Bonmin_jll model = Model(() -> AmplNLWriter.Optimizer(Bonmin_jll.amplexe)) set_attribute(model, "bonmin.nlp_log_level", 0)

    opt files

    Some options need to be specified via an .opt file.

    This file must be located in the current working directory whenever the model is solved.

    The .opt file must be named after the name of the solver, for example, bonmin.opt, and each line must contain an option name and the desired value, separated by a space.

    For example, to set the absolute and relative tolerances in Couenne to 1 and 0.05 respectively, the couenne.opt file should contain:

    allowable_gap 1
    -allowable_fraction_gap 0.05
    +allowable_fraction_gap 0.05 diff --git a/previews/PR3778/packages/BARON/index.html b/previews/PR3778/packages/BARON/index.html index dda81383acc..b7bf35cd7b1 100644 --- a/previews/PR3778/packages/BARON/index.html +++ b/previews/PR3778/packages/BARON/index.html @@ -6,4 +6,4 @@

    BARON.jl

    Build Status codecov

    BARON.jl is a wrapper for BARON by The Optimization Firm.

    Affiliation

    This wrapper is maintained by the JuMP community and is not officially supported by The Optimization Firm.

    Getting help

    If you need help, please ask a question on the JuMP community forum.

    If you have a reproducible example of a bug, please open a GitHub issue.

    License

    BARON.jl is licensed under the MIT License.

    The underlying solver is a closed-source commercial product for which you must obtain a license from The Optimization Firm, although a small trial version is available for free.

    Installation

    First, download a copy of the BARON solver and unpack the executable in a location of your choosing.

    Once installed, set the BARON_EXEC environment variable pointing to the BARON executable (full path, including file name as it differs across platforms), and run Pkg.add("BARON"). For example:

    ENV["BARON_EXEC"] = "/path/to/baron.exe"
     using Pkg
     Pkg.add("BARON")

    The baronlice.txt license file should be placed in the same directory as the BARON executable, or in your current working directory.

    Use with JuMP

    using JuMP, BARON
    -model = Model(BARON.Optimizer)

    MathOptInterface API

    The BARON optimizer supports the following constraints and attributes.

    List of supported objective functions:

    List of supported variable types:

    List of supported constraint types:

    List of supported model attributes:

    +model = Model(BARON.Optimizer)

    MathOptInterface API

    The BARON optimizer supports the following constraints and attributes.

    List of supported objective functions:

    List of supported variable types:

    List of supported constraint types:

    List of supported model attributes:

    diff --git a/previews/PR3778/packages/BilevelJuMP/index.html b/previews/PR3778/packages/BilevelJuMP/index.html index ae3fdca79c7..d5a288008b3 100644 --- a/previews/PR3778/packages/BilevelJuMP/index.html +++ b/previews/PR3778/packages/BilevelJuMP/index.html @@ -34,4 +34,4 @@ objective_value(model) # = 3 * (3.5 * 8/15) + 8/15 # = 6.13... value(x) # = 3.5 * 8/15 # = 1.86... -value(y) # = 8/15 # = 0.53... +value(y) # = 8/15 # = 0.53... diff --git a/previews/PR3778/packages/CDCS/index.html b/previews/PR3778/packages/CDCS/index.html index 4637dc7ac9d..f67de8a79aa 100644 --- a/previews/PR3778/packages/CDCS/index.html +++ b/previews/PR3778/packages/CDCS/index.html @@ -27,4 +27,4 @@ mat"cdcsInstall" end -julia> mat"savepath" +julia> mat"savepath" diff --git a/previews/PR3778/packages/CDDLib/index.html b/previews/PR3778/packages/CDDLib/index.html index 6d26520197a..912729fd722 100644 --- a/previews/PR3778/packages/CDDLib/index.html +++ b/previews/PR3778/packages/CDDLib/index.html @@ -6,4 +6,4 @@

    CDDLib

    CDDLib.jl is a wrapper for cddlib.

    CDDLib.jl can be used with C API of cddlib, the higher level interface of Polyhedra.jl, or as a linear programming solver with JuMP or MathOptInterface.

    Problem description

    As written in the README of cddlib:

    The C-library cddlib is a C implementation of the Double Description Method of Motzkin et al. for generating all vertices (that is, extreme points) and extreme rays of a general convex polyhedron in R^d given by a system of linear inequalities:

    P = { x=(x1, ..., xd)^T :  b - A  x  >= 0 }

    where A is a given m x d real matrix, b is a given m-vector and 0 is the m-vector of all zeros.

    The program can be used for the reverse operation (that is, convex hull computation). This means that one can move back and forth between an inequality representation and a generator (that is, vertex and ray) representation of a polyhedron with cdd. Also, cdd can solve a linear programming problem, that is, a problem of maximizing and minimizing a linear function over P.

    License

    CDDLib.jl is licensed under the GPL v2 license.

    The underlying solver, cddlib/cddlib is also licensed under the GPL v2 license.

    Installation

    Install CDDLib.jl using the Julia package manager:

    import Pkg
     Pkg.add("CDDLib")

    Building the package will download binaries of cddlib that are provided by cddlib_jll.jl.

    Use with JuMP

    Use CDDLib.Optimizer{Float64} to use CDDLib.jl with JuMP:

    using JuMP, CDDLib
     model = Model(CDDLib.Optimizer{Float64})

    When using CDDLib.jl with MathOptInterface, you can pass a different number type:

    using MathOptInterface, CDDLib
    -model = CDDLib.Optimizer{Rational{BigInt}}()

    Debugging

    CDDLib.jl uses two global Boolean variables to enable debugging outputs: debug and log.

    You can query the value of debug and log with get_debug and get_log, and set their values with set_debug and set_log.

    +model = CDDLib.Optimizer{Rational{BigInt}}()

    Debugging

    CDDLib.jl uses two global Boolean variables to enable debugging outputs: debug and log.

    You can query the value of debug and log with get_debug and get_log, and set their values with set_debug and set_log.

    diff --git a/previews/PR3778/packages/COPT/index.html b/previews/PR3778/packages/COPT/index.html index e25e46a7807..a9a6bb79ee8 100644 --- a/previews/PR3778/packages/COPT/index.html +++ b/previews/PR3778/packages/COPT/index.html @@ -39,4 +39,4 @@ @show value.(X) @show value.(z) @show shadow_price(c1) -@show shadow_price(c2) +@show shadow_price(c2) diff --git a/previews/PR3778/packages/COSMO/index.html b/previews/PR3778/packages/COSMO/index.html index ed041cead8b..700a1c0d049 100644 --- a/previews/PR3778/packages/COSMO/index.html +++ b/previews/PR3778/packages/COSMO/index.html @@ -34,4 +34,4 @@ publisher = {Springer}, doi = {10.1007/s10957-021-01896-x}, url = {https://doi.org/10.1007/s10957-021-01896-x} -}

    The article is available under Open Access here.

    Contributing

    Python - Interface

    COSMO can also be called from Python. Take a look at: cosmo-python

    Licence 🔍

    This project is licensed under the Apache License - see the LICENSE.md file for details.

    +}

    The article is available under Open Access here.

    Contributing

    Python - Interface

    COSMO can also be called from Python. Take a look at: cosmo-python

    Licence 🔍

    This project is licensed under the Apache License - see the LICENSE.md file for details.

    diff --git a/previews/PR3778/packages/CPLEX/index.html b/previews/PR3778/packages/CPLEX/index.html index afd63c49171..3a52d5a3f60 100644 --- a/previews/PR3778/packages/CPLEX/index.html +++ b/previews/PR3778/packages/CPLEX/index.html @@ -163,4 +163,4 @@ x_optimal = value.(x) y_optimal = value.(y) println("x: $(x_optimal), y: $(y_optimal)") -end +end diff --git a/previews/PR3778/packages/CSDP/index.html b/previews/PR3778/packages/CSDP/index.html index ab2ada29ef7..b5d523eee5c 100644 --- a/previews/PR3778/packages/CSDP/index.html +++ b/previews/PR3778/packages/CSDP/index.html @@ -10,4 +10,4 @@ A(X) = a X ⪰ 0

    where A(X) = [⟨A_1, X⟩, ..., ⟨A_m, X⟩]. The corresponding dual is:

    min ⟨a, y⟩
          A'(y) - C = Z
    -             Z ⪰ 0

    where A'(y) = y_1A_1 + ... + y_mA_m

    Termination criteria

    CSDP will terminate successfully (or partially) in the following cases:

    In addition, if the printlevel option is at least 1, the following will be printed:

    In theory, for feasible primal and dual solutions, ⟨a, y⟩ - ⟨C, X⟩ = ⟨Z, X⟩, so the objective and XY duality gap should be equivalent. However, in practice, there are sometimes solution which satisfy primal and dual feasibility tolerances but have objective duality gap which are not close to XY duality gap. In some cases, the objective duality gap may even become negative (hence the tweakgap option). This is the reason usexygap is 1 by default.

    CSDP considers that X ⪰ 0 (resp. Z ⪰ 0) is satisfied when the Cholesky factorizations can be computed. In practice, this is somewhat more conservative than simply requiring all eigenvalues to be nonnegative.

    Status

    The table below shows how the different CSDP statuses are converted to the MathOptInterface statuses.

    CSDP codeStateDescriptionMOI status
    0SuccessSDP solvedMOI.OPTIMAL
    1SuccessThe problem is primal infeasible, and we have a certificateMOI.INFEASIBLE
    2SuccessThe problem is dual infeasible, and we have a certificateMOI.DUAL_INFEASIBLE
    3Partial SuccessA solution has been found, but full accuracy was not achievedMOI.ALMOST_OPTIMAL
    4FailureMaximum iterations reachedMOI.ITERATION_LIMIT
    5FailureStuck at edge of primal feasibilityMOI.SLOW_PROGRESS
    6FailureStuck at edge of dual infeasibilityMOI.SLOW_PROGRESS
    7FailureLack of progressMOI.SLOW_PROGRESS
    8FailureX, Z, or O was singularMOI.NUMERICAL_ERROR
    9FailureDetected NaN or Inf valuesMOI.NUMERICAL_ERROR
    + Z ⪰ 0

    where A'(y) = y_1A_1 + ... + y_mA_m

    Termination criteria

    CSDP will terminate successfully (or partially) in the following cases:

    In addition, if the printlevel option is at least 1, the following will be printed:

    In theory, for feasible primal and dual solutions, ⟨a, y⟩ - ⟨C, X⟩ = ⟨Z, X⟩, so the objective and XY duality gap should be equivalent. However, in practice, there are sometimes solution which satisfy primal and dual feasibility tolerances but have objective duality gap which are not close to XY duality gap. In some cases, the objective duality gap may even become negative (hence the tweakgap option). This is the reason usexygap is 1 by default.

    CSDP considers that X ⪰ 0 (resp. Z ⪰ 0) is satisfied when the Cholesky factorizations can be computed. In practice, this is somewhat more conservative than simply requiring all eigenvalues to be nonnegative.

    Status

    The table below shows how the different CSDP statuses are converted to the MathOptInterface statuses.

    CSDP codeStateDescriptionMOI status
    0SuccessSDP solvedMOI.OPTIMAL
    1SuccessThe problem is primal infeasible, and we have a certificateMOI.INFEASIBLE
    2SuccessThe problem is dual infeasible, and we have a certificateMOI.DUAL_INFEASIBLE
    3Partial SuccessA solution has been found, but full accuracy was not achievedMOI.ALMOST_OPTIMAL
    4FailureMaximum iterations reachedMOI.ITERATION_LIMIT
    5FailureStuck at edge of primal feasibilityMOI.SLOW_PROGRESS
    6FailureStuck at edge of dual infeasibilityMOI.SLOW_PROGRESS
    7FailureLack of progressMOI.SLOW_PROGRESS
    8FailureX, Z, or O was singularMOI.NUMERICAL_ERROR
    9FailureDetected NaN or Inf valuesMOI.NUMERICAL_ERROR
    diff --git a/previews/PR3778/packages/Cbc/index.html b/previews/PR3778/packages/Cbc/index.html index 6026fe5fcbb..4c6e68abb61 100644 --- a/previews/PR3778/packages/Cbc/index.html +++ b/previews/PR3778/packages/Cbc/index.html @@ -9,4 +9,4 @@ set_attribute(model, "logLevel", 1)

    MathOptInterface API

    The COIN Branch-and-Cut (Cbc) optimizer supports the following constraints and attributes.

    List of supported objective functions:

    List of supported variable types:

    List of supported constraint types:

    List of supported model attributes:

    List of supported optimizer attributes:

    List of supported variable attributes:

    List of supported constraint attributes:

    Options

    Options are, unfortunately, not well documented.

    The following options are likely to be the most useful:

    ParameterExampleExplanation
    seconds60.0Solution timeout limit
    logLevel2Set to 0 to disable solution output
    maxSolutions1Terminate after this many feasible solutions have been found
    maxNodes1Terminate after this many branch-and-bound nodes have been evaluated
    allowableGap0.05Terminate after optimality gap is less than this value (on an absolute scale)
    ratioGap0.05Terminate after optimality gap is smaller than this relative fraction
    threads1Set the number of threads to use for parallel branch & bound

    The complete list of parameters can be found by running the cbc executable and typing ? at the prompt.

    Start the cbc executable from Julia as follows:

    using Cbc_jll
     Cbc_jll.cbc() do exe
         run(`$(exe)`)
    -end
    +end diff --git a/previews/PR3778/packages/Clarabel/index.html b/previews/PR3778/packages/Clarabel/index.html index 629657c71b9..3cfabd2e1f0 100644 --- a/previews/PR3778/packages/Clarabel/index.html +++ b/previews/PR3778/packages/Clarabel/index.html @@ -33,4 +33,4 @@

    eprint={2405.12762}, archivePrefix={arXiv}, primaryClass={math.OC} -}

    License 🔍

    This project is licensed under the Apache License 2.0 - see the LICENSE.md file for details.

    +}

    License 🔍

    This project is licensed under the Apache License 2.0 - see the LICENSE.md file for details.

    diff --git a/previews/PR3778/packages/Clp/index.html b/previews/PR3778/packages/Clp/index.html index d64b2f17241..95ed9cd6d1b 100644 --- a/previews/PR3778/packages/Clp/index.html +++ b/previews/PR3778/packages/Clp/index.html @@ -7,4 +7,4 @@ Pkg.add("Clp")

    In addition to installing the Clp.jl package, this will also download and install the Clp binaries. You do not need to install Clp separately.

    To use a custom binary, read the Custom solver binaries section of the JuMP documentation.

    Use with JuMP

    To use Clp with JuMP, use Clp.Optimizer:

    using JuMP, Clp
     model = Model(Clp.Optimizer)
     set_attribute(model, "LogLevel", 1)
    -set_attribute(model, "Algorithm", 4)

    MathOptInterface API

    The Clp optimizer supports the following constraints and attributes.

    List of supported objective functions:

    List of supported variable types:

    List of supported constraint types:

    List of supported model attributes:

    Options

    Options are, unfortunately, not well documented.

    The following options are likely to be the most useful:

    ParameterExampleExplanation
    PrimalTolerance1e-7Primal feasibility tolerance
    DualTolerance1e-7Dual feasibility tolerance
    DualObjectiveLimit1e308When using dual simplex (where the objective is monotonically changing), terminate when the objective exceeds this limit
    MaximumIterations2147483647Terminate after performing this number of simplex iterations
    MaximumSeconds-1.0Terminate after this many seconds have passed. A negative value means no time limit
    LogLevel1Set to 1, 2, 3, or 4 for increasing output. Set to 0 to disable output
    PresolveType0Set to 1 to disable presolve
    SolveType5Solution method: dual simplex (0), primal simplex (1), sprint (2), barrier with crossover (3), barrier without crossover (4), automatic (5)
    InfeasibleReturn0Set to 1 to return as soon as the problem is found to be infeasible (by default, an infeasibility proof is computed as well)
    Scaling30 -off, 1 equilibrium, 2 geometric, 3 auto, 4 dynamic(later)
    Perturbation100switch on perturbation (50), automatic (100), don't try perturbing (102)

    C API

    The C API can be accessed via Clp.Clp_XXX functions, where the names and arguments are identical to the C API.

    +set_attribute(model, "Algorithm", 4)

    MathOptInterface API

    The Clp optimizer supports the following constraints and attributes.

    List of supported objective functions:

    List of supported variable types:

    List of supported constraint types:

    List of supported model attributes:

    Options

    Options are, unfortunately, not well documented.

    The following options are likely to be the most useful:

    ParameterExampleExplanation
    PrimalTolerance1e-7Primal feasibility tolerance
    DualTolerance1e-7Dual feasibility tolerance
    DualObjectiveLimit1e308When using dual simplex (where the objective is monotonically changing), terminate when the objective exceeds this limit
    MaximumIterations2147483647Terminate after performing this number of simplex iterations
    MaximumSeconds-1.0Terminate after this many seconds have passed. A negative value means no time limit
    LogLevel1Set to 1, 2, 3, or 4 for increasing output. Set to 0 to disable output
    PresolveType0Set to 1 to disable presolve
    SolveType5Solution method: dual simplex (0), primal simplex (1), sprint (2), barrier with crossover (3), barrier without crossover (4), automatic (5)
    InfeasibleReturn0Set to 1 to return as soon as the problem is found to be infeasible (by default, an infeasibility proof is computed as well)
    Scaling30 -off, 1 equilibrium, 2 geometric, 3 auto, 4 dynamic(later)
    Perturbation100switch on perturbation (50), automatic (100), don't try perturbing (102)

    C API

    The C API can be accessed via Clp.Clp_XXX functions, where the names and arguments are identical to the C API.

    diff --git a/previews/PR3778/packages/DAQP/index.html b/previews/PR3778/packages/DAQP/index.html index 646d941169a..d694f07e125 100644 --- a/previews/PR3778/packages/DAQP/index.html +++ b/previews/PR3778/packages/DAQP/index.html @@ -5,4 +5,4 @@ gtag('config', 'G-0RZ8X3D3D0', {'page_path': location.pathname + location.search + location.hash});

    DAQP.jl

    DAQP.jl is a Julia wrapper for the Quadratic Programming solver DAQP.

    License

    DAQP.jl is licensed under the MIT license.

    The underlying solver, darnstrom/daqp is licensed under the MIT license.

    Installation

    Install DAQP.jl using the Julia package manager:

    import Pkg
     Pkg.add("DAQP")

    Use with JuMP

    To use DAQP with JuMP, do:

    using JuMP, DAQP
    -model = Model(DAQP.Optimizer)

    Documentation

    General information about the solver is available at https://darnstrom.github.io/daqp/, and specifics for the Julia interface are available at https://darnstrom.github.io/daqp/start/julia.

    +model = Model(DAQP.Optimizer)

    Documentation

    General information about the solver is available at https://darnstrom.github.io/daqp/, and specifics for the Julia interface are available at https://darnstrom.github.io/daqp/start/julia.

    diff --git a/previews/PR3778/packages/DSDP/index.html b/previews/PR3778/packages/DSDP/index.html index a82d4ee3afd..59ef669e214 100644 --- a/previews/PR3778/packages/DSDP/index.html +++ b/previews/PR3778/packages/DSDP/index.html @@ -8,4 +8,4 @@ model = Model(DSDP.Optimizer)

    MathOptInterface API

    The DSDP optimizer supports the following constraints and attributes.

    List of supported objective functions:

    List of supported variable types:

    List of supported constraint types:

    List of supported model attributes:

    Compile your own binaries

    In order to compile your own libdsdp.so to be used of DSDP.jl, use the following

    OB_DIR=$(julia --project=. -e 'import OpenBLAS32_jll; println(OpenBLAS32_jll.OpenBLAS32_jll.artifact_dir)')
     OB="-L${LIBOB_DIR}/lib -lopenblas"
     make DSDPCFLAGS="-g -Wall -fPIC -DPIC" LAPACKBLAS="$OB" dsdplibrary
    -make DSDPCFLAGS="-g -Wall -fPIC -DPIC" LAPACKBLAS="$OB" SH_LD="${CC} ${CFLAGS} -Wall -fPIC -DPIC -shared $OB" oshared
    +make DSDPCFLAGS="-g -Wall -fPIC -DPIC" LAPACKBLAS="$OB" SH_LD="${CC} ${CFLAGS} -Wall -fPIC -DPIC -shared $OB" oshared diff --git a/previews/PR3778/packages/DiffOpt/index.html b/previews/PR3778/packages/DiffOpt/index.html index 0e911df662d..73d8ae47eec 100644 --- a/previews/PR3778/packages/DiffOpt/index.html +++ b/previews/PR3778/packages/DiffOpt/index.html @@ -20,4 +20,4 @@ # fetch the gradients grad_exp = MOI.get(model, DiffOpt.ReverseConstraintFunction(), cons) # -3 x - 1 constant(grad_exp) # -1 -coefficient(grad_exp, x) # -3

    GSOC2020

    DiffOpt began as a NumFOCUS sponsored Google Summer of Code (2020) project

    +coefficient(grad_exp, x) # -3

    GSOC2020

    DiffOpt began as a NumFOCUS sponsored Google Summer of Code (2020) project

    diff --git a/previews/PR3778/packages/DisjunctiveProgramming/index.html b/previews/PR3778/packages/DisjunctiveProgramming/index.html index 7d3e222b263..db4146dd061 100644 --- a/previews/PR3778/packages/DisjunctiveProgramming/index.html +++ b/previews/PR3778/packages/DisjunctiveProgramming/index.html @@ -8,4 +8,4 @@ author={Perez, Hector D and Joshi, Shivank and Grossmann, Ignacio E}, journal={arXiv preprint arXiv:2304.10492}, year={2023} -} +} diff --git a/previews/PR3778/packages/Dualization/index.html b/previews/PR3778/packages/Dualization/index.html index d2989b64689..0eb4f27c42c 100644 --- a/previews/PR3778/packages/Dualization/index.html +++ b/previews/PR3778/packages/Dualization/index.html @@ -10,4 +10,4 @@ dual_model = dualize(model)

    To solve the dual formulation of a JuMP model, create a dual_optimizer:

    using JuMP, Dualization, SCS
     model = Model(dual_optimizer(SCS.Optimizer))
     # ... build model ...
    -optimize!(model)  # Solves the dual instead of the primal

    Documentation

    The documentation for Dualization.jl includes a detailed description of the dual reformulation, along with examples and an API reference.

    +optimize!(model) # Solves the dual instead of the primal

    Documentation

    The documentation for Dualization.jl includes a detailed description of the dual reformulation, along with examples and an API reference.

    diff --git a/previews/PR3778/packages/EAGO/index.html b/previews/PR3778/packages/EAGO/index.html index b9771ca8d8f..0ee4e3051cc 100644 --- a/previews/PR3778/packages/EAGO/index.html +++ b/previews/PR3778/packages/EAGO/index.html @@ -71,4 +71,4 @@ doi = {10.1080/10556788.2020.1786566}, URL = {https://doi.org/10.1080/10556788.2020.1786566}, eprint = {https://doi.org/10.1080/10556788.2020.1786566} -}

    References

    1. Mitsos, A., Chachuat, B., and Barton, P.I. McCormick-based relaxations of algorithms. SIAM Journal on Optimization. 20(2): 573—601 (2009).
    2. Khan, K.A., Watson, H.A.J., and Barton, P.I. Differentiable McCormick relaxations. Journal of Global Optimization. 67(4): 687—729 (2017).
    3. Stuber, M.D., Scott, J.K., and Barton, P.I.: Convex and concave relaxations of implicit functions. Optimization Methods and Software 30(3): 424—460 (2015).
    4. Wechsung, A., Scott, J.K., Watson, H.A.J., and Barton, P.I. Reverse propagation of McCormick relaxations. Journal of Global Optimization 63(1): 1—36 (2015).
    5. Bracken, J., and McCormick, G.P. Selected Applications of Nonlinear Programming. John Wiley and Sons, New York (1968).
    +}

    References

    1. Mitsos, A., Chachuat, B., and Barton, P.I. McCormick-based relaxations of algorithms. SIAM Journal on Optimization. 20(2): 573—601 (2009).
    2. Khan, K.A., Watson, H.A.J., and Barton, P.I. Differentiable McCormick relaxations. Journal of Global Optimization. 67(4): 687—729 (2017).
    3. Stuber, M.D., Scott, J.K., and Barton, P.I.: Convex and concave relaxations of implicit functions. Optimization Methods and Software 30(3): 424—460 (2015).
    4. Wechsung, A., Scott, J.K., Watson, H.A.J., and Barton, P.I. Reverse propagation of McCormick relaxations. Journal of Global Optimization 63(1): 1—36 (2015).
    5. Bracken, J., and McCormick, G.P. Selected Applications of Nonlinear Programming. John Wiley and Sons, New York (1968).
    diff --git a/previews/PR3778/packages/ECOS/index.html b/previews/PR3778/packages/ECOS/index.html index 27489ea8fcc..fdbbee96c57 100644 --- a/previews/PR3778/packages/ECOS/index.html +++ b/previews/PR3778/packages/ECOS/index.html @@ -6,4 +6,4 @@

    ECOS.jl

    Build Status codecov

    ECOS.jl is a wrapper for the ECOS solver.

    The wrapper has two components:

    Affiliation

    This wrapper is maintained by the JuMP community and is not a product of Embotech AG.

    License

    ECOS.jl is licensed under the MIT License.

    The underlying solver, embotech/ecos, is licensed under the GPL v3 license.

    Installation

    Install ECOS.jl using Pkg.add:

    import Pkg
     Pkg.add("ECOS")

    In addition to installing the ECOS.jl package, this will also download and install the ECOS binaries. You do not need to install ECOS separately.

    To use a custom binary, read the Custom solver binaries section of the JuMP documentation.

    Use with JuMP

    To use ECOS with JuMP, use ECOS.Optimizer:

    using JuMP, ECOS
     model = Model(ECOS.Optimizer)
    -set_attribute(model, "maxit", 100)

    MathOptInterface API

    The ECOS optimizer supports the following constraints and attributes.

    List of supported objective functions:

    List of supported variable types:

    List of supported constraint types:

    List of supported model attributes:

    Options

    The following options are supported:

    ParameterExplanation
    gammascaling the final step length
    deltaregularization parameter
    epsregularization threshold
    feastolprimal/dual infeasibility tolerance
    abstolabsolute tolerance on duality gap
    reltolrelative tolerance on duality gap
    feastol_inaccprimal/dual infeasibility relaxed tolerance
    abstol_inaccabsolute relaxed tolerance on duality gap
    reltol_inaccrelative relaxed tolerance on duality gap
    nitrefnumber of iterative refinement steps
    maxitmaximum number of iterations
    verboseverbosity bool for PRINTLEVEL < 3
    +set_attribute(model, "maxit", 100)

    MathOptInterface API

    The ECOS optimizer supports the following constraints and attributes.

    List of supported objective functions:

    List of supported variable types:

    List of supported constraint types:

    List of supported model attributes:

    Options

    The following options are supported:

    ParameterExplanation
    gammascaling the final step length
    deltaregularization parameter
    epsregularization threshold
    feastolprimal/dual infeasibility tolerance
    abstolabsolute tolerance on duality gap
    reltolrelative tolerance on duality gap
    feastol_inaccprimal/dual infeasibility relaxed tolerance
    abstol_inaccabsolute relaxed tolerance on duality gap
    reltol_inaccrelative relaxed tolerance on duality gap
    nitrefnumber of iterative refinement steps
    maxitmaximum number of iterations
    verboseverbosity bool for PRINTLEVEL < 3
    diff --git a/previews/PR3778/packages/GAMS/index.html b/previews/PR3778/packages/GAMS/index.html index 6c5ea78ed7e..a25e80a4efd 100644 --- a/previews/PR3778/packages/GAMS/index.html +++ b/previews/PR3778/packages/GAMS/index.html @@ -22,4 +22,4 @@ MOI.get(model, GAMS.GeneratedConstraintName(), c[2]) # returns eq2 MOI.get(model, GAMS.OriginalConstraintName("eq1")) # returns c[1] -MOI.get(model, GAMS.OriginalConstraintName("eq10")) # returns nothing

    Note that JuMP direct-mode is used.

    +MOI.get(model, GAMS.OriginalConstraintName("eq10")) # returns nothing

    Note that JuMP direct-mode is used.

    diff --git a/previews/PR3778/packages/GLPK/index.html b/previews/PR3778/packages/GLPK/index.html index 8e2acb66603..fd919e191a8 100644 --- a/previews/PR3778/packages/GLPK/index.html +++ b/previews/PR3778/packages/GLPK/index.html @@ -36,4 +36,4 @@ @test primal_status(model) == MOI.FEASIBLE_POINT @test value(x) == 1 @test value(y) == 2 -@show reasons

    C API

    The C API can be accessed via GLPK.glp_XXX functions, where the names and arguments are identical to the C API. See the /tests folder for inspiration.

    Thread safety

    GLPK is not thread-safe and should not be used with multithreading.

    +@show reasons

    C API

    The C API can be accessed via GLPK.glp_XXX functions, where the names and arguments are identical to the C API. See the /tests folder for inspiration.

    Thread safety

    GLPK is not thread-safe and should not be used with multithreading.

    diff --git a/previews/PR3778/packages/Gurobi/index.html b/previews/PR3778/packages/Gurobi/index.html index 92cfc3ad843..22b85f6e8ca 100644 --- a/previews/PR3778/packages/Gurobi/index.html +++ b/previews/PR3778/packages/Gurobi/index.html @@ -169,4 +169,4 @@ println(lower_bound(x[i])) end

    Common errors

    Using Gurobi v9.0 and you got an error like Q not PSD?

    You need to set the NonConvex parameter:

    model = Model(Gurobi.Optimizer)
     set_optimizer_attribute(model, "NonConvex", 2)

    Gurobi Error 1009: Version number is XX.X, license is for version XX.X

    Make sure that your license is correct for your Gurobi version. See the Gurobi documentation for details.

    Once you are sure that the license and Gurobi versions match, re-install Gurobi.jl by running:

    import Pkg
    -Pkg.build("Gurobi")
    +Pkg.build("Gurobi") diff --git a/previews/PR3778/packages/HiGHS/index.html b/previews/PR3778/packages/HiGHS/index.html index 2215e0d75db..d8a4e648432 100644 --- a/previews/PR3778/packages/HiGHS/index.html +++ b/previews/PR3778/packages/HiGHS/index.html @@ -10,4 +10,4 @@ set_attribute(model, "time_limit", 60.0)

    MathOptInterface API

    The HiGHS optimizer supports the following constraints and attributes.

    List of supported objective functions:

    List of supported variable types:

    List of supported constraint types:

    List of supported model attributes:

    Options

    See the HiGHS documentation for a full list of the available options.

    C API

    The C API can be accessed via HiGHS.Highs_xxx functions, where the names and arguments are identical to the C API.

    Threads

    HiGHS uses a global scheduler that is shared between threads.

    Before changing the number of threads using MOI.Threads(), you must call Highs_resetGlobalScheduler(1):

    using JuMP, HiGHS
     model = Model(HiGHS.Optimizer)
     Highs_resetGlobalScheduler(1)
    -set_attribute(model, MOI.NumberOfThreads(), 1)

    If modifying the number of HiGHS threads across different Julia threads, be sure to read the docstring of Highs_resetGlobalScheduler. In particular, resetting the scheduler is not thread-safe.

    +set_attribute(model, MOI.NumberOfThreads(), 1)

    If modifying the number of HiGHS threads across different Julia threads, be sure to read the docstring of Highs_resetGlobalScheduler. In particular, resetting the scheduler is not thread-safe.

    diff --git a/previews/PR3778/packages/Hypatia/index.html b/previews/PR3778/packages/Hypatia/index.html index 7141b7eea44..9ae4ae01212 100644 --- a/previews/PR3778/packages/Hypatia/index.html +++ b/previews/PR3778/packages/Hypatia/index.html @@ -42,4 +42,4 @@ volume={15}, pages={53--101}, doi={https://doi.org/10.1007/s12532-022-00226-0} -} +} diff --git a/previews/PR3778/packages/InfiniteOpt/index.html b/previews/PR3778/packages/InfiniteOpt/index.html index 9a784b8ff5f..29ca01733c9 100644 --- a/previews/PR3778/packages/InfiniteOpt/index.html +++ b/previews/PR3778/packages/InfiniteOpt/index.html @@ -12,4 +12,4 @@ doi = {https://doi.org/10.1016/j.compchemeng.2021.107567}, url = {https://www.sciencedirect.com/science/article/pii/S0098135421003458}, author = {Joshua L. Pulsipher and Weiqi Zhang and Tyler J. Hongisto and Victor M. Zavala}, -}

    A pre-print version is freely available though arXiv.

    +}

    A pre-print version is freely available though arXiv.

    diff --git a/previews/PR3778/packages/Ipopt/index.html b/previews/PR3778/packages/Ipopt/index.html index b8b4e617164..23804ba7891 100644 --- a/previews/PR3778/packages/Ipopt/index.html +++ b/previews/PR3778/packages/Ipopt/index.html @@ -119,4 +119,4 @@ using Ipopt

    BLIS

    If you have BLISBLAS.jl installed, switch to BLIS by adding using BLISBLAS to your code:

    using BLISBLAS
     using Ipopt

    Note that this will replace OpenBLAS's BLAS functionality by BLIS. OpenBLAS will still be used for LAPACK functionality.

    AppleAccelerate

    If you are using macOS ≥ v13.4 and you have AppleAccelerate.jl installed, add using AppleAccelerate to your code:

    using AppleAccelerate
     using Ipopt

    Display backends

    Check what backends are loaded using:

    import LinearAlgebra
    -LinearAlgebra.BLAS.lbt_get_config()
    +LinearAlgebra.BLAS.lbt_get_config() diff --git a/previews/PR3778/packages/Juniper/index.html b/previews/PR3778/packages/Juniper/index.html index af6e829a314..e5c74a93c89 100644 --- a/previews/PR3778/packages/Juniper/index.html +++ b/previews/PR3778/packages/Juniper/index.html @@ -33,4 +33,4 @@ year="2018", publisher="Springer International Publishing", isbn="978-3-319-93031-2" -} +} diff --git a/previews/PR3778/packages/KNITRO/index.html b/previews/PR3778/packages/KNITRO/index.html index 37b346f7388..773d38c8911 100644 --- a/previews/PR3778/packages/KNITRO/index.html +++ b/previews/PR3778/packages/KNITRO/index.html @@ -10,4 +10,4 @@ set_attribute(model, "algorithm", 4)

    Use with AMPL

    To use KNITRO with AmplNLWriter.jl, use KNITRO.amplexe:

    using JuMP
     import AmplNLWriter
     import KNITRO
    -model = Model(() -> AmplNLWriter.Optimizer(KNITRO.amplexe, ["outlev=3"]))

    Use with other packages

    A variety of packages extend KNITRO.jl to support other optimization modeling systems. These include:

    MathOptInterface API

    The Knitro optimizer supports the following constraints and attributes.

    List of supported objective functions:

    List of supported variable types:

    List of supported constraint types:

    List of supported model attributes:

    Options

    A list of available options is provided in the KNITRO reference manual.

    Low-level wrapper

    The complete C API can be accessed via KNITRO.KN_xx functions, where the names and arguments are identical to the C API.

    See the KNITRO documentation for details.

    As general rules when converting from Julia to C:

    Extensive examples using the C wrapper can be found in examples/.

    Breaking changes

    KNITRO.jl v0.14.0 introduced a number of breaking changes to the low-level C API. The main changes were:

    1. removing Julia-specific functions like KN_set_param. Use the C API functions like KN_set_int_param and KN_set_double_param_by_name.
    2. removing intermediate methods that tried to make the C API more Julia-like. For example, we have removed the KN_add_var method that returned the index of the variable. There is now only the method from the C API.

    If you have trouble updating, please open a GitHub issue.

    Multi-threading

    Due to limitations in the interaction between Julia and C, KNITRO.jl disables multi-threading if the problem is nonlinear. This will override any options such as par_numthreads that you may have set.

    If you are using the low-level API, opt-in to enable multi-threading by calling KN_solve(model.env) instead of KN_solve(model), where model is the value returned by model = KN_new(). Note that calling KN_solve(model.env) is an advanced operation because it requires all callbacks you provide to be threadsafe.

    Read GitHub issue #93 for more details.

    +model = Model(() -> AmplNLWriter.Optimizer(KNITRO.amplexe, ["outlev=3"]))

    Use with other packages

    A variety of packages extend KNITRO.jl to support other optimization modeling systems. These include:

    MathOptInterface API

    The Knitro optimizer supports the following constraints and attributes.

    List of supported objective functions:

    List of supported variable types:

    List of supported constraint types:

    List of supported model attributes:

    Options

    A list of available options is provided in the KNITRO reference manual.

    Low-level wrapper

    The complete C API can be accessed via KNITRO.KN_xx functions, where the names and arguments are identical to the C API.

    See the KNITRO documentation for details.

    As general rules when converting from Julia to C:

    Extensive examples using the C wrapper can be found in examples/.

    Breaking changes

    KNITRO.jl v0.14.0 introduced a number of breaking changes to the low-level C API. The main changes were:

    1. removing Julia-specific functions like KN_set_param. Use the C API functions like KN_set_int_param and KN_set_double_param_by_name.
    2. removing intermediate methods that tried to make the C API more Julia-like. For example, we have removed the KN_add_var method that returned the index of the variable. There is now only the method from the C API.

    If you have trouble updating, please open a GitHub issue.

    Multi-threading

    Due to limitations in the interaction between Julia and C, KNITRO.jl disables multi-threading if the problem is nonlinear. This will override any options such as par_numthreads that you may have set.

    If you are using the low-level API, opt-in to enable multi-threading by calling KN_solve(model.env) instead of KN_solve(model), where model is the value returned by model = KN_new(). Note that calling KN_solve(model.env) is an advanced operation because it requires all callbacks you provide to be threadsafe.

    Read GitHub issue #93 for more details.

    diff --git a/previews/PR3778/packages/Loraine/index.html b/previews/PR3778/packages/Loraine/index.html index 7baa8fd84c7..56ed3b82e67 100644 --- a/previews/PR3778/packages/Loraine/index.html +++ b/previews/PR3778/packages/Loraine/index.html @@ -29,4 +29,4 @@ www={https://hal.science/hal-04076509/} note={Preprint hal-04076509} year={2023} -}
    +}
    diff --git a/previews/PR3778/packages/MAiNGO/index.html b/previews/PR3778/packages/MAiNGO/index.html index f2457603398..af7a70e0c79 100644 --- a/previews/PR3778/packages/MAiNGO/index.html +++ b/previews/PR3778/packages/MAiNGO/index.html @@ -94,4 +94,4 @@ findMAiNGO(preferred=MAiNGO.C_API) # switch back to MAiNGO_jll findMAiNGO(preferred=MAiNGO.MAINGO_JLL)

    The findMAiNGO() function takes several optional arguments, which can be passed as keyword-arguments:

    For example, to use the C-API at a new location, one could call:

    using MAiNGO
    -findMAiNGO(preferred=MAiNGO.C_API, c_api="path\\to\\c\\api\\shared_parser.dll")

    Currently working:

    Restrictions compared to using the Python or C++ interface

    It is assumed that all variables are bounded. This interface assumes that integer variables are bounded between -1e6 and 1e6. For real variables these bounds are -1e8 and 1e8.

    Other functionality such as special support for growing datasets or MPI parallelization is not currently supported via this wrapper. Additionally, constraint formulations are simply passed from their representation in JuMP/MathOptInterface to MAiNGO. As such, there is no way to make use of advanced techniques such as defining constraints that are only used for the relaxations, using special relaxations for functions used in thermodynamics and process engineering or formulating reduced space formulations.

    Tests

    A subset of test cases for MathOptInterface solvers can be run by running the script ./test/runtests.jl. The current release was tested in the following combinations:

    +findMAiNGO(preferred=MAiNGO.C_API, c_api="path\\to\\c\\api\\shared_parser.dll")

    Currently working:

    Restrictions compared to using the Python or C++ interface

    It is assumed that all variables are bounded. This interface assumes that integer variables are bounded between -1e6 and 1e6. For real variables these bounds are -1e8 and 1e8.

    Other functionality such as special support for growing datasets or MPI parallelization is not currently supported via this wrapper. Additionally, constraint formulations are simply passed from their representation in JuMP/MathOptInterface to MAiNGO. As such, there is no way to make use of advanced techniques such as defining constraints that are only used for the relaxations, using special relaxations for functions used in thermodynamics and process engineering or formulating reduced space formulations.

    Tests

    A subset of test cases for MathOptInterface solvers can be run by running the script ./test/runtests.jl. The current release was tested in the following combinations:

    diff --git a/previews/PR3778/packages/MadNLP/index.html b/previews/PR3778/packages/MadNLP/index.html index afe2f85cd64..e21ff8d8d4d 100644 --- a/previews/PR3778/packages/MadNLP/index.html +++ b/previews/PR3778/packages/MadNLP/index.html @@ -45,4 +45,4 @@ author={Shin, Sungho and Coffrin, Carleton and Sundar, Kaarthik and Zavala, Victor M}, journal={arXiv preprint arXiv:2010.02404}, year={2020} -}

    Bug reports and support

    Please report issues and feature requests via the GitHub issue tracker.

    +}

    Bug reports and support

    Please report issues and feature requests via the GitHub issue tracker.

    diff --git a/previews/PR3778/packages/Manopt/index.html b/previews/PR3778/packages/Manopt/index.html index 0ed1c58cffe..4307f356abc 100644 --- a/previews/PR3778/packages/Manopt/index.html +++ b/previews/PR3778/packages/Manopt/index.html @@ -30,4 +30,4 @@ TITLE = {Manifolds.jl: An Extensible Julia Framework for Data Analysis on Manifolds}, VOLUME = {49}, YEAR = {2023} -}

    as well. Note that all citations are in BibLaTeX format.

    Manopt.jl belongs to the Manopt family:

    Did you use Manopt.jl somewhere? Let us know! We'd love to collect those here as well.

    +}

    as well. Note that all citations are in BibLaTeX format.

    Manopt.jl belongs to the Manopt family:

    Did you use Manopt.jl somewhere? Let us know! We'd love to collect those here as well.

    diff --git a/previews/PR3778/packages/MiniZinc/index.html b/previews/PR3778/packages/MiniZinc/index.html index 52b7a9a1102..058e63a9076 100644 --- a/previews/PR3778/packages/MiniZinc/index.html +++ b/previews/PR3778/packages/MiniZinc/index.html @@ -53,4 +53,4 @@ @constraint(model, x in MOI.AllDifferent(3)) @objective(model, Max, sum(i * x[i] for i in 1:3)) optimize!(model) -@show value.(x)

    MathOptInterface API

    The MiniZinc Optimizer{T} supports the following constraints and attributes.

    List of supported objective functions:

    List of supported variable types:

    List of supported constraint types:

    List of supported model attributes:

    Options

    Set options using MOI.RawOptimizerAttribute in MOI or set_attribute in JuMP.

    MiniZinc.jl supports the following options:

    +@show value.(x)

    MathOptInterface API

    The MiniZinc Optimizer{T} supports the following constraints and attributes.

    List of supported objective functions:

    List of supported variable types:

    List of supported constraint types:

    List of supported model attributes:

    Options

    Set options using MOI.RawOptimizerAttribute in MOI or set_attribute in JuMP.

    MiniZinc.jl supports the following options:

    diff --git a/previews/PR3778/packages/MosekTools/index.html b/previews/PR3778/packages/MosekTools/index.html index 408d383b86d..d78463c96ae 100644 --- a/previews/PR3778/packages/MosekTools/index.html +++ b/previews/PR3778/packages/MosekTools/index.html @@ -7,4 +7,4 @@ using MosekTools model = Model(Mosek.Optimizer) set_attribute(model, "QUIET", true) -set_attribute(model, "INTPNT_CO_TOL_DFEAS", 1e-7)

    Options

    The parameter QUIET is a special parameter that when set to true disables all Mosek printing output.

    All other parameters can be found in the Mosek documentation.

    Note that the prefix MSK_IPAR_ (for integer parameters), MSK_DPAR_ (for floating point parameters) or MSK_SPAR_ (for string parameters) are optional. If they are not given, they are inferred from the type of the value. For example, in the example above, as 1e-7 is a floating point number, the parameters name used is MSK_DPAR_INTPNT_CO_TOL_DFEAS.

    +set_attribute(model, "INTPNT_CO_TOL_DFEAS", 1e-7)

    Options

    The parameter QUIET is a special parameter that when set to true disables all Mosek printing output.

    All other parameters can be found in the Mosek documentation.

    Note that the prefix MSK_IPAR_ (for integer parameters), MSK_DPAR_ (for floating point parameters) or MSK_SPAR_ (for string parameters) are optional. If they are not given, they are inferred from the type of the value. For example, in the example above, as 1e-7 is a floating point number, the parameters name used is MSK_DPAR_INTPNT_CO_TOL_DFEAS.

    diff --git a/previews/PR3778/packages/MultiObjectiveAlgorithms/index.html b/previews/PR3778/packages/MultiObjectiveAlgorithms/index.html index 0359166a6f3..2a7d54a42a9 100644 --- a/previews/PR3778/packages/MultiObjectiveAlgorithms/index.html +++ b/previews/PR3778/packages/MultiObjectiveAlgorithms/index.html @@ -9,4 +9,4 @@ import MultiObjectiveAlgorithms as MOA model = JuMP.Model(() -> MOA.Optimizer(HiGHS.Optimizer)) set_attribute(model, MOA.Algorithm(), MOA.Dichotomy()) -set_attribute(model, MOA.SolutionLimit(), 4)

    Replace HiGHS.Optimizer with an optimizer capable of solving a single-objective instance of your optimization problem.

    You may set additional optimizer attributes, the supported attributes depend on the choice of solution algorithm.

    Algorithm

    Set the algorithm using the MOA.Algorithm() attribute.

    The value must be one of the algorithms supported by MOA:

    Consult their docstrings for details.

    Other optimizer attributes

    There are a number of optimizer attributes supported by the algorithms in MOA.

    Each algorithm supports only a subset of the attributes. Consult the algorithm's docstring for details on which attributes it supports, and how it uses them in the solution process.

    +set_attribute(model, MOA.SolutionLimit(), 4)

    Replace HiGHS.Optimizer with an optimizer capable of solving a single-objective instance of your optimization problem.

    You may set additional optimizer attributes, the supported attributes depend on the choice of solution algorithm.

    Algorithm

    Set the algorithm using the MOA.Algorithm() attribute.

    The value must be one of the algorithms supported by MOA:

    Consult their docstrings for details.

    Other optimizer attributes

    There are a number of optimizer attributes supported by the algorithms in MOA.

    Each algorithm supports only a subset of the attributes. Consult the algorithm's docstring for details on which attributes it supports, and how it uses them in the solution process.

    diff --git a/previews/PR3778/packages/NEOSServer/index.html b/previews/PR3778/packages/NEOSServer/index.html index 5a0047aac6a..db3cab1acee 100644 --- a/previews/PR3778/packages/NEOSServer/index.html +++ b/previews/PR3778/packages/NEOSServer/index.html @@ -28,4 +28,4 @@ model = Model() do NEOSServer.Optimizer(email="me@mydomain.com", solver="Ipopt") -end

    Note: NEOSServer.Optimizer is limited to the following solvers:

    NEOS Limits

    NEOS currently limits jobs to an 8 hour time limit, 3 GB of memory, and a 16 MB submission file. If your model exceeds these limits, NEOSServer.jl may be unable to return useful information to the user.

    +end

    Note: NEOSServer.Optimizer is limited to the following solvers:

    NEOS Limits

    NEOS currently limits jobs to an 8 hour time limit, 3 GB of memory, and a 16 MB submission file. If your model exceeds these limits, NEOSServer.jl may be unable to return useful information to the user.

    diff --git a/previews/PR3778/packages/NLopt/index.html b/previews/PR3778/packages/NLopt/index.html index fa6e74fd274..9fc94ee374d 100644 --- a/previews/PR3778/packages/NLopt/index.html +++ b/previews/PR3778/packages/NLopt/index.html @@ -6,4 +6,4 @@

    NLopt.jl

    Build Status codecov

    NLopt.jl is a wrapper for the NLopt library.

    License

    NLopt.jl is licensed under the MIT License.

    The underlying solver, stevengj/nlopt, is licensed under the LGPL v3.0 license.

    Installation

    Install NLopt.jl using the Julia package manager:

    import Pkg
     Pkg.add("NLopt")

    In addition to installing the NLopt.jl package, this will also download and install the NLopt binaries. You do not need to install NLopt separately.

    Use with JuMP

    You can use NLopt with JuMP as follows:

    using JuMP, NLopt
     model = Model(NLopt.Optimizer)
    -set_attribute(model, "algorithm", :LD_MMA)

    Options

    The algorithm attribute is required. The value must be one of the supported NLopt algorithms.

    Documentation

    For more details, see the NLopt.jl README or the NLopt documentation.

    +set_attribute(model, "algorithm", :LD_MMA)

    Options

    The algorithm attribute is required. The value must be one of the supported NLopt algorithms.

    Documentation

    For more details, see the NLopt.jl README or the NLopt documentation.

    diff --git a/previews/PR3778/packages/OSQP/index.html b/previews/PR3778/packages/OSQP/index.html index bc1eab1a374..4da443ad5a9 100644 --- a/previews/PR3778/packages/OSQP/index.html +++ b/previews/PR3778/packages/OSQP/index.html @@ -6,4 +6,4 @@

    OSQP.jl

    Build Status codecov.io

    OSQP.jl is a Julia wrapper for OSQP: the Operator Splitting QP Solver.

    License

    OSQP.jl is licensed under the Apache-2.0 license.

    The upstream solver, osqp/osqp is also licensed under the Apache-2.0 license.

    Installation

    Install OSQP.jl using the Julia package manager

    import Pkg
     Pkg.add("OSQP")

    Problem class

    The OSQP (Operator Splitting Quadratic Program) solver is a numerical optimization package for solving problems in the form

    minimize        0.5 x' P x + q' x
     
    -subject to      l <= A x <= u

    where x in R^n is the optimization variable. The objective function is defined by a positive semidefinite matrix P in S^n_+ and vector q in R^n. The linear constraints are defined by matrix A in R^{m x n} and vectors l in R^m U {-inf}^m, u in R^m U {+inf}^m.

    Documentation

    Detailed documentation is available at https://osqp.org/.

    +subject to l <= A x <= u

    where x in R^n is the optimization variable. The objective function is defined by a positive semidefinite matrix P in S^n_+ and vector q in R^n. The linear constraints are defined by matrix A in R^{m x n} and vectors l in R^m U {-inf}^m, u in R^m U {+inf}^m.

    Documentation

    Detailed documentation is available at https://osqp.org/.

    diff --git a/previews/PR3778/packages/Optim/index.html b/previews/PR3778/packages/Optim/index.html index bd225659e7e..b9f71fb2e8f 100644 --- a/previews/PR3778/packages/Optim/index.html +++ b/previews/PR3778/packages/Optim/index.html @@ -105,4 +105,4 @@ number = {24}, pages = {615}, doi = {10.21105/joss.00615} -} +} diff --git a/previews/PR3778/packages/PATHSolver/index.html b/previews/PR3778/packages/PATHSolver/index.html index fa8060c0c8f..d1f47948e98 100644 --- a/previews/PR3778/packages/PATHSolver/index.html +++ b/previews/PR3778/packages/PATHSolver/index.html @@ -165,4 +165,4 @@ 0.8 1.2

    Thread safety

    PATH is not thread-safe and there are no known work-arounds. Do not run it in parallel using Threads.@threads. See issue #62 for more details.

    Factorization methods

    By default, PATHSolver.jl will download the LUSOL shared library. To use LUSOL, set the following options:

    model = Model(PATHSolver.Optimizer)
     set_optimizer_attribute(model, "factorization_method", "blu_lusol")
    -set_optimizer_attribute(model, "factorization_library_name", PATHSolver.LUSOL_LIBRARY_PATH)

    To use factorization_method umfpack you will need the umfpack shared library that is available directly from the developers of that code for academic use.

    Manual installation

    By default PATHSolver.jl will download a copy of the libpath library. If you already have one installed and want to use that, set the PATH_JL_LOCATION environment variable to point to the libpath50.xx library.

    +set_optimizer_attribute(model, "factorization_library_name", PATHSolver.LUSOL_LIBRARY_PATH)

    To use factorization_method umfpack you will need the umfpack shared library that is available directly from the developers of that code for academic use.

    Manual installation

    By default PATHSolver.jl will download a copy of the libpath library. If you already have one installed and want to use that, set the PATH_JL_LOCATION environment variable to point to the libpath50.xx library.

    diff --git a/previews/PR3778/packages/Pajarito/index.html b/previews/PR3778/packages/Pajarito/index.html index effd32d4ac7..4a4b06fd7e5 100644 --- a/previews/PR3778/packages/Pajarito/index.html +++ b/previews/PR3778/packages/Pajarito/index.html @@ -27,4 +27,4 @@ pages={249--293}, year={2020}, publisher={Springer} -}

    Note this paper describes a legacy MathProgBase version of Pajarito, which is available on the mathprogbase branch of this repository. Starting with version v0.8.0, Pajarito supports MathOptInterface instead of MathProgBase.

    +}

    Note this paper describes a legacy MathProgBase version of Pajarito, which is available on the mathprogbase branch of this repository. Starting with version v0.8.0, Pajarito supports MathOptInterface instead of MathProgBase.

    diff --git a/previews/PR3778/packages/ParametricOptInterface/index.html b/previews/PR3778/packages/ParametricOptInterface/index.html index 4bde638a4b8..3a9d5f90592 100644 --- a/previews/PR3778/packages/ParametricOptInterface/index.html +++ b/previews/PR3778/packages/ParametricOptInterface/index.html @@ -13,4 +13,4 @@ @objective(model, Min, 2x) optimize!(model) MOI.set(model, POI.ParameterValue(), p, 2.0) -optimize!(model)

    GSOC2020

    ParametricOptInterface began as a NumFOCUS sponsored Google Summer of Code (2020) project.

    +optimize!(model)

    GSOC2020

    ParametricOptInterface began as a NumFOCUS sponsored Google Summer of Code (2020) project.

    diff --git a/previews/PR3778/packages/Pavito/index.html b/previews/PR3778/packages/Pavito/index.html index 559b371ac8c..b2ade07994a 100644 --- a/previews/PR3778/packages/Pavito/index.html +++ b/previews/PR3778/packages/Pavito/index.html @@ -13,4 +13,4 @@ "cont_solver" => optimizer_with_attributes(Ipopt.Optimizer, "print_level" => 0), ), -)

    The algorithm implemented by Pavito itself is relatively simple; most of the hard work is performed by the MILP solver passed as mip_solver and the NLP solver passed as cont_solver.

    The performance of Pavito depends on these two types of solvers.

    For better performance, you should use a commercial MILP solver such as CPLEX or Gurobi.

    Options

    The following optimizer attributes can set to a Pavito.Optimizer to modify its behavior:

    Pavito is not yet numerically robust and may require tuning of parameters to improve convergence.

    If the default parameters don't work for you, please let us know by opening an issue.

    For improved Pavito performance, MILP solver integrality tolerance and feasibility tolerances should typically be tightened, for example to 1e-8.

    Bug reports and support

    Please report any issues via the GitHub issue tracker. All types of issues are welcome and encouraged; this includes bug reports, documentation typos, feature requests, etc. The Optimization (Mathematical) category on Discourse is appropriate for general discussion.

    +)

    The algorithm implemented by Pavito itself is relatively simple; most of the hard work is performed by the MILP solver passed as mip_solver and the NLP solver passed as cont_solver.

    The performance of Pavito depends on these two types of solvers.

    For better performance, you should use a commercial MILP solver such as CPLEX or Gurobi.

    Options

    The following optimizer attributes can set to a Pavito.Optimizer to modify its behavior:

    Pavito is not yet numerically robust and may require tuning of parameters to improve convergence.

    If the default parameters don't work for you, please let us know by opening an issue.

    For improved Pavito performance, MILP solver integrality tolerance and feasibility tolerances should typically be tightened, for example to 1e-8.

    Bug reports and support

    Please report any issues via the GitHub issue tracker. All types of issues are welcome and encouraged; this includes bug reports, documentation typos, feature requests, etc. The Optimization (Mathematical) category on Discourse is appropriate for general discussion.

    diff --git a/previews/PR3778/packages/Percival/index.html b/previews/PR3778/packages/Percival/index.html index 28da23d0bb1..faf1f959cc9 100644 --- a/previews/PR3778/packages/Percival/index.html +++ b/previews/PR3778/packages/Percival/index.html @@ -22,4 +22,4 @@ [1.0], [1.0], ) -output = percival(nlp, verbose = 1)

    Bug reports and discussions

    If you think you found a bug, feel free to open an issue. Focused suggestions and requests can also be opened as issues. Before opening a pull request, start an issue or a discussion on the topic, please.

    If you want to ask a question not suited for a bug report, feel free to start a discussion here. This forum is for general discussion about this repository and the JuliaSmoothOptimizers, so questions about any of our packages are welcome.

    +output = percival(nlp, verbose = 1)

    Bug reports and discussions

    If you think you found a bug, feel free to open an issue. Focused suggestions and requests can also be opened as issues. Before opening a pull request, start an issue or a discussion on the topic, please.

    If you want to ask a question not suited for a bug report, feel free to start a discussion here. This forum is for general discussion about this repository and the JuliaSmoothOptimizers, so questions about any of our packages are welcome.

    diff --git a/previews/PR3778/packages/Plasmo/index.html b/previews/PR3778/packages/Plasmo/index.html index b87e3a6258d..a059d3cd457 100644 --- a/previews/PR3778/packages/Plasmo/index.html +++ b/previews/PR3778/packages/Plasmo/index.html @@ -46,4 +46,4 @@ eprint = {2006.05378}, archivePrefix = {arXiv}, primaryClass = {math.OC} -} +} diff --git a/previews/PR3778/packages/PolyJuMP/index.html b/previews/PR3778/packages/PolyJuMP/index.html index bf4f6df41d8..778829d095c 100644 --- a/previews/PR3778/packages/PolyJuMP/index.html +++ b/previews/PR3778/packages/PolyJuMP/index.html @@ -17,4 +17,4 @@ model = Model(optimizer_with_attributes( PolyJuMP.KKT.Optimizer, "solver" => HomotopyContinuation.SemialgebraicSetsHCSolver(), -))

    Documentation

    Documentation for PolyJuMP.jl is included in the documentation for SumOfSquares.jl.

    +))

    Documentation

    Documentation for PolyJuMP.jl is included in the documentation for SumOfSquares.jl.

    diff --git a/previews/PR3778/packages/ProxSDP/index.html b/previews/PR3778/packages/ProxSDP/index.html index 0232146609a..796eebbfc67 100644 --- a/previews/PR3778/packages/ProxSDP/index.html +++ b/previews/PR3778/packages/ProxSDP/index.html @@ -56,4 +56,4 @@ publisher = {Taylor & Francis}, doi = {10.1080/02331934.2020.1823387}, URL = {https://doi.org/10.1080/02331934.2020.1823387} -}

    The preprint version of the paper can be found here.

    Disclaimer

    ROAD MAP

    +}

    The preprint version of the paper can be found here.

    Disclaimer

    ROAD MAP

    diff --git a/previews/PR3778/packages/SCIP/index.html b/previews/PR3778/packages/SCIP/index.html index 33b87fc0baf..d1e915f3527 100644 --- a/previews/PR3778/packages/SCIP/index.html +++ b/previews/PR3778/packages/SCIP/index.html @@ -10,4 +10,4 @@ Pkg.build("SCIP")

    Use with JuMP

    Use SCIP with JuMP as follows:

    using JuMP, SCIP
     model = Model(SCIP.Optimizer)
     set_attribute(model, "display/verblevel", 0)
    -set_attribute(model, "limits/gap", 0.05)

    Options

    See the SCIP documentation for a list of supported options.

    MathOptInterface API

    The SCIP optimizer supports the following constraints and attributes.

    List of supported objective functions:

    List of supported variable types:

    List of supported constraint types:

    List of supported model attributes:

    Design considerations

    Wrapping the public API

    All of the public API methods are wrapped and available within the SCIP package. This includes the scip_*.h and pub_*.h headers that are collected in scip.h, as well as all default constraint handlers (cons_*.h.)

    The wrapped functions do not transform any data structures and work on the raw pointers (for example, SCIP* in C, Ptr{SCIP_} in Julia). Convenience wrapper functions based on Julia types are added as needed.

    Memory management

    Programming with SCIP requires dealing with variable and constraint objects that use reference counting for memory management.

    The SCIP.Optimizer wrapper type collects lists of SCIP_VAR* and SCIP_CONS* under the hood, and it releases all references when it is garbage collected itself (via finalize).

    When adding a variable (add_variable) or a constraint (add_linear_constraint), an integer index is returned. This index can be used to retrieve the SCIP_VAR* or SCIP_CONS* pointer via get_var and get_cons respectively.

    Supported nonlinear operators

    Supported operators in nonlinear expressions are as follows:

    +set_attribute(model, "limits/gap", 0.05)

    Options

    See the SCIP documentation for a list of supported options.

    MathOptInterface API

    The SCIP optimizer supports the following constraints and attributes.

    List of supported objective functions:

    List of supported variable types:

    List of supported constraint types:

    List of supported model attributes:

    Design considerations

    Wrapping the public API

    All of the public API methods are wrapped and available within the SCIP package. This includes the scip_*.h and pub_*.h headers that are collected in scip.h, as well as all default constraint handlers (cons_*.h.)

    The wrapped functions do not transform any data structures and work on the raw pointers (for example, SCIP* in C, Ptr{SCIP_} in Julia). Convenience wrapper functions based on Julia types are added as needed.

    Memory management

    Programming with SCIP requires dealing with variable and constraint objects that use reference counting for memory management.

    The SCIP.Optimizer wrapper type collects lists of SCIP_VAR* and SCIP_CONS* under the hood, and it releases all references when it is garbage collected itself (via finalize).

    When adding a variable (add_variable) or a constraint (add_linear_constraint), an integer index is returned. This index can be used to retrieve the SCIP_VAR* or SCIP_CONS* pointer via get_var and get_cons respectively.

    Supported nonlinear operators

    Supported operators in nonlinear expressions are as follows:

    diff --git a/previews/PR3778/packages/SCS/index.html b/previews/PR3778/packages/SCS/index.html index b53503e6861..9f8e4e1cd4d 100644 --- a/previews/PR3778/packages/SCS/index.html +++ b/previews/PR3778/packages/SCS/index.html @@ -53,4 +53,4 @@ julia> SCS.is_available(SCS.GpuIndirectSolver) true

    The GpuIndirectSolver is available on Linux x86_64 platform only.

    Low-level wrapper

    SCS.jl provides a low-level interface to solve a problem directly, without interfacing through MathOptInterface.

    This is an advanced interface with a risk of incorrect usage. For new users, we recommend that you use the JuMP or Convex interfaces instead.

    SCS solves a problem of the form:

    minimize        1/2 * x' * P * x + c' * x
     subject to      A * x + s = b
    -                s in K

    where K is a product cone of:

    To solve this problem with SCS, call SCS.scs_solve; see the docstring for details.

    + s in K

    where K is a product cone of:

    To solve this problem with SCS, call SCS.scs_solve; see the docstring for details.

    diff --git a/previews/PR3778/packages/SDDP/index.html b/previews/PR3778/packages/SDDP/index.html index 7999c718983..bffa62949c5 100644 --- a/previews/PR3778/packages/SDDP/index.html +++ b/previews/PR3778/packages/SDDP/index.html @@ -3,4 +3,4 @@ function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-0RZ8X3D3D0', {'page_path': location.pathname + location.search + location.hash}); -
    +
    diff --git a/previews/PR3778/packages/SDPA/index.html b/previews/PR3778/packages/SDPA/index.html index 4ebf42a7121..e58cbbb040c 100644 --- a/previews/PR3778/packages/SDPA/index.html +++ b/previews/PR3778/packages/SDPA/index.html @@ -12,4 +12,4 @@ set_attribute(model, "Mode", SDPA.PARAMETER_STABLE_BUT_SLOW)

    Note that the parameters are set in the order they are given, so you can set a mode and then modify parameters from this mode.

    using JuMP, SDPA
     model = Model(SDPA.Optimizer)
     set_attribute(model, "Mode", SDPA.PARAMETER_STABLE_BUT_SLOW)
    -set_attribute(model, "MaxIteration", 100)

    The choice of parameter mode has a large impact on the performance and stability of SDPA, and not necessarily in the way implied by the names of the modes; for example, PARAMETER_UNSTABLE_BUT_FAST can be more stable than the other modes for some problems. You should try each mode to see how it performs on your specific problem. See SDPA.jl#17 for more details.

    +set_attribute(model, "MaxIteration", 100)

    The choice of parameter mode has a large impact on the performance and stability of SDPA, and not necessarily in the way implied by the names of the modes; for example, PARAMETER_UNSTABLE_BUT_FAST can be more stable than the other modes for some problems. You should try each mode to see how it performs on your specific problem. See SDPA.jl#17 for more details.

    diff --git a/previews/PR3778/packages/SDPLR/index.html b/previews/PR3778/packages/SDPLR/index.html index 595d03ed54a..12ce78bc4b1 100644 --- a/previews/PR3778/packages/SDPLR/index.html +++ b/previews/PR3778/packages/SDPLR/index.html @@ -50,4 +50,4 @@ sigma *= 2 end lambdaupdate = 0 -end +end diff --git a/previews/PR3778/packages/SDPNAL/index.html b/previews/PR3778/packages/SDPNAL/index.html index c34bc330151..84e79f9aa39 100644 --- a/previews/PR3778/packages/SDPNAL/index.html +++ b/previews/PR3778/packages/SDPNAL/index.html @@ -18,4 +18,4 @@ '/path/to/SDPNALv1.0/solver:', ... '/path/to/SDPNALv1.0/solver_main_default:', ... '/path/to/SDPNALv1.0/util:', ... -% (...)

    If you have SDPT3 in addition to SDPNAL in the MATLAB path (that is, the toolbox/local/pathdef.m file) then you might have issues because both solvers define a validate function, and this might make SDPNAL call SDPT3's validate function instead of SDPT3's validate function.

    +% (...)

    If you have SDPT3 in addition to SDPNAL in the MATLAB path (that is, the toolbox/local/pathdef.m file) then you might have issues because both solvers define a validate function, and this might make SDPNAL call SDPT3's validate function instead of SDPT3's validate function.

    diff --git a/previews/PR3778/packages/SDPT3/index.html b/previews/PR3778/packages/SDPT3/index.html index 6ee2b5fc00e..1e92528d665 100644 --- a/previews/PR3778/packages/SDPT3/index.html +++ b/previews/PR3778/packages/SDPT3/index.html @@ -29,4 +29,4 @@ julia> MATLAB.restoredefaultpath() -julia> MATLAB.mat"savepath" +julia> MATLAB.mat"savepath" diff --git a/previews/PR3778/packages/SeDuMi/index.html b/previews/PR3778/packages/SeDuMi/index.html index ce3b056cca0..2d035254be3 100644 --- a/previews/PR3778/packages/SeDuMi/index.html +++ b/previews/PR3778/packages/SeDuMi/index.html @@ -17,4 +17,4 @@ MATLAB.mat"install_sedumi" end -julia> MATLAB.mat"savepath" +julia> MATLAB.mat"savepath" diff --git a/previews/PR3778/packages/SumOfSquares/index.html b/previews/PR3778/packages/SumOfSquares/index.html index ae664fc9f35..96784aeb13c 100644 --- a/previews/PR3778/packages/SumOfSquares/index.html +++ b/previews/PR3778/packages/SumOfSquares/index.html @@ -4,4 +4,4 @@ gtag('js', new Date()); gtag('config', 'G-0RZ8X3D3D0', {'page_path': location.pathname + location.search + location.hash});

    SumOfSquares.jl

    Build Status codecov

    SumOfSquares.jl is a JuMP extension that, when used in conjunction with MultivariatePolynomial and PolyJuMP, implements a sum of squares reformulation for polynomial optimization.

    License

    SumOfSquares.jl is licensed under the MIT license.

    Installation

    Install SumOfSquares using Pkg.add:

    import Pkg
    -Pkg.add("SumOfSquares")

    Documentation

    See https://jump.dev/SumOfSquares.jl/stable for the most recently tagged version of the documentation.

    See https://jump.dev/SumOfSquares.jl/dev for the in-development version of the documentation.

    Presentations

    Some presentations on, or using, SumOfSquares (see blegat/SumOfSquaresSlides for the source code of the presentations):

    Citing

    See CITATION.bib.

    +Pkg.add("SumOfSquares")

    Documentation

    See https://jump.dev/SumOfSquares.jl/stable for the most recently tagged version of the documentation.

    See https://jump.dev/SumOfSquares.jl/dev for the in-development version of the documentation.

    Presentations

    Some presentations on, or using, SumOfSquares (see blegat/SumOfSquaresSlides for the source code of the presentations):

    Citing

    See CITATION.bib.

    diff --git a/previews/PR3778/packages/Tulip/index.html b/previews/PR3778/packages/Tulip/index.html index 8c2bd684960..7ca81d6810d 100644 --- a/previews/PR3778/packages/Tulip/index.html +++ b/previews/PR3778/packages/Tulip/index.html @@ -28,4 +28,4 @@ language = {en}, url = {https://doi.org/10.1007/s12532-020-00200-8}, urldate = {2021-03-07}, -} +} diff --git a/previews/PR3778/packages/Xpress/index.html b/previews/PR3778/packages/Xpress/index.html index 7cc177ab3dc..5a6081c0c02 100644 --- a/previews/PR3778/packages/Xpress/index.html +++ b/previews/PR3778/packages/Xpress/index.html @@ -8,4 +8,4 @@ import Pkg Pkg.add("Xpress")

    By default, building Xpress.jl will fail if the Xpress library is not found. This may not be desirable in certain cases, for example when part of a package's test suite uses Xpress as an optional test dependency, but Xpress cannot be installed on a CI server running the test suite. To support this use case, the XPRESS_JL_SKIP_LIB_CHECK environment variable may be set (to any value) to make Xpress.jl installable (but not usable).

    Use with JuMP

    To use Xpress with JuMP, use:

    using JuMP, Xpress
     model = Model(Xpress.Optimizer)
    -set_optimizer(model, "PRESOLVE", 0)

    Options

    For other parameters use Xpress Optimizer manual or type julia -e "using Xpress; println(keys(Xpress.XPRS_ATTRIBUTES))".

    If logfile is set to "", the log file is disabled and output is printed to the console (there might be issues with console output on windows (it is manually implemented with callbacks)). If logfile is set to a file's path, output is printed to that file. By default, logfile = "" (console).

    Callbacks

    Solver specific and solver independent callbacks are working in MathOptInterface and, consequently, in JuMP. However, the current implementation should be considered experimental.

    Environment variables

    Specially useful for explicitly loading the dynamic library.

    Skipping Xpress.postsolve

    In older versions of Xpress, the command XPRSpostsolve throws an error in infeasible models. In these older versions the post solve should not be executed. To do this, one can use the MOI.RawOptimizerAttribute("MOI_POST_SOLVE") to skip this routine.

    C API

    The C API can be accessed via Xpress.Lib.XPRSxx functions, where the names and arguments are identical to the C API.

    See the Xpress documentation for details.

    Documentation

    For more information, consult the FICO optimizer manual.

    +set_optimizer(model, "PRESOLVE", 0)

    Options

    For other parameters use Xpress Optimizer manual or type julia -e "using Xpress; println(keys(Xpress.XPRS_ATTRIBUTES))".

    If logfile is set to "", the log file is disabled and output is printed to the console (there might be issues with console output on windows (it is manually implemented with callbacks)). If logfile is set to a file's path, output is printed to that file. By default, logfile = "" (console).

    Callbacks

    Solver specific and solver independent callbacks are working in MathOptInterface and, consequently, in JuMP. However, the current implementation should be considered experimental.

    Environment variables

    Specially useful for explicitly loading the dynamic library.

    Skipping Xpress.postsolve

    In older versions of Xpress, the command XPRSpostsolve throws an error in infeasible models. In these older versions the post solve should not be executed. To do this, one can use the MOI.RawOptimizerAttribute("MOI_POST_SOLVE") to skip this routine.

    C API

    The C API can be accessed via Xpress.Lib.XPRSxx functions, where the names and arguments are identical to the C API.

    See the Xpress documentation for details.

    Documentation

    For more information, consult the FICO optimizer manual.

    diff --git a/previews/PR3778/packages/solvers/index.html b/previews/PR3778/packages/solvers/index.html index 0799065f694..b3060e6f2fd 100644 --- a/previews/PR3778/packages/solvers/index.html +++ b/previews/PR3778/packages/solvers/index.html @@ -3,4 +3,4 @@ function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-0RZ8X3D3D0', {'page_path': location.pathname + location.search + location.hash}); -

    Introduction

    This section of the documentation contains brief documentation for some of the solvers that JuMP supports. The list of solvers is not exhaustive, but instead is intended to help you discover commonly used solvers.

    Affiliation

    Packages beginning with jump-dev/ are developed and maintained by the JuMP developers. In many cases, these packages wrap external solvers that are not developed by the JuMP developers and, while the Julia packages are all open-source, in some cases the solvers themselves are closed source commercial products.

    Packages that do not begin with jump-dev/ are developed independently. The developers of these packages requested or consented to the inclusion of their README contents in the JuMP documentation for the benefit of users.

    Adding new solvers

    Written a solver? Add it to this section of the JuMP documentation by making a pull request to the docs/packages.toml file.

    +

    Introduction

    This section of the documentation contains brief documentation for some of the solvers that JuMP supports. The list of solvers is not exhaustive, but instead is intended to help you discover commonly used solvers.

    Affiliation

    Packages beginning with jump-dev/ are developed and maintained by the JuMP developers. In many cases, these packages wrap external solvers that are not developed by the JuMP developers and, while the Julia packages are all open-source, in some cases the solvers themselves are closed source commercial products.

    Packages that do not begin with jump-dev/ are developed independently. The developers of these packages requested or consented to the inclusion of their README contents in the JuMP documentation for the benefit of users.

    Adding new solvers

    Written a solver? Add it to this section of the JuMP documentation by making a pull request to the docs/packages.toml file.

    diff --git a/previews/PR3778/release_notes/index.html b/previews/PR3778/release_notes/index.html index ce7065b8b7a..44b64142d30 100644 --- a/previews/PR3778/release_notes/index.html +++ b/previews/PR3778/release_notes/index.html @@ -12,4 +12,4 @@ new_b = backend(model)
  • All usages of @SDconstraint are deprecated. The new syntax is @constraint(model, X >= Y, PSDCone()).
  • Creating a DenseAxisArray with a Number as an axis will now display a warning. This catches a common error in which users write @variable(model, x[length(S)]) instead of @variable(model, x[1:length(S)]).
  • The caching_mode argument to Model, for example, Model(caching_mode = MOIU.MANUAL) mode has been removed. For more control over the optimizer, use direct_model instead.
  • The previously deprecated lp_objective_perturbation_range and lp_rhs_perturbation_range functions have been removed. Use lp_sensitivity_report instead.
  • The .m fields of NonlinearExpression and NonlinearParameter have been renamed to .model.
  • Infinite variable bounds are now ignored. Thus, @variable(model, x <= Inf) will show has_upper_bound(x) == false. Previously, these bounds were passed through to the solvers which caused numerical issues for solvers expecting finite bounds.
  • The variable_type and constraint_type functions were removed. This should only affect users who previously wrote JuMP extensions. The functions can be deleted without consequence.
  • The internal functions moi_mode, moi_bridge_constraints, moi_add_constraint, and moi_add_to_function_constant are no longer exported.
  • The un-used method Containers.generate_container has been deleted.
  • The Containers API has been refactored, and _build_ref_sets is now public as Containers.build_ref_sets.
  • The parse_constraint_ methods for extending @constraint at parse time have been refactored in a breaking way. Consult the Extensions documentation for more details and examples.
  • Added

    Fixed

    Other

    Version 0.21.10 (September 4, 2021)

    Added

    Fixed

    Other

    Version 0.21.9 (August 1, 2021)

    Added

    Other

    Version 0.21.8 (May 8, 2021)

    Added

    Fixed

    Version 0.21.7 (April 12, 2021)

    Added

    Fixed

    Other

    Version 0.21.6 (January 29, 2021)

    Added

    Fixed

    Other

    Version 0.21.5 (September 18, 2020)

    Fixed

    Version 0.21.4 (September 14, 2020)

    Added

    Fixed

    Version 0.21.3 (June 18, 2020)

    Version 0.21.2 (April 2, 2020)

    Fixed

    Version 0.21.1 (Feb 18, 2020)

    Version 0.21.0 (Feb 16, 2020)

    Breaking

    Added

    Fixed

    Version 0.20.1 (Oct 18, 2019)

    Version 0.20.0 (Aug 24, 2019)

    Version 0.19.2 (June 8, 2019)

    Version 0.19.1 (May 12, 2019)

    Version 0.19.0 (February 15, 2019)

    JuMP 0.19 contains significant breaking changes.

    Breaking

    Added

    Regressions

    There are known regressions from JuMP 0.18 that will be addressed in a future release (0.19.x or later):

    Version 0.18.5 (December 1, 2018)

    Version 0.18.4 (October 8, 2018)

    Version 0.18.3 (October 1, 2018)

    Version 0.18.2 (June 10, 2018)

    Version 0.18.1 (April 9, 2018)

    Version 0.18.0 (July 27, 2017)

    Version 0.17.1 (June 9, 2017)

    Version 0.17.0 (May 27, 2017)

    The following changes are primarily of interest to developers of JuMP extensions:

    Version 0.16.2 (March 28, 2017)

    Version 0.16.1 (March 7, 2017)

    Version 0.16.0 (February 23, 2017)

    Version 0.15.1 (January 31, 2017)

    Version 0.15.0 (December 22, 2016)

    Version 0.14.2 (December 12, 2016)

    Version 0.14.1 (September 12, 2016)

    Version 0.14.0 (August 7, 2016)

    Version 0.13.2 (May 16, 2016)

    Version 0.13.1 (May 3, 2016)

    Version 0.13.0 (April 29, 2016)

    Version 0.12.2 (March 9, 2016)

    Version 0.12.1 (March 1, 2016)

    Version 0.12.0 (February 27, 2016)

    Version 0.11.3 (February 4, 2016)

    Version 0.11.2 (January 14, 2016)

    Version 0.11.1 (December 1, 2015)

    Version 0.11.0 (November 30, 2015)

    Version 0.10.3 (November 20, 2015)

    Version 0.10.2 (September 28, 2015)

    Version 0.10.1 (September 3, 2015)

    Version 0.10.0 (August 31, 2015)

    Version 0.9.3 (August 11, 2015)

    Version 0.9.2 (June 27, 2015)

    Version 0.9.1 (April 25, 2015)

    Version 0.9.0 (April 18, 2015)

    Version 0.8.0 (February 17, 2015)

    Version 0.7.4 (February 4, 2015)

    Version 0.7.3 (January 14, 2015)

    Version 0.7.2 (January 9, 2015)

    after construction, and getCategory to retrieve the variable category.

    Version 0.7.1 (January 2, 2015)

    Version 0.7.0 (December 29, 2014)

    Linear/quadratic/conic programming

    Nonlinear programming

    General

    Version 0.6.3 (October 19, 2014)

    Version 0.6.2 (October 11, 2014)

    Version 0.6.1 (September 19, 2014)

    Version 0.6.0 (September 9, 2014)

    Version 0.5.8 (September 24, 2014)

    Version 0.5.7 (September 5, 2014)

    Version 0.5.6 (September 2, 2014)

    Version 0.5.5 (July 6, 2014)

    Version 0.5.4 (June 19, 2014)

    Version 0.5.3 (May 21, 2014)

    Version 0.5.2 (May 9, 2014)

    Version 0.5.1 (May 5, 2014)

    Version 0.5.0 (May 2, 2014)

    Version 0.4.1 (March 24, 2014)

    Version 0.4.0 (March 10, 2014)

    Version 0.3.2 (February 17, 2014)

    Version 0.3.1 (January 30, 2014)

    Version 0.3.0 (January 21, 2014)

    Version 0.2.0 (December 15, 2013)

    Breaking

    Added

    Version 0.1.2 (November 16, 2013)

    Version 0.1.1 (October 23, 2013)

    Version 0.1.0 (October 3, 2013)

    +end
  • The lowerbound, upperbound, and basename keyword arguments to the @variable macro have been renamed to lower_bound, upper_bound, and base_name, for consistency with JuMP's new style recommendations.

  • We rely on broadcasting syntax to apply accessors to collections of variables, for example, value.(x) instead of getvalue(x) for collections. (Use value(x) when x is a scalar object.)

  • Added

    Regressions

    There are known regressions from JuMP 0.18 that will be addressed in a future release (0.19.x or later):

    Version 0.18.5 (December 1, 2018)

    Version 0.18.4 (October 8, 2018)

    Version 0.18.3 (October 1, 2018)

    Version 0.18.2 (June 10, 2018)

    Version 0.18.1 (April 9, 2018)

    Version 0.18.0 (July 27, 2017)

    Version 0.17.1 (June 9, 2017)

    Version 0.17.0 (May 27, 2017)

    The following changes are primarily of interest to developers of JuMP extensions:

    Version 0.16.2 (March 28, 2017)

    Version 0.16.1 (March 7, 2017)

    Version 0.16.0 (February 23, 2017)

    Version 0.15.1 (January 31, 2017)

    Version 0.15.0 (December 22, 2016)

    Version 0.14.2 (December 12, 2016)

    Version 0.14.1 (September 12, 2016)

    Version 0.14.0 (August 7, 2016)

    Version 0.13.2 (May 16, 2016)

    Version 0.13.1 (May 3, 2016)

    Version 0.13.0 (April 29, 2016)

    Version 0.12.2 (March 9, 2016)

    Version 0.12.1 (March 1, 2016)

    Version 0.12.0 (February 27, 2016)

    Version 0.11.3 (February 4, 2016)

    Version 0.11.2 (January 14, 2016)

    Version 0.11.1 (December 1, 2015)

    Version 0.11.0 (November 30, 2015)

    Version 0.10.3 (November 20, 2015)

    Version 0.10.2 (September 28, 2015)

    Version 0.10.1 (September 3, 2015)

    Version 0.10.0 (August 31, 2015)

    Version 0.9.3 (August 11, 2015)

    Version 0.9.2 (June 27, 2015)

    Version 0.9.1 (April 25, 2015)

    Version 0.9.0 (April 18, 2015)

    Version 0.8.0 (February 17, 2015)

    Version 0.7.4 (February 4, 2015)

    Version 0.7.3 (January 14, 2015)

    Version 0.7.2 (January 9, 2015)

    after construction, and getCategory to retrieve the variable category.

    Version 0.7.1 (January 2, 2015)

    Version 0.7.0 (December 29, 2014)

    Linear/quadratic/conic programming

    Nonlinear programming

    General

    Version 0.6.3 (October 19, 2014)

    Version 0.6.2 (October 11, 2014)

    Version 0.6.1 (September 19, 2014)

    Version 0.6.0 (September 9, 2014)

    Version 0.5.8 (September 24, 2014)

    Version 0.5.7 (September 5, 2014)

    Version 0.5.6 (September 2, 2014)

    Version 0.5.5 (July 6, 2014)

    Version 0.5.4 (June 19, 2014)

    Version 0.5.3 (May 21, 2014)

    Version 0.5.2 (May 9, 2014)

    Version 0.5.1 (May 5, 2014)

    Version 0.5.0 (May 2, 2014)

    Version 0.4.1 (March 24, 2014)

    Version 0.4.0 (March 10, 2014)

    Version 0.3.2 (February 17, 2014)

    Version 0.3.1 (January 30, 2014)

    Version 0.3.0 (January 21, 2014)

    Version 0.2.0 (December 15, 2013)

    Breaking

    Added

    Version 0.1.2 (November 16, 2013)

    Version 0.1.1 (October 23, 2013)

    Version 0.1.0 (October 3, 2013)

    diff --git a/previews/PR3778/should_i_use/index.html b/previews/PR3778/should_i_use/index.html index 3c081515461..1903ec83a22 100644 --- a/previews/PR3778/should_i_use/index.html +++ b/previews/PR3778/should_i_use/index.html @@ -3,4 +3,4 @@ function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-0RZ8X3D3D0', {'page_path': location.pathname + location.search + location.hash}); -

    Should you use JuMP?

    JuMP is an algebraic modeling language for mathematical optimization written in the Julia language.

    This page explains when you should consider using JuMP, and importantly, when you should not use JuMP.

    When should you use JuMP?

    You should use JuMP if you have a constrained optimization problem that is formulated using the language of mathematical programming, that is, the problem has:

    • a set of real- or complex-valued decision variables
    • a scalar- or vector-valued real objective function
    • a set of constraints.

    Key reasons to use JuMP include:

    • User friendliness
    • Solver independence
      • JuMP uses a generic solver-independent interface provided by the MathOptInterface package, making it easy to change between a number of open-source and commercial optimization software packages ("solvers"). The Supported solvers section contains a table of the currently supported solvers.
    • Ease of embedding
      • JuMP itself is written purely in Julia. Solvers are the only binary dependencies.
      • JuMP provides automatic installation of most solvers.
      • Because it is embedded in a general-purpose programming language, JuMP makes it easy to solve optimization problems as part of a larger workflow, for example, inside a simulation, behind a web server, or as a subproblem in a decomposition algorithm. As a trade-off, JuMP's syntax is constrained by the syntax and functionality available in Julia.
      • JuMP is MPL licensed, meaning that it can be embedded in commercial software that complies with the terms of the license.
    • Speed
      • Benchmarking has shown that JuMP can create problems at similar speeds to special-purpose modeling languages such as AMPL.
      • JuMP communicates with most solvers in memory, avoiding the need to write intermediary files.
    • Access to advanced algorithmic techniques
      • JuMP supports efficient in-memory re-solves of models.
      • JuMP provides access to solver-independent and solver-dependent Callbacks.

    When should you not use JuMP?

    JuMP supports a broad range of optimization classes. However, there are still some that it doesn't support, or that are better supported by other software packages.

    You want to optimize a complicated Julia function

    Packages in Julia compose well. It's common for people to pick two unrelated packages and use them in conjunction to create novel behavior. JuMP isn't one of those packages.

    If you want to optimize an ordinary differential equation from DifferentialEquations.jl or tune a neural network from Flux.jl, consider using other packages such as:

    Black-box, derivative free, or unconstrained optimization

    JuMP does support nonlinear programs with constraints and objectives containing user-defined operators. However, the functions must be automatically differentiable, or need to provide explicit derivatives. (See User-defined operators for more information.)

    If your function is a black-box that is non-differentiable (for example, it is the output of a simulation written in C++), JuMP is not the right tool for the job. This also applies if you want to use a derivative free method.

    Even if your problem is differentiable, if it is unconstrained there is limited benefit (and downsides in the form of more overhead) to using JuMP over tools which are only concerned with function minimization.

    Alternatives to consider are:

    Disciplined convex programming

    JuMP does not support disciplined convex programming (DCP).

    Alternatives to consider are:

    Note

    Convex.jl is also built on MathOptInterface, and shares the same set of underlying solvers. However, you input problems differently, and Convex.jl checks that the problem is DCP.

    Stochastic programming

    JuMP requires deterministic input data.

    If you have stochastic input data, consider using a JuMP extension such as:

    Polyhedral computations

    JuMP does not provide tools for working with the polyhedron formed by the set of linear constraints.

    Alternatives to consider are:

    +

    Should you use JuMP?

    JuMP is an algebraic modeling language for mathematical optimization written in the Julia language.

    This page explains when you should consider using JuMP, and importantly, when you should not use JuMP.

    When should you use JuMP?

    You should use JuMP if you have a constrained optimization problem that is formulated using the language of mathematical programming, that is, the problem has:

    • a set of real- or complex-valued decision variables
    • a scalar- or vector-valued real objective function
    • a set of constraints.

    Key reasons to use JuMP include:

    • User friendliness
    • Solver independence
      • JuMP uses a generic solver-independent interface provided by the MathOptInterface package, making it easy to change between a number of open-source and commercial optimization software packages ("solvers"). The Supported solvers section contains a table of the currently supported solvers.
    • Ease of embedding
      • JuMP itself is written purely in Julia. Solvers are the only binary dependencies.
      • JuMP provides automatic installation of most solvers.
      • Because it is embedded in a general-purpose programming language, JuMP makes it easy to solve optimization problems as part of a larger workflow, for example, inside a simulation, behind a web server, or as a subproblem in a decomposition algorithm. As a trade-off, JuMP's syntax is constrained by the syntax and functionality available in Julia.
      • JuMP is MPL licensed, meaning that it can be embedded in commercial software that complies with the terms of the license.
    • Speed
      • Benchmarking has shown that JuMP can create problems at similar speeds to special-purpose modeling languages such as AMPL.
      • JuMP communicates with most solvers in memory, avoiding the need to write intermediary files.
    • Access to advanced algorithmic techniques
      • JuMP supports efficient in-memory re-solves of models.
      • JuMP provides access to solver-independent and solver-dependent Callbacks.

    When should you not use JuMP?

    JuMP supports a broad range of optimization classes. However, there are still some that it doesn't support, or that are better supported by other software packages.

    You want to optimize a complicated Julia function

    Packages in Julia compose well. It's common for people to pick two unrelated packages and use them in conjunction to create novel behavior. JuMP isn't one of those packages.

    If you want to optimize an ordinary differential equation from DifferentialEquations.jl or tune a neural network from Flux.jl, consider using other packages such as:

    Black-box, derivative free, or unconstrained optimization

    JuMP does support nonlinear programs with constraints and objectives containing user-defined operators. However, the functions must be automatically differentiable, or need to provide explicit derivatives. (See User-defined operators for more information.)

    If your function is a black-box that is non-differentiable (for example, it is the output of a simulation written in C++), JuMP is not the right tool for the job. This also applies if you want to use a derivative free method.

    Even if your problem is differentiable, if it is unconstrained there is limited benefit (and downsides in the form of more overhead) to using JuMP over tools which are only concerned with function minimization.

    Alternatives to consider are:

    Disciplined convex programming

    JuMP does not support disciplined convex programming (DCP).

    Alternatives to consider are:

    Note

    Convex.jl is also built on MathOptInterface, and shares the same set of underlying solvers. However, you input problems differently, and Convex.jl checks that the problem is DCP.

    Stochastic programming

    JuMP requires deterministic input data.

    If you have stochastic input data, consider using a JuMP extension such as:

    Polyhedral computations

    JuMP does not provide tools for working with the polyhedron formed by the set of linear constraints.

    Alternatives to consider are:

    diff --git a/previews/PR3778/tutorials/algorithms/benders_decomposition/index.html b/previews/PR3778/tutorials/algorithms/benders_decomposition/index.html index b0759854282..a40abcce3f8 100644 --- a/previews/PR3778/tutorials/algorithms/benders_decomposition/index.html +++ b/previews/PR3778/tutorials/algorithms/benders_decomposition/index.html @@ -180,4 +180,4 @@ 1.0
    optimal_ret = solve_subproblem(subproblem, x_optimal)
     y_optimal = optimal_ret.y
    2-element Vector{Float64}:
      0.0
    - 0.0

    For larger problems, the benefit of re-using the same subproblem and not needing to multiply the duals by A_1 in the cut coefficient usually outweights the cost of needing a copy of the x variables in the subproblem.

    As a secondary benefit, because we no longer need an explicit representation of A_1 in the cut, we can build the model and subproblem formulations using arbitrary JuMP syntax; they do not need to be in matrix form.

    + 0.0

    For larger problems, the benefit of re-using the same subproblem and not needing to multiply the duals by A_1 in the cut coefficient usually outweights the cost of needing a copy of the x variables in the subproblem.

    As a secondary benefit, because we no longer need an explicit representation of A_1 in the cut, we can build the model and subproblem formulations using arbitrary JuMP syntax; they do not need to be in matrix form.

    diff --git a/previews/PR3778/tutorials/algorithms/cutting_stock_column_generation/313b0615.svg b/previews/PR3778/tutorials/algorithms/cutting_stock_column_generation/028ff4e9.svg similarity index 72% rename from previews/PR3778/tutorials/algorithms/cutting_stock_column_generation/313b0615.svg rename to previews/PR3778/tutorials/algorithms/cutting_stock_column_generation/028ff4e9.svg index b4d95a5c1bf..efe24477496 100644 --- a/previews/PR3778/tutorials/algorithms/cutting_stock_column_generation/313b0615.svg +++ b/previews/PR3778/tutorials/algorithms/cutting_stock_column_generation/028ff4e9.svg @@ -1,350 +1,350 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/previews/PR3778/tutorials/algorithms/cutting_stock_column_generation/73afe413.svg b/previews/PR3778/tutorials/algorithms/cutting_stock_column_generation/41b5e70b.svg similarity index 69% rename from previews/PR3778/tutorials/algorithms/cutting_stock_column_generation/73afe413.svg rename to previews/PR3778/tutorials/algorithms/cutting_stock_column_generation/41b5e70b.svg index 078020e874d..c6d3215d3cf 100644 --- a/previews/PR3778/tutorials/algorithms/cutting_stock_column_generation/73afe413.svg +++ b/previews/PR3778/tutorials/algorithms/cutting_stock_column_generation/41b5e70b.svg @@ -1,516 +1,516 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/previews/PR3778/tutorials/algorithms/cutting_stock_column_generation/index.html b/previews/PR3778/tutorials/algorithms/cutting_stock_column_generation/index.html index 7669d7d8f2f..31115ca71f1 100644 --- a/previews/PR3778/tutorials/algorithms/cutting_stock_column_generation/index.html +++ b/previews/PR3778/tutorials/algorithms/cutting_stock_column_generation/index.html @@ -117,8 +117,8 @@ Relative gap : 2.87105e-01 * Work counters - Solve time (sec) : 5.05782e+00 - Simplex iterations : 20874 + Solve time (sec) : 5.04419e+00 + Simplex iterations : 20327 Barrier iterations : -1 Node count : 0

    However, there is a formulation that solves much faster, and that is to use a column generation scheme.

    Column generation theory

    The key insight for column generation is to recognize that feasible columns in the $x$ matrix of variables encode cutting patterns.

    For example, if we look only at the roll $j=1$, then a feasible solution is:

    Another solution is

    Cutting patterns like $x_{1,1} = 1$ and $x_{2,1} = 1$ are infeasible because the combined length is greater than $W$.

    Since there are a finite number of ways that we could cut a roll into a valid cutting pattern, we could create a set of all possible cutting patterns $p = 1,\ldots,P$, with data $a_{i,p}$ indicating how many units of piece $i$ we cut in pattern $p$. Then, we can formulate our mixed-integer linear program as:

    \[\begin{align} @@ -188,7 +188,7 @@ return plot end -plot_patterns(data, patterns)Example block output

    The base problem

    Using the initial set of patterns, we can create and optimize our base model:

    model = Model(HiGHS.Optimizer)
    +plot_patterns(data, patterns)
    Example block output

    The base problem

    Using the initial set of patterns, we can create and optimize our base model:

    model = Model(HiGHS.Optimizer)
     set_silent(model)
     @variable(model, x[1:length(patterns)] >= 0, Int)
     @objective(model, Min, sum(x))
    @@ -211,7 +211,7 @@
       Relative gap       : 0.00000e+00
     
     * Work counters
    -  Solve time (sec)   : 1.50204e-04
    +  Solve time (sec)   : 1.50442e-04
       Simplex iterations : 0
       Barrier iterations : -1
       Node count         : 0
    @@ -283,7 +283,7 @@
     [ Info: No new patterns, terminating the algorithm.

    We found lots of new patterns. Here's pattern 21:

    patterns[21]
    20-element SparseArrays.SparseVector{Int64, Int64} with 3 stored entries:
       [9 ]  =  1
       [13]  =  2
    -  [17]  =  1

    Let's have a look at the patterns now:

    plot_patterns(data, patterns)
    Example block output

    Looking at the solution

    Let's see how many of each column we need:

    solution = DataFrames.DataFrame([
    +  [17]  =  1

    Let's have a look at the patterns now:

    plot_patterns(data, patterns)
    Example block output

    Looking at the solution

    Let's see how many of each column we need:

    solution = DataFrames.DataFrame([
         (pattern = p, rolls = value(x_p)) for (p, x_p) in enumerate(x)
     ])
     filter!(row -> row.rolls > 0, solution)
    16×2 DataFrame
    Rowpatternrolls
    Int64Float64
    1138.0
    2244.0
    3330.0
    4210.5
    52210.2
    62314.65
    72423.1
    82511.25
    92621.35
    10284.3
    112919.55
    123011.25
    133117.45
    143336.0
    153411.4
    163541.0

    Since we solved a linear program, some of our columns have fractional solutions. We can create a integer feasible solution by rounding up the orders. This requires 341 rolls:

    sum(ceil.(Int, solution.rolls))
    341

    Alternatively, we can re-introduce the integrality constraints and resolve the problem:

    set_integer.(x)
    @@ -292,4 +292,4 @@
     solution = DataFrames.DataFrame([
         (pattern = p, rolls = value(x_p)) for (p, x_p) in enumerate(x)
     ])
    -filter!(row -> row.rolls > 0, solution)
    16×2 DataFrame
    Rowpatternrolls
    Int64Float64
    1138.0
    2244.0
    3330.0
    4211.0
    5229.0
    62319.0
    72419.0
    82513.0
    92617.0
    10282.0
    112919.0
    123013.0
    133118.0
    143336.0
    153415.0
    163541.0

    This now requires 334 rolls:

    sum(solution.rolls)
    333.99999999999994

    Note that this may not be the global minimum because we are not adding new columns during the solution of the mixed-integer problem model (an algorithm known as branch and price). Nevertheless, the column generation algorithm typically finds good integer feasible solutions to an otherwise intractable optimization problem.

    Next steps

    +filter!(row -> row.rolls > 0, solution)
    16×2 DataFrame
    Rowpatternrolls
    Int64Float64
    1138.0
    2244.0
    3330.0
    4211.0
    5229.0
    62319.0
    72419.0
    82513.0
    92617.0
    10282.0
    112919.0
    123013.0
    133118.0
    143336.0
    153415.0
    163541.0

    This now requires 334 rolls:

    sum(solution.rolls)
    333.99999999999994

    Note that this may not be the global minimum because we are not adding new columns during the solution of the mixed-integer problem model (an algorithm known as branch and price). Nevertheless, the column generation algorithm typically finds good integer feasible solutions to an otherwise intractable optimization problem.

    Next steps

    diff --git a/previews/PR3778/tutorials/algorithms/parallelism/index.html b/previews/PR3778/tutorials/algorithms/parallelism/index.html index d2f6918d662..36b31b491ea 100644 --- a/previews/PR3778/tutorials/algorithms/parallelism/index.html +++ b/previews/PR3778/tutorials/algorithms/parallelism/index.html @@ -129,4 +129,4 @@ 7.0 8.0 9.0 - 10.0

    Other types of parallelism

    GPU

    JuMP does not support GPU programming, and few solvers support execution on a GPU.

    Parallelism within the solver

    Many solvers use parallelism internally. For example, commercial solvers like Gurobi and CPLEX both parallelize the search in branch-and-bound. Solvers supporting internal parallelism will typically support the MOI.NumberOfThreads attribute, which you can set using set_attribute.

    + 10.0

    Other types of parallelism

    GPU

    JuMP does not support GPU programming, and few solvers support execution on a GPU.

    Parallelism within the solver

    Many solvers use parallelism internally. For example, commercial solvers like Gurobi and CPLEX both parallelize the search in branch-and-bound. Solvers supporting internal parallelism will typically support the MOI.NumberOfThreads attribute, which you can set using set_attribute.

    diff --git a/previews/PR3778/tutorials/algorithms/tsp_lazy_constraints/c0e2df50.svg b/previews/PR3778/tutorials/algorithms/tsp_lazy_constraints/e1f38b11.svg similarity index 75% rename from previews/PR3778/tutorials/algorithms/tsp_lazy_constraints/c0e2df50.svg rename to previews/PR3778/tutorials/algorithms/tsp_lazy_constraints/e1f38b11.svg index ab19a8dd356..211b6052b15 100644 --- a/previews/PR3778/tutorials/algorithms/tsp_lazy_constraints/c0e2df50.svg +++ b/previews/PR3778/tutorials/algorithms/tsp_lazy_constraints/e1f38b11.svg @@ -1,122 +1,122 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/previews/PR3778/tutorials/algorithms/tsp_lazy_constraints/f3650452.svg b/previews/PR3778/tutorials/algorithms/tsp_lazy_constraints/ea5a89f2.svg similarity index 75% rename from previews/PR3778/tutorials/algorithms/tsp_lazy_constraints/f3650452.svg rename to previews/PR3778/tutorials/algorithms/tsp_lazy_constraints/ea5a89f2.svg index 308de88ba27..f0da3de283b 100644 --- a/previews/PR3778/tutorials/algorithms/tsp_lazy_constraints/f3650452.svg +++ b/previews/PR3778/tutorials/algorithms/tsp_lazy_constraints/ea5a89f2.svg @@ -1,122 +1,122 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/previews/PR3778/tutorials/algorithms/tsp_lazy_constraints/index.html b/previews/PR3778/tutorials/algorithms/tsp_lazy_constraints/index.html index cd8ad96dd9e..ee9f2d36e3c 100644 --- a/previews/PR3778/tutorials/algorithms/tsp_lazy_constraints/index.html +++ b/previews/PR3778/tutorials/algorithms/tsp_lazy_constraints/index.html @@ -61,7 +61,7 @@ global cycle = subtour(iterative_model[:x]) end -objective_value(iterative_model)
    525.7039004442727
    time_iterated
    0.02842116355895996

    As a quick sanity check, we visualize the optimal tour to verify that no subtour is present:

    function plot_tour(X, Y, x)
    +objective_value(iterative_model)
    525.7039004442727
    time_iterated
    0.028751850128173828

    As a quick sanity check, we visualize the optimal tour to verify that no subtour is present:

    function plot_tour(X, Y, x)
         plot = Plots.plot()
         for (i, j) in selected_edges(x, size(x, 1))
             Plots.plot!([X[i], X[j]], [Y[i], Y[j]]; legend = false)
    @@ -69,7 +69,7 @@
         return plot
     end
     
    -plot_tour(X, Y, value.(iterative_model[:x]))
    Example block output

    Lazy constraint method

    A more sophisticated approach makes use of lazy constraints. To be more precise, we do this through the subtour_elimination_callback() below, which is only run whenever we encounter a new integer-feasible solution.

    lazy_model = build_tsp_model(d, n)
    +plot_tour(X, Y, value.(iterative_model[:x]))
    Example block output

    Lazy constraint method

    A more sophisticated approach makes use of lazy constraints. To be more precise, we do this through the subtour_elimination_callback() below, which is only run whenever we encounter a new integer-feasible solution.

    lazy_model = build_tsp_model(d, n)
     function subtour_elimination_callback(cb_data)
         status = callback_node_status(cb_data, lazy_model)
         if status != MOI.CALLBACK_NODE_STATUS_INTEGER
    @@ -94,4 +94,4 @@
     )
     optimize!(lazy_model)
     @assert is_solved_and_feasible(lazy_model)
    -objective_value(lazy_model)
    525.7039004442727

    This finds the same optimal tour:

    plot_tour(X, Y, value.(lazy_model[:x]))
    Example block output

    Surprisingly, for this particular model with GLPK, the solution time is worse than the iterative method:

    time_lazy = solve_time(lazy_model)
    0.13778996467590332

    In most other cases and solvers, however, the lazy time should be faster than the iterative method.

    +objective_value(lazy_model)
    525.7039004442727

    This finds the same optimal tour:

    plot_tour(X, Y, value.(lazy_model[:x]))
    Example block output

    Surprisingly, for this particular model with GLPK, the solution time is worse than the iterative method:

    time_lazy = solve_time(lazy_model)
    0.15285897254943848

    In most other cases and solvers, however, the lazy time should be faster than the iterative method.

    diff --git a/previews/PR3778/tutorials/applications/optimal_power_flow/index.html b/previews/PR3778/tutorials/applications/optimal_power_flow/index.html index a53d0314bf3..7f6041df21c 100644 --- a/previews/PR3778/tutorials/applications/optimal_power_flow/index.html +++ b/previews/PR3778/tutorials/applications/optimal_power_flow/index.html @@ -129,7 +129,7 @@ Objective value : 3.08784e+03 * Work counters - Solve time (sec) : 9.78589e-03 + Solve time (sec) : 7.85398e-03 Barrier iterations : 16
    objval_solution = round(objective_value(model); digits = 2)
     println("Objective value (feasible solution) : $(objval_solution)")
    Objective value (feasible solution) : 3087.84

    The solution's power generation (in rectangular form) and complex voltage values (in polar form using degrees) are:

    DataFrames.DataFrame(;
    @@ -215,7 +215,7 @@
       9   1.5653e+03   1.5641e+03  7.67e-04  2.80e-08  3.75e-06  5.96e-03  1.74e-02  4.38e-01
     ---------------------------------------------------------------------------------------------
     Terminated with status = solved
    -solve time = 72.5ms
    Test.@test is_solved_and_feasible(model; allow_almost = true)
    +solve time = 73.7ms
    Test.@test is_solved_and_feasible(model; allow_almost = true)
     sdp_relaxation_lower_bound = round(objective_value(model); digits = 2)
     println(
         "Objective value (W & V relax. lower bound): $sdp_relaxation_lower_bound",
    @@ -232,4 +232,4 @@
         Bus = 1:N,
         Magnitude = round.(abs.(value.(V)); digits = 2),
         AngleDeg = round.(rad2deg.(angle.(value.(V))); digits = 2),
    -)
    9×3 DataFrame
    RowBusMagnitudeAngleDeg
    Int64Float64Float64
    110.95-0.0
    220.843.76
    330.832.66
    440.85-1.22
    550.86-2.12
    660.860.93
    770.86-0.18
    880.861.14
    990.85-2.47

    For further information on exploiting sparsity see (Jabr, 2012).

    This relaxation has the advantage that we can work directly with complex voltages to extend the formulation, strengthen the relaxation and gain additional approximate information about the voltage variables.

    +)
    9×3 DataFrame
    RowBusMagnitudeAngleDeg
    Int64Float64Float64
    110.95-0.0
    220.843.76
    330.832.66
    440.85-1.22
    550.86-2.12
    660.860.93
    770.86-0.18
    880.861.14
    990.85-2.47

    For further information on exploiting sparsity see (Jabr, 2012).

    This relaxation has the advantage that we can work directly with complex voltages to extend the formulation, strengthen the relaxation and gain additional approximate information about the voltage variables.

    diff --git a/previews/PR3778/tutorials/applications/power_systems/fe476fd8.svg b/previews/PR3778/tutorials/applications/power_systems/45a65509.svg similarity index 86% rename from previews/PR3778/tutorials/applications/power_systems/fe476fd8.svg rename to previews/PR3778/tutorials/applications/power_systems/45a65509.svg index e03b5072e29..db030adb9ee 100644 --- a/previews/PR3778/tutorials/applications/power_systems/fe476fd8.svg +++ b/previews/PR3778/tutorials/applications/power_systems/45a65509.svg @@ -1,78 +1,78 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/previews/PR3778/tutorials/applications/power_systems/30c87d5c.svg b/previews/PR3778/tutorials/applications/power_systems/887bc997.svg similarity index 85% rename from previews/PR3778/tutorials/applications/power_systems/30c87d5c.svg rename to previews/PR3778/tutorials/applications/power_systems/887bc997.svg index 8e2b25bd83f..c048de6468e 100644 --- a/previews/PR3778/tutorials/applications/power_systems/30c87d5c.svg +++ b/previews/PR3778/tutorials/applications/power_systems/887bc997.svg @@ -1,43 +1,43 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/previews/PR3778/tutorials/applications/power_systems/5fc716e6.svg b/previews/PR3778/tutorials/applications/power_systems/e85d5e61.svg similarity index 86% rename from previews/PR3778/tutorials/applications/power_systems/5fc716e6.svg rename to previews/PR3778/tutorials/applications/power_systems/e85d5e61.svg index 74e828b77f5..af41387a941 100644 --- a/previews/PR3778/tutorials/applications/power_systems/5fc716e6.svg +++ b/previews/PR3778/tutorials/applications/power_systems/e85d5e61.svg @@ -1,80 +1,80 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/previews/PR3778/tutorials/applications/power_systems/index.html b/previews/PR3778/tutorials/applications/power_systems/index.html index 8ec693c77f4..fee517932d0 100644 --- a/previews/PR3778/tutorials/applications/power_systems/index.html +++ b/previews/PR3778/tutorials/applications/power_systems/index.html @@ -98,7 +98,7 @@ (c_g1_scale, sol.g[1], sol.g[2], sol.w, sol.wind_spill, sol.total_cost), ) end -print(string("elapsed time: ", time() - start, " seconds"))
    elapsed time: 0.1626579761505127 seconds
    c_g_scale_df
    26×6 DataFrame
    Rowscaledispatch_G1dispatch_G2dispatch_windspillage_windtotal_cost
    Float64Float64Float64Float64Float64Float64
    10.51000.0300.0200.00.065000.0
    20.61000.0300.0200.00.070000.0
    30.71000.0300.0200.00.075000.0
    40.81000.0300.0200.00.080000.0
    50.91000.0300.0200.00.085000.0
    61.01000.0300.0200.00.090000.0
    71.11000.0300.0200.00.095000.0
    81.21000.0300.0200.00.0100000.0
    91.31000.0300.0200.00.0105000.0
    101.41000.0300.0200.00.0110000.0
    111.51000.0300.0200.00.0115000.0
    121.61000.0300.0200.00.0120000.0
    131.71000.0300.0200.00.0125000.0
    141.81000.0300.0200.00.0130000.0
    151.91000.0300.0200.00.0135000.0
    162.0300.01000.0200.00.0140000.0
    172.1300.01000.0200.00.0141500.0
    182.2300.01000.0200.00.0143000.0
    192.3300.01000.0200.00.0144500.0
    202.4300.01000.0200.00.0146000.0
    212.5300.01000.0200.00.0147500.0
    222.6300.01000.0200.00.0149000.0
    232.7300.01000.0200.00.0150500.0
    242.8300.01000.0200.00.0152000.0
    252.9300.01000.0200.00.0153500.0
    263.0300.01000.0200.00.0155000.0

    Modifying the JuMP model in-place

    Note that in the previous exercise we entirely rebuilt the optimization model at every iteration of the internal loop, which incurs an additional computational burden. This burden can be alleviated if instead of re-building the entire model, we modify the constraints or objective function, as it shown in the example below.

    Compare the computing time in case of the above and below models.

    function solve_economic_dispatch_inplace(
    +print(string("elapsed time: ", time() - start, " seconds"))
    elapsed time: 0.1714160442352295 seconds
    c_g_scale_df
    26×6 DataFrame
    Rowscaledispatch_G1dispatch_G2dispatch_windspillage_windtotal_cost
    Float64Float64Float64Float64Float64Float64
    10.51000.0300.0200.00.065000.0
    20.61000.0300.0200.00.070000.0
    30.71000.0300.0200.00.075000.0
    40.81000.0300.0200.00.080000.0
    50.91000.0300.0200.00.085000.0
    61.01000.0300.0200.00.090000.0
    71.11000.0300.0200.00.095000.0
    81.21000.0300.0200.00.0100000.0
    91.31000.0300.0200.00.0105000.0
    101.41000.0300.0200.00.0110000.0
    111.51000.0300.0200.00.0115000.0
    121.61000.0300.0200.00.0120000.0
    131.71000.0300.0200.00.0125000.0
    141.81000.0300.0200.00.0130000.0
    151.91000.0300.0200.00.0135000.0
    162.0300.01000.0200.00.0140000.0
    172.1300.01000.0200.00.0141500.0
    182.2300.01000.0200.00.0143000.0
    192.3300.01000.0200.00.0144500.0
    202.4300.01000.0200.00.0146000.0
    212.5300.01000.0200.00.0147500.0
    222.6300.01000.0200.00.0149000.0
    232.7300.01000.0200.00.0150500.0
    242.8300.01000.0200.00.0152000.0
    252.9300.01000.0200.00.0153500.0
    263.0300.01000.0200.00.0155000.0

    Modifying the JuMP model in-place

    Note that in the previous exercise we entirely rebuilt the optimization model at every iteration of the internal loop, which incurs an additional computational burden. This burden can be alleviated if instead of re-building the entire model, we modify the constraints or objective function, as it shown in the example below.

    Compare the computing time in case of the above and below models.

    function solve_economic_dispatch_inplace(
         generators::Vector,
         wind,
         scenario,
    @@ -155,7 +155,7 @@
         scenario,
         0.5:0.1:3.0,
     )
    -print(string("elapsed time: ", time() - start, " seconds"))
    elapsed time: 0.1457669734954834 seconds

    For small models, adjusting specific constraints or the objective function is sometimes faster and sometimes slower than re-building the entire model. However, as the problem size increases, updating the model in-place is usually faster.

    inplace_df
    26×6 DataFrame
    Rowscaledispatch_G1dispatch_G2dispatch_windspillage_windtotal_cost
    Float64Float64Float64Float64Float64Float64
    10.51000.0300.0200.00.065000.0
    20.61000.0300.0200.00.070000.0
    30.71000.0300.0200.00.075000.0
    40.81000.0300.0200.00.080000.0
    50.91000.0300.0200.00.085000.0
    61.01000.0300.0200.00.090000.0
    71.11000.0300.0200.00.095000.0
    81.21000.0300.0200.00.0100000.0
    91.31000.0300.0200.00.0105000.0
    101.41000.0300.0200.00.0110000.0
    111.51000.0300.0200.00.0115000.0
    121.61000.0300.0200.00.0120000.0
    131.71000.0300.0200.00.0125000.0
    141.81000.0300.0200.00.0130000.0
    151.91000.0300.0200.00.0135000.0
    162.01000.0300.0200.00.0140000.0
    172.1300.01000.0200.00.0141500.0
    182.2300.01000.0200.00.0143000.0
    192.3300.01000.0200.00.0144500.0
    202.4300.01000.0200.00.0146000.0
    212.5300.01000.0200.00.0147500.0
    222.6300.01000.0200.00.0149000.0
    232.7300.01000.0200.00.0150500.0
    242.8300.01000.0200.00.0152000.0
    252.9300.01000.0200.00.0153500.0
    263.0300.01000.0200.00.0155000.0

    Inefficient usage of wind generators

    The economic dispatch problem does not perform commitment decisions and, thus, assumes that all generators must be dispatched at least at their minimum power output limit. This approach is not cost efficient and may lead to absurd decisions. For example, if $d = \sum_{i \in I} g^{\min}_{i}$, the wind power injection must be zero, that is, all available wind generation is spilled, to meet the minimum power output constraints on generators.

    In the following example, we adjust the total demand and observed how it affects wind spillage.

    demand_scale_df = DataFrames.DataFrame(;
    +print(string("elapsed time: ", time() - start, " seconds"))
    elapsed time: 0.15123486518859863 seconds

    For small models, adjusting specific constraints or the objective function is sometimes faster and sometimes slower than re-building the entire model. However, as the problem size increases, updating the model in-place is usually faster.

    inplace_df
    26×6 DataFrame
    Rowscaledispatch_G1dispatch_G2dispatch_windspillage_windtotal_cost
    Float64Float64Float64Float64Float64Float64
    10.51000.0300.0200.00.065000.0
    20.61000.0300.0200.00.070000.0
    30.71000.0300.0200.00.075000.0
    40.81000.0300.0200.00.080000.0
    50.91000.0300.0200.00.085000.0
    61.01000.0300.0200.00.090000.0
    71.11000.0300.0200.00.095000.0
    81.21000.0300.0200.00.0100000.0
    91.31000.0300.0200.00.0105000.0
    101.41000.0300.0200.00.0110000.0
    111.51000.0300.0200.00.0115000.0
    121.61000.0300.0200.00.0120000.0
    131.71000.0300.0200.00.0125000.0
    141.81000.0300.0200.00.0130000.0
    151.91000.0300.0200.00.0135000.0
    162.01000.0300.0200.00.0140000.0
    172.1300.01000.0200.00.0141500.0
    182.2300.01000.0200.00.0143000.0
    192.3300.01000.0200.00.0144500.0
    202.4300.01000.0200.00.0146000.0
    212.5300.01000.0200.00.0147500.0
    222.6300.01000.0200.00.0149000.0
    232.7300.01000.0200.00.0150500.0
    242.8300.01000.0200.00.0152000.0
    252.9300.01000.0200.00.0153500.0
    263.0300.01000.0200.00.0155000.0

    Inefficient usage of wind generators

    The economic dispatch problem does not perform commitment decisions and, thus, assumes that all generators must be dispatched at least at their minimum power output limit. This approach is not cost efficient and may lead to absurd decisions. For example, if $d = \sum_{i \in I} g^{\min}_{i}$, the wind power injection must be zero, that is, all available wind generation is spilled, to meet the minimum power output constraints on generators.

    In the following example, we adjust the total demand and observed how it affects wind spillage.

    demand_scale_df = DataFrames.DataFrame(;
         demand = Float64[],
         dispatch_G1 = Float64[],
         dispatch_G2 = Float64[],
    @@ -212,7 +212,7 @@
         ),
     )
     
    -Plots.plot(dispatch_plot, wind_plot)
    Example block output

    This particular drawback can be overcome by introducing binary decisions on the "on/off" status of generators. This model is called unit commitment and considered later in these notes.

    For further reading on the interplay between wind generation and the minimum power output constraints of generators, we refer interested readers to R. Baldick, "Wind and energy markets: a case study of Texas," IEEE Systems Journal, vol. 6, pp. 27-34, 2012.

    Unit commitment

    The Unit Commitment (UC) model can be obtained from ED model by introducing binary variable associated with each generator. This binary variable can attain two values: if it is "1," the generator is synchronized and, thus, can be dispatched, otherwise, that is, if the binary variable is "0," that generator is not synchronized and its power output is set to 0.

    To obtain the mathematical formulation of the UC model, we will modify the constraints of the ED model as follows:

    \[g^{\min}_{i} \cdot u_{t,i} \leq g_{i} \leq g^{\max}_{i} \cdot u_{t,i},\]

    where $u_{i} \in \{0,1\}.$ In this constraint, if $u_{i} = 0$, then $g_{i} = 0$. On the other hand, if $u_{i} = 1$, then $g^{min}_{i} \leq g_{i} \leq g^{max}_{i}$.

    For further reading on the UC problem we refer interested readers to G. Morales-Espana, J. M. Latorre, and A. Ramos, "Tight and Compact MILP Formulation for the Thermal Unit Commitment Problem," IEEE Transactions on Power Systems, vol. 28, pp. 4897-4908, 2013.

    In the following example we convert the ED model explained above to the UC model.

    function solve_unit_commitment(generators::Vector, wind, scenario)
    +Plots.plot(dispatch_plot, wind_plot)
    Example block output

    This particular drawback can be overcome by introducing binary decisions on the "on/off" status of generators. This model is called unit commitment and considered later in these notes.

    For further reading on the interplay between wind generation and the minimum power output constraints of generators, we refer interested readers to R. Baldick, "Wind and energy markets: a case study of Texas," IEEE Systems Journal, vol. 6, pp. 27-34, 2012.

    Unit commitment

    The Unit Commitment (UC) model can be obtained from ED model by introducing binary variable associated with each generator. This binary variable can attain two values: if it is "1," the generator is synchronized and, thus, can be dispatched, otherwise, that is, if the binary variable is "0," that generator is not synchronized and its power output is set to 0.

    To obtain the mathematical formulation of the UC model, we will modify the constraints of the ED model as follows:

    \[g^{\min}_{i} \cdot u_{t,i} \leq g_{i} \leq g^{\max}_{i} \cdot u_{t,i},\]

    where $u_{i} \in \{0,1\}.$ In this constraint, if $u_{i} = 0$, then $g_{i} = 0$. On the other hand, if $u_{i} = 1$, then $g^{min}_{i} \leq g_{i} \leq g^{max}_{i}$.

    For further reading on the UC problem we refer interested readers to G. Morales-Espana, J. M. Latorre, and A. Ramos, "Tight and Compact MILP Formulation for the Thermal Unit Commitment Problem," IEEE Transactions on Power Systems, vol. 28, pp. 4897-4908, 2013.

    In the following example we convert the ED model explained above to the UC model.

    function solve_unit_commitment(generators::Vector, wind, scenario)
         model = Model(HiGHS.Optimizer)
         set_silent(model)
         N = length(generators)
    @@ -325,7 +325,7 @@
         ),
     )
     
    -Plots.plot(commitment_plot, dispatch_plot)
    Example block output

    Nonlinear economic dispatch

    As a final example, we modify our economic dispatch problem in two ways:

    • The thermal cost function is user-defined
    • The output of the wind is only the square-root of the dispatch
    import Ipopt
    +Plots.plot(commitment_plot, dispatch_plot)
    Example block output

    Nonlinear economic dispatch

    As a final example, we modify our economic dispatch problem in two ways:

    • The thermal cost function is user-defined
    • The output of the wind is only the square-root of the dispatch
    import Ipopt
     
     """
         thermal_cost_function(g)
    @@ -395,4 +395,4 @@
         xlabel = "Cost",
         ylabel = "Dispatch [MW]",
         label = false,
    -)
    Example block output +)Example block output diff --git a/previews/PR3778/tutorials/applications/two_stage_stochastic/1d0560cf.svg b/previews/PR3778/tutorials/applications/two_stage_stochastic/1d0560cf.svg new file mode 100644 index 00000000000..9a2d9ff9a12 --- /dev/null +++ b/previews/PR3778/tutorials/applications/two_stage_stochastic/1d0560cf.svg @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/previews/PR3778/tutorials/applications/two_stage_stochastic/722d34d9.svg b/previews/PR3778/tutorials/applications/two_stage_stochastic/722d34d9.svg deleted file mode 100644 index b4310f6b165..00000000000 --- a/previews/PR3778/tutorials/applications/two_stage_stochastic/722d34d9.svg +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/previews/PR3778/tutorials/applications/two_stage_stochastic/41d9c485.svg b/previews/PR3778/tutorials/applications/two_stage_stochastic/7d582a3a.svg similarity index 51% rename from previews/PR3778/tutorials/applications/two_stage_stochastic/41d9c485.svg rename to previews/PR3778/tutorials/applications/two_stage_stochastic/7d582a3a.svg index 8bdac19a716..f20850590d5 100644 --- a/previews/PR3778/tutorials/applications/two_stage_stochastic/41d9c485.svg +++ b/previews/PR3778/tutorials/applications/two_stage_stochastic/7d582a3a.svg @@ -1,81 +1,81 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/previews/PR3778/tutorials/applications/two_stage_stochastic/91035c45.svg b/previews/PR3778/tutorials/applications/two_stage_stochastic/91035c45.svg deleted file mode 100644 index cc24e6449f7..00000000000 --- a/previews/PR3778/tutorials/applications/two_stage_stochastic/91035c45.svg +++ /dev/null @@ -1,106 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/previews/PR3778/tutorials/applications/two_stage_stochastic/a0cbc4f2.svg b/previews/PR3778/tutorials/applications/two_stage_stochastic/a0cbc4f2.svg new file mode 100644 index 00000000000..a153e276841 --- /dev/null +++ b/previews/PR3778/tutorials/applications/two_stage_stochastic/a0cbc4f2.svg @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/previews/PR3778/tutorials/applications/two_stage_stochastic/39847ed7.svg b/previews/PR3778/tutorials/applications/two_stage_stochastic/b0344eca.svg similarity index 52% rename from previews/PR3778/tutorials/applications/two_stage_stochastic/39847ed7.svg rename to previews/PR3778/tutorials/applications/two_stage_stochastic/b0344eca.svg index a52574cdf91..bc7f566c102 100644 --- a/previews/PR3778/tutorials/applications/two_stage_stochastic/39847ed7.svg +++ b/previews/PR3778/tutorials/applications/two_stage_stochastic/b0344eca.svg @@ -1,116 +1,116 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/previews/PR3778/tutorials/applications/two_stage_stochastic/index.html b/previews/PR3778/tutorials/applications/two_stage_stochastic/index.html index efe2fc6636d..e9a0caf100a 100644 --- a/previews/PR3778/tutorials/applications/two_stage_stochastic/index.html +++ b/previews/PR3778/tutorials/applications/two_stage_stochastic/index.html @@ -18,7 +18,7 @@ d = sort!(rand(D, N)); Ω = 1:N P = fill(1 / N, N); -StatsPlots.histogram(d; bins = 20, label = "", xlabel = "Demand")Example block output

    JuMP model

    The implementation of our two-stage stochastic program in JuMP is:

    model = Model(HiGHS.Optimizer)
    +StatsPlots.histogram(d; bins = 20, label = "", xlabel = "Demand")
    Example block output

    JuMP model

    The implementation of our two-stage stochastic program in JuMP is:

    model = Model(HiGHS.Optimizer)
     set_silent(model)
     @variable(model, x >= 0)
     @variable(model, 0 <= y[ω in Ω] <= d[ω])
    @@ -38,37 +38,37 @@
     * Candidate solution (result #1)
       Primal status      : FEASIBLE_POINT
       Dual status        : FEASIBLE_POINT
    -  Objective value    : 5.61501e+02
    -  Objective bound    : 5.61501e+02
    +  Objective value    : 5.43339e+02
    +  Objective bound    : 5.43339e+02
       Relative gap       : Inf
    -  Dual objective value : 5.61501e+02
    +  Dual objective value : 5.43339e+02
     
     * Work counters
    -  Solve time (sec)   : 3.69072e-04
    +  Solve time (sec)   : 3.88861e-04
       Simplex iterations : 42
       Barrier iterations : 0
       Node count         : -1
    -

    The optimal number of pies to make is:

    value(x)
    204.3892847646041

    The distribution of total profit is:

    total_profit = [-2 * value(x) + value(z[ω]) for ω in Ω]
    100-element Vector{Float64}:
    - 358.4843451522356
    - 367.9403462898857
    - 370.2719932887172
    - 412.61304728188236
    - 420.2512176682375
    - 427.64735572332495
    - 428.77390885977786
    - 429.1037080029711
    - 435.1279092026832
    - 466.4945520025997
    +

    The optimal number of pies to make is:

    value(x)
    200.3577901040576

    The distribution of total profit is:

    total_profit = [-2 * value(x) + value(z[ω]) for ω in Ω]
    100-element Vector{Float64}:
    + 362.3047123359781
    + 389.747847553757
    + 396.03465612688655
    + 404.9121311382931
    + 410.777350317723
    + 412.03053148454416
    + 417.1206950472402
    + 424.8281759439115
    + 434.267141185982
    + 435.85969908122075
        ⋮
    - 613.1678542938123
    - 613.1678542938123
    - 613.1678542938123
    - 613.1678542938123
    - 613.1678542938123
    - 613.1678542938123
    - 613.1678542938123
    - 613.1678542938123
    - 613.1678542938123

    Let's plot it:

    """
    + 601.0733703121728
    + 601.0733703121728
    + 601.0733703121728
    + 601.0733703121728
    + 601.0733703121728
    + 601.0733703121728
    + 601.0733703121728
    + 601.0733703121728
    + 601.0733703121728

    Let's plot it:

    """
         bin_distribution(x::Vector{Float64}, N::Int)
     
     A helper function that discretizes `x` into bins of width `N`.
    @@ -89,7 +89,7 @@
         label = "Expected profit (\$$(round(Int, μ)))",
         linewidth = 3,
     )
    -plot
    Example block output

    Risk measures

    A risk measure is a function which maps a random variable to a real number. Common risk measures include the mean (expectation), median, mode, and maximum. We need a risk measure to convert the distribution of second stage costs into a single number that can be optimized.

    Our model currently uses the expectation risk measure, but others are possible too. One popular risk measure is the conditional value at risk (CVaR).

    CVaR has a parameter $\gamma$, and it computes the expectation of the worst $\gamma$ fraction of outcomes.

    If we are maximizing, so that small outcomes are bad, the definition of CVaR is:

    \[CVaR_{\gamma}[Z] = \max\limits_{\xi} \;\; \xi - \frac{1}{\gamma}\mathbb{E}_\omega\left[(\xi - Z)_+\right]\]

    which can be formulated as the linear program:

    \[\begin{aligned} +plotExample block output

    Risk measures

    A risk measure is a function which maps a random variable to a real number. Common risk measures include the mean (expectation), median, mode, and maximum. We need a risk measure to convert the distribution of second stage costs into a single number that can be optimized.

    Our model currently uses the expectation risk measure, but others are possible too. One popular risk measure is the conditional value at risk (CVaR).

    CVaR has a parameter $\gamma$, and it computes the expectation of the worst $\gamma$ fraction of outcomes.

    If we are maximizing, so that small outcomes are bad, the definition of CVaR is:

    \[CVaR_{\gamma}[Z] = \max\limits_{\xi} \;\; \xi - \frac{1}{\gamma}\mathbb{E}_\omega\left[(\xi - Z)_+\right]\]

    which can be formulated as the linear program:

    \[\begin{aligned} CVaR_{\gamma}[Z] = \max\limits_{\xi, z_\omega} \;\; & \xi - \frac{1}{\gamma}\sum P_\omega z_\omega\\ & z_\omega \ge \xi - Z_\omega & \quad \forall \omega \\ & z_\omega \ge 0 & \quad \forall \omega. @@ -105,7 +105,7 @@ optimize!(model) @assert is_solved_and_feasible(model) return objective_value(model) -end

    CVaR (generic function with 1 method)

    When γ is 1.0, we compute the mean of the profit:

    cvar_10 = CVaR(total_profit, P; γ = 1.0)
    561.5007625696609
    Statistics.mean(total_profit)
    561.5007625696609

    As γ approaches 0.0, we compute the worst-case (minimum) profit:

    cvar_00 = CVaR(total_profit, P; γ = 0.0001)
    358.4843451522356
    minimum(total_profit)
    358.4843451522356

    By varying γ between 0 and 1 we can compute some trade-off of these two extremes:

    cvar_05 = CVaR(total_profit, P; γ = 0.5)
    512.3527749939648

    Let's plot these outcomes on our distribution:

    plot = StatsPlots.histogram(
    +end
    CVaR (generic function with 1 method)

    When γ is 1.0, we compute the mean of the profit:

    cvar_10 = CVaR(total_profit, P; γ = 1.0)
    543.3387259226043
    Statistics.mean(total_profit)
    543.3387259226042

    As γ approaches 0.0, we compute the worst-case (minimum) profit:

    cvar_00 = CVaR(total_profit, P; γ = 0.0001)
    362.3047123359781
    minimum(total_profit)
    362.3047123359781

    By varying γ between 0 and 1 we can compute some trade-off of these two extremes:

    cvar_05 = CVaR(total_profit, P; γ = 0.5)
    489.0858641376421

    Let's plot these outcomes on our distribution:

    plot = StatsPlots.histogram(
         total_profit;
         bins = bin_distribution(total_profit, 25),
         label = "",
    @@ -118,7 +118,7 @@
         label = ["γ = 1.0" "γ = 0.5" "γ = 0.0"],
         linewidth = 3,
     )
    -plot
    Example block output

    Risk averse sample average approximation

    Because CVaR can be formulated as a linear program, we can form a risk averse sample average approximation model by combining the two formulations:

    γ = 0.4
    +plot
    Example block output

    Risk averse sample average approximation

    Because CVaR can be formulated as a linear program, we can form a risk averse sample average approximation model by combining the two formulations:

    γ = 0.4
     model = Model(HiGHS.Optimizer)
     set_silent(model)
     @variable(model, x >= 0)
    @@ -130,7 +130,7 @@
     @constraint(model, [ω in Ω], z[ω] >= ξ - Z[ω])
     @objective(model, Max, -2x + ξ - 1 / γ * sum(P[ω] * z[ω] for ω in Ω))
     optimize!(model)
    -@assert is_solved_and_feasible(model)

    When $\gamma = 0.4$, the optimal number of pies to bake is:

    value(x)
    187.1492942246542

    The distribution of total profit is:

    risk_averse_total_profit = [value(-2x + Z[ω]) for ω in Ω]
    +@assert is_solved_and_feasible(model)

    When $\gamma = 0.4$, the optimal number of pies to bake is:

    value(x)
    178.141743457943

    The distribution of total profit is:

    risk_averse_total_profit = [value(-2x + Z[ω]) for ω in Ω]
     bins = bin_distribution([total_profit; risk_averse_total_profit], 25)
     plot = StatsPlots.histogram(total_profit; label = "Expectation", bins = bins)
     StatsPlots.histogram!(
    @@ -140,4 +140,4 @@
         bins = bins,
         alpha = 0.5,
     )
    -plot
    Example block output

    Next steps

    • Try solving this problem for different numbers of samples and different distributions.
    • Refactor the example to avoid hard-coding the costs. What happens to the solution if the cost of disposing unsold pies increases?
    • Plot the optimal number of pies to make for different values of the risk aversion parameter $\gamma$. What is the relationship?
    +plotExample block output

    Next steps

    • Try solving this problem for different numbers of samples and different distributions.
    • Refactor the example to avoid hard-coding the costs. What happens to the solution if the cost of disposing unsold pies increases?
    • Plot the optimal number of pies to make for different values of the risk aversion parameter $\gamma$. What is the relationship?
    diff --git a/previews/PR3778/tutorials/applications/web_app/index.html b/previews/PR3778/tutorials/applications/web_app/index.html index 61c31f745fb..30832cf1f26 100644 --- a/previews/PR3778/tutorials/applications/web_app/index.html +++ b/previews/PR3778/tutorials/applications/web_app/index.html @@ -88,4 +88,4 @@ "status" => "failure" "reason" => "missing lower_bound param"

    If we don't send a lower_bound that is a number, we get:

    send_request(Dict("lower_bound" => "1.2"))
    Dict{String, Any} with 2 entries:
       "status" => "failure"
    -  "reason" => "lower_bound is not a number"

    Finally, we can shutdown our HTTP server:

    close(server)
    [ Info: Server on 127.0.0.1:8080 closing

    Next steps

    For more complicated examples relating to HTTP servers, consult the HTTP.jl documentation.

    To see how you can integrate this with a larger JuMP model, read Design patterns for larger models.

    + "reason" => "lower_bound is not a number"

    Finally, we can shutdown our HTTP server:

    close(server)
    [ Info: Server on 127.0.0.1:8080 closing

    Next steps

    For more complicated examples relating to HTTP servers, consult the HTTP.jl documentation.

    To see how you can integrate this with a larger JuMP model, read Design patterns for larger models.

    diff --git a/previews/PR3778/tutorials/conic/arbitrary_precision/index.html b/previews/PR3778/tutorials/conic/arbitrary_precision/index.html index 7742ff66a34..9c94fd8019b 100644 --- a/previews/PR3778/tutorials/conic/arbitrary_precision/index.html +++ b/previews/PR3778/tutorials/conic/arbitrary_precision/index.html @@ -36,7 +36,7 @@ Dual objective value : -6.42857e-01 * Work counters - Solve time (sec) : 2.26397e-03 + Solve time (sec) : 2.09800e-03 Barrier iterations : 5

    The value of each decision variable is a BigFloat:

    value.(x)
    2-element Vector{BigFloat}:
      0.4285714246558161076147072906813123533593766450416896337912086518811186790735189
    @@ -80,4 +80,4 @@
     * Work counters
     

    The optimal values are given in exact rational arithmetic:

    value.(x)
    2-element Vector{Rational{BigInt}}:
      1//6
    - 2//3
    objective_value(model)
    5//6
    value(c2)
    13//6
    + 2//3
    objective_value(model)
    5//6
    value(c2)
    13//6
    diff --git a/previews/PR3778/tutorials/conic/dualization/index.html b/previews/PR3778/tutorials/conic/dualization/index.html index 71ca17b2e45..045ce28f58b 100644 --- a/previews/PR3778/tutorials/conic/dualization/index.html +++ b/previews/PR3778/tutorials/conic/dualization/index.html @@ -53,12 +53,12 @@ ------------------------------------------------------------------ iter | pri res | dua res | gap | obj | scale | time (s) ------------------------------------------------------------------ - 0| 1.65e+01 1.60e-01 5.09e+01 -2.91e+01 1.00e-01 1.04e-04 - 50| 1.74e-08 2.70e-10 4.88e-08 -4.00e+00 1.00e-01 1.82e-04 + 0| 1.65e+01 1.60e-01 5.09e+01 -2.91e+01 1.00e-01 1.41e-04 + 50| 1.74e-08 2.70e-10 4.88e-08 -4.00e+00 1.00e-01 2.18e-04 ------------------------------------------------------------------ status: solved -timings: total: 1.83e-04s = setup: 4.09e-05s + solve: 1.42e-04s - lin-sys: 1.11e-05s, cones: 5.75e-05s, accel: 2.70e-06s +timings: total: 2.19e-04s = setup: 6.11e-05s + solve: 1.58e-04s + lin-sys: 1.09e-05s, cones: 5.73e-05s, accel: 2.79e-06s ------------------------------------------------------------------ objective = -4.000000 ------------------------------------------------------------------

    (There are five rows in the constraint matrix because SCS expects problems in geometric conic form, and so JuMP has reformulated the X, PSD variable constraint into the affine constraint X .+ 0 in PSDCone().)

    The solution we obtain is:

    value.(X)
    2×2 Matrix{Float64}:
    @@ -83,12 +83,12 @@
     ------------------------------------------------------------------
      iter | pri res | dua res |   gap   |   obj   |  scale  | time (s)
     ------------------------------------------------------------------
    -     0| 1.23e+01  1.00e+00  2.73e+01 -9.03e+00  1.00e-01  9.69e-05
    -    50| 1.13e-07  1.05e-09  3.23e-07  4.00e+00  1.00e-01  1.77e-04
    +     0| 1.23e+01  1.00e+00  2.73e+01 -9.03e+00  1.00e-01  1.08e-04
    +    50| 1.13e-07  1.05e-09  3.23e-07  4.00e+00  1.00e-01  1.89e-04
     ------------------------------------------------------------------
     status:  solved
    -timings: total: 1.78e-04s = setup: 4.42e-05s + solve: 1.34e-04s
    -	 lin-sys: 9.73e-06s, cones: 5.66e-05s, accel: 2.65e-06s
    +timings: total: 1.90e-04s = setup: 5.01e-05s + solve: 1.40e-04s
    +	 lin-sys: 9.71e-06s, cones: 5.77e-05s, accel: 2.70e-06s
     ------------------------------------------------------------------
     objective = 4.000000
     ------------------------------------------------------------------

    and the solution we obtain is:

    dual.(dual_c)
    2×2 Matrix{Float64}:
    @@ -113,12 +113,12 @@
     ------------------------------------------------------------------
      iter | pri res | dua res |   gap   |   obj   |  scale  | time (s)
     ------------------------------------------------------------------
    -     0| 1.23e+01  1.00e+00  2.73e+01 -9.03e+00  1.00e-01  1.17e-04
    -    50| 1.13e-07  1.05e-09  3.23e-07  4.00e+00  1.00e-01  1.99e-04
    +     0| 1.23e+01  1.00e+00  2.73e+01 -9.03e+00  1.00e-01  1.52e-04
    +    50| 1.13e-07  1.05e-09  3.23e-07  4.00e+00  1.00e-01  2.35e-04
     ------------------------------------------------------------------
     status:  solved
    -timings: total: 2.00e-04s = setup: 4.11e-05s + solve: 1.59e-04s
    -	 lin-sys: 9.71e-06s, cones: 5.81e-05s, accel: 2.82e-06s
    +timings: total: 2.35e-04s = setup: 6.51e-05s + solve: 1.70e-04s
    +	 lin-sys: 9.63e-06s, cones: 5.90e-05s, accel: 2.79e-06s
     ------------------------------------------------------------------
     objective = 4.000000
     ------------------------------------------------------------------

    The performance is the same as if we solved model_dual, and the correct solution is returned to X:

    value.(X)
    2×2 Matrix{Float64}:
    @@ -144,12 +144,12 @@
     ------------------------------------------------------------------
      iter | pri res | dua res |   gap   |   obj   |  scale  | time (s)
     ------------------------------------------------------------------
    -     0| 1.65e+01  1.60e-01  5.09e+01 -2.91e+01  1.00e-01  1.14e-04
    -    50| 1.74e-08  2.70e-10  4.88e-08 -4.00e+00  1.00e-01  1.91e-04
    +     0| 1.65e+01  1.60e-01  5.09e+01 -2.91e+01  1.00e-01  1.52e-04
    +    50| 1.74e-08  2.70e-10  4.88e-08 -4.00e+00  1.00e-01  2.31e-04
     ------------------------------------------------------------------
     status:  solved
    -timings: total: 1.92e-04s = setup: 4.02e-05s + solve: 1.52e-04s
    -	 lin-sys: 1.07e-05s, cones: 5.49e-05s, accel: 2.68e-06s
    +timings: total: 2.32e-04s = setup: 5.35e-05s + solve: 1.78e-04s
    +	 lin-sys: 1.12e-05s, cones: 5.75e-05s, accel: 2.74e-06s
     ------------------------------------------------------------------
     objective = -4.000000
     ------------------------------------------------------------------
    dual.(dual_c)
    2×2 Matrix{Float64}:
    @@ -185,12 +185,12 @@
     ------------------------------------------------------------------
      iter | pri res | dua res |   gap   |   obj   |  scale  | time (s)
     ------------------------------------------------------------------
    -     0| 4.73e+00  1.00e+00  2.92e+00  1.23e+00  1.00e-01  1.43e-04
    -   150| 1.01e-04  3.07e-05  6.08e-05  1.33e+00  1.00e-01  7.25e-04
    +     0| 4.73e+00  1.00e+00  2.92e+00  1.23e+00  1.00e-01  1.95e-04
    +   150| 1.01e-04  3.07e-05  6.08e-05  1.33e+00  1.00e-01  7.64e-04
     ------------------------------------------------------------------
     status:  solved
    -timings: total: 7.26e-04s = setup: 7.23e-05s + solve: 6.54e-04s
    -	 lin-sys: 9.75e-05s, cones: 3.77e-04s, accel: 3.69e-05s
    +timings: total: 7.66e-04s = setup: 8.94e-05s + solve: 6.76e-04s
    +	 lin-sys: 9.75e-05s, cones: 3.77e-04s, accel: 3.85e-05s
     ------------------------------------------------------------------
     objective = 1.333363
     ------------------------------------------------------------------
    set_optimizer(model, Dualization.dual_optimizer(SCS.Optimizer))
    @@ -212,12 +212,12 @@
     ------------------------------------------------------------------
      iter | pri res | dua res |   gap   |   obj   |  scale  | time (s)
     ------------------------------------------------------------------
    -     0| 3.71e+01  1.48e+00  2.23e+02 -1.13e+02  1.00e-01  9.87e-05
    -   150| 1.57e-04  2.28e-05  2.08e-04 -1.33e+00  1.00e-01  6.72e-04
    +     0| 3.71e+01  1.48e+00  2.23e+02 -1.13e+02  1.00e-01  1.57e-04
    +   150| 1.57e-04  2.28e-05  2.08e-04 -1.33e+00  1.00e-01  7.40e-04
     ------------------------------------------------------------------
     status:  solved
    -timings: total: 6.73e-04s = setup: 7.50e-05s + solve: 5.98e-04s
    -	 lin-sys: 1.02e-04s, cones: 3.83e-04s, accel: 2.11e-05s
    +timings: total: 7.42e-04s = setup: 9.52e-05s + solve: 6.46e-04s
    +	 lin-sys: 1.03e-04s, cones: 3.95e-04s, accel: 2.71e-05s
     ------------------------------------------------------------------
     objective = -1.333460
    -------------------------------------------------------------------

    For this problem, SCS reports that the primal has variables n: 11, constraints m: 24 and that the dual has variables n: 14, constraints m: 24. Therefore, we should probably use the primal formulation because it has fewer variables and the same number of constraints.

    When to use dual_optimizer

    Because it can make the problem larger or smaller, depending on the problem and the choice of solver, there is no definitive rule on when you should use dual_optimizer. However, you should try dual_optimizer if your conic optimization problem takes a long time to solve, or if you need to repeatedly solve similarly structured problems with different data. In some cases solving the dual instead of the primal can make a large difference.

    +------------------------------------------------------------------

    For this problem, SCS reports that the primal has variables n: 11, constraints m: 24 and that the dual has variables n: 14, constraints m: 24. Therefore, we should probably use the primal formulation because it has fewer variables and the same number of constraints.

    When to use dual_optimizer

    Because it can make the problem larger or smaller, depending on the problem and the choice of solver, there is no definitive rule on when you should use dual_optimizer. However, you should try dual_optimizer if your conic optimization problem takes a long time to solve, or if you need to repeatedly solve similarly structured problems with different data. In some cases solving the dual instead of the primal can make a large difference.

    diff --git a/previews/PR3778/tutorials/conic/ellipse_approx/c69aa373.svg b/previews/PR3778/tutorials/conic/ellipse_approx/15c87826.svg similarity index 57% rename from previews/PR3778/tutorials/conic/ellipse_approx/c69aa373.svg rename to previews/PR3778/tutorials/conic/ellipse_approx/15c87826.svg index 7f0d6e5a767..2c5f373362c 100644 --- a/previews/PR3778/tutorials/conic/ellipse_approx/c69aa373.svg +++ b/previews/PR3778/tutorials/conic/ellipse_approx/15c87826.svg @@ -1,2450 +1,2450 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/previews/PR3778/tutorials/conic/ellipse_approx/7a6d44f8.svg b/previews/PR3778/tutorials/conic/ellipse_approx/c1248c44.svg similarity index 57% rename from previews/PR3778/tutorials/conic/ellipse_approx/7a6d44f8.svg rename to previews/PR3778/tutorials/conic/ellipse_approx/c1248c44.svg index 7c861951f80..f04479d832f 100644 --- a/previews/PR3778/tutorials/conic/ellipse_approx/7a6d44f8.svg +++ b/previews/PR3778/tutorials/conic/ellipse_approx/c1248c44.svg @@ -1,2451 +1,2451 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/previews/PR3778/tutorials/conic/ellipse_approx/index.html b/previews/PR3778/tutorials/conic/ellipse_approx/index.html index 309396dee60..f806a764dba 100644 --- a/previews/PR3778/tutorials/conic/ellipse_approx/index.html +++ b/previews/PR3778/tutorials/conic/ellipse_approx/index.html @@ -36,7 +36,7 @@ c = :green, shape = :x, size = (600, 600), -)Example block output

    JuMP formulation

    Now let's build and the JuMP model. We'll compute $D$ and $c$ after the solve.

    model = Model(SCS.Optimizer)
    +)
    Example block output

    JuMP formulation

    Now let's build and the JuMP model. We'll compute $D$ and $c$ after the solve.

    model = Model(SCS.Optimizer)
     # We need to use a tighter tolerance for this example, otherwise the bounding
     # ellipse won't actually be bounding...
     set_attribute(model, "eps_rel", 1e-6)
    @@ -71,7 +71,7 @@
       Dual objective value : 4.47966e-03
     
     * Work counters
    -  Solve time (sec)   : 8.14246e-01
    +  Solve time (sec)   : 7.87477e-01
     

    Results

    After solving the model to optimality we can recover the solution in terms of $D$ and $c$:

    D = value.(Z)
    2×2 Matrix{Float64}:
       0.00707822  -0.0102173
      -0.0102173    0.0175624
    c = D \ value.(z)
    2-element Vector{Float64}:
    @@ -79,7 +79,7 @@
      -1.8428256866082124

    Finally, overlaying the solution in the plot we see the minimal volume approximating ellipsoid:

    P = sqrt(D)
     q = -P * c
     data = [tuple(P \ [cos(θ) - q[1], sin(θ) - q[2]]...) for θ in 0:0.05:(2pi+0.05)]
    -Plots.plot!(plot, data; c = :crimson, label = nothing)
    Example block output

    Alternative formulations

    The formulation of model uses MOI.RootDetConeSquare. However, because SCS does not natively support this cone, JuMP automatically reformulates the problem into an equivalent problem that SCS does support. You can see the reformulation that JuMP chose using print_active_bridges:

    print_active_bridges(model)
     * Unsupported objective: MOI.VariableIndex
    +Plots.plot!(plot, data; c = :crimson, label = nothing)
    Example block output

    Alternative formulations

    The formulation of model uses MOI.RootDetConeSquare. However, because SCS does not natively support this cone, JuMP automatically reformulates the problem into an equivalent problem that SCS does support. You can see the reformulation that JuMP chose using print_active_bridges:

    print_active_bridges(model)
     * Unsupported objective: MOI.VariableIndex
      |  bridged by:
      |   MOIB.Objective.FunctionConversionBridge{Float64, MOI.ScalarAffineFunction{Float64}, MOI.VariableIndex}
      |  may introduce:
    @@ -259,7 +259,7 @@
     @objective(model, Max, 1 * t + 0)
     optimize!(model)
     Test.@test is_solved_and_feasible(model)
    -solve_time_1 = solve_time(model)
    0.772480042

    This formulation gives the much smaller graph:

    print_active_bridges(model)
     * Supported objective: MOI.ScalarAffineFunction{Float64}
    +solve_time_1 = solve_time(model)
    0.8079895149999999

    This formulation gives the much smaller graph:

    print_active_bridges(model)
     * Supported objective: MOI.ScalarAffineFunction{Float64}
      * Supported constraint: MOI.VectorAffineFunction{Float64}-in-MOI.Nonnegatives
      * Unsupported constraint: MOI.VectorAffineFunction{Float64}-in-MOI.PositiveSemidefiniteConeTriangle
      |  bridged by:
    @@ -298,7 +298,7 @@
      |   |   |   |   * Supported constraint: MOI.VectorAffineFunction{Float64}-in-MOI.Nonnegatives
      |   * Supported variable: MOI.Reals

    The last bullet shows how JuMP reformulated the MOI.RootDetConeTriangle constraint by adding a mix of MOI.PositiveSemidefiniteConeTriangle and MOI.GeometricMeanCone constraints.

    Because SCS doesn't natively support the MOI.GeometricMeanCone, these constraints were further bridged using a MOI.Bridges.Constraint.GeoMeanToPowerBridge to a series of MOI.PowerCone constraints.

    However, there are many other ways that a MOI.GeometricMeanCone can be reformulated into something that SCS supports. Let's see what happens if we use remove_bridge to remove the MOI.Bridges.Constraint.GeoMeanToPowerBridge:

    remove_bridge(model, MOI.Bridges.Constraint.GeoMeanToPowerBridge)
     optimize!(model)
    -Test.@test is_solved_and_feasible(model)
    Test Passed

    This time, the solve took:

    solve_time_2 = solve_time(model)
    0.513007313

    where previously it took

    solve_time_1
    0.772480042

    Why was the solve time different?

    print_active_bridges(model)
     * Supported objective: MOI.ScalarAffineFunction{Float64}
    +Test.@test is_solved_and_feasible(model)
    Test Passed

    This time, the solve took:

    solve_time_2 = solve_time(model)
    0.508288987

    where previously it took

    solve_time_1
    0.8079895149999999

    Why was the solve time different?

    print_active_bridges(model)
     * Supported objective: MOI.ScalarAffineFunction{Float64}
      * Supported constraint: MOI.VectorAffineFunction{Float64}-in-MOI.Nonnegatives
      * Unsupported constraint: MOI.VectorAffineFunction{Float64}-in-MOI.PositiveSemidefiniteConeTriangle
      |  bridged by:
    @@ -342,4 +342,4 @@
      |   |   |   * Supported constraint: MOI.VectorAffineFunction{Float64}-in-MOI.SecondOrderCone
      |   |   * Supported constraint: MOI.VectorAffineFunction{Float64}-in-MOI.Nonnegatives
      |   |   * Supported variable: MOI.Reals
    - |   * Supported variable: MOI.Reals

    This time, JuMP used a MOI.Bridges.Constraint.GeoMeanBridge to reformulate the constraint into a set of MOI.RotatedSecondOrderCone constraints, which were further reformulated into a set of supported MOI.SecondOrderCone constraints.

    Since the two models are equivalent, we can conclude that for this particular model, the MOI.SecondOrderCone formulation is more efficient.

    In general though, the performance of a particular reformulation is problem- and solver-specific. Therefore, JuMP chooses to minimize the number of bridges in the default reformulation, leaving you to explore alternative formulations using the tools and techniques shown in this tutorial.

    + | * Supported variable: MOI.Reals

    This time, JuMP used a MOI.Bridges.Constraint.GeoMeanBridge to reformulate the constraint into a set of MOI.RotatedSecondOrderCone constraints, which were further reformulated into a set of supported MOI.SecondOrderCone constraints.

    Since the two models are equivalent, we can conclude that for this particular model, the MOI.SecondOrderCone formulation is more efficient.

    In general though, the performance of a particular reformulation is problem- and solver-specific. Therefore, JuMP chooses to minimize the number of bridges in the default reformulation, leaving you to explore alternative formulations using the tools and techniques shown in this tutorial.

    diff --git a/previews/PR3778/tutorials/conic/experiment_design/index.html b/previews/PR3778/tutorials/conic/experiment_design/index.html index eb7f5316454..4b356c937b0 100644 --- a/previews/PR3778/tutorials/conic/experiment_design/index.html +++ b/previews/PR3778/tutorials/conic/experiment_design/index.html @@ -98,4 +98,4 @@ 2.9157806299837166 2.67337566459234 2.735395012219622 - 0.3378388086258122 + 0.3378388086258122 diff --git a/previews/PR3778/tutorials/conic/introduction/index.html b/previews/PR3778/tutorials/conic/introduction/index.html index e4da92a7d34..bc142e47c88 100644 --- a/previews/PR3778/tutorials/conic/introduction/index.html +++ b/previews/PR3778/tutorials/conic/introduction/index.html @@ -6,4 +6,4 @@

    Introduction

    Conic programs are a class of convex nonlinear optimization problems which use cones to represent the nonlinearities. They have the form:

    \[\begin{align} & \min_{x \in \mathbb{R}^n} & f_0(x) \\ & \;\;\text{s.t.} & f_j(x) \in \mathcal{S}_j & \;\; j = 1 \ldots m -\end{align}\]

    Mixed-integer conic programs (MICPs) are extensions of conic programs in which some (or all) of the decision variables take discrete values.

    How to choose a solver

    JuMP supports a range of conic solvers, although support differs on what types of cones each solver supports. In the list of Supported solvers, "SOCP" denotes solvers supporting second-order cones and "SDP" denotes solvers supporting semidefinite cones. In addition, solvers such as SCS and Mosek have support for the exponential cone. Moreover, due to the bridging system in MathOptInterface, many of these solvers support a much wider range of exotic cones than they natively support. Solvers supporting discrete variables start with "(MI)" in the list of Supported solvers.

    Tip

    Duality plays a large role in solving conic optimization models. Depending on the solver, it can be more efficient to solve the dual instead of the primal. If performance is an issue, see the Dualization tutorial for more details.

    How these tutorials are structured

    Having a high-level overview of how this part of the documentation is structured will help you know where to look for certain things.

    • The following tutorials are worked examples that present a problem in words, then formulate it in mathematics, and then solve it in JuMP. This usually involves some sort of visualization of the solution. Start here if you are new to JuMP.
    • The Tips and tricks tutorial contains a number of helpful reformulations and tricks you can use when modeling conic programs. Look here if you are stuck trying to formulate a problem as a conic program.
    • The remaining tutorials are less verbose and styled in the form of short code examples. These tutorials have less explanation, but may contain useful code snippets, particularly if they are similar to a problem you are trying to solve.
    +\end{align}\]

    Mixed-integer conic programs (MICPs) are extensions of conic programs in which some (or all) of the decision variables take discrete values.

    How to choose a solver

    JuMP supports a range of conic solvers, although support differs on what types of cones each solver supports. In the list of Supported solvers, "SOCP" denotes solvers supporting second-order cones and "SDP" denotes solvers supporting semidefinite cones. In addition, solvers such as SCS and Mosek have support for the exponential cone. Moreover, due to the bridging system in MathOptInterface, many of these solvers support a much wider range of exotic cones than they natively support. Solvers supporting discrete variables start with "(MI)" in the list of Supported solvers.

    Tip

    Duality plays a large role in solving conic optimization models. Depending on the solver, it can be more efficient to solve the dual instead of the primal. If performance is an issue, see the Dualization tutorial for more details.

    How these tutorials are structured

    Having a high-level overview of how this part of the documentation is structured will help you know where to look for certain things.

    • The following tutorials are worked examples that present a problem in words, then formulate it in mathematics, and then solve it in JuMP. This usually involves some sort of visualization of the solution. Start here if you are new to JuMP.
    • The Tips and tricks tutorial contains a number of helpful reformulations and tricks you can use when modeling conic programs. Look here if you are stuck trying to formulate a problem as a conic program.
    • The remaining tutorials are less verbose and styled in the form of short code examples. These tutorials have less explanation, but may contain useful code snippets, particularly if they are similar to a problem you are trying to solve.
    diff --git a/previews/PR3778/tutorials/conic/logistic_regression/index.html b/previews/PR3778/tutorials/conic/logistic_regression/index.html index ddf417bb46f..917542586b3 100644 --- a/previews/PR3778/tutorials/conic/logistic_regression/index.html +++ b/previews/PR3778/tutorials/conic/logistic_regression/index.html @@ -106,4 +106,4 @@ )
    Number of non-zero components: 8 (out of 10 features)

    Extensions

    A direct extension would be to consider the sparse logistic regression with hard thresholding, which, on contrary to the soft version using a $\ell_1$ regularization, adds an explicit cardinality constraint in its formulation:

    \[\begin{aligned} \min_{\theta} & \; \sum_{i=1}^n \log(1 + \exp(-y_i \theta^\top x_i)) + \lambda \| \theta \|_2^2 \\ \text{subject to } & \quad \| \theta \|_0 <= k -\end{aligned}\]

    where $k$ is the maximum number of non-zero components in the vector $\theta$, and $\|.\|_0$ is the $\ell_0$ pseudo-norm:

    \[\| x\|_0 = \#\{i : \; x_i \neq 0\}\]

    The cardinality constraint $\|\theta\|_0 \leq k$ could be reformulated with binary variables. Thus the hard sparse regression problem could be solved by any solver supporting mixed integer conic problems.

    +\end{aligned}\]

    where $k$ is the maximum number of non-zero components in the vector $\theta$, and $\|.\|_0$ is the $\ell_0$ pseudo-norm:

    \[\| x\|_0 = \#\{i : \; x_i \neq 0\}\]

    The cardinality constraint $\|\theta\|_0 \leq k$ could be reformulated with binary variables. Thus the hard sparse regression problem could be solved by any solver supporting mixed integer conic problems.

    diff --git a/previews/PR3778/tutorials/conic/min_ellipse/1c0b13f2.svg b/previews/PR3778/tutorials/conic/min_ellipse/40e731c1.svg similarity index 88% rename from previews/PR3778/tutorials/conic/min_ellipse/1c0b13f2.svg rename to previews/PR3778/tutorials/conic/min_ellipse/40e731c1.svg index bc61bd3c551..67f99f848a8 100644 --- a/previews/PR3778/tutorials/conic/min_ellipse/1c0b13f2.svg +++ b/previews/PR3778/tutorials/conic/min_ellipse/40e731c1.svg @@ -1,50 +1,50 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/previews/PR3778/tutorials/conic/min_ellipse/3d8f5417.svg b/previews/PR3778/tutorials/conic/min_ellipse/a82e7e2b.svg similarity index 88% rename from previews/PR3778/tutorials/conic/min_ellipse/3d8f5417.svg rename to previews/PR3778/tutorials/conic/min_ellipse/a82e7e2b.svg index 45e5d7d9ad5..7dfa77f7b9d 100644 --- a/previews/PR3778/tutorials/conic/min_ellipse/3d8f5417.svg +++ b/previews/PR3778/tutorials/conic/min_ellipse/a82e7e2b.svg @@ -1,53 +1,53 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/previews/PR3778/tutorials/conic/min_ellipse/index.html b/previews/PR3778/tutorials/conic/min_ellipse/index.html index 6e844acc739..1c11013fb46 100644 --- a/previews/PR3778/tutorials/conic/min_ellipse/index.html +++ b/previews/PR3778/tutorials/conic/min_ellipse/index.html @@ -46,7 +46,7 @@ for ellipse in ellipses plot_ellipse(plot, ellipse) end -plotExample block output

    Build the model

    Now let's build the model, using the change-of-variables = $P^2$ and P_q = $P q$. We'll recover the true value of P and q after the solve.

    model = Model(SCS.Optimizer)
    +plot
    Example block output

    Build the model

    Now let's build the model, using the change-of-variables = $P^2$ and P_q = $P q$. We'll recover the true value of P and q after the solve.

    model = Model(SCS.Optimizer)
     # We need to use a tighter tolerance for this example, otherwise the bounding
     # ellipse won't actually be bounding...
     set_attribute(model, "eps_rel", 1e-6)
    @@ -85,7 +85,7 @@
       Dual objective value : -4.04364e+00
     
     * Work counters
    -  Solve time (sec)   : 2.17538e-01
    +  Solve time (sec)   : 2.67604e-01
     

    Results

    After solving the model to optimality we can recover the solution in terms of $P$ and $q$:

    P = sqrt(value.(P²))
     q = P \ value.(P_q)
    2-element Vector{Float64}:
      -0.39642176964330034
    @@ -94,4 +94,4 @@
         [tuple(P \ [cos(θ) - q[1], sin(θ) - q[2]]...) for θ in 0:0.05:(2pi+0.05)];
         c = :crimson,
         label = nothing,
    -)
    Example block output +)Example block output diff --git a/previews/PR3778/tutorials/conic/quantum_discrimination/index.html b/previews/PR3778/tutorials/conic/quantum_discrimination/index.html index 7314101aae5..8283f922a1e 100644 --- a/previews/PR3778/tutorials/conic/quantum_discrimination/index.html +++ b/previews/PR3778/tutorials/conic/quantum_discrimination/index.html @@ -44,7 +44,7 @@ Dual objective value : 8.64062e-01 * Work counters - Solve time (sec) : 4.37678e-04 + Solve time (sec) : 4.37128e-04

    The probability of guessing correctly is:

    objective_value(model)
    0.8640614507314219

    When N = 2, there is a known analytical solution of:

    0.5 + 0.25 * sum(LinearAlgebra.svdvals(ρ[1] - ρ[2]))
    0.8640627582954737

    proving that we found the optimal solution.

    Finally, the optimal POVM is:

    solution = [value.(e) for e in E]
    2-element Vector{Matrix{ComplexF64}}:
      [0.9495721399750024 + 0.0im 0.03442451603977098 + 0.21609731371190505im; 0.03442451603977098 - 0.21609731371190505im 0.05042785512985496 + 0.0im]
      [0.05042785517602001 + 0.0im -0.03442451605312517 - 0.21609731370614843im; -0.03442451605312517 + 0.21609731370614843im 0.9495721400119357 + 0.0im]
    Tip

    Duality plays a large role in solving conic optimization models. Depending on the solver, it can be more efficient to solve the dual of this problem instead of the primal. If performance is an issue, see the Dualization tutorial for more details.

    Alternative formulation

    The formulation above includes N Hermitian matrices and a set of linear equality constraints. We can simplify the problem by replacing $E_N$ with $E_N = I - \sum\limits_{i=1}^{N-1} E_i$. This results in:

    model = Model(SCS.Optimizer)
    @@ -71,5 +71,5 @@
       Dual objective value : 8.64062e-01
     
     * Work counters
    -  Solve time (sec)   : 4.43288e-04
    -
    objective_value(model)
    0.8640596603179975
    + Solve time (sec) : 4.90346e-04 +
    objective_value(model)
    0.8640596603179975
    diff --git a/previews/PR3778/tutorials/conic/simple_examples/8632fa4b.svg b/previews/PR3778/tutorials/conic/simple_examples/60ebefc4.svg similarity index 79% rename from previews/PR3778/tutorials/conic/simple_examples/8632fa4b.svg rename to previews/PR3778/tutorials/conic/simple_examples/60ebefc4.svg index ba27027e206..bb5b2e104e5 100644 --- a/previews/PR3778/tutorials/conic/simple_examples/8632fa4b.svg +++ b/previews/PR3778/tutorials/conic/simple_examples/60ebefc4.svg @@ -1,49 +1,49 @@ - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/previews/PR3778/tutorials/conic/simple_examples/index.html b/previews/PR3778/tutorials/conic/simple_examples/index.html index 69f021707ee..01db5d18503 100644 --- a/previews/PR3778/tutorials/conic/simple_examples/index.html +++ b/previews/PR3778/tutorials/conic/simple_examples/index.html @@ -179,7 +179,7 @@ ) end -example_minimum_distortion()Example block output

    Lovász numbers

    The Lovász number of a graph, also known as Lovász's theta-function, is a number that lies between two important and related numbers that are computationally hard to determine, namely the chromatic and clique numbers of the graph. It is possible however to efficient compute the Lovász number as the optimal value of a semidefinite program.

    Consider the pentagon graph:

         [5]
    +example_minimum_distortion()
    Example block output

    Lovász numbers

    The Lovász number of a graph, also known as Lovász's theta-function, is a number that lies between two important and related numbers that are computationally hard to determine, namely the chromatic and clique numbers of the graph. It is possible however to efficient compute the Lovász number as the optimal value of a semidefinite program.

    Consider the pentagon graph:

         [5]
         /   \
        /     \
      [1]     [4]
    @@ -242,4 +242,4 @@
         return
     end
     
    -example_robust_uncertainty_sets()
    +example_robust_uncertainty_sets() diff --git a/previews/PR3778/tutorials/conic/start_values/index.html b/previews/PR3778/tutorials/conic/start_values/index.html index e5250f9381c..8f871e8fec2 100644 --- a/previews/PR3778/tutorials/conic/start_values/index.html +++ b/previews/PR3778/tutorials/conic/start_values/index.html @@ -52,12 +52,12 @@ ------------------------------------------------------------------ iter | pri res | dua res | gap | obj | scale | time (s) ------------------------------------------------------------------ - 0| 4.42e+01 1.00e+00 1.28e+02 -6.64e+01 1.00e-01 1.02e-04 - 75| 5.30e-07 2.63e-06 3.15e-07 -3.00e+00 1.00e-01 1.49e-04 + 0| 4.42e+01 1.00e+00 1.28e+02 -6.64e+01 1.00e-01 1.07e-04 + 75| 5.30e-07 2.63e-06 3.15e-07 -3.00e+00 1.00e-01 1.56e-04 ------------------------------------------------------------------ status: solved -timings: total: 1.50e-04s = setup: 3.48e-05s + solve: 1.16e-04s - lin-sys: 1.40e-05s, cones: 6.33e-06s, accel: 3.69e-06s +timings: total: 1.57e-04s = setup: 3.99e-05s + solve: 1.17e-04s + lin-sys: 1.41e-05s, cones: 6.73e-06s, accel: 3.95e-06s ------------------------------------------------------------------ objective = -2.999998 ------------------------------------------------------------------

    By looking at the log, we can see that SCS took 75 iterations to find the optimal solution. Now we set the optimal solution as our starting point:

    set_optimal_start_values(model)

    and we re-optimize:

    optimize!(model)
    ------------------------------------------------------------------
    @@ -76,11 +76,11 @@
     ------------------------------------------------------------------
      iter | pri res | dua res |   gap   |   obj   |  scale  | time (s)
     ------------------------------------------------------------------
    -     0| 1.90e-05  1.56e-06  9.14e-05 -3.00e+00  1.00e-01  8.75e-05
    +     0| 1.90e-05  1.56e-06  9.14e-05 -3.00e+00  1.00e-01  9.49e-05
     ------------------------------------------------------------------
     status:  solved
    -timings: total: 8.85e-05s = setup: 3.92e-05s + solve: 4.93e-05s
    -	 lin-sys: 8.72e-07s, cones: 1.24e-06s, accel: 3.00e-08s
    +timings: total: 9.60e-05s = setup: 4.04e-05s + solve: 5.56e-05s
    +	 lin-sys: 8.61e-07s, cones: 1.22e-06s, accel: 3.00e-08s
     ------------------------------------------------------------------
     objective = -3.000044
    -------------------------------------------------------------------

    Now the optimization terminates after 0 iterations because our starting point is already optimal.

    Note that some solvers do not support setting some parts of the starting solution, for example, they may support only set_start_value for variables. If you encounter an UnsupportedSupported attribute error for MOI.VariablePrimalStart, MOI.ConstraintPrimalStart, or MOI.ConstraintDualStart, comment out the corresponding part of the set_optimal_start_values function.

    +------------------------------------------------------------------

    Now the optimization terminates after 0 iterations because our starting point is already optimal.

    Note that some solvers do not support setting some parts of the starting solution, for example, they may support only set_start_value for variables. If you encounter an UnsupportedSupported attribute error for MOI.VariablePrimalStart, MOI.ConstraintPrimalStart, or MOI.ConstraintDualStart, comment out the corresponding part of the set_optimal_start_values function.

    diff --git a/previews/PR3778/tutorials/conic/tips_and_tricks/index.html b/previews/PR3778/tutorials/conic/tips_and_tricks/index.html index fc8a27eff17..abdb7af906a 100644 --- a/previews/PR3778/tutorials/conic/tips_and_tricks/index.html +++ b/previews/PR3778/tutorials/conic/tips_and_tricks/index.html @@ -171,4 +171,4 @@ @constraint(model, u == 0.5) optimize!(model) @assert is_solved_and_feasible(model) -value(t), 0.5 * log(LinearAlgebra.det(value.(X) ./ 0.5))
    (1.4979204481049098, 1.4978661010981238)

    Other Cones and Functions

    For other cones supported by JuMP, check out the MathOptInterface Manual.

    +value(t), 0.5 * log(LinearAlgebra.det(value.(X) ./ 0.5))
    (1.4979204481049098, 1.4978661010981238)

    Other Cones and Functions

    For other cones supported by JuMP, check out the MathOptInterface Manual.

    diff --git a/previews/PR3778/tutorials/getting_started/debugging/index.html b/previews/PR3778/tutorials/getting_started/debugging/index.html index d0c96808343..18a03d01508 100644 --- a/previews/PR3778/tutorials/getting_started/debugging/index.html +++ b/previews/PR3778/tutorials/getting_started/debugging/index.html @@ -20,4 +20,4 @@ if abs(value(var)) > 1e3 println("Variable `$(name(var))` may be unbounded") end - endVariable `x` may be unbounded + endVariable `x` may be unbounded diff --git a/previews/PR3778/tutorials/getting_started/design_patterns_for_larger_models/index.html b/previews/PR3778/tutorials/getting_started/design_patterns_for_larger_models/index.html index ee651cc711a..945d3cc3b7b 100644 --- a/previews/PR3778/tutorials/getting_started/design_patterns_for_larger_models/index.html +++ b/previews/PR3778/tutorials/getting_started/design_patterns_for_larger_models/index.html @@ -520,4 +520,4 @@ ) @test x === nothing end -end
    Test.DefaultTestSet("KnapsackModel", Any[Test.DefaultTestSet("feasible_binary_knapsack", Any[], 5, false, false, true, 1.722832387082175e9, 1.722832387089704e9, false, "design_patterns_for_larger_models.md"), Test.DefaultTestSet("feasible_integer_knapsack", Any[], 5, false, false, true, 1.722832387089747e9, 1.72283238721318e9, false, "design_patterns_for_larger_models.md"), Test.DefaultTestSet("infeasible_binary_knapsack", Any[], 1, false, false, true, 1.72283238721322e9, 1.722832387215185e9, false, "design_patterns_for_larger_models.md")], 0, false, false, true, 1.722832387082129e9, 1.722832387215191e9, false, "design_patterns_for_larger_models.md")
    Tip

    Place these tests in a separate file test_knapsack_model.jl so that you can run the tests by adding include("test_knapsack_model.jl") to any file where needed.

    Next steps

    We've only briefly scratched the surface of ways to create and structure large JuMP models, so consider this tutorial a starting point, rather than a comprehensive list of all the possible ways to structure JuMP models. If you are embarking on a large project that uses JuMP, a good next step is to look at ways people have written large JuMP projects "in the wild."

    Here are some good examples (all co-incidentally related to energy):

    +end
    Test.DefaultTestSet("KnapsackModel", Any[Test.DefaultTestSet("feasible_binary_knapsack", Any[], 5, false, false, true, 1.722892853255631e9, 1.722892853261944e9, false, "design_patterns_for_larger_models.md"), Test.DefaultTestSet("feasible_integer_knapsack", Any[], 5, false, false, true, 1.722892853261988e9, 1.722892853382085e9, false, "design_patterns_for_larger_models.md"), Test.DefaultTestSet("infeasible_binary_knapsack", Any[], 1, false, false, true, 1.722892853382131e9, 1.72289285338434e9, false, "design_patterns_for_larger_models.md")], 0, false, false, true, 1.722892853255592e9, 1.722892853384347e9, false, "design_patterns_for_larger_models.md")
    Tip

    Place these tests in a separate file test_knapsack_model.jl so that you can run the tests by adding include("test_knapsack_model.jl") to any file where needed.

    Next steps

    We've only briefly scratched the surface of ways to create and structure large JuMP models, so consider this tutorial a starting point, rather than a comprehensive list of all the possible ways to structure JuMP models. If you are embarking on a large project that uses JuMP, a good next step is to look at ways people have written large JuMP projects "in the wild."

    Here are some good examples (all co-incidentally related to energy):

    diff --git a/previews/PR3778/tutorials/getting_started/getting_started_with_JuMP/index.html b/previews/PR3778/tutorials/getting_started/getting_started_with_JuMP/index.html index c224ba62570..21b53a8db4f 100644 --- a/previews/PR3778/tutorials/getting_started/getting_started_with_JuMP/index.html +++ b/previews/PR3778/tutorials/getting_started/getting_started_with_JuMP/index.html @@ -240,4 +240,4 @@ Model status : Optimal Simplex iterations: 4 Objective value : 4.9230769231e+00 -HiGHS run time : 0.00
    julia> @assert is_solved_and_feasible(vector_model)
    julia> objective_value(vector_model)4.923076923076922 +HiGHS run time : 0.00
    julia> @assert is_solved_and_feasible(vector_model)
    julia> objective_value(vector_model)4.923076923076922 diff --git a/previews/PR3778/tutorials/getting_started/getting_started_with_data_and_plotting/002c15dc.svg b/previews/PR3778/tutorials/getting_started/getting_started_with_data_and_plotting/616b54ca.svg similarity index 84% rename from previews/PR3778/tutorials/getting_started/getting_started_with_data_and_plotting/002c15dc.svg rename to previews/PR3778/tutorials/getting_started/getting_started_with_data_and_plotting/616b54ca.svg index 918c11323a3..a485964e3ea 100644 --- a/previews/PR3778/tutorials/getting_started/getting_started_with_data_and_plotting/002c15dc.svg +++ b/previews/PR3778/tutorials/getting_started/getting_started_with_data_and_plotting/616b54ca.svg @@ -1,62 +1,62 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/previews/PR3778/tutorials/getting_started/getting_started_with_data_and_plotting/5de5025b.svg b/previews/PR3778/tutorials/getting_started/getting_started_with_data_and_plotting/83a7ab34.svg similarity index 82% rename from previews/PR3778/tutorials/getting_started/getting_started_with_data_and_plotting/5de5025b.svg rename to previews/PR3778/tutorials/getting_started/getting_started_with_data_and_plotting/83a7ab34.svg index cd2c6ef7232..2d1f81b7ef4 100644 --- a/previews/PR3778/tutorials/getting_started/getting_started_with_data_and_plotting/5de5025b.svg +++ b/previews/PR3778/tutorials/getting_started/getting_started_with_data_and_plotting/83a7ab34.svg @@ -1,73 +1,73 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/previews/PR3778/tutorials/getting_started/getting_started_with_data_and_plotting/824546f1.svg b/previews/PR3778/tutorials/getting_started/getting_started_with_data_and_plotting/d8470a78.svg similarity index 85% rename from previews/PR3778/tutorials/getting_started/getting_started_with_data_and_plotting/824546f1.svg rename to previews/PR3778/tutorials/getting_started/getting_started_with_data_and_plotting/d8470a78.svg index 59c94d25b95..04416a80687 100644 --- a/previews/PR3778/tutorials/getting_started/getting_started_with_data_and_plotting/824546f1.svg +++ b/previews/PR3778/tutorials/getting_started/getting_started_with_data_and_plotting/d8470a78.svg @@ -1,59 +1,59 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/previews/PR3778/tutorials/getting_started/getting_started_with_data_and_plotting/index.html b/previews/PR3778/tutorials/getting_started/getting_started_with_data_and_plotting/index.html index 5dfd658c4e1..c2fc86624b0 100644 --- a/previews/PR3778/tutorials/getting_started/getting_started_with_data_and_plotting/index.html +++ b/previews/PR3778/tutorials/getting_started/getting_started_with_data_and_plotting/index.html @@ -14,7 +14,7 @@ csv_df.Height; xlabel = "Weight", ylabel = "Height", -)Example block output

    That doesn't look right. What happened? If you look at the dataframe above, it read Weight in as a String column because there are "NA" fields. Let's correct that, by telling CSV to consider "NA" as missing.

    csv_df = CSV.read(
    +)
    Example block output

    That doesn't look right. What happened? If you look at the dataframe above, it read Weight in as a String column because there are "NA" fields. Let's correct that, by telling CSV to consider "NA" as missing.

    csv_df = CSV.read(
         joinpath(DATA_DIR, "StarWars.csv"),
         DataFrames.DataFrame;
         missingstring = "NA",
    @@ -26,7 +26,7 @@
         ylabel = "Height",
         label = false,
         ylims = (0, 3),
    -)
    Example block output

    That looks better.

    Tip

    Read the CSV documentation for other parsing options.

    DataFrames.jl supports manipulation using functions similar to pandas. For example, split the dataframe into groups based on eye-color:

    by_eyecolor = DataFrames.groupby(csv_df, :Eyecolor)

    GroupedDataFrame with 7 groups based on key: Eyecolor

    First Group (5 rows): Eyecolor = "blue"
    RowNameGenderHeightWeightEyecolorHaircolorSkincolorHomelandBornDiedJediSpeciesWeapon
    String31String7Float64Float64?String15String7String15String15String15String15String7String15String15
    1Anakin Skywalkermale1.8884.0blueblondfairTatooine41.9BBY4ABYjedihumanlightsaber
    2Luke Skywalkermale1.7277.0blueblondfairTatooine19BBYunk_diedjedihumanlightsaber
    3Qui-Gon Jinnmale1.9388.5bluebrownlightunk_planet92BBY32BBYjedihumanlightsaber
    4Sheev Palpatinemale1.7375.0blueredpaleNaboo82BBY10ABYno_jedihumanforce-lightning
    5Chewbaccamale2.28112.0bluebrownmissingKashyyyk200BBY25ABYno_jediwookieebowcaster

    Last Group (1 row): Eyecolor = "black"
    RowNameGenderHeightWeightEyecolorHaircolorSkincolorHomelandBornDiedJediSpeciesWeapon
    String31String7Float64Float64?String15String7String15String15String15String15String7String15String15
    1Chief Chirpamale1.050.0blackgraybrownEndorunk_born4ABYno_jediewokspear

    Then recombine into a single dataframe based on a function operating over the split dataframes:

    eyecolor_count = DataFrames.combine(by_eyecolor) do df
    +)
    Example block output

    That looks better.

    Tip

    Read the CSV documentation for other parsing options.

    DataFrames.jl supports manipulation using functions similar to pandas. For example, split the dataframe into groups based on eye-color:

    by_eyecolor = DataFrames.groupby(csv_df, :Eyecolor)

    GroupedDataFrame with 7 groups based on key: Eyecolor

    First Group (5 rows): Eyecolor = "blue"
    RowNameGenderHeightWeightEyecolorHaircolorSkincolorHomelandBornDiedJediSpeciesWeapon
    String31String7Float64Float64?String15String7String15String15String15String15String7String15String15
    1Anakin Skywalkermale1.8884.0blueblondfairTatooine41.9BBY4ABYjedihumanlightsaber
    2Luke Skywalkermale1.7277.0blueblondfairTatooine19BBYunk_diedjedihumanlightsaber
    3Qui-Gon Jinnmale1.9388.5bluebrownlightunk_planet92BBY32BBYjedihumanlightsaber
    4Sheev Palpatinemale1.7375.0blueredpaleNaboo82BBY10ABYno_jedihumanforce-lightning
    5Chewbaccamale2.28112.0bluebrownmissingKashyyyk200BBY25ABYno_jediwookieebowcaster

    Last Group (1 row): Eyecolor = "black"
    RowNameGenderHeightWeightEyecolorHaircolorSkincolorHomelandBornDiedJediSpeciesWeapon
    String31String7Float64Float64?String15String7String15String15String15String15String7String15String15
    1Chief Chirpamale1.050.0blackgraybrownEndorunk_born4ABYno_jediewokspear

    Then recombine into a single dataframe based on a function operating over the split dataframes:

    eyecolor_count = DataFrames.combine(by_eyecolor) do df
         return DataFrames.nrow(df)
     end
    7×2 DataFrame
    RowEyecolorx1
    String15Int64
    1blue5
    2brown8
    3bluegray1
    4missing2
    5yellow2
    6gold1
    7black1

    We can rename columns:

    DataFrames.rename!(eyecolor_count, :x1 => :count)
    7×2 DataFrame
    RowEyecolorcount
    String15Int64
    1blue5
    2brown8
    3bluegray1
    4missing2
    5yellow2
    6gold1
    7black1

    Drop some missing rows:

    DataFrames.dropmissing!(eyecolor_count, :Eyecolor)
    6×2 DataFrame
    RowEyecolorcount
    String15Int64
    1blue5
    2brown8
    3bluegray1
    4yellow2
    5gold1
    6black1

    Then we can visualize the data:

    sort!(eyecolor_count, :count; rev = true)
     Plots.bar(
    @@ -35,7 +35,7 @@
         xlabel = "Eye color",
         ylabel = "Number of characters",
         label = false,
    -)
    Example block output

    Other Delimited Files

    We can also use the CSV.jl package to read any other delimited text file format.

    By default, CSV.File will try to detect a file's delimiter from the first 10 lines of the file.

    Candidate delimiters include ',', '\t', ' ', '|', ';', and ':'. If it can't auto-detect the delimiter, it will assume ','.

    Let's take the example of space separated data.

    ss_df = CSV.read(joinpath(DATA_DIR, "Cereal.txt"), DataFrames.DataFrame)
    23×10 DataFrame
    RowNameCupsCaloriesCarbsFatFiberPotassiumProteinSodiumSugars
    String31Float64Int64Float64Int64Float64Int64Int64Int64Int64
    1CapnCrunch0.7512012.020.035122012
    2CocoaPuffs1.011012.010.055118013
    3Trix1.011013.010.025114012
    4AppleJacks1.011011.001.030212514
    5CornChex1.011022.000.02522803
    6CornFlakes1.010021.001.03522902
    7Nut&Honey0.6712015.010.04021909
    8Smacks0.751109.011.04027015
    9MultiGrain1.010015.012.09022206
    10CracklinOat0.511010.034.016031407
    11GrapeNuts0.2511017.003.09031793
    12HoneyNutCheerios0.7511011.511.590325010
    13NutriGrain0.6714021.023.013032207
    14Product191.010020.001.04533203
    15TotalRaisinBran1.014015.014.0230319014
    16WheatChex0.6710017.013.011532303
    17Oatmeal0.513013.521.5120317010
    18Life0.6710012.022.09541506
    19Maypo1.010016.010.095403
    20QuakerOats0.510014.012.011041356
    21Muesli1.015016.033.0170415011
    22Cheerios1.2511017.022.010562901
    23SpecialK1.011016.001.05562303

    We can also specify the delimiter as follows:

    delim_df = CSV.read(
    +)
    Example block output

    Other Delimited Files

    We can also use the CSV.jl package to read any other delimited text file format.

    By default, CSV.File will try to detect a file's delimiter from the first 10 lines of the file.

    Candidate delimiters include ',', '\t', ' ', '|', ';', and ':'. If it can't auto-detect the delimiter, it will assume ','.

    Let's take the example of space separated data.

    ss_df = CSV.read(joinpath(DATA_DIR, "Cereal.txt"), DataFrames.DataFrame)
    23×10 DataFrame
    RowNameCupsCaloriesCarbsFatFiberPotassiumProteinSodiumSugars
    String31Float64Int64Float64Int64Float64Int64Int64Int64Int64
    1CapnCrunch0.7512012.020.035122012
    2CocoaPuffs1.011012.010.055118013
    3Trix1.011013.010.025114012
    4AppleJacks1.011011.001.030212514
    5CornChex1.011022.000.02522803
    6CornFlakes1.010021.001.03522902
    7Nut&Honey0.6712015.010.04021909
    8Smacks0.751109.011.04027015
    9MultiGrain1.010015.012.09022206
    10CracklinOat0.511010.034.016031407
    11GrapeNuts0.2511017.003.09031793
    12HoneyNutCheerios0.7511011.511.590325010
    13NutriGrain0.6714021.023.013032207
    14Product191.010020.001.04533203
    15TotalRaisinBran1.014015.014.0230319014
    16WheatChex0.6710017.013.011532303
    17Oatmeal0.513013.521.5120317010
    18Life0.6710012.022.09541506
    19Maypo1.010016.010.095403
    20QuakerOats0.510014.012.011041356
    21Muesli1.015016.033.0170415011
    22Cheerios1.2511017.022.010562901
    23SpecialK1.011016.001.05562303

    We can also specify the delimiter as follows:

    delim_df = CSV.read(
         joinpath(DATA_DIR, "Soccer.txt"),
         DataFrames.DataFrame;
         delim = "::",
    @@ -203,7 +203,7 @@
       Relative gap       : 0.00000e+00
     
     * Work counters
    -  Solve time (sec)   : 6.20198e-03
    +  Solve time (sec)   : 5.99909e-03
       Simplex iterations : 26
       Barrier iterations : -1
       Node count         : 1
    @@ -235,4 +235,4 @@
      * Uganda
      * United Arab Emirates
      * United States
    - * Zimbabwe

    We need some passports, like New Zealand and the United States, which have widespread access to a large number of countries. However, we also need passports like North Korea which only have visa-free access to a very limited number of countries.

    Note

    We use value(x[c]) > 0.5 rather than value(x[c]) == 1 to avoid excluding solutions like x[c] = 0.99999 that are "1" to some tolerance.

    + * Zimbabwe

    We need some passports, like New Zealand and the United States, which have widespread access to a large number of countries. However, we also need passports like North Korea which only have visa-free access to a very limited number of countries.

    Note

    We use value(x[c]) > 0.5 rather than value(x[c]) == 1 to avoid excluding solutions like x[c] = 0.99999 that are "1" to some tolerance.

    diff --git a/previews/PR3778/tutorials/getting_started/getting_started_with_julia/index.html b/previews/PR3778/tutorials/getting_started/getting_started_with_julia/index.html index 2ba8fe3e57e..a1875b9e64e 100644 --- a/previews/PR3778/tutorials/getting_started/getting_started_with_julia/index.html +++ b/previews/PR3778/tutorials/getting_started/getting_started_with_julia/index.html @@ -41,10 +41,10 @@ Closest candidates are: *(::Any, ::Any, ::Any, ::Any...) @ Base operators.jl:587 - *(::ChainRulesCore.NotImplemented, ::Any) - @ ChainRulesCore ~/.julia/packages/ChainRulesCore/I1EbV/src/tangent_arithmetic.jl:37 - *(::Any, ::ChainRulesCore.NoTangent) - @ ChainRulesCore ~/.julia/packages/ChainRulesCore/I1EbV/src/tangent_arithmetic.jl:65 + *(::MutableArithmetics.Zero, ::Any) + @ MutableArithmetics ~/.julia/packages/MutableArithmetics/OfRUD/src/rewrite.jl:61 + *(::Any, ::MutableArithmetics.Zero) + @ MutableArithmetics ~/.julia/packages/MutableArithmetics/OfRUD/src/rewrite.jl:62 ...

    But multiplying transposes works:

    julia> b' * b61
    julia> b * b'2×2 Matrix{Int64}: 25 30 30 36

    Other common types

    Comments

    Although not technically a type, code comments begin with the # character:

    julia> 1 + 1  # This is a comment2

    Multiline comments begin with #= and end with =#:

    #=
    @@ -180,4 +180,4 @@
      0.5103924401614957
      0.9296414851080324

    The Package Manager is used to install packages that are not part of Julia's standard library.

    For example the following can be used to install JuMP,

    using Pkg
     Pkg.add("JuMP")

    For a complete list of registered Julia packages see the package listing at JuliaHub.

    From time to you may wish to use a Julia package that is not registered. In this case a git repository URL can be used to install the package.

    using Pkg
    -Pkg.add("https://github.com/user-name/MyPackage.jl.git")

    Package environments

    By default, Pkg.add will add packages to Julia's global environment. However, Julia also has built-in support for virtual environments.

    Activate a virtual environment with:

    import Pkg; Pkg.activate("/path/to/environment")

    You can see what packages are installed in the current environment with Pkg.status().

    Tip

    We strongly recommend you create a Pkg environment for each project that you create in Julia, and add only the packages that you need, instead of adding lots of packages to the global environment. The Pkg manager documentation has more information on this topic.

    +Pkg.add("https://github.com/user-name/MyPackage.jl.git")

    Package environments

    By default, Pkg.add will add packages to Julia's global environment. However, Julia also has built-in support for virtual environments.

    Activate a virtual environment with:

    import Pkg; Pkg.activate("/path/to/environment")

    You can see what packages are installed in the current environment with Pkg.status().

    Tip

    We strongly recommend you create a Pkg environment for each project that you create in Julia, and add only the packages that you need, instead of adding lots of packages to the global environment. The Pkg manager documentation has more information on this topic.

    diff --git a/previews/PR3778/tutorials/getting_started/getting_started_with_sets_and_indexing/index.html b/previews/PR3778/tutorials/getting_started/getting_started_with_sets_and_indexing/index.html index 6d68e8b68ba..499877c3387 100644 --- a/previews/PR3778/tutorials/getting_started/getting_started_with_sets_and_indexing/index.html +++ b/previews/PR3778/tutorials/getting_started/getting_started_with_sets_and_indexing/index.html @@ -219,4 +219,4 @@ ("Dunedin", "Auckland") => 1426 ("Auckland", "Christchurch") => 1071

    Then, we can create our model like so:

    model = Model()
     @variable(model, x[keys(routes)])
    -@objective(model, Min, sum(v * x[k] for (k, v) in routes))

    \[ 643 x_{("Auckland", "Wellington")} + 436 x_{("Wellington", "Christchurch")} + 790 x_{("Wellington", "Dunedin")} + 360 x_{("Christchurch", "Dunedin")} + 1426 x_{("Auckland", "Dunedin")} + 1426 x_{("Dunedin", "Auckland")} + 1071 x_{("Auckland", "Christchurch")} \]

    This has a number of benefits over the other approaches, including a compacter algebraic model and variables that are named in a more meaningful way.

    Tip

    If you're struggling to formulate a problem using the available syntax in JuMP, it's probably a sign that you should convert your data into a different form.

    Next steps

    The purpose of this tutorial was to show how JuMP does not have specialized syntax for set creation and manipulation. Instead, you should use the tools provided by Julia itself.

    This is both an opportunity and a challenge, because you are free to pick the syntax and data structures that best suit your problem, but for new users it can be daunting to decide which structure to use.

    Read through some of the other JuMP tutorials to get inspiration and ideas for how you can use Julia's syntax and data structures to your advantage.

    +@objective(model, Min, sum(v * x[k] for (k, v) in routes))

    \[ 643 x_{("Auckland", "Wellington")} + 436 x_{("Wellington", "Christchurch")} + 790 x_{("Wellington", "Dunedin")} + 360 x_{("Christchurch", "Dunedin")} + 1426 x_{("Auckland", "Dunedin")} + 1426 x_{("Dunedin", "Auckland")} + 1071 x_{("Auckland", "Christchurch")} \]

    This has a number of benefits over the other approaches, including a compacter algebraic model and variables that are named in a more meaningful way.

    Tip

    If you're struggling to formulate a problem using the available syntax in JuMP, it's probably a sign that you should convert your data into a different form.

    Next steps

    The purpose of this tutorial was to show how JuMP does not have specialized syntax for set creation and manipulation. Instead, you should use the tools provided by Julia itself.

    This is both an opportunity and a challenge, because you are free to pick the syntax and data structures that best suit your problem, but for new users it can be daunting to decide which structure to use.

    Read through some of the other JuMP tutorials to get inspiration and ideas for how you can use Julia's syntax and data structures to your advantage.

    diff --git a/previews/PR3778/tutorials/getting_started/introduction/index.html b/previews/PR3778/tutorials/getting_started/introduction/index.html index d51f6ee12ce..b12c4a5f81c 100644 --- a/previews/PR3778/tutorials/getting_started/introduction/index.html +++ b/previews/PR3778/tutorials/getting_started/introduction/index.html @@ -3,4 +3,4 @@ function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-0RZ8X3D3D0', {'page_path': location.pathname + location.search + location.hash}); -

    Introduction

    The purpose of these "Getting started" tutorials is to teach new users the basics of Julia and JuMP.

    How these tutorials are structured

    Having a high-level overview of how this part of the documentation is structured will help you know where to look for certain things.

    • The "Getting started with" tutorials are basic introductions to different aspects of JuMP and Julia. If you are new to JuMP and Julia, start by reading them in the following order:
    • Julia has a reputation for being "fast." Unfortunately, it is also easy to write slow Julia code. Performance tips contains a number of important tips on how to improve the performance of models you write in JuMP.
    • Design patterns for larger models is a more advanced tutorial that is aimed at users writing large JuMP models. It's in the "Getting started" section to give you an early preview of how JuMP makes it easy to structure larger models. If you are new to JuMP you may want to skip or briefly skim this tutorial, and come back to it once you have written a few JuMP models.
    +

    Introduction

    The purpose of these "Getting started" tutorials is to teach new users the basics of Julia and JuMP.

    How these tutorials are structured

    Having a high-level overview of how this part of the documentation is structured will help you know where to look for certain things.

    • The "Getting started with" tutorials are basic introductions to different aspects of JuMP and Julia. If you are new to JuMP and Julia, start by reading them in the following order:
    • Julia has a reputation for being "fast." Unfortunately, it is also easy to write slow Julia code. Performance tips contains a number of important tips on how to improve the performance of models you write in JuMP.
    • Design patterns for larger models is a more advanced tutorial that is aimed at users writing large JuMP models. It's in the "Getting started" section to give you an early preview of how JuMP makes it easy to structure larger models. If you are new to JuMP you may want to skip or briefly skim this tutorial, and come back to it once you have written a few JuMP models.
    diff --git a/previews/PR3778/tutorials/getting_started/performance_tips/index.html b/previews/PR3778/tutorials/getting_started/performance_tips/index.html index cced9ee885a..8ddb6f947a5 100644 --- a/previews/PR3778/tutorials/getting_started/performance_tips/index.html +++ b/previews/PR3778/tutorials/getting_started/performance_tips/index.html @@ -37,4 +37,4 @@ Solver name: No optimizer attached.
    julia> @variable(model, x[1:3])3-element Vector{VariableRef}: x[1] x[2] - x[3]

    Here's what happens if we construct the expression outside the macro:

    julia> @allocated x[1] + x[2] + x[3]1424
    Info

    The @allocated measures how many bytes were allocated during the evaluation of an expression. Fewer is better.

    If we use the @expression macro, we get many fewer allocations:

    julia> @allocated @expression(model, x[1] + x[2] + x[3])800

    Disable string names

    By default, JuMP creates String names for variables and constraints and passes these to the solver. The benefit of passing names is that it improves the readability of log messages from the solver (for example, "variable x has invalid bounds" instead of "variable v1203 has invalid bounds"), but for larger models the overhead of passing names can be non-trivial.

    Disable the creation of String names by setting set_string_name = false in the @variable and @constraint macros, or by calling set_string_names_on_creation to disable all names for a particular model:

    julia> model = Model();
    julia> set_string_names_on_creation(model, false)
    julia> @variable(model, x)_[1]
    julia> @constraint(model, c, 2x <= 1)2 _[1] ≤ 1

    Note that this doesn't change how symbolic names and bindings are stored:

    julia> x_[1]
    julia> model[:x]_[1]
    julia> x === model[:x]true

    But you can no longer look up the variable by the string name:

    julia> variable_by_name(model, "x") === nothingtrue
    Info

    For more information on the difference between string names, symbolic names, and bindings, see String names, symbolic names, and bindings.

    + x[3]

    Here's what happens if we construct the expression outside the macro:

    julia> @allocated x[1] + x[2] + x[3]1424
    Info

    The @allocated measures how many bytes were allocated during the evaluation of an expression. Fewer is better.

    If we use the @expression macro, we get many fewer allocations:

    julia> @allocated @expression(model, x[1] + x[2] + x[3])800

    Disable string names

    By default, JuMP creates String names for variables and constraints and passes these to the solver. The benefit of passing names is that it improves the readability of log messages from the solver (for example, "variable x has invalid bounds" instead of "variable v1203 has invalid bounds"), but for larger models the overhead of passing names can be non-trivial.

    Disable the creation of String names by setting set_string_name = false in the @variable and @constraint macros, or by calling set_string_names_on_creation to disable all names for a particular model:

    julia> model = Model();
    julia> set_string_names_on_creation(model, false)
    julia> @variable(model, x)_[1]
    julia> @constraint(model, c, 2x <= 1)2 _[1] ≤ 1

    Note that this doesn't change how symbolic names and bindings are stored:

    julia> x_[1]
    julia> model[:x]_[1]
    julia> x === model[:x]true

    But you can no longer look up the variable by the string name:

    julia> variable_by_name(model, "x") === nothingtrue
    Info

    For more information on the difference between string names, symbolic names, and bindings, see String names, symbolic names, and bindings.

    diff --git a/previews/PR3778/tutorials/linear/basis/index.html b/previews/PR3778/tutorials/linear/basis/index.html index 09496a1e2a8..fe5cee58385 100644 --- a/previews/PR3778/tutorials/linear/basis/index.html +++ b/previews/PR3778/tutorials/linear/basis/index.html @@ -61,8 +61,8 @@ all_constraints(model; include_variable_in_set_constraints = false) )
    Dict{ConstraintRef{Model, C, ScalarShape} where C, MathOptInterface.BasisStatusCode} with 3 entries:
       c1 : 6 x + 8 y ≥ 100  => NONBASIC
    -  c2 : 7 x + 12 y ≥ 120 => NONBASIC
    -  c3 : x + y ≤ 20       => BASIC

    Thus, the basis is formed by x, y, and the slack associated with c3.

    A simple way to get the A matrix of an unstructured linear program is with lp_matrix_data:

    matrix = lp_matrix_data(model)
    +  c3 : x + y ≤ 20       => BASIC
    +  c2 : 7 x + 12 y ≥ 120 => NONBASIC

    Thus, the basis is formed by x, y, and the slack associated with c3.

    A simple way to get the A matrix of an unstructured linear program is with lp_matrix_data:

    matrix = lp_matrix_data(model)
     matrix.A
    3×3 SparseArrays.SparseMatrixCSC{Float64, Int64} with 6 stored entries:
      6.0   8.0   ⋅ 
      7.0  12.0   ⋅ 
    @@ -96,4 +96,4 @@
     @constraint(model, A * x == b)
     optimize!(model)
     degenerate_variables = filter(is_degenerate, all_variables(model))
    1-element Vector{VariableRef}:
    - x[1]

    The solution is degenerate because:

    value(x[1])
    -0.0

    and

    get_attribute(x[1], MOI.VariableBasisStatus())
    BASIC::BasisStatusCode = 0
    + x[1]

    The solution is degenerate because:

    value(x[1])
    -0.0

    and

    get_attribute(x[1], MOI.VariableBasisStatus())
    BASIC::BasisStatusCode = 0
    diff --git a/previews/PR3778/tutorials/linear/callbacks/index.html b/previews/PR3778/tutorials/linear/callbacks/index.html index 6642515fe5f..75434d1cc39 100644 --- a/previews/PR3778/tutorials/linear/callbacks/index.html +++ b/previews/PR3778/tutorials/linear/callbacks/index.html @@ -166,4 +166,4 @@ Adding ScalarConstraint{AffExpr, MathOptInterface.LessThan{Float64}}(y - x, MathOptInterface.LessThan{Float64}(1.0)) Called from reason = 7 Called from reason = 1 -Called from reason = 2 +Called from reason = 2 diff --git a/previews/PR3778/tutorials/linear/cannery/index.html b/previews/PR3778/tutorials/linear/cannery/index.html index 66872fe90cd..f51e744b8ef 100644 --- a/previews/PR3778/tutorials/linear/cannery/index.html +++ b/previews/PR3778/tutorials/linear/cannery/index.html @@ -76,7 +76,7 @@ Dual objective value : 1.68000e+03 * Work counters - Solve time (sec) : 2.00272e-04 + Solve time (sec) : 2.02894e-04 Simplex iterations : 3 Barrier iterations : 0 Node count : -1 @@ -88,4 +88,4 @@ Seattle => New-York: 0.0 San-Diego => Chicago: 0.0 San-Diego => Topeka: 300.0 -San-Diego => New-York: 300.0 +San-Diego => New-York: 300.0 diff --git a/previews/PR3778/tutorials/linear/constraint_programming/index.html b/previews/PR3778/tutorials/linear/constraint_programming/index.html index f2101c02206..8675ffbf0d7 100644 --- a/previews/PR3778/tutorials/linear/constraint_programming/index.html +++ b/previews/PR3778/tutorials/linear/constraint_programming/index.html @@ -97,4 +97,4 @@ value.(x)
    3-element Vector{Float64}:
      1.0
      1.0
    - 0.0
    + 0.0 diff --git a/previews/PR3778/tutorials/linear/diet/index.html b/previews/PR3778/tutorials/linear/diet/index.html index 74954705b6a..28d40044a2f 100644 --- a/previews/PR3778/tutorials/linear/diet/index.html +++ b/previews/PR3778/tutorials/linear/diet/index.html @@ -11,7 +11,7 @@ \min & \sum\limits_{f \in F} c_f x_f \\ \text{s.t.}\ \ & l_m \le \sum\limits_{f \in F} a_{m,f} x_f \le u_m, && \forall m \in M \\ & x_f \ge 0, && \forall f \in F. -\end{aligned}\]

    In the rest of this tutorial, we will create and solve this problem in JuMP, and learn what we should cook for dinner.

    Data

    First, we need some data for the problem. For this tutorial, we'll write CSV files to a temporary directory from Julia. If you have existing files, you could change the filenames to point to them instead.

    dir = mktempdir()
    "/tmp/jl_A8j0fk"

    The first file is a list of foods with their macro-nutrient profile:

    food_csv_filename = joinpath(dir, "diet_foods.csv")
    +\end{aligned}\]

    In the rest of this tutorial, we will create and solve this problem in JuMP, and learn what we should cook for dinner.

    Data

    First, we need some data for the problem. For this tutorial, we'll write CSV files to a temporary directory from Julia. If you have existing files, you could change the filenames to point to them instead.

    dir = mktempdir()
    "/tmp/jl_yCL37Z"

    The first file is a list of foods with their macro-nutrient profile:

    food_csv_filename = joinpath(dir, "diet_foods.csv")
     open(food_csv_filename, "w") do io
         write(
             io,
    @@ -103,7 +103,7 @@
       Dual objective value : 1.18289e+01
     
     * Work counters
    -  Solve time (sec)   : 2.02656e-04
    +  Solve time (sec)   : 2.21014e-04
       Simplex iterations : 6
       Barrier iterations : 0
       Node count         : -1
    @@ -142,8 +142,8 @@
       Dual objective value : 3.56146e+00
     
     * Work counters
    -  Solve time (sec)   : 1.45435e-04
    +  Solve time (sec)   : 1.57595e-04
       Simplex iterations : 0
       Barrier iterations : 0
       Node count         : -1
    -

    There exists no feasible solution to our problem. Looks like we're stuck eating ice cream for dinner.

    Next steps

    • You can delete a constraint using delete(model, dairy_constraint). Can you add a different constraint to provide a diet with less dairy?
    • Some food items (like hamburgers) are discrete. You can use set_integer to force a variable to take integer values. What happens to the solution if you do?
    +

    There exists no feasible solution to our problem. Looks like we're stuck eating ice cream for dinner.

    Next steps

    • You can delete a constraint using delete(model, dairy_constraint). Can you add a different constraint to provide a diet with less dairy?
    • Some food items (like hamburgers) are discrete. You can use set_integer to force a variable to take integer values. What happens to the solution if you do?
    diff --git a/previews/PR3778/tutorials/linear/facility_location/cddb271e.svg b/previews/PR3778/tutorials/linear/facility_location/47d0bcd6.svg similarity index 81% rename from previews/PR3778/tutorials/linear/facility_location/cddb271e.svg rename to previews/PR3778/tutorials/linear/facility_location/47d0bcd6.svg index e428e0cce53..5e21e2cb09c 100644 --- a/previews/PR3778/tutorials/linear/facility_location/cddb271e.svg +++ b/previews/PR3778/tutorials/linear/facility_location/47d0bcd6.svg @@ -1,61 +1,61 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/previews/PR3778/tutorials/linear/facility_location/aa3f6dff.svg b/previews/PR3778/tutorials/linear/facility_location/6e3b8a75.svg similarity index 79% rename from previews/PR3778/tutorials/linear/facility_location/aa3f6dff.svg rename to previews/PR3778/tutorials/linear/facility_location/6e3b8a75.svg index 058afced25b..cff7cf5ce5d 100644 --- a/previews/PR3778/tutorials/linear/facility_location/aa3f6dff.svg +++ b/previews/PR3778/tutorials/linear/facility_location/6e3b8a75.svg @@ -1,69 +1,69 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/previews/PR3778/tutorials/linear/facility_location/6c78af8e.svg b/previews/PR3778/tutorials/linear/facility_location/9aef9f47.svg similarity index 79% rename from previews/PR3778/tutorials/linear/facility_location/6c78af8e.svg rename to previews/PR3778/tutorials/linear/facility_location/9aef9f47.svg index f2c4f589954..fcbd3362231 100644 --- a/previews/PR3778/tutorials/linear/facility_location/6c78af8e.svg +++ b/previews/PR3778/tutorials/linear/facility_location/9aef9f47.svg @@ -1,69 +1,69 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/previews/PR3778/tutorials/linear/facility_location/a2c10bc2.svg b/previews/PR3778/tutorials/linear/facility_location/ec6fa163.svg similarity index 80% rename from previews/PR3778/tutorials/linear/facility_location/a2c10bc2.svg rename to previews/PR3778/tutorials/linear/facility_location/ec6fa163.svg index 79376cfefe7..bfbeab8b408 100644 --- a/previews/PR3778/tutorials/linear/facility_location/a2c10bc2.svg +++ b/previews/PR3778/tutorials/linear/facility_location/ec6fa163.svg @@ -1,57 +1,57 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/previews/PR3778/tutorials/linear/facility_location/index.html b/previews/PR3778/tutorials/linear/facility_location/index.html index 0e5c04f5cce..35b38ff439b 100644 --- a/previews/PR3778/tutorials/linear/facility_location/index.html +++ b/previews/PR3778/tutorials/linear/facility_location/index.html @@ -51,7 +51,7 @@ markersize = 6, markerstrokecolor = :red, markerstrokewidth = 2, -)Example block output

    JuMP implementation

    Create a JuMP model

    model = Model(HiGHS.Optimizer)
    +)
    Example block output

    JuMP implementation

    Create a JuMP model

    model = Model(HiGHS.Optimizer)
     set_silent(model)
     @variable(model, y[1:n], Bin);
     @variable(model, x[1:m, 1:n], Bin);
    @@ -94,7 +94,7 @@
         end
     end
     
    -p
    Example block output

    Capacitated facility location

    Problem formulation

    The capacitated variant introduces a capacity constraint on each facility, that is, clients have a certain level of demand to be served, while each facility only has finite capacity which cannot be exceeded.

    Specifically,

    • The demand of client $i$ is denoted by $a_{i} \geq 0$
    • The capacity of facility $j$ is denoted by $q_{j} \geq 0$

    The capacity constraints then write

    \[\begin{aligned} +pExample block output

    Capacitated facility location

    Problem formulation

    The capacitated variant introduces a capacity constraint on each facility, that is, clients have a certain level of demand to be served, while each facility only has finite capacity which cannot be exceeded.

    Specifically,

    • The demand of client $i$ is denoted by $a_{i} \geq 0$
    • The capacity of facility $j$ is denoted by $q_{j} \geq 0$

    The capacity constraints then write

    \[\begin{aligned} \sum_{i} a_{i} x_{i, j} &\leq q_{j} y_{j} && \forall j \in N \end{aligned}\]

    Note that, if $y_{j}$ is set to $0$, the capacity constraint above automatically forces $x_{i, j}$ to $0$.

    Thus, the capacitated facility location can be formulated as follows

    \[\begin{aligned} \min_{x, y} \ \ \ & @@ -126,7 +126,7 @@ markersize = q, markerstrokecolor = :red, markerstrokewidth = 2, -)Example block output

    JuMP implementation

    Create a JuMP model

    model = Model(HiGHS.Optimizer)
    +)
    Example block output

    JuMP implementation

    Create a JuMP model

    model = Model(HiGHS.Optimizer)
     set_silent(model)
     @variable(model, y[1:n], Bin);
     @variable(model, x[1:m, 1:n], Bin);
    @@ -169,4 +169,4 @@
         end
     end
     
    -p
    Example block output +pExample block output diff --git a/previews/PR3778/tutorials/linear/factory_schedule/d1d70a87.svg b/previews/PR3778/tutorials/linear/factory_schedule/12683eb4.svg similarity index 85% rename from previews/PR3778/tutorials/linear/factory_schedule/d1d70a87.svg rename to previews/PR3778/tutorials/linear/factory_schedule/12683eb4.svg index 981333779a0..a4b13b8a561 100644 --- a/previews/PR3778/tutorials/linear/factory_schedule/d1d70a87.svg +++ b/previews/PR3778/tutorials/linear/factory_schedule/12683eb4.svg @@ -1,81 +1,81 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/previews/PR3778/tutorials/linear/factory_schedule/00a623d2.svg b/previews/PR3778/tutorials/linear/factory_schedule/231d2865.svg similarity index 78% rename from previews/PR3778/tutorials/linear/factory_schedule/00a623d2.svg rename to previews/PR3778/tutorials/linear/factory_schedule/231d2865.svg index 0cdb90c8f5e..06ae8112a2e 100644 --- a/previews/PR3778/tutorials/linear/factory_schedule/00a623d2.svg +++ b/previews/PR3778/tutorials/linear/factory_schedule/231d2865.svg @@ -1,160 +1,160 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/previews/PR3778/tutorials/linear/factory_schedule/c931f44c.svg b/previews/PR3778/tutorials/linear/factory_schedule/24a0f385.svg similarity index 78% rename from previews/PR3778/tutorials/linear/factory_schedule/c931f44c.svg rename to previews/PR3778/tutorials/linear/factory_schedule/24a0f385.svg index f2a95601897..1def023d6e7 100644 --- a/previews/PR3778/tutorials/linear/factory_schedule/c931f44c.svg +++ b/previews/PR3778/tutorials/linear/factory_schedule/24a0f385.svg @@ -1,162 +1,162 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/previews/PR3778/tutorials/linear/factory_schedule/index.html b/previews/PR3778/tutorials/linear/factory_schedule/index.html index 430c89585fb..6a48cc3fe2f 100644 --- a/previews/PR3778/tutorials/linear/factory_schedule/index.html +++ b/previews/PR3778/tutorials/linear/factory_schedule/index.html @@ -126,7 +126,7 @@ ylabel = "Production", legend = :topleft, color = ["#20326c" "#4063d8" "#a0b1ec"], -)Example block output

    Note that we don't have any unmet demand.

    What happens if demand increases?

    Let's run an experiment by increasing the demand by 50% in all time periods:

    demand_df.demand .*= 1.5
    12-element Vector{Float64}:
    +)
    Example block output

    Note that we don't have any unmet demand.

    What happens if demand increases?

    Let's run an experiment by increasing the demand by 50% in all time periods:

    demand_df.demand .*= 1.5
    12-element Vector{Float64}:
      180000.0
      150000.0
      195000.0
    @@ -146,7 +146,7 @@
         ylabel = "Production",
         legend = :topleft,
         color = ["#20326c" "#4063d8" "#a0b1ec"],
    -)
    Example block output

    Uh oh, we can't satisfy all of the demand.

    How sensitive is the solution to changes in variable cost?

    Let's run another experiment, this time seeing how the optimal objective value changes as we vary the variable costs of each factory.

    First though, let's reset the demand to it's original level:

    demand_df.demand ./= 1.5;

    For our experiment, we're going to scale the variable costs of both factories by a set of values from 0.0 to 1.5:

    scale_factors = 0:0.1:1.5
    0.0:0.1:1.5

    At a high level, we're going to loop over the scale factors for A, then the scale factors for B, rescale the input data, call our solve_factory_scheduling example, and then store the optimal objective value in the following cost matrix:

    cost = zeros(length(scale_factors), length(scale_factors));

    Because we're modifying factory_df in-place, we need to store the original variable costs in a new column:

    factory_df[!, :old_variable_cost] = copy(factory_df.variable_cost);

    Then, we need a function to scale the :variable_cost column for a particular factory by a value scale:

    function scale_variable_cost(df, factory, scale)
    +)
    Example block output

    Uh oh, we can't satisfy all of the demand.

    How sensitive is the solution to changes in variable cost?

    Let's run another experiment, this time seeing how the optimal objective value changes as we vary the variable costs of each factory.

    First though, let's reset the demand to it's original level:

    demand_df.demand ./= 1.5;

    For our experiment, we're going to scale the variable costs of both factories by a set of values from 0.0 to 1.5:

    scale_factors = 0:0.1:1.5
    0.0:0.1:1.5

    At a high level, we're going to loop over the scale factors for A, then the scale factors for B, rescale the input data, call our solve_factory_scheduling example, and then store the optimal objective value in the following cost matrix:

    cost = zeros(length(scale_factors), length(scale_factors));

    Because we're modifying factory_df in-place, we need to store the original variable costs in a new column:

    factory_df[!, :old_variable_cost] = copy(factory_df.variable_cost);

    Then, we need a function to scale the :variable_cost column for a particular factory by a value scale:

    function scale_variable_cost(df, factory, scale)
         rows = df.factory .== factory
         df[rows, :variable_cost] .=
             round.(Int, df[rows, :old_variable_cost] .* scale)
    @@ -163,4 +163,4 @@
         cost;
         xlabel = "Scale of factory A",
         ylabel = "Scale of factory B",
    -)
    Example block output

    What can you infer from the solution?

    Info

    The Power Systems tutorial explains a number of other ways you can structure a problem to perform a parametric analysis of the solution. In particular, you can use in-place modification to reduce the time it takes to build and solve the resulting models.

    +)Example block output

    What can you infer from the solution?

    Info

    The Power Systems tutorial explains a number of other ways you can structure a problem to perform a parametric analysis of the solution. In particular, you can use in-place modification to reduce the time it takes to build and solve the resulting models.

    diff --git a/previews/PR3778/tutorials/linear/finance/index.html b/previews/PR3778/tutorials/linear/finance/index.html index 11950b71f40..31839a5e880 100644 --- a/previews/PR3778/tutorials/linear/finance/index.html +++ b/previews/PR3778/tutorials/linear/finance/index.html @@ -50,4 +50,4 @@ 1.0 -0.0 -0.0 - 0.0 + 0.0 diff --git a/previews/PR3778/tutorials/linear/geographic_clustering/index.html b/previews/PR3778/tutorials/linear/geographic_clustering/index.html index 8bdfac2a0a1..99e89a001ca 100644 --- a/previews/PR3778/tutorials/linear/geographic_clustering/index.html +++ b/previews/PR3778/tutorials/linear/geographic_clustering/index.html @@ -135,4 +135,4 @@ 5 │ San Francisco, CA 0.837 37.7749 -122.419 3.0 6 │ El Paso, TX 0.674 31.7775 -106.442 3.0 -sum(group.population) = 9.261000000000001 +sum(group.population) = 9.261000000000001 diff --git a/previews/PR3778/tutorials/linear/introduction/index.html b/previews/PR3778/tutorials/linear/introduction/index.html index a400efcbb45..cae35553ac1 100644 --- a/previews/PR3778/tutorials/linear/introduction/index.html +++ b/previews/PR3778/tutorials/linear/introduction/index.html @@ -7,4 +7,4 @@ \min_{x \in \mathbb{R}^n} & \sum\limits_{i=1}^n c_i x_i \\ \;\;\text{s.t.} & l_j \le \sum\limits_{i=1}^n a_{ij} x_i \le u_j & j = 1 \ldots m \\ & l_i \le x_i \le u_i & i = 1 \ldots n. -\end{align}\]

    The most important thing to note is that all terms are of the form coefficient * variable, and that there are no nonlinear terms or multiplications between variables.

    Mixed-integer linear programs (MILPs) are extensions of linear programs in which some (or all) of the decision variables take discrete values.

    How to choose a solver

    Almost all solvers support linear programs; look for "LP" in the list of Supported solvers. However, fewer solvers support mixed-integer linear programs. Solvers supporting discrete variables start with "(MI)" in the list of Supported solvers.

    How these tutorials are structured

    Having a high-level overview of how this part of the documentation is structured will help you know where to look for certain things.

    • The following tutorials are worked examples that present a problem in words, then formulate it in mathematics, and then solve it in JuMP. This usually involves some sort of visualization of the solution. Start here if you are new to JuMP.
    • The Tips and tricks tutorial contains a number of helpful reformulations and tricks you can use when modeling linear programs. Look here if you are stuck trying to formulate a problem as a linear program.
    • The Sensitivity analysis of a linear program tutorial explains how to create sensitivity reports like those produced by the Excel Solver.
    • The Callbacks tutorial explains how to write a variety of solver-independent callbacks. Look here if you want to write a callback.
    • The remaining tutorials are less verbose and styled in the form of short code examples. These tutorials have less explanation, but may contain useful code snippets, particularly if they are similar to a problem you are trying to solve.
    +\end{align}\]

    The most important thing to note is that all terms are of the form coefficient * variable, and that there are no nonlinear terms or multiplications between variables.

    Mixed-integer linear programs (MILPs) are extensions of linear programs in which some (or all) of the decision variables take discrete values.

    How to choose a solver

    Almost all solvers support linear programs; look for "LP" in the list of Supported solvers. However, fewer solvers support mixed-integer linear programs. Solvers supporting discrete variables start with "(MI)" in the list of Supported solvers.

    How these tutorials are structured

    Having a high-level overview of how this part of the documentation is structured will help you know where to look for certain things.

    • The following tutorials are worked examples that present a problem in words, then formulate it in mathematics, and then solve it in JuMP. This usually involves some sort of visualization of the solution. Start here if you are new to JuMP.
    • The Tips and tricks tutorial contains a number of helpful reformulations and tricks you can use when modeling linear programs. Look here if you are stuck trying to formulate a problem as a linear program.
    • The Sensitivity analysis of a linear program tutorial explains how to create sensitivity reports like those produced by the Excel Solver.
    • The Callbacks tutorial explains how to write a variety of solver-independent callbacks. Look here if you want to write a callback.
    • The remaining tutorials are less verbose and styled in the form of short code examples. These tutorials have less explanation, but may contain useful code snippets, particularly if they are similar to a problem you are trying to solve.
    diff --git a/previews/PR3778/tutorials/linear/knapsack/index.html b/previews/PR3778/tutorials/linear/knapsack/index.html index fc6d78e1fc8..38ff9fb1f2c 100644 --- a/previews/PR3778/tutorials/linear/knapsack/index.html +++ b/previews/PR3778/tutorials/linear/knapsack/index.html @@ -48,7 +48,7 @@ Relative gap : 0.00000e+00 * Work counters - Solve time (sec) : 5.28812e-04 + Solve time (sec) : 5.19991e-04 Simplex iterations : 1 Barrier iterations : -1 Node count : 1 @@ -83,4 +83,4 @@ solve_knapsack_problem(; profit = profit, weight = weight, capacity = capacity)
    3-element Vector{Int64}:
      1
      4
    - 5

    We observe that the chosen items (1, 4, and 5) have the best profit to weight ratio in this particular example.

    Next steps

    Here are some things to try next:

    • Call the function with different data. What happens as the capacity increases?
    • What happens if the profit and weight vectors are different lengths?
    • Instead of creating a binary variable with Bin, we could have written @variable(model, 0 <= x[1:n] <= 1, Int). Verify that this formulation finds the same solution. What happens if we are allowed to take more than one of each item?
    + 5

    We observe that the chosen items (1, 4, and 5) have the best profit to weight ratio in this particular example.

    Next steps

    Here are some things to try next:

    • Call the function with different data. What happens as the capacity increases?
    • What happens if the profit and weight vectors are different lengths?
    • Instead of creating a binary variable with Bin, we could have written @variable(model, 0 <= x[1:n] <= 1, Int). Verify that this formulation finds the same solution. What happens if we are allowed to take more than one of each item?
    diff --git a/previews/PR3778/tutorials/linear/lp_sensitivity/index.html b/previews/PR3778/tutorials/linear/lp_sensitivity/index.html index 99725f6f1b9..fa5daef9b42 100644 --- a/previews/PR3778/tutorials/linear/lp_sensitivity/index.html +++ b/previews/PR3778/tutorials/linear/lp_sensitivity/index.html @@ -40,11 +40,11 @@ c3 : 0.00000e+00 * Work counters - Solve time (sec) : 2.32697e-04 + Solve time (sec) : 2.64168e-04 Simplex iterations : 2 Barrier iterations : 0 Node count : -1 -

    Can you identify:

    • The objective coefficient of each variable?
    • The right-hand side of each constraint?
    • The optimal primal and dual solutions?

    Sensitivity reports

    Now let's call lp_sensitivity_report:

    report = lp_sensitivity_report(model)
    SensitivityReport{Float64}(Dict{ConstraintRef, Tuple{Float64, Float64}}(c1 : 6 x + 8 y ≥ 100 => (-4.0, 2.857142857142857), x ≥ 0 => (-Inf, 15.0), c2 : 7 x + 12 y ≥ 120 => (-3.3333333333333335, 4.666666666666667), c3 : x + y ≤ 20 => (-3.75, Inf), y ≥ 0 => (-Inf, 1.25), z ≤ 1 => (-Inf, Inf), y ≤ 3 => (-1.75, Inf)), Dict{VariableRef, Tuple{Float64, Float64}}(y => (-4.0, 0.5714285714285714), x => (-0.3333333333333333, 3.0), z => (-Inf, 1.0)))

    It returns a SensitivityReport object, which maps:

    • Every variable reference to a tuple (d_lo, d_hi)::Tuple{Float64,Float64}, explaining how much the objective coefficient of the corresponding variable can change by, such that the original basis remains optimal.
    • Every constraint reference to a tuple (d_lo, d_hi)::Tuple{Float64,Float64}, explaining how much the right-hand side of the corresponding constraint can change by, such that the basis remains optimal.

    Both tuples are relative, rather than absolute. So, given an objective coefficient of 1.0 and a tuple (-0.5, 0.5), the objective coefficient can range between 1.0 - 0.5 an 1.0 + 0.5.

    For example:

    report[x]
    (-0.3333333333333333, 3.0)

    indicates that the objective coefficient on x, that is, 12, can decrease by -0.333 or increase by 3.0 and the primal solution (15, 1.25) will remain optimal. In addition:

    report[c1]
    (-4.0, 2.857142857142857)

    means that the right-hand side of the c1 constraint (100), can decrease by 4 units, or increase by 2.85 units, and the primal solution (15, 1.25) will remain optimal.

    Variable sensitivity

    By themselves, the tuples aren't informative. Let's put them in context by collating a range of other information about a variable:

    function variable_report(xi)
    +

    Can you identify:

    • The objective coefficient of each variable?
    • The right-hand side of each constraint?
    • The optimal primal and dual solutions?

    Sensitivity reports

    Now let's call lp_sensitivity_report:

    report = lp_sensitivity_report(model)
    SensitivityReport{Float64}(Dict{ConstraintRef, Tuple{Float64, Float64}}(c3 : x + y ≤ 20 => (-3.75, Inf), y ≤ 3 => (-1.75, Inf), x ≥ 0 => (-Inf, 15.0), z ≤ 1 => (-Inf, Inf), c1 : 6 x + 8 y ≥ 100 => (-4.0, 2.857142857142857), c2 : 7 x + 12 y ≥ 120 => (-3.3333333333333335, 4.666666666666667), y ≥ 0 => (-Inf, 1.25)), Dict{VariableRef, Tuple{Float64, Float64}}(y => (-4.0, 0.5714285714285714), x => (-0.3333333333333333, 3.0), z => (-Inf, 1.0)))

    It returns a SensitivityReport object, which maps:

    • Every variable reference to a tuple (d_lo, d_hi)::Tuple{Float64,Float64}, explaining how much the objective coefficient of the corresponding variable can change by, such that the original basis remains optimal.
    • Every constraint reference to a tuple (d_lo, d_hi)::Tuple{Float64,Float64}, explaining how much the right-hand side of the corresponding constraint can change by, such that the basis remains optimal.

    Both tuples are relative, rather than absolute. So, given an objective coefficient of 1.0 and a tuple (-0.5, 0.5), the objective coefficient can range between 1.0 - 0.5 an 1.0 + 0.5.

    For example:

    report[x]
    (-0.3333333333333333, 3.0)

    indicates that the objective coefficient on x, that is, 12, can decrease by -0.333 or increase by 3.0 and the primal solution (15, 1.25) will remain optimal. In addition:

    report[c1]
    (-4.0, 2.857142857142857)

    means that the right-hand side of the c1 constraint (100), can decrease by 4 units, or increase by 2.85 units, and the primal solution (15, 1.25) will remain optimal.

    Variable sensitivity

    By themselves, the tuples aren't informative. Let's put them in context by collating a range of other information about a variable:

    function variable_report(xi)
         return (
             name = name(xi),
             lower_bound = has_lower_bound(xi) ? lower_bound(xi) : -Inf,
    @@ -71,4 +71,4 @@
     c1_report = constraint_report(c1)
    (name = "c1", value = 100.0, rhs = 100.0, slack = 0.0, shadow_price = -0.25, allowed_decrease = -4.0, allowed_increase = 2.857142857142857)

    That's a bit hard to read, so let's call this on every variable in the model and put things into a DataFrame:

    constraint_df = DataFrames.DataFrame(
         constraint_report(ci) for (F, S) in list_of_constraint_types(model) for
         ci in all_constraints(model, F, S) if F == AffExpr
    -)
    3×7 DataFrame
    Rownamevaluerhsslackshadow_priceallowed_decreaseallowed_increase
    StringFloat64Float64Float64Float64Float64Float64
    1c1100.0100.00.0-0.25-4.02.85714
    2c2120.0120.00.0-1.5-3.333334.66667
    3c316.2520.03.750.0-3.75Inf

    Analysis questions

    Now we can use these dataframes to ask questions of the solution.

    For example, we can find basic variables by looking for variables with a reduced cost of 0:

    basic = filter(row -> iszero(row.reduced_cost), variable_df)
    2×8 DataFrame
    Rownamelower_boundvalueupper_boundreduced_costobj_coefficientallowed_decreaseallowed_increase
    StringFloat64Float64Float64Float64Float64Float64Float64
    1x0.015.0Inf0.012.0-0.3333333.0
    2y0.01.253.00.020.0-4.00.571429

    and non-basic variables by looking for non-zero reduced costs:

    non_basic = filter(row -> !iszero(row.reduced_cost), variable_df)
    1×8 DataFrame
    Rownamelower_boundvalueupper_boundreduced_costobj_coefficientallowed_decreaseallowed_increase
    StringFloat64Float64Float64Float64Float64Float64Float64
    1z-Inf1.01.0-1.0-1.0-Inf1.0

    we can also find constraints that are binding by looking for zero slacks:

    binding = filter(row -> iszero(row.slack), constraint_df)
    2×7 DataFrame
    Rownamevaluerhsslackshadow_priceallowed_decreaseallowed_increase
    StringFloat64Float64Float64Float64Float64Float64
    1c1100.0100.00.0-0.25-4.02.85714
    2c2120.0120.00.0-1.5-3.333334.66667

    or non-zero shadow prices:

    binding2 = filter(row -> !iszero(row.shadow_price), constraint_df)
    2×7 DataFrame
    Rownamevaluerhsslackshadow_priceallowed_decreaseallowed_increase
    StringFloat64Float64Float64Float64Float64Float64
    1c1100.0100.00.0-0.25-4.02.85714
    2c2120.0120.00.0-1.5-3.333334.66667
    +)
    3×7 DataFrame
    Rownamevaluerhsslackshadow_priceallowed_decreaseallowed_increase
    StringFloat64Float64Float64Float64Float64Float64
    1c1100.0100.00.0-0.25-4.02.85714
    2c2120.0120.00.0-1.5-3.333334.66667
    3c316.2520.03.750.0-3.75Inf

    Analysis questions

    Now we can use these dataframes to ask questions of the solution.

    For example, we can find basic variables by looking for variables with a reduced cost of 0:

    basic = filter(row -> iszero(row.reduced_cost), variable_df)
    2×8 DataFrame
    Rownamelower_boundvalueupper_boundreduced_costobj_coefficientallowed_decreaseallowed_increase
    StringFloat64Float64Float64Float64Float64Float64Float64
    1x0.015.0Inf0.012.0-0.3333333.0
    2y0.01.253.00.020.0-4.00.571429

    and non-basic variables by looking for non-zero reduced costs:

    non_basic = filter(row -> !iszero(row.reduced_cost), variable_df)
    1×8 DataFrame
    Rownamelower_boundvalueupper_boundreduced_costobj_coefficientallowed_decreaseallowed_increase
    StringFloat64Float64Float64Float64Float64Float64Float64
    1z-Inf1.01.0-1.0-1.0-Inf1.0

    we can also find constraints that are binding by looking for zero slacks:

    binding = filter(row -> iszero(row.slack), constraint_df)
    2×7 DataFrame
    Rownamevaluerhsslackshadow_priceallowed_decreaseallowed_increase
    StringFloat64Float64Float64Float64Float64Float64
    1c1100.0100.00.0-0.25-4.02.85714
    2c2120.0120.00.0-1.5-3.333334.66667

    or non-zero shadow prices:

    binding2 = filter(row -> !iszero(row.shadow_price), constraint_df)
    2×7 DataFrame
    Rownamevaluerhsslackshadow_priceallowed_decreaseallowed_increase
    StringFloat64Float64Float64Float64Float64Float64
    1c1100.0100.00.0-0.25-4.02.85714
    2c2120.0120.00.0-1.5-3.333334.66667
    diff --git a/previews/PR3778/tutorials/linear/mip_duality/index.html b/previews/PR3778/tutorials/linear/mip_duality/index.html index 75c649a916c..77406799dd1 100644 --- a/previews/PR3778/tutorials/linear/mip_duality/index.html +++ b/previews/PR3778/tutorials/linear/mip_duality/index.html @@ -113,4 +113,4 @@ g[2] ≤ 1000 w ≤ 200 dispatch[1] binary - dispatch[2] binary + dispatch[2] binary diff --git a/previews/PR3778/tutorials/linear/multi/index.html b/previews/PR3778/tutorials/linear/multi/index.html index 4d177cb02bf..876ff6d2d29 100644 --- a/previews/PR3778/tutorials/linear/multi/index.html +++ b/previews/PR3778/tutorials/linear/multi/index.html @@ -118,7 +118,7 @@ INNER JOIN locations b ON a.type = 'origin' AND b.type = 'destination' """, -)
    SQLite.Query{false}(SQLite.Stmt(SQLite.DB("/home/runner/work/JuMP.jl/JuMP.jl/docs/build/tutorials/linear/multi.sqlite"), Base.RefValue{Ptr{SQLite.C.sqlite3_stmt}}(Ptr{SQLite.C.sqlite3_stmt} @0x0000000046cf69b8), Dict{Int64, Any}()), Base.RefValue{Int32}(100), [:origin, :destination], Type[Union{Missing, String}, Union{Missing, String}], Dict(:origin => 1, :destination => 2), Base.RefValue{Int64}(0))

    With a constraint that we cannot send more than 625 units between each pair:

    for r in Tables.rows(od_pairs)
    +)
    SQLite.Query{false}(SQLite.Stmt(SQLite.DB("/home/runner/work/JuMP.jl/JuMP.jl/docs/build/tutorials/linear/multi.sqlite"), Base.RefValue{Ptr{SQLite.C.sqlite3_stmt}}(Ptr{SQLite.C.sqlite3_stmt} @0x0000000043b65408), Dict{Int64, Any}()), Base.RefValue{Int32}(100), [:origin, :destination], Type[Union{Missing, String}, Union{Missing, String}], Dict(:origin => 1, :destination => 2), Base.RefValue{Int64}(0))

    With a constraint that we cannot send more than 625 units between each pair:

    for r in Tables.rows(od_pairs)
         @constraint(model, sum(x[r.origin, r.destination, :]) <= 625)
     end

    Solution

    Finally, we can optimize the model:

    optimize!(model)
     Test.@test is_solved_and_feasible(model)
    @@ -139,7 +139,7 @@
       Dual objective value : 2.25700e+05
     
     * Work counters
    -  Solve time (sec)   : 6.31094e-04
    +  Solve time (sec)   : 6.70433e-04
       Simplex iterations : 54
       Barrier iterations : 0
       Node count         : -1
    @@ -170,4 +170,4 @@
     PITT WIN    75   250    .
     PITT STL   400    25   200
     PITT FRE    .    450   100
    -PITT LAF   250   125    .
    +PITT LAF 250 125 . diff --git a/previews/PR3778/tutorials/linear/multi_commodity_network/index.html b/previews/PR3778/tutorials/linear/multi_commodity_network/index.html index 859e6a13306..cd6e604d261 100644 --- a/previews/PR3778/tutorials/linear/multi_commodity_network/index.html +++ b/previews/PR3778/tutorials/linear/multi_commodity_network/index.html @@ -87,7 +87,7 @@ Dual objective value : 1.43228e+02 * Work counters - Solve time (sec) : 3.14236e-04 + Solve time (sec) : 3.23772e-04 Simplex iterations : 8 Barrier iterations : 0 Node count : -1 @@ -95,4 +95,4 @@ df_supply.x_supply = value.(df_supply.x_supply);

    and display the optimal solution for flows:

    DataFrames.select(
         filter!(row -> row.x_flow > 0.0, df_shipping),
         [:origin, :destination, :product, :x_flow],
    -)
    9×4 DataFrame
    Roworigindestinationproductx_flow
    StringStringStringFloat64
    1waikatoaucklandmilk10.0
    2waikatowellingtonmilk2.0
    3taurangaaucklandmilk2.0
    4taurangawaikatomilk2.0
    5christchurchaucklandmilk4.0
    6aucklandchristchurchkiwifruit4.0
    7waikatoaucklandkiwifruit20.0
    8waikatowellingtonkiwifruit2.0
    9taurangawaikatokiwifruit22.0
    +)
    9×4 DataFrame
    Roworigindestinationproductx_flow
    StringStringStringFloat64
    1waikatoaucklandmilk10.0
    2waikatowellingtonmilk2.0
    3taurangaaucklandmilk2.0
    4taurangawaikatomilk2.0
    5christchurchaucklandmilk4.0
    6aucklandchristchurchkiwifruit4.0
    7waikatoaucklandkiwifruit20.0
    8waikatowellingtonkiwifruit2.0
    9taurangawaikatokiwifruit22.0
    diff --git a/previews/PR3778/tutorials/linear/multi_objective_examples/index.html b/previews/PR3778/tutorials/linear/multi_objective_examples/index.html index 2d0d291cab0..d9d872cbeec 100644 --- a/previews/PR3778/tutorials/linear/multi_objective_examples/index.html +++ b/previews/PR3778/tutorials/linear/multi_objective_examples/index.html @@ -31,7 +31,7 @@ Dual objective value : -1.50000e+01 * Work counters - Solve time (sec) : 1.13106e-03 + Solve time (sec) : 1.18089e-03 Simplex iterations : 0 Barrier iterations : 0 Node count : 0 @@ -68,7 +68,7 @@ Relative gap : 0.00000e+00 * Work counters - Solve time (sec) : 7.28202e-03 + Solve time (sec) : 7.22599e-03 Simplex iterations : 0 Barrier iterations : 0 Node count : 0 @@ -125,7 +125,7 @@ Relative gap : 0.00000e+00 * Work counters - Solve time (sec) : 5.67412e-03 + Solve time (sec) : 5.20682e-03 Simplex iterations : 0 Barrier iterations : 0 Node count : 0 @@ -142,4 +142,4 @@ end
    1: z = [8, 9] | Path: 1->2 2->4 4->6
     2: z = [10, 7] | Path: 1->2 2->5 5->6
     3: z = [11, 5] | Path: 1->2 2->6
    -4: z = [13, 4] | Path: 1->3 3->4 4->6
    +4: z = [13, 4] | Path: 1->3 3->4 4->6 diff --git a/previews/PR3778/tutorials/linear/multi_objective_knapsack/55fdf836.svg b/previews/PR3778/tutorials/linear/multi_objective_knapsack/259ff6ff.svg similarity index 87% rename from previews/PR3778/tutorials/linear/multi_objective_knapsack/55fdf836.svg rename to previews/PR3778/tutorials/linear/multi_objective_knapsack/259ff6ff.svg index e46bb71fb59..08d0a41a43f 100644 --- a/previews/PR3778/tutorials/linear/multi_objective_knapsack/55fdf836.svg +++ b/previews/PR3778/tutorials/linear/multi_objective_knapsack/259ff6ff.svg @@ -1,53 +1,53 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/previews/PR3778/tutorials/linear/multi_objective_knapsack/d519d37a.svg b/previews/PR3778/tutorials/linear/multi_objective_knapsack/4b8cc4eb.svg similarity index 83% rename from previews/PR3778/tutorials/linear/multi_objective_knapsack/d519d37a.svg rename to previews/PR3778/tutorials/linear/multi_objective_knapsack/4b8cc4eb.svg index a907299fa7a..b80a407ca33 100644 --- a/previews/PR3778/tutorials/linear/multi_objective_knapsack/d519d37a.svg +++ b/previews/PR3778/tutorials/linear/multi_objective_knapsack/4b8cc4eb.svg @@ -1,55 +1,55 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/previews/PR3778/tutorials/linear/multi_objective_knapsack/index.html b/previews/PR3778/tutorials/linear/multi_objective_knapsack/index.html index d0f66dc11d3..e5d4abc2849 100644 --- a/previews/PR3778/tutorials/linear/multi_objective_knapsack/index.html +++ b/previews/PR3778/tutorials/linear/multi_objective_knapsack/index.html @@ -25,7 +25,7 @@ xlabel = "Profit", ylabel = "Desire", legend = false, -)Example block output

    The goal of the bi-objective knapsack problem is to choose a subset which maximizes both objectives.

    JuMP formulation

    Our JuMP formulation is a direct translation of the mathematical formulation:

    model = Model()
    +)
    Example block output

    The goal of the bi-objective knapsack problem is to choose a subset which maximizes both objectives.

    JuMP formulation

    Our JuMP formulation is a direct translation of the mathematical formulation:

    model = Model()
     @variable(model, x[1:N], Bin)
     @constraint(model, sum(weight[i] * x[i] for i in 1:N) <= capacity)
     @expression(model, profit_expr, sum(profit[i] * x[i] for i in 1:N))
    @@ -51,7 +51,7 @@
       Relative gap       : 0.00000e+00
     
     * Work counters
    -  Solve time (sec)   : 9.91361e-02
    +  Solve time (sec)   : 9.87630e-02
       Simplex iterations : 0
       Barrier iterations : 0
       Node count         : 0
    @@ -81,7 +81,7 @@
         Plots.annotate!(y[1] - 1, y[2], (i, 10))
     end
     ideal_point = objective_bound(model)
    -Plots.scatter!([ideal_point[1]], [ideal_point[2]]; label = "Ideal point")
    Example block output

    Visualizing the objective space lets the decision maker choose a solution that suits their personal preferences. For example, result #7 is close to the maximum value of profit, but offers significantly higher desirability compared with solutions #8 and #9.

    The set of items that are chosen in solution #7 are:

    items_chosen = [i for i in 1:N if value(x[i]; result = 7) > 0.9]
    11-element Vector{Int64}:
    +Plots.scatter!([ideal_point[1]], [ideal_point[2]]; label = "Ideal point")
    Example block output

    Visualizing the objective space lets the decision maker choose a solution that suits their personal preferences. For example, result #7 is close to the maximum value of profit, but offers significantly higher desirability compared with solutions #8 and #9.

    The set of items that are chosen in solution #7 are:

    items_chosen = [i for i in 1:N if value(x[i]; result = 7) > 0.9]
    11-element Vector{Int64}:
       1
       2
       3
    @@ -92,4 +92,4 @@
      11
      15
      16
    - 17

    Next steps

    MultiObjectiveAlgorithms.jl implements a number of different algorithms. Try solving the same problem using MOA.Dichotomy(). Does it find the same solution?

    + 17

    Next steps

    MultiObjectiveAlgorithms.jl implements a number of different algorithms. Try solving the same problem using MOA.Dichotomy(). Does it find the same solution?

    diff --git a/previews/PR3778/tutorials/linear/n-queens/index.html b/previews/PR3778/tutorials/linear/n-queens/index.html index cb2a026490f..4ea84092b99 100644 --- a/previews/PR3778/tutorials/linear/n-queens/index.html +++ b/previews/PR3778/tutorials/linear/n-queens/index.html @@ -23,4 +23,4 @@ 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 - 0 1 0 0 0 0 0 0 + 0 1 0 0 0 0 0 0 diff --git a/previews/PR3778/tutorials/linear/network_flows/index.html b/previews/PR3778/tutorials/linear/network_flows/index.html index 967bda212f5..d979d0d0896 100644 --- a/previews/PR3778/tutorials/linear/network_flows/index.html +++ b/previews/PR3778/tutorials/linear/network_flows/index.html @@ -91,4 +91,4 @@ 0.0 0.0 0.0 0.0 0.0 0.0 0.0 3.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 2.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 - 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 + 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 diff --git a/previews/PR3778/tutorials/linear/piecewise_linear/e323a275.svg b/previews/PR3778/tutorials/linear/piecewise_linear/0167e83d.svg similarity index 78% rename from previews/PR3778/tutorials/linear/piecewise_linear/e323a275.svg rename to previews/PR3778/tutorials/linear/piecewise_linear/0167e83d.svg index 41a71290621..4ca45bd855e 100644 --- a/previews/PR3778/tutorials/linear/piecewise_linear/e323a275.svg +++ b/previews/PR3778/tutorials/linear/piecewise_linear/0167e83d.svg @@ -1,60 +1,60 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/previews/PR3778/tutorials/linear/piecewise_linear/da487731.svg b/previews/PR3778/tutorials/linear/piecewise_linear/0aef42cb.svg similarity index 84% rename from previews/PR3778/tutorials/linear/piecewise_linear/da487731.svg rename to previews/PR3778/tutorials/linear/piecewise_linear/0aef42cb.svg index beba42822f7..4b61de9e62e 100644 --- a/previews/PR3778/tutorials/linear/piecewise_linear/da487731.svg +++ b/previews/PR3778/tutorials/linear/piecewise_linear/0aef42cb.svg @@ -1,65 +1,65 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/previews/PR3778/tutorials/linear/piecewise_linear/16147e70.svg b/previews/PR3778/tutorials/linear/piecewise_linear/25536322.svg similarity index 85% rename from previews/PR3778/tutorials/linear/piecewise_linear/16147e70.svg rename to previews/PR3778/tutorials/linear/piecewise_linear/25536322.svg index dacf90f4ef0..e7c60a97246 100644 --- a/previews/PR3778/tutorials/linear/piecewise_linear/16147e70.svg +++ b/previews/PR3778/tutorials/linear/piecewise_linear/25536322.svg @@ -1,46 +1,46 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/previews/PR3778/tutorials/linear/piecewise_linear/fd4e66bd.svg b/previews/PR3778/tutorials/linear/piecewise_linear/2edec1ec.svg similarity index 81% rename from previews/PR3778/tutorials/linear/piecewise_linear/fd4e66bd.svg rename to previews/PR3778/tutorials/linear/piecewise_linear/2edec1ec.svg index aaa2fb1deb8..7937bdabc77 100644 --- a/previews/PR3778/tutorials/linear/piecewise_linear/fd4e66bd.svg +++ b/previews/PR3778/tutorials/linear/piecewise_linear/2edec1ec.svg @@ -1,45 +1,45 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/previews/PR3778/tutorials/linear/piecewise_linear/f556434d.svg b/previews/PR3778/tutorials/linear/piecewise_linear/6df61ee4.svg similarity index 82% rename from previews/PR3778/tutorials/linear/piecewise_linear/f556434d.svg rename to previews/PR3778/tutorials/linear/piecewise_linear/6df61ee4.svg index 2e941a2b287..2bd706f3c41 100644 --- a/previews/PR3778/tutorials/linear/piecewise_linear/f556434d.svg +++ b/previews/PR3778/tutorials/linear/piecewise_linear/6df61ee4.svg @@ -1,48 +1,48 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/previews/PR3778/tutorials/linear/piecewise_linear/7d942523.svg b/previews/PR3778/tutorials/linear/piecewise_linear/7e07c6ce.svg similarity index 80% rename from previews/PR3778/tutorials/linear/piecewise_linear/7d942523.svg rename to previews/PR3778/tutorials/linear/piecewise_linear/7e07c6ce.svg index ef998b57878..a41a4224e9e 100644 --- a/previews/PR3778/tutorials/linear/piecewise_linear/7d942523.svg +++ b/previews/PR3778/tutorials/linear/piecewise_linear/7e07c6ce.svg @@ -1,63 +1,63 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/previews/PR3778/tutorials/linear/piecewise_linear/0a5ff71a.svg b/previews/PR3778/tutorials/linear/piecewise_linear/856cc48d.svg similarity index 86% rename from previews/PR3778/tutorials/linear/piecewise_linear/0a5ff71a.svg rename to previews/PR3778/tutorials/linear/piecewise_linear/856cc48d.svg index 1b90b0eca1b..d53e8b6cb60 100644 --- a/previews/PR3778/tutorials/linear/piecewise_linear/0a5ff71a.svg +++ b/previews/PR3778/tutorials/linear/piecewise_linear/856cc48d.svg @@ -1,43 +1,43 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/previews/PR3778/tutorials/linear/piecewise_linear/cdcfd575.svg b/previews/PR3778/tutorials/linear/piecewise_linear/96092514.svg similarity index 92% rename from previews/PR3778/tutorials/linear/piecewise_linear/cdcfd575.svg rename to previews/PR3778/tutorials/linear/piecewise_linear/96092514.svg index 69a66208f6f..329b779736f 100644 --- a/previews/PR3778/tutorials/linear/piecewise_linear/cdcfd575.svg +++ b/previews/PR3778/tutorials/linear/piecewise_linear/96092514.svg @@ -1,63 +1,63 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/previews/PR3778/tutorials/linear/piecewise_linear/c42d04a3.svg b/previews/PR3778/tutorials/linear/piecewise_linear/9b079071.svg similarity index 94% rename from previews/PR3778/tutorials/linear/piecewise_linear/c42d04a3.svg rename to previews/PR3778/tutorials/linear/piecewise_linear/9b079071.svg index 803e62cc478..73ab7bd4043 100644 --- a/previews/PR3778/tutorials/linear/piecewise_linear/c42d04a3.svg +++ b/previews/PR3778/tutorials/linear/piecewise_linear/9b079071.svg @@ -1,48 +1,48 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/previews/PR3778/tutorials/linear/piecewise_linear/536b9e7f.svg b/previews/PR3778/tutorials/linear/piecewise_linear/9ba9773f.svg similarity index 85% rename from previews/PR3778/tutorials/linear/piecewise_linear/536b9e7f.svg rename to previews/PR3778/tutorials/linear/piecewise_linear/9ba9773f.svg index 78e5ad4a6fd..9b069420e20 100644 --- a/previews/PR3778/tutorials/linear/piecewise_linear/536b9e7f.svg +++ b/previews/PR3778/tutorials/linear/piecewise_linear/9ba9773f.svg @@ -1,44 +1,44 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/previews/PR3778/tutorials/linear/piecewise_linear/3c6923ca.svg b/previews/PR3778/tutorials/linear/piecewise_linear/9d2e28ec.svg similarity index 82% rename from previews/PR3778/tutorials/linear/piecewise_linear/3c6923ca.svg rename to previews/PR3778/tutorials/linear/piecewise_linear/9d2e28ec.svg index e815083c32e..172cf7d912b 100644 --- a/previews/PR3778/tutorials/linear/piecewise_linear/3c6923ca.svg +++ b/previews/PR3778/tutorials/linear/piecewise_linear/9d2e28ec.svg @@ -1,61 +1,61 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/previews/PR3778/tutorials/linear/piecewise_linear/ccca3fd6.svg b/previews/PR3778/tutorials/linear/piecewise_linear/b852417a.svg similarity index 86% rename from previews/PR3778/tutorials/linear/piecewise_linear/ccca3fd6.svg rename to previews/PR3778/tutorials/linear/piecewise_linear/b852417a.svg index dc324365e8e..0aaf1b587da 100644 --- a/previews/PR3778/tutorials/linear/piecewise_linear/ccca3fd6.svg +++ b/previews/PR3778/tutorials/linear/piecewise_linear/b852417a.svg @@ -1,50 +1,50 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/previews/PR3778/tutorials/linear/piecewise_linear/index.html b/previews/PR3778/tutorials/linear/piecewise_linear/index.html index 23293af82b7..4c336c4b34f 100644 --- a/previews/PR3778/tutorials/linear/piecewise_linear/index.html +++ b/previews/PR3778/tutorials/linear/piecewise_linear/index.html @@ -7,11 +7,11 @@ import HiGHS import Plots

    Minimizing a convex function (outer approximation)

    If the function you are approximating is convex, and you want to minimize "down" onto it, then you can use an outer approximation.

    For example, $f(x) = x^2$ is a convex function:

    f(x) = x^2
     ∇f(x) = 2 * x
    -plot = Plots.plot(f, -2:0.01:2; ylims = (-0.5, 4), label = false, width = 3)
    Example block output

    Because $f$ is convex, we know that for any $x_k$, we have: $f(x) \ge f(x_k) + \nabla f(x_k) \cdot (x - x_k)$

    for x_k in -2:1:2  ## Tip: try changing the number of points x_k
    +plot = Plots.plot(f, -2:0.01:2; ylims = (-0.5, 4), label = false, width = 3)
    Example block output

    Because $f$ is convex, we know that for any $x_k$, we have: $f(x) \ge f(x_k) + \nabla f(x_k) \cdot (x - x_k)$

    for x_k in -2:1:2  ## Tip: try changing the number of points x_k
         g = x -> f(x_k) + ∇f(x_k) * (x - x_k)
         Plots.plot!(plot, g, -2:0.01:2; color = :red, label = false, width = 3)
     end
    -plot
    Example block output

    We can use these tangent planes as constraints in our model to create an outer approximation of the function. As we add more planes, the error between the true function and the piecewise linear outer approximation decreases.

    Here is the model in JuMP:

    function outer_approximate_x_squared(x̄)
    +plot
    Example block output

    We can use these tangent planes as constraints in our model to create an outer approximation of the function. As we add more planes, the error between the true function and the piecewise linear outer approximation decreases.

    Here is the model in JuMP:

    function outer_approximate_x_squared(x̄)
         f(x) = x^2
         ∇f(x) = 2x
         model = Model(HiGHS.Optimizer)
    @@ -29,7 +29,7 @@
         ȳ = outer_approximate_x_squared(x̄)
         Plots.scatter!(plot, [x̄], [ȳ]; label = false, color = :black)
     end
    -plot
    Example block output
    Note

    This formulation does not work if we want to maximize y.

    Maximizing a concave function (outer approximation)

    The outer approximation also works if we want to maximize "up" into a concave function.

    f(x) = log(x)
    +plot
    Example block output
    Note

    This formulation does not work if we want to maximize y.

    Maximizing a concave function (outer approximation)

    The outer approximation also works if we want to maximize "up" into a concave function.

    f(x) = log(x)
     ∇f(x) = 1 / x
     X = 0.1:0.1:1.6
     plot = Plots.plot(
    @@ -44,7 +44,7 @@
         g = x -> f(x_k) + ∇f(x_k) * (x - x_k)
         Plots.plot!(plot, g, X; color = :red, label = false, width = 3)
     end
    -plot
    Example block output

    Here is the model in JuMP:

    function outer_approximate_log(x̄)
    +plot
    Example block output

    Here is the model in JuMP:

    function outer_approximate_log(x̄)
         f(x) = log(x)
         ∇f(x) = 1 / x
         model = Model(HiGHS.Optimizer)
    @@ -62,18 +62,18 @@
         ȳ = outer_approximate_log(x̄)
         Plots.scatter!(plot, [x̄], [ȳ]; label = false, color = :black)
     end
    -plot
    Example block output
    Note

    This formulation does not work if we want to minimize y.

    Minimizing a convex function (inner approximation)

    Instead of creating an outer approximation, we can also create an inner approximation. For example, given $f(x) = x^2$, we may want to approximate the true function by the red piecewise linear function:

    f(x) = x^2
    +plot
    Example block output
    Note

    This formulation does not work if we want to minimize y.

    Minimizing a convex function (inner approximation)

    Instead of creating an outer approximation, we can also create an inner approximation. For example, given $f(x) = x^2$, we may want to approximate the true function by the red piecewise linear function:

    f(x) = x^2
     x̂ = -2:0.8:2  ## Tip: try changing the number of points in x̂
     plot = Plots.plot(f, -2:0.01:2; ylims = (-0.5, 4), label = false, linewidth = 3)
     Plots.plot!(plot, f, x̂; label = false, color = :red, linewidth = 3)
    -plot
    Example block output

    To do so, we represent the decision variables $(x, y)$ by the convex combination of a set of discrete points $\{x_k, y_k\}_{k=1}^K$:

    \[\begin{aligned} +plotExample block output

    To do so, we represent the decision variables $(x, y)$ by the convex combination of a set of discrete points $\{x_k, y_k\}_{k=1}^K$:

    \[\begin{aligned} x = \sum\limits_{k=1}^K \lambda_k x_k \\ y = \sum\limits_{k=1}^K \lambda_k y_k \\ \sum\limits_{k=1}^K \lambda_k = 1 \\ \lambda_k \ge 0, k=1,\ldots,k \\ \end{aligned}\]

    The feasible region of the convex combination actually allows any $(x, y)$ point inside this shaded region:

    I = [1, 2, 3, 4, 5, 6, 1]
     Plots.plot!(x̂[I], f.(x̂[I]); fill = (0, 0, "#f004"), width = 0, label = false)
    -plot
    Example block output

    Thus, this formulation does not work if we want to maximize $y$.

    Here is the model in JuMP:

    function inner_approximate_x_squared(x̄)
    +plot
    Example block output

    Thus, this formulation does not work if we want to maximize $y$.

    Here is the model in JuMP:

    function inner_approximate_x_squared(x̄)
         f(x) = x^2
         ∇f(x) = 2x
         x̂ = -2:0.8:2  ## Tip: try changing the number of points in x̂
    @@ -96,13 +96,13 @@
         ȳ = inner_approximate_x_squared(x̄)
         Plots.scatter!(plot, [x̄], [ȳ]; label = false, color = :black)
     end
    -plot
    Example block output

    Maximizing a convex function (inner approximation)

    The inner approximation also works if we want to maximize "up" into a concave function.

    f(x) = log(x)
    +plot
    Example block output

    Maximizing a convex function (inner approximation)

    The inner approximation also works if we want to maximize "up" into a concave function.

    f(x) = log(x)
     x̂ = 0.1:0.5:1.6  ## Tip: try changing the number of points in x̂
     plot = Plots.plot(f, 0.1:0.01:1.6; label = false, linewidth = 3)
     Plots.plot!(x̂, f.(x̂); linewidth = 3, color = :red, label = false)
     I = [1, 2, 3, 4, 1]
     Plots.plot!(x̂[I], f.(x̂[I]); fill = (0, 0, "#f004"), width = 0, label = false)
    -plot
    Example block output

    Here is the model in JuMP:

    function inner_approximate_log(x̄)
    +plot
    Example block output

    Here is the model in JuMP:

    function inner_approximate_log(x̄)
         f(x) = log(x)
         x̂ = 0.1:0.5:1.6  ## Tip: try changing the number of points in x̂
         ŷ = f.(x̂)
    @@ -124,13 +124,13 @@
         ȳ = inner_approximate_log(x̄)
         Plots.scatter!(plot, [x̄], [ȳ]; label = false, color = :black)
     end
    -plot
    Example block output

    Piecewise linear approximation

    If the model is non-convex (or non-concave), then we cannot use an outer approximation, and the inner approximation allows a solution far from the true function. For example, for $f(x) = sin(x)$, we have:

    f(x) = sin(x)
    +plot
    Example block output

    Piecewise linear approximation

    If the model is non-convex (or non-concave), then we cannot use an outer approximation, and the inner approximation allows a solution far from the true function. For example, for $f(x) = sin(x)$, we have:

    f(x) = sin(x)
     plot = Plots.plot(f, 0:0.01:2π; label = false)
     x̂ = range(; start = 0, stop = 2π, length = 7)
     Plots.plot!(x̂, f.(x̂); linewidth = 3, color = :red, label = false)
     I = [1, 5, 6, 7, 3, 2, 1]
     Plots.plot!(x̂[I], f.(x̂[I]); fill = (0, 0, "#f004"), width = 0, label = false)
    -plot
    Example block output

    We can force the inner approximation to stay on the red line by adding the constraint λ in SOS2(). The SOS2 set is a Special Ordered Set of Type 2, and it ensures that at most two elements of λ can be non-zero, and if they are, that they must be adjacent. This prevents the model from taking a convex combination of points 1 and 5 to end up on the lower boundary of the shaded red area.

    Here is the model in JuMP:

    function piecewise_linear_sin(x̄)
    +plot
    Example block output

    We can force the inner approximation to stay on the red line by adding the constraint λ in SOS2(). The SOS2 set is a Special Ordered Set of Type 2, and it ensures that at most two elements of λ can be non-zero, and if they are, that they must be adjacent. This prevents the model from taking a convex combination of points 1 and 5 to end up on the lower boundary of the shaded red area.

    Here is the model in JuMP:

    function piecewise_linear_sin(x̄)
         f(x) = sin(x)
         # Tip: try changing the number of points in x̂
         x̂ = range(; start = 0, stop = 2π, length = 7)
    @@ -155,4 +155,4 @@
         ȳ = piecewise_linear_sin(x̄)
         Plots.scatter!(plot, [x̄], [ȳ]; label = false, color = :black)
     end
    -plot
    Example block output +plotExample block output diff --git a/previews/PR3778/tutorials/linear/sudoku/index.html b/previews/PR3778/tutorials/linear/sudoku/index.html index 59171ea30ce..ba48424c784 100644 --- a/previews/PR3778/tutorials/linear/sudoku/index.html +++ b/previews/PR3778/tutorials/linear/sudoku/index.html @@ -93,4 +93,4 @@ 7 1 3 9 2 4 8 5 6 9 6 1 5 3 7 2 8 4 2 8 7 4 1 9 6 3 5 - 3 4 5 2 8 6 1 7 9

    Which is the same as we found before:

    sol == csp_sol
    true
    + 3 4 5 2 8 6 1 7 9

    Which is the same as we found before:

    sol == csp_sol
    true
    diff --git a/previews/PR3778/tutorials/linear/tips_and_tricks/index.html b/previews/PR3778/tutorials/linear/tips_and_tricks/index.html index e12efe364c7..f4bf3adf178 100644 --- a/previews/PR3778/tutorials/linear/tips_and_tricks/index.html +++ b/previews/PR3778/tutorials/linear/tips_and_tricks/index.html @@ -70,4 +70,4 @@ y == sum(ŷ[i] * λ[i] for i in 1:N) sum(λ) == 1 λ in SOS2() - end)(x + λ[1] + 0.5 λ[2] - 0.5 λ[4] - λ[5] - 1.5 λ[6] - 2 λ[7] = 0, y - λ[1] - 0.25 λ[2] - 0.25 λ[4] - λ[5] - 2.25 λ[6] - 4 λ[7] = 0, λ[1] + λ[2] + λ[3] + λ[4] + λ[5] + λ[6] + λ[7] = 1, [λ[1], λ[2], λ[3], λ[4], λ[5], λ[6], λ[7]] ∈ MathOptInterface.SOS2{Float64}([1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0])) + end)(x + λ[1] + 0.5 λ[2] - 0.5 λ[4] - λ[5] - 1.5 λ[6] - 2 λ[7] = 0, y - λ[1] - 0.25 λ[2] - 0.25 λ[4] - λ[5] - 2.25 λ[6] - 4 λ[7] = 0, λ[1] + λ[2] + λ[3] + λ[4] + λ[5] + λ[6] + λ[7] = 1, [λ[1], λ[2], λ[3], λ[4], λ[5], λ[6], λ[7]] ∈ MathOptInterface.SOS2{Float64}([1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0])) diff --git a/previews/PR3778/tutorials/linear/transp/index.html b/previews/PR3778/tutorials/linear/transp/index.html index bbc9e781ac9..d9f02cba911 100644 --- a/previews/PR3778/tutorials/linear/transp/index.html +++ b/previews/PR3778/tutorials/linear/transp/index.html @@ -74,4 +74,4 @@ end
    solve_transportation_problem (generic function with 1 method)

    Solution

    Let's solve and view the solution:

    solve_transportation_problem(data)
            FRA    DET    LAN    WIN    STL    FRE    LAF
     GARY      .      .      .      .  300.0 1100.0      .
     CLEV      .      .  600.0      . 1000.0      . 1000.0
    -PITT  900.0 1200.0      .  400.0  400.0      .      .
    +PITT 900.0 1200.0 . 400.0 400.0 . . diff --git a/previews/PR3778/tutorials/nonlinear/classifiers/1bf094eb.svg b/previews/PR3778/tutorials/nonlinear/classifiers/1b7b94b1.svg similarity index 62% rename from previews/PR3778/tutorials/nonlinear/classifiers/1bf094eb.svg rename to previews/PR3778/tutorials/nonlinear/classifiers/1b7b94b1.svg index 43b251be3cb..ae9dc5a8b74 100644 --- a/previews/PR3778/tutorials/nonlinear/classifiers/1bf094eb.svg +++ b/previews/PR3778/tutorials/nonlinear/classifiers/1b7b94b1.svg @@ -1,543 +1,543 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/previews/PR3778/tutorials/nonlinear/classifiers/84dbf0dc.svg b/previews/PR3778/tutorials/nonlinear/classifiers/21ec51d9.svg similarity index 61% rename from previews/PR3778/tutorials/nonlinear/classifiers/84dbf0dc.svg rename to previews/PR3778/tutorials/nonlinear/classifiers/21ec51d9.svg index 1e20583a31f..7ca6af9588a 100644 --- a/previews/PR3778/tutorials/nonlinear/classifiers/84dbf0dc.svg +++ b/previews/PR3778/tutorials/nonlinear/classifiers/21ec51d9.svg @@ -1,1042 +1,1042 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/previews/PR3778/tutorials/nonlinear/classifiers/d04377a0.svg b/previews/PR3778/tutorials/nonlinear/classifiers/3be623e0.svg similarity index 62% rename from previews/PR3778/tutorials/nonlinear/classifiers/d04377a0.svg rename to previews/PR3778/tutorials/nonlinear/classifiers/3be623e0.svg index daaf3b73e42..f57c241e8c1 100644 --- a/previews/PR3778/tutorials/nonlinear/classifiers/d04377a0.svg +++ b/previews/PR3778/tutorials/nonlinear/classifiers/3be623e0.svg @@ -1,550 +1,550 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/previews/PR3778/tutorials/nonlinear/classifiers/9f2623d8.svg b/previews/PR3778/tutorials/nonlinear/classifiers/443dbec9.svg similarity index 73% rename from previews/PR3778/tutorials/nonlinear/classifiers/9f2623d8.svg rename to previews/PR3778/tutorials/nonlinear/classifiers/443dbec9.svg index c8358732390..3d68592e2be 100644 --- a/previews/PR3778/tutorials/nonlinear/classifiers/9f2623d8.svg +++ b/previews/PR3778/tutorials/nonlinear/classifiers/443dbec9.svg @@ -1,143 +1,143 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/previews/PR3778/tutorials/nonlinear/classifiers/6353758a.svg b/previews/PR3778/tutorials/nonlinear/classifiers/60a6cbb2.svg similarity index 69% rename from previews/PR3778/tutorials/nonlinear/classifiers/6353758a.svg rename to previews/PR3778/tutorials/nonlinear/classifiers/60a6cbb2.svg index ea49ed5392f..3d0ddf59e4c 100644 --- a/previews/PR3778/tutorials/nonlinear/classifiers/6353758a.svg +++ b/previews/PR3778/tutorials/nonlinear/classifiers/60a6cbb2.svg @@ -1,20913 +1,20913 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/previews/PR3778/tutorials/nonlinear/classifiers/ca5e1bcf.svg b/previews/PR3778/tutorials/nonlinear/classifiers/ba2026e5.svg similarity index 63% rename from previews/PR3778/tutorials/nonlinear/classifiers/ca5e1bcf.svg rename to previews/PR3778/tutorials/nonlinear/classifiers/ba2026e5.svg index 8a0ab5d5275..c1e4c8c7a16 100644 --- a/previews/PR3778/tutorials/nonlinear/classifiers/ca5e1bcf.svg +++ b/previews/PR3778/tutorials/nonlinear/classifiers/ba2026e5.svg @@ -1,551 +1,551 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/previews/PR3778/tutorials/nonlinear/classifiers/3b5b7fb8.svg b/previews/PR3778/tutorials/nonlinear/classifiers/be0f750d.svg similarity index 62% rename from previews/PR3778/tutorials/nonlinear/classifiers/3b5b7fb8.svg rename to previews/PR3778/tutorials/nonlinear/classifiers/be0f750d.svg index 72c02ba65da..32a790ca34f 100644 --- a/previews/PR3778/tutorials/nonlinear/classifiers/3b5b7fb8.svg +++ b/previews/PR3778/tutorials/nonlinear/classifiers/be0f750d.svg @@ -1,543 +1,543 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/previews/PR3778/tutorials/nonlinear/classifiers/ec47aa50.svg b/previews/PR3778/tutorials/nonlinear/classifiers/c6bdad13.svg similarity index 72% rename from previews/PR3778/tutorials/nonlinear/classifiers/ec47aa50.svg rename to previews/PR3778/tutorials/nonlinear/classifiers/c6bdad13.svg index c4bfc444bd9..179e1eb28e2 100644 --- a/previews/PR3778/tutorials/nonlinear/classifiers/ec47aa50.svg +++ b/previews/PR3778/tutorials/nonlinear/classifiers/c6bdad13.svg @@ -1,142 +1,142 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/previews/PR3778/tutorials/nonlinear/classifiers/350373d8.svg b/previews/PR3778/tutorials/nonlinear/classifiers/e0c8ad58.svg similarity index 62% rename from previews/PR3778/tutorials/nonlinear/classifiers/350373d8.svg rename to previews/PR3778/tutorials/nonlinear/classifiers/e0c8ad58.svg index f48ea55168a..11bfac3b3bc 100644 --- a/previews/PR3778/tutorials/nonlinear/classifiers/350373d8.svg +++ b/previews/PR3778/tutorials/nonlinear/classifiers/e0c8ad58.svg @@ -1,544 +1,544 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/previews/PR3778/tutorials/nonlinear/classifiers/index.html b/previews/PR3778/tutorials/nonlinear/classifiers/index.html index 18c15148829..2a71a2dd65a 100644 --- a/previews/PR3778/tutorials/nonlinear/classifiers/index.html +++ b/previews/PR3778/tutorials/nonlinear/classifiers/index.html @@ -20,9 +20,9 @@ color = :white, size = (600, 600), legend = false, -)Example block output

    We want to split the points into two distinct sets on either side of a dividing line. We'll then label each point depending on which side of the line it happens to fall. Based on the labels of the point, we'll show how to create a classifier using a JuMP model. We can then test how well our classifier reproduces the original labels and the boundary between them.

    Let's make a line to divide the points into two sets by defining a gradient and a constant:

    w_0, g_0 = [5, 3], 8
    +)
    Example block output

    We want to split the points into two distinct sets on either side of a dividing line. We'll then label each point depending on which side of the line it happens to fall. Based on the labels of the point, we'll show how to create a classifier using a JuMP model. We can then test how well our classifier reproduces the original labels and the boundary between them.

    Let's make a line to divide the points into two sets by defining a gradient and a constant:

    w_0, g_0 = [5, 3], 8
     line(v::AbstractArray; w = w_0, g = g_0) = w' * v - g
    -line(x::Real; w = w_0, g = g_0) = -(w[1] * x - g) / w[2];

    Julia's multiple dispatch feature allows us to define the vector and single-variable form of the line function under the same name.

    Let's add this to the plot:

    Plots.plot!(plot, line; linewidth = 5)
    Example block output

    Now we label the points relative to which side of the line they are. It is numerically useful to have the labels +1 and -1 for the upcoming JuMP formulation.

    labels = ifelse.(line.(eachrow(P)) .>= 0, 1, -1)
    +line(x::Real; w = w_0, g = g_0) = -(w[1] * x - g) / w[2];

    Julia's multiple dispatch feature allows us to define the vector and single-variable form of the line function under the same name.

    Let's add this to the plot:

    Plots.plot!(plot, line; linewidth = 5)
    Example block output

    Now we label the points relative to which side of the line they are. It is numerically useful to have the labels +1 and -1 for the upcoming JuMP formulation.

    labels = ifelse.(line.(eachrow(P)) .>= 0, 1, -1)
     Plots.scatter!(
         plot,
         P[:, 1],
    @@ -30,7 +30,7 @@
         shape = ifelse.(labels .== 1, :cross, :xcross),
         markercolor = ifelse.(labels .== 1, :blue, :crimson),
         markersize = 8,
    -)
    Example block output

    Our goal is to show we can reconstruct the line from just the points and the labels.

    Formulation: linear support vector machine

    A classifier known as the linear support vector machine (SVM) looks for the affine function $L(p) = w^\top p - g$ that satisfies $L(p) < 0$ for all points $p$ with a label -1 and $L(p) \ge 0$ for all points $p$ with a label +1.

    The linearly constrained quadratic program that implements this is:

    \[\begin{aligned} +)Example block output

    Our goal is to show we can reconstruct the line from just the points and the labels.

    Formulation: linear support vector machine

    A classifier known as the linear support vector machine (SVM) looks for the affine function $L(p) = w^\top p - g$ that satisfies $L(p) < 0$ for all points $p$ with a label -1 and $L(p) \ge 0$ for all points $p$ with a label +1.

    The linearly constrained quadratic program that implements this is:

    \[\begin{aligned} \min_{w \in \mathbb{R}^n, \; g \in \mathbb{R}, \; y \in \mathbb{R}^m} \quad & \frac{1}{2} w^\top w + C \; \sum_{i=1}^m y_i \\ \text{subject to } \quad & D \cdot (P w - g) + y \geq \mathbf{1} \\ & y \ge 0. @@ -59,7 +59,7 @@ Model mode: AUTOMATIC CachingOptimizer state: ATTACHED_OPTIMIZER Solver name: Ipopt -Names registered in the model: g, w, y, Main.classifier)

    With the solution, we can ask: was the value of the penalty constant "sufficiently large" for this data set? This can be judged in part by the range of the slack variables. If the slack is too large, then we need to increase the penalty constant.

    Let's plot the solution and check how we did:

    Plots.plot!(plot, classifier; linewidth = 5, linestyle = :dashdotdot)
    Example block output

    We find that we have recovered the dividing line from just the information of the points and their labels.

    Nonseparable classes of points

    Now, what if the point sets are not cleanly separable by a line (or a hyperplane in higher dimensions)? Does this still work? Let's repeat the process, but this time we will simulate nonseparable classes of points by intermingling a few nearby points across the previously used line.

    nearby_indices = abs.(line.(eachrow(P))) .< 1.1
    +Names registered in the model: g, w, y, Main.classifier)

    With the solution, we can ask: was the value of the penalty constant "sufficiently large" for this data set? This can be judged in part by the range of the slack variables. If the slack is too large, then we need to increase the penalty constant.

    Let's plot the solution and check how we did:

    Plots.plot!(plot, classifier; linewidth = 5, linestyle = :dashdotdot)
    Example block output

    We find that we have recovered the dividing line from just the information of the points and their labels.

    Nonseparable classes of points

    Now, what if the point sets are not cleanly separable by a line (or a hyperplane in higher dimensions)? Does this still work? Let's repeat the process, but this time we will simulate nonseparable classes of points by intermingling a few nearby points across the previously used line.

    nearby_indices = abs.(line.(eachrow(P))) .< 1.1
     labels_new = ifelse.(nearby_indices, -labels, labels)
     model, classifier = solve_SVM_classifier(P, labels_new)
     plot = Plots.scatter(
    @@ -79,7 +79,7 @@
         markercolor = ifelse.(labels_new .== 1, :blue, :crimson),
         markersize = 8,
     )
    -Plots.plot!(plot, classifier; linewidth = 5, linestyle = :dashdotdot)
    Example block output

    So our JuMP formulation still produces a classifier, but it mis-classifies some of the nonseparable points.

    We can find out which points are contributing to the shape of the line by looking at the dual values of the affine constraints and comparing them to the penalty constant $C$:

    affine_cons = all_constraints(model, AffExpr, MOI.GreaterThan{Float64})
    +Plots.plot!(plot, classifier; linewidth = 5, linestyle = :dashdotdot)
    Example block output

    So our JuMP formulation still produces a classifier, but it mis-classifies some of the nonseparable points.

    We can find out which points are contributing to the shape of the line by looking at the dual values of the affine constraints and comparing them to the penalty constant $C$:

    affine_cons = all_constraints(model, AffExpr, MOI.GreaterThan{Float64})
     active_cons = findall(isapprox.(dual.(affine_cons), C_0; atol = 0.001))
     findall(nearby_indices) ⊆ active_cons
    true

    The last statement tells us that our nonseparable points are actively contributing to how the classifier is defined. The remaining points are of interest and are highlighted:

    P_active = P[setdiff(active_cons, findall(nearby_indices)), :]
     Plots.scatter!(
    @@ -89,7 +89,7 @@
         shape = :hexagon,
         markersize = 8,
         markeropacity = 0.5,
    -)
    Example block output

    Advanced: duality and the kernel method

    We now consider an alternative formulation for a linear SVM by solving the dual problem.

    The dual program

    The dual of the linear SVM program is also a linearly constrained quadratic program:

    \[\begin{aligned} +)Example block output

    Advanced: duality and the kernel method

    We now consider an alternative formulation for a linear SVM by solving the dual problem.

    The dual program

    The dual of the linear SVM program is also a linearly constrained quadratic program:

    \[\begin{aligned} \min_{u \in \mathbb{R}^m} \quad & \frac{1}{2} u^\top D P P^\top D u - \; \mathbf{1}^\top u \\ \text{subject to } \quad & \mathbf{1}^\top D u = 0 \\ & 0 \leq u \leq C\mathbf{1}. @@ -108,7 +108,7 @@ classifier(x) = line(x; w = w, g = g) return classifier end

    solve_dual_SVM_classifier (generic function with 1 method)

    We recover the line gradient vector $w$ through setting $w = P^\top D u$, and the line constant $g$ as the dual value of the single affine constraint.

    The dual problem has fewer variables and fewer constraints, so in many cases it may be simpler to solve the dual form.

    We can check that the dual form has recovered a classifier:

    classifier = solve_dual_SVM_classifier(P, labels)
    -Plots.plot!(plot, classifier; linewidth = 5, linestyle = :dash)
    Example block output

    The kernel method

    Linear SVM techniques are not limited to finding separating hyperplanes in the original space of the dataset. One could first transform the training data under a nonlinear mapping, apply our method, then map the hyperplane back into original space.

    The actual data describing the point set is held in a matrix $P$, but looking at the dual program we see that what actually matters is the Gram matrix $P P^\top$, expressing a pairwise comparison (an inner-product) between each point vector. It follows that any mapping of the point set only needs to be defined at the level of pairwise maps between points. Such maps are known as kernel functions:

    \[k \; : \; \mathbb{R}^n \times \mathbb{R}^n \; \rightarrow \mathbb{R}, \qquad +Plots.plot!(plot, classifier; linewidth = 5, linestyle = :dash)Example block output

    The kernel method

    Linear SVM techniques are not limited to finding separating hyperplanes in the original space of the dataset. One could first transform the training data under a nonlinear mapping, apply our method, then map the hyperplane back into original space.

    The actual data describing the point set is held in a matrix $P$, but looking at the dual program we see that what actually matters is the Gram matrix $P P^\top$, expressing a pairwise comparison (an inner-product) between each point vector. It follows that any mapping of the point set only needs to be defined at the level of pairwise maps between points. Such maps are known as kernel functions:

    \[k \; : \; \mathbb{R}^n \times \mathbb{R}^n \; \rightarrow \mathbb{R}, \qquad (s, t) \mapsto \left< \Phi(s), \Phi(t) \right>\]

    where the right-hand side applies some transformation $\Phi : \mathbb{R}^n \rightarrow \mathbb{R}^{n'}$ followed by an inner-product in that image space.

    In practice, we can avoid having $\Phi$ explicitly given but instead define a kernel function directly between pairs of vectors. This change to using a kernel function without knowing the map is called the kernel method (or sometimes, the kernel trick).

    Classifier using a Gaussian kernel

    We will demonstrate the application of a Gaussian or radial basis function kernel:

    \[k(s, t) = \exp\left( -\mu \lVert s - t \rVert^2_2 \right)\]

    for some positive parameter $\mu$.

    k_gauss(s::Vector, t::Vector; μ = 0.5) = exp(-μ * LinearAlgebra.norm(s - t)^2)
    k_gauss (generic function with 1 method)

    Given a matrix of points expressed row-wise and a kernel, the next function returns the transformed matrix $K$ that replaces $P P^\top$:

    function pairwise_transform(kernel::Function, P::Matrix{T}) where {T}
         m, n = size(P)
         K = zeros(T, m, m)
    @@ -151,7 +151,7 @@
         markersize = ifelse.(labels .== 1, 4, 2),
         size = (600, 600),
         legend = false,
    -)
    Example block output

    Is the technique capable of generating a distinctly nonlinear surface? Let's solve the Gaussian kernel based quadratic problem with these parameters:

    classifier = solve_kernel_SVM_classifier(k_gauss, B, labels; C = 1e5, μ = 10.0)
    +)
    Example block output

    Is the technique capable of generating a distinctly nonlinear surface? Let's solve the Gaussian kernel based quadratic problem with these parameters:

    classifier = solve_kernel_SVM_classifier(k_gauss, B, labels; C = 1e5, μ = 10.0)
     grid = [[x, y] for x in 0:0.01:2, y in 0:0.01:2]
     grid_pos = [Tuple(g) for g in grid if classifier(g) >= 0]
    -Plots.scatter!(plot, grid_pos; markersize = 0.2)
    Example block output

    We find that the kernel method can perform well as a nonlinear classifier.

    The result has a fairly strong dependence on the choice of parameters, with larger values of $\mu$ allowing for a more complex boundary while smaller values lead to a smoother boundary for the classifier. Determining a better performing kernel function and choice of parameters is covered by the process of cross-validation with respect to the dataset, where different testing, training and tuning sets are used to validate the best choice of parameters against a statistical measure of error.

    +Plots.scatter!(plot, grid_pos; markersize = 0.2)Example block output

    We find that the kernel method can perform well as a nonlinear classifier.

    The result has a fairly strong dependence on the choice of parameters, with larger values of $\mu$ allowing for a more complex boundary while smaller values lead to a smoother boundary for the classifier. Determining a better performing kernel function and choice of parameters is covered by the process of cross-validation with respect to the dataset, where different testing, training and tuning sets are used to validate the best choice of parameters against a statistical measure of error.

    diff --git a/previews/PR3778/tutorials/nonlinear/complementarity/index.html b/previews/PR3778/tutorials/nonlinear/complementarity/index.html index 887f7b8891e..fc67d234b7e 100644 --- a/previews/PR3778/tutorials/nonlinear/complementarity/index.html +++ b/previews/PR3778/tutorials/nonlinear/complementarity/index.html @@ -131,7 +131,7 @@ Objective value : 0.00000e+00 * Work counters - Solve time (sec) : 1.44000e-04 + Solve time (sec) : 1.45000e-04

    An equilibrium solution is to build 389 MW:

    value(x)
    389.31506849315065

    The production in each scenario is:

    value.(Q)
    5-element Vector{Float64}:
      240.00000000000014
      289.99999999999994
    @@ -142,4 +142,4 @@
       60.0
       59.99999999999999
       60.68493150684928
    - 110.68493150684935
    + 110.68493150684935 diff --git a/previews/PR3778/tutorials/nonlinear/introduction/index.html b/previews/PR3778/tutorials/nonlinear/introduction/index.html index cd5b3301f76..dab6785e147 100644 --- a/previews/PR3778/tutorials/nonlinear/introduction/index.html +++ b/previews/PR3778/tutorials/nonlinear/introduction/index.html @@ -7,4 +7,4 @@ \min_{x \in \mathbb{R}^n} & f_0(x) \\ \;\;\text{s.t.} & l_j \le f_j(x) \le u_j & j = 1 \ldots m \\ & l_i \le x_i \le u_i & i = 1 \ldots n. -\end{align}\]

    Mixed-integer nonlinear linear programs (MINLPs) are extensions of nonlinear programs in which some (or all) of the decision variables take discrete values.

    How to choose a solver

    JuMP supports a range of nonlinear solvers; look for "NLP" in the list of Supported solvers. However, very few solvers support mixed-integer nonlinear linear programs. Solvers supporting discrete variables start with "(MI)" in the list of Supported solvers.

    If the only nonlinearities in your model are quadratic terms (that is, multiplication between two decision variables), you can also use second-order cone solvers, which are indicated by "SOCP." In most cases, these solvers are restricted to convex quadratic problems and will error if you pass a nonconvex quadratic function; however, Gurobi has the ability to solve nonconvex quadratic terms.

    How these tutorials are structured

    Having a high-level overview of how this part of the documentation is structured will help you know where to look for certain things.

    • The following tutorials are worked examples that present a problem in words, then formulate it in mathematics, and then solve it in JuMP. This usually involves some sort of visualization of the solution. Start here if you are new to JuMP.
    • The Tips and tricks tutorial contains a number of helpful reformulations and tricks you can use when modeling nonlinear programs. Look here if you are stuck trying to formulate a problem as a nonlinear program.
    • The Computing Hessians is an advanced tutorial which explains how to compute the Hessian of the Lagrangian of a nonlinear program. This is useful only in particular cases.
    • The remaining tutorials are less verbose and styled in the form of short code examples. These tutorials have less explanation, but may contain useful code snippets, particularly if they are similar to a problem you are trying to solve.
    +\end{align}\]

    Mixed-integer nonlinear linear programs (MINLPs) are extensions of nonlinear programs in which some (or all) of the decision variables take discrete values.

    How to choose a solver

    JuMP supports a range of nonlinear solvers; look for "NLP" in the list of Supported solvers. However, very few solvers support mixed-integer nonlinear linear programs. Solvers supporting discrete variables start with "(MI)" in the list of Supported solvers.

    If the only nonlinearities in your model are quadratic terms (that is, multiplication between two decision variables), you can also use second-order cone solvers, which are indicated by "SOCP." In most cases, these solvers are restricted to convex quadratic problems and will error if you pass a nonconvex quadratic function; however, Gurobi has the ability to solve nonconvex quadratic terms.

    How these tutorials are structured

    Having a high-level overview of how this part of the documentation is structured will help you know where to look for certain things.

    • The following tutorials are worked examples that present a problem in words, then formulate it in mathematics, and then solve it in JuMP. This usually involves some sort of visualization of the solution. Start here if you are new to JuMP.
    • The Tips and tricks tutorial contains a number of helpful reformulations and tricks you can use when modeling nonlinear programs. Look here if you are stuck trying to formulate a problem as a nonlinear program.
    • The Computing Hessians is an advanced tutorial which explains how to compute the Hessian of the Lagrangian of a nonlinear program. This is useful only in particular cases.
    • The remaining tutorials are less verbose and styled in the form of short code examples. These tutorials have less explanation, but may contain useful code snippets, particularly if they are similar to a problem you are trying to solve.
    diff --git a/previews/PR3778/tutorials/nonlinear/nested_problems/index.html b/previews/PR3778/tutorials/nonlinear/nested_problems/index.html index 76509a4db89..c75dfd889d1 100644 --- a/previews/PR3778/tutorials/nonlinear/nested_problems/index.html +++ b/previews/PR3778/tutorials/nonlinear/nested_problems/index.html @@ -64,7 +64,7 @@ Dual objective value : 0.00000e+00 * Work counters - Solve time (sec) : 7.80693e-01 + Solve time (sec) : 8.08239e-01 Barrier iterations : 32

    The optimal objective value is:

    objective_value(model)
    -418983.48680640775

    and the optimal upper-level decision variables $x$ are:

    value.(x)
    2-element Vector{Float64}:
      154.97862337234338
    @@ -127,8 +127,8 @@
       Dual objective value : 0.00000e+00
     
     * Work counters
    -  Solve time (sec)   : 2.41728e-01
    +  Solve time (sec)   : 2.57113e-01
       Barrier iterations : 32
     

    an we can check we get the same objective value:

    objective_value(model)
    -418983.48680640775

    and upper-level decision variable $x$:

    value.(x)
    2-element Vector{Float64}:
      154.97862337234338
    - 180.0096143098799
    + 180.0096143098799 diff --git a/previews/PR3778/tutorials/nonlinear/operator_ad/index.html b/previews/PR3778/tutorials/nonlinear/operator_ad/index.html index 2e0a2bfe099..68bcbe22670 100644 --- a/previews/PR3778/tutorials/nonlinear/operator_ad/index.html +++ b/previews/PR3778/tutorials/nonlinear/operator_ad/index.html @@ -150,4 +150,4 @@ enzyme_rosenbrock()
    2-element Vector{Float64}:
      0.9999999999999899
    - 0.9999999999999792
    + 0.9999999999999792 diff --git a/previews/PR3778/tutorials/nonlinear/portfolio/8aa3ddde.svg b/previews/PR3778/tutorials/nonlinear/portfolio/d86ba738.svg similarity index 79% rename from previews/PR3778/tutorials/nonlinear/portfolio/8aa3ddde.svg rename to previews/PR3778/tutorials/nonlinear/portfolio/d86ba738.svg index 9ac6c7e69a7..2462ae12e62 100644 --- a/previews/PR3778/tutorials/nonlinear/portfolio/8aa3ddde.svg +++ b/previews/PR3778/tutorials/nonlinear/portfolio/d86ba738.svg @@ -1,581 +1,581 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/previews/PR3778/tutorials/nonlinear/portfolio/index.html b/previews/PR3778/tutorials/nonlinear/portfolio/index.html index 49b3c8e25ef..9cd6b3833dc 100644 --- a/previews/PR3778/tutorials/nonlinear/portfolio/index.html +++ b/previews/PR3778/tutorials/nonlinear/portfolio/index.html @@ -72,7 +72,7 @@ Dual objective value : 4.52688e+04 * Work counters - Solve time (sec) : 4.39501e-03 + Solve time (sec) : 4.54998e-03 Barrier iterations : 11

    The optimal allocation of our assets is:

    value.(x)
    3-element Vector{Float64}:
      497.045529849864
    @@ -103,7 +103,7 @@
       Objective bound    : [5.78303e-09,-7.37159e+01]
     
     * Work counters
    -  Solve time (sec)   : 3.22247e-01
    +  Solve time (sec)   : 3.28120e-01
       Barrier iterations : 0
     

    The algorithm found 50 different solutions. Let's plot them to see how they differ:

    objective_space = Plots.hline(
         [scalar_return];
    @@ -136,4 +136,4 @@
         ylabel = "Investment (\$)",
         title = "Decision space",
     )
    -Plots.plot(objective_space, decision_space; layout = (2, 1), size = (600, 600))
    Example block output

    Perhaps our trade-off wasn't so bad after all. Our original solution corresponded to picking a solution #17. If we buy more SEHI, we can increase the return, but the variance also increases. If we buy less SEHI, such as a solution like #5 or #6, then we can achieve the corresponding return without deploying all of our capital. We should also note that at no point should we buy WMT.

    +Plots.plot(objective_space, decision_space; layout = (2, 1), size = (600, 600))Example block output

    Perhaps our trade-off wasn't so bad after all. Our original solution corresponded to picking a solution #17. If we buy more SEHI, we can increase the return, but the variance also increases. If we buy less SEHI, such as a solution like #5 or #6, then we can achieve the corresponding return without deploying all of our capital. We should also note that at no point should we buy WMT.

    diff --git a/previews/PR3778/tutorials/nonlinear/querying_hessians/index.html b/previews/PR3778/tutorials/nonlinear/querying_hessians/index.html index e5e57b9c047..d36f14fe46a 100644 --- a/previews/PR3778/tutorials/nonlinear/querying_hessians/index.html +++ b/previews/PR3778/tutorials/nonlinear/querying_hessians/index.html @@ -168,4 +168,4 @@ 2.82843 2.82843

    Compare that to the analytic solution:

    y = value.(x)
     [2y[1] 0; 2y[1]+2y[2] 2y[1]+2y[2]]
    2×2 Matrix{Float64}:
      1.58072  0.0
    - 2.82843  2.82843
    + 2.82843 2.82843 diff --git a/previews/PR3778/tutorials/nonlinear/rocket_control/478cf4bd.svg b/previews/PR3778/tutorials/nonlinear/rocket_control/ce313cb2.svg similarity index 89% rename from previews/PR3778/tutorials/nonlinear/rocket_control/478cf4bd.svg rename to previews/PR3778/tutorials/nonlinear/rocket_control/ce313cb2.svg index 63bbe6bb821..2af048fbd02 100644 --- a/previews/PR3778/tutorials/nonlinear/rocket_control/478cf4bd.svg +++ b/previews/PR3778/tutorials/nonlinear/rocket_control/ce313cb2.svg @@ -1,130 +1,130 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + diff --git a/previews/PR3778/tutorials/nonlinear/rocket_control/index.html b/previews/PR3778/tutorials/nonlinear/rocket_control/index.html index 97038f85e12..481d2646206 100644 --- a/previews/PR3778/tutorials/nonlinear/rocket_control/index.html +++ b/previews/PR3778/tutorials/nonlinear/rocket_control/index.html @@ -48,7 +48,7 @@ Dual objective value : 4.66547e+00 * Work counters - Solve time (sec) : 1.51550e-01 + Solve time (sec) : 1.58214e-01 Barrier iterations : 24

    Finally, we plot the solution:

    function plot_trajectory(y; kwargs...)
         return Plots.plot(
    @@ -66,4 +66,4 @@
         plot_trajectory(x_v; ylabel = "Velocity"),
         plot_trajectory(u_t; ylabel = "Thrust");
         layout = (2, 2),
    -)
    Example block output

    Next steps

    • Experiment with different values for the constants. How does the solution change? In particular, what happens if you change T_max?
    • The dynamical equations use rectangular integration for the right-hand side terms. Modify the equations to use the Trapezoidal rule instead. (As an example, x_v[t-1] would become 0.5 * (x_v[t-1] + x_v[t]).) Is there a difference?
    +)Example block output

    Next steps

    • Experiment with different values for the constants. How does the solution change? In particular, what happens if you change T_max?
    • The dynamical equations use rectangular integration for the right-hand side terms. Modify the equations to use the Trapezoidal rule instead. (As an example, x_v[t-1] would become 0.5 * (x_v[t-1] + x_v[t]).) Is there a difference?
    diff --git a/previews/PR3778/tutorials/nonlinear/simple_examples/index.html b/previews/PR3778/tutorials/nonlinear/simple_examples/index.html index 79d0bab381b..f5e746692fc 100644 --- a/previews/PR3778/tutorials/nonlinear/simple_examples/index.html +++ b/previews/PR3778/tutorials/nonlinear/simple_examples/index.html @@ -181,4 +181,4 @@ z ≥ 0 Objective value: 0.32699283491387243 x = 0.32699283491387243 -y = 0.2570658388068964 +y = 0.2570658388068964 diff --git a/previews/PR3778/tutorials/nonlinear/space_shuttle_reentry_trajectory/82328990.svg b/previews/PR3778/tutorials/nonlinear/space_shuttle_reentry_trajectory/0228ab6b.svg similarity index 88% rename from previews/PR3778/tutorials/nonlinear/space_shuttle_reentry_trajectory/82328990.svg rename to previews/PR3778/tutorials/nonlinear/space_shuttle_reentry_trajectory/0228ab6b.svg index 846bd215909..bf51bd82091 100644 --- a/previews/PR3778/tutorials/nonlinear/space_shuttle_reentry_trajectory/82328990.svg +++ b/previews/PR3778/tutorials/nonlinear/space_shuttle_reentry_trajectory/0228ab6b.svg @@ -1,97 +1,97 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + diff --git a/previews/PR3778/tutorials/nonlinear/space_shuttle_reentry_trajectory/26b081ee.svg b/previews/PR3778/tutorials/nonlinear/space_shuttle_reentry_trajectory/4e6ea72b.svg similarity index 88% rename from previews/PR3778/tutorials/nonlinear/space_shuttle_reentry_trajectory/26b081ee.svg rename to previews/PR3778/tutorials/nonlinear/space_shuttle_reentry_trajectory/4e6ea72b.svg index 0673df01bf7..89ec76edc2e 100644 --- a/previews/PR3778/tutorials/nonlinear/space_shuttle_reentry_trajectory/26b081ee.svg +++ b/previews/PR3778/tutorials/nonlinear/space_shuttle_reentry_trajectory/4e6ea72b.svg @@ -1,182 +1,182 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + diff --git a/previews/PR3778/tutorials/nonlinear/space_shuttle_reentry_trajectory/6b6abcf3.svg b/previews/PR3778/tutorials/nonlinear/space_shuttle_reentry_trajectory/fd820268.svg similarity index 87% rename from previews/PR3778/tutorials/nonlinear/space_shuttle_reentry_trajectory/6b6abcf3.svg rename to previews/PR3778/tutorials/nonlinear/space_shuttle_reentry_trajectory/fd820268.svg index dc2e874de16..a3a003c6b64 100644 --- a/previews/PR3778/tutorials/nonlinear/space_shuttle_reentry_trajectory/6b6abcf3.svg +++ b/previews/PR3778/tutorials/nonlinear/space_shuttle_reentry_trajectory/fd820268.svg @@ -1,48 +1,48 @@ - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/previews/PR3778/tutorials/nonlinear/space_shuttle_reentry_trajectory/index.html b/previews/PR3778/tutorials/nonlinear/space_shuttle_reentry_trajectory/index.html index 961d425aa70..b9a24085823 100644 --- a/previews/PR3778/tutorials/nonlinear/space_shuttle_reentry_trajectory/index.html +++ b/previews/PR3778/tutorials/nonlinear/space_shuttle_reentry_trajectory/index.html @@ -223,7 +223,7 @@ layout = grid(3, 2), linewidth = 2, size = (700, 700), -)Example block output
    function q(h, v, a)
    +)
    Example block output
    function q(h, v, a)
         ρ(h) = ρ₀ * exp(-h / hᵣ)
         qᵣ(h, v) = 17700 * √ρ(h) * (0.0001 * v)^3.07
         qₐ(a) = c₀ + c₁ * rad2deg(a) + c₂ * rad2deg(a)^2 + c₃ * rad2deg(a)^3
    @@ -257,7 +257,7 @@
         layout = grid(3, 1),
         linewidth = 2,
         size = (700, 700),
    -)
    Example block output
    plot(
    +)
    Example block output
    plot(
         rad2deg.(value.(ϕ)),
         rad2deg.(value.(θ)),
         value.(scaled_h);
    @@ -267,4 +267,4 @@
         xlabel = "Longitude (deg)",
         ylabel = "Latitude (deg)",
         zlabel = "Altitude (100,000 ft)",
    -)
    Example block output +)Example block output diff --git a/previews/PR3778/tutorials/nonlinear/tips_and_tricks/index.html b/previews/PR3778/tutorials/nonlinear/tips_and_tricks/index.html index fb9573270c2..ab94442239e 100644 --- a/previews/PR3778/tutorials/nonlinear/tips_and_tricks/index.html +++ b/previews/PR3778/tutorials/nonlinear/tips_and_tricks/index.html @@ -69,4 +69,4 @@ @assert is_solved_and_feasible(model) Test.@test objective_value(model) ≈ √3 atol = 1e-4 Test.@test value.(x) ≈ [1.0, 1.0] atol = 1e-4 -println("Memoized approach: function_calls = $(function_calls)")
    Memoized approach: function_calls = 22

    Compared to the naive approach, the memoized approach requires half as many function evaluations.

    +println("Memoized approach: function_calls = $(function_calls)")
    Memoized approach: function_calls = 22

    Compared to the naive approach, the memoized approach requires half as many function evaluations.

    diff --git a/previews/PR3778/tutorials/nonlinear/user_defined_hessians/index.html b/previews/PR3778/tutorials/nonlinear/user_defined_hessians/index.html index 568dd07cf92..725031ab96d 100644 --- a/previews/PR3778/tutorials/nonlinear/user_defined_hessians/index.html +++ b/previews/PR3778/tutorials/nonlinear/user_defined_hessians/index.html @@ -39,6 +39,6 @@ Dual solution : * Work counters - Solve time (sec) : 3.42460e-02 + Solve time (sec) : 3.70240e-02 Barrier iterations : 14 - + diff --git a/previews/PR3778/tutorials/transitioning/transitioning_from_matlab/index.html b/previews/PR3778/tutorials/transitioning/transitioning_from_matlab/index.html index 51182ce800d..a38f4312cbf 100644 --- a/previews/PR3778/tutorials/transitioning/transitioning_from_matlab/index.html +++ b/previews/PR3778/tutorials/transitioning/transitioning_from_matlab/index.html @@ -58,7 +58,7 @@ 6 1.1746e-09 -1.2507e-09 2.43e-09 1.59e-16 6.59e-17 2.83e-10 3.87e-10 9.90e-01 --------------------------------------------------------------------------------------------- Terminated with status = solved -solve time = 966μs

    The exclamation mark here is a Julia-ism that means the function is modifying its argument, model.

    Querying solution status

    After the optimization is done, you should check for the solution status to see what solution (if any) the solver found.

    Like YALMIP and CVX, JuMP provides a solver-independent way to check it, via the command:

    is_solved_and_feasible(model)
    true

    If the return value is false, you should investigate with termination_status, primal_status, and raw_status, See Solutions for more details on how to query and interpret solution statuses.

    Extracting variables

    Like YALMIP, but unlike CVX, with JuMP you need to explicitly ask for the value of your variables after optimization is done, with the function call value(x) to obtain the value of variable x.

    value.(m[1][1, 1])
    0.0

    A subtlety is that, unlike YALMIP, the function value is only defined for scalars. For vectors and matrices you need to use Julia broadcasting: value.(v).

    value.(m[1])
    3×3 Matrix{Float64}:
    +solve time = 1.01ms

    The exclamation mark here is a Julia-ism that means the function is modifying its argument, model.

    Querying solution status

    After the optimization is done, you should check for the solution status to see what solution (if any) the solver found.

    Like YALMIP and CVX, JuMP provides a solver-independent way to check it, via the command:

    is_solved_and_feasible(model)
    true

    If the return value is false, you should investigate with termination_status, primal_status, and raw_status, See Solutions for more details on how to query and interpret solution statuses.

    Extracting variables

    Like YALMIP, but unlike CVX, with JuMP you need to explicitly ask for the value of your variables after optimization is done, with the function call value(x) to obtain the value of variable x.

    value.(m[1][1, 1])
    0.0

    A subtlety is that, unlike YALMIP, the function value is only defined for scalars. For vectors and matrices you need to use Julia broadcasting: value.(v).

    value.(m[1])
    3×3 Matrix{Float64}:
      0.0  0.0  0.0
      0.0  0.0  0.0
      0.0  0.0  0.0

    There is also a specialized function for extracting the value of the objective, objective_value(model), which is useful if your objective doesn't have a convenient expression.

    objective_value(model)
    -5.999999998825352

    Dual variables

    Like YALMIP and CVX, JuMP allows you to recover the dual variables. In order to do that, the simplest method is to name the constraint you're interested in, for example, @constraint(model, bob, sum(v) == 1) and then, after the optimzation is done, call dual(bob). See Duality for more details.

    Reformulating problems

    Perhaps the biggest difference between JuMP and YALMIP and CVX is how far the package is willing to go in reformulating the problems you give to it.

    CVX is happy to reformulate anything it can, even using approximations if your solver cannot handle the problem.

    YALMIP will only do exact reformulations, but is still fairly adventurous, for example, being willing to reformulate a nonlinear objective in terms of conic constraints.

    JuMP does no such thing: it only reformulates objectives into objectives, and constraints into constraints, and is fairly conservative at that. As a result, you might need to do some reformulations manually, for which a good guide is the Tips and tricks tutorial.

    Vectorization

    In MATLAB, it is absolutely essential to "vectorize" your code to obtain acceptable performance. This is because MATLAB is a slow interpreted language, which sends your commands to fast libraries. When you "vectorize" your code you are minimizing the MATLAB part of the work and sending it to the fast libraries instead.

    There's no such duality with Julia.

    Everything you write and most libraries you use will compile down to LLVM, so "vectorization" has no effect.

    For example, if you are writing a linear program in MATLAB and instead of the usual constraints = [v >= 0] you write:

    for i = 1:n
    @@ -157,4 +157,4 @@
         x = randn(d, 1) + 1i * randn(d, 1);
         y = x * x';
         rho = y / trace(y);
    -end
    +end