Variables
A technical manual for variables in InfiniteOpt. See the respective guide for more information.
Definition
Note that the principle way for defining variables is by using JuMP.@variable which originates from JuMP.jl.
Infinite Variables
InfiniteOpt.InfOptVariableType — Type
InfOptVariableTypeAn abstract DataType for variable type objects used to create InfiniteOpt variables via JuMP.@variable.
InfiniteOpt.Infinite — Type
Infinite <: InfOptVariableTypeA DataType to assist in making infinite variables. This can be passed as an extra argument to @variable to make an infinite variable:
@variable(model, var_expr, Infinite(parameter_refs...), args..., kwargs...)Here parameter_refs can be a single parameter reference, a single parameter array with parameters defined in the same macro call, or multiple arguments where each argument is either of the first two options listed.
Fields
parameter_refs::VectorTuple{GeneralVariableRef}: The infinite parameters the variable will depend on.
JuMP.build_variable — Method
JuMP.build_variable(
_error::Function,
info::JuMP.VariableInfo,
var_type::Infinite
)::InfiniteVariableBuild and return an infinite variable based on info and var_type. Errors if the infinite parameter references included in var_type are invalid. See Infinite for more information.
Example
julia> info = VariableInfo(false, 0, false, 0, false, 0, true, 0, false, false);
julia> inf_var = build_variable(error, info, Infinite(t));JuMP.add_variable — Method
JuMP.add_variable(model::InfiniteModel, var::InfiniteVariable,
[name::String = ""])::GeneralVariableRefExtend the JuMP.add_variable function to accomodate infinite variable types. Adds a variable to an infinite model model and returns a GeneralVariableRef. Primarily intended to be an internal function of the constructor macro @variable. However, it can be used in combination with JuMP.build_variable to add infinite variables to an infinite model object. Errors if invalid parameter reference(s) are included in var.
Example
julia> @infinite_parameter(m, t in [0, 10]);
julia> info = VariableInfo(false, 0, false, 0, false, 0, true, 0, false, false);
julia> inf_var = build_variable(error, info, Infinite(t));
julia> ivref = add_variable(m, inf_var, "var_name")
var_name(t)InfiniteOpt.InfiniteVariable — Type
InfiniteVariable{
LB <: {Float64, ParameterFunction},
UB <: {Float64, ParameterFunction},
FX <: {Float64, ParameterFunction},
ST <: {Float64, ParameterFunction},
T <: JuMP.AbstractVariableRef
} <: JuMP.AbstractVariableA DataType for storing core infinite variable information. Note that indices that refer to the same dependent parameter group must be in the same tuple element. It is important to note that the subfields of info can be comprised of ParameterFunctions such that each evaluates to a Float64 given an infinite parameter support that matches the format encoded in parameter_refs.
Fields
info::JuMP.VariableInfo{LB, UB, FX, ST}: JuMP variable information.parameter_refs::Collections.VectorTuple{T}: The infinite parameter references that parameterize the variable.group_int_idxs::Vector{Int}: The parameter group integer indices associated withparameter_refs.
InfiniteOpt.restrict — Function
restrict(ivref::GeneralVariableRef, supps...)::GeneralVariableRefRestrict the input domain of an infinite variable/derivative ivref in accordance with the infinite parameters and/or values supps. Here supps must match the formatting of ivref's infinite parameters. Here the following outputs are possible:
- Equivalent to
@variable(model, variable_type = Point(ivref, supps...)ifsuppsare a complete support point - Equivalent to
@variable(model, variable_type = SemiInfinite(ivref, supps...)ifsuppsare a partial support point.
Conveniently, we can also invoke this method by calling ivref(supps...).
Errors if ivref is not an infinite variable or derivative or the formatting of supps is incorrect. Will warn if supps only contain infinite parameters and will simply return ivref.
Example
julia> restrict(y, 0, x)
y(0, [x[1], x[2]])
julia> restrict(y, 0, [0, 0])
y(0, [0, 0])
julia> y(0, x)
y(0, [x[1], x[2]])
julia> y(0, [0, 0])
y(0, [0, 0])restrict(expr::JuMP.AbstractJuMPScalar, supps...)::JuMP.AbstractJuMPScalarRestrict an infinite expression expr to be enforced over infinite parameter supports supps. This is limited to expressions only contain infinite variables with the same kind of infinite parameter dependencies. Note that more conveniently the expression can be treated as a function for the syntax expr(supps...).
Example
julia> ex = @expression(model, 3y - 2)
3 y(t) - 2
julia> restrict(ex, 0)
3 y(0) - 2
julia> ex(0)
3 y(0) - 2InfiniteOpt.VariableData — Type
VariableData{V <: JuMP.AbstractVariable} <: AbstractDataObjectA mutable DataType for storing variables and their data.
Fields
variable::V: The scalar variable.name::String: The name used for printing.lower_bound_index::Union{InfOptConstraintIndex, Nothing}: Index of lower bound constraint.upper_bound_index::Union{InfOptConstraintIndex, Nothing}: Index of upper bound constraint.fix_index::Union{InfOptConstraintIndex, Nothing}: Index on fixing constraint.zero_one_index::Union{InfOptConstraintIndex, Nothing}: Index of binary constraint.integrality_index::Union{InfOptConstraintIndex, Nothing}: Index of integer constraint.measure_indices::Vector{MeasureIndex}: Indices of dependent measures.constraint_indices::Vector{InfOptConstraintIndex}: Indices of dependent constraints.in_objective::Bool: Is this used in objective?point_var_indices::Vector{PointVariableIndex}: Indices of dependent point variables.semi_infinite_var_indices::Vector{SemiInfiniteVariableIndex}: Indices of dependent semi-infinite variables.derivative_indices::Vector{DerivativeIndex}: Indices of dependent derivatives.deriv_constr_indices::Vector{InfOptConstraintIndex}: Indices of dependent derivative evaluation constraints.
InfiniteOpt.InfiniteVariableIndex — Type
InfiniteVariableIndex <: ObjectIndexA DataType for storing the index of a InfiniteVariable.
Fields
value::Int64: The index value.
InfiniteOpt.InfiniteVariableRef — Type
InfiniteVariableRef <: DispatchVariableRefA DataType for untranscripted infinite dimensional variable references (e.g., second stage variables, time dependent variables).
Fields
model::InfiniteModel: Infinite model.index::InfiniteVariableIndex: Index of the variable in model.
InfiniteOpt.Collections.VectorTuple — Type
VectorTuple{T}A collection DataType for storing a Tuple of singular elements of type T and/or Array{T, N}s in a convenient vector form that utilizes linear indexing. Here I is denotes the type of a Tuple that stores the indices of each tuple element as given by indices. VectorTuples should be defined from an original tuple via VectorTuple(tuple) or by listing the tuple elements VectorTuple(items...). Note this is still an experimental type and is primarily intended to store infinite parameter reference tuples and point variable support value tuples. Some of the notable capabilities are exemplified below.
Example
julia> julia> tuple = (3., [-2., 4.], ones(2, 2))
(3.0, [-2.0, 4.0], [1.0 1.0; 1.0 1.0])
julia> vt = VectorTuple(tuple) # make by listing items (notice everything is a vector)
(3.0, [-2.0, 4.0], [1.0 1.0; 1.0 1.0])
julia> vt[2] # linear indexing
-2.0
julia> vt[2, 2] # tuple indexing (note the second index is treated linearly)
4.0
julia> vt[6:end] # linear slicing
2-element Array{Float64,1}:
1.0
1.0
julia> vt[2:3, :] # tuple slicing
2-element Array{Array{Float64,1},1}:
[-2.0, 4.0]
[1.0, 1.0, 1.0, 1.0]
julia> tuple2 = Tuple(vt) # rebuild original Tuple with original indices
(3.0, [-2.0, 4.0], [1.0 1.0; 1.0 1.0])
julia> restricted_copy(vt, [true, false, true]) # make a copy with deleted elements
(3.0, [1.0 1.0; 1.0 1.0])Semi-Infinite Variables
InfiniteOpt.SemiInfinite — Type
SemiInfinite{T} <: InfOptVariableTypeA DataType to assist in making semi-infinite variables. This can be passed as an extra argument to @variable to make such a variable:
@variable(model, var_expr, SemiInfinite(inf_var, parameter_values...), kwargs...)Here parameter_values must match the format of the infinite parameter references associated with the infinite variable inf_var and can be comprised of both real valued supports and/or infinite parameters.
Fields
infinite_variable_ref::GeneralVariableRefparameter_values::VectorTuple{T}: The infinite parameters and/or infinite parameter support values the variable will depend on.
JuMP.build_variable — Method
JuMP.build_variable(_error::Function, info::JuMP.VariableInfo,
var_type::SemiInfinite)::SemiInfiniteVariable{GeneralVariableRef}Build and return a semi-infinite variable based on info and var_type. Errors if the information stored in var_type is invalid. See SemiInfinite for more information.
Example
julia> y
y(t, x)
julia> info = VariableInfo(false, 0, false, 0, false, 0, true, 0, false, false);
julia> semi_inf_var = build_variable(error, info, SemiInfinite(y, t, 0));JuMP.build_variable — Method
JuMP.build_variable(
_error::Function,
ivref::GeneralVariableRef,
eval_support::Vector{Float64},
[restricted_info::RestrictedDomainInfo];
[check::Bool = true]
)::SemiInfiniteVariable{GeneralVariableRef}Extend the JuMP.build_variable function to build a semi-infinite variable based on the infinite variable/derivative/parameter function ivref with reduction support eval_support. Will check that input is appropriate if check = true. Errors if ivref is not an infinite variable, eval_support violate infinite parameter domains, or if the support dimensions don't match the infinite parameter dimensions of ivref. This is intended an internal method for use in evaluating measures.
JuMP.add_variable — Method
JuMP.add_variable(
model::InfiniteModel,
var::SemiInfiniteVariable,
[name::String = ""]
)::GeneralVariableRefExtend the JuMP.add_variable function to accomodate InfiniteOpt semi-infinite variable types. Adds var to the infinite model model and returns a GeneralVariableRef. Primarily intended to be an internal function used in evaluating measures.
InfiniteOpt.SemiInfiniteVariable — Type
SemiInfiniteVariable{
I <: GeneralVariableRef,
} <: JuMP.AbstractVariableA DataType for storing semi-infinite variables which partially support an infinite variable.
Fields
info::RestrictedDomainInfo: Distinguished domain info.infinite_variable_ref::I: The original infinite/derivative variable.eval_support::Vector{Float64}: The evaluated parameter values that corresponds to the vectorized infinite parameters ofinfinite_variable_ref. Any infinite parameter not replaced by a value is represented with aNaN.group_int_idxs::Vector{Int}: The parameter group integer indices associated with the evaluatedparameter_refs.
InfiniteOpt.RestrictedDomainInfo — Type
RestrictedDomainInfoA structure for storing variable domain information of semi-infinite and point variables. By default, these variables will inherit the domain of their underlying infinite variable. This structure stores the attributes that overide the domain of the infinite variable. This not intended to be used by users directly unless they are creating a new transformation backend.
InfiniteOpt.SemiInfiniteVariableIndex — Type
SemiInfiniteVariableIndex <: ObjectIndexA DataType for storing the index of a SemiInfiniteVariable.
Fields
value::Int64: The index value.
InfiniteOpt.SemiInfiniteVariableRef — Type
SemiInfiniteVariableRef <: DispatchVariableRefA DataType for partially transcripted infinite dimensional variable references. This is used to expand measures that contain infinite variables that are not fully transcripted by the measure.
Fields
model::InfiniteModel: Infinite model.index::SemiInfiniteVariableIndex: Index of the variable in model.
Point Variables
InfiniteOpt.Point — Type
Point{T <: Real} <: InfOptVariableTypeA DataType to assist in making point variables. This can be passed as an extra argument to @variable to make such a variable:
@variable(model, var_expr, Point(inf_var, parameter_values...), args...,
kwargs...)Here parameter_values must match the format of the infinite parameter references associated with the infinite variable inf_var and can be comprised of both real valued supports.
Fields
infinite_variable_ref::GeneralVariableRefparameter_values::VectorTuple{T}: The infinite parameter support values the variable will depend on.
JuMP.build_variable — Method
JuMP.build_variable(
_error::Function,
info::JuMP.VariableInfo,
var_type::Point
)::PointVariableBuild and return a point variable based on info and var_type. Errors if the information stored in var_type is invalid. See Point for more information. This is intended to enable the use of @variable.
JuMP.add_variable — Method
JuMP.add_variable(
model::InfiniteModel,
var::PointVariable,
[name::String = ""]
)::GeneralVariableRefExtend the JuMP.add_variable function to accomodate PointVariable variable types. Adds a variable to an infinite model model and returns a GeneralVariableRef. Primarily intended to be an internal function of the constructor macro @variable. However, it can be used in combination with JuMP.build_variable to add variables to an infinite model object. Errors if an invalid infinite variable reference is included in var.
Example
julia> @infinite_parameter(m, t in [0, 10]);
julia> info = VariableInfo(false, 0, false, 0, false, 0, true, 0, false, false);
julia> inf_var = build_variable(error, info, Infinite(t));
julia> ivref = add_variable(m, inf_var, "var_name")
var_name(t)
julia> pt_var = build_variable(error, ivref, Collections.VectorTuple(0.5));
julia> pvref = add_variable(m, pt_var, "var_alias")
var_aliasInfiniteOpt.PointVariable — Type
PointVariable{
I <: GeneralVariableRef
} <: JuMP.AbstractVariableA DataType for storing point variable information. Note that the elements parameter_values field must match the format of the parameter reference tuple defined in InfiniteVariable
Fields
info::RestrictedDomainInfo: Domain info.infinite_variable_ref::I: The infinite variable/derivative reference associated with the point variable.parameter_values::Vector{Float64}: The infinite parameter values defining the point.
InfiniteOpt.PointVariableIndex — Type
PointVariableIndex <: ObjectIndexA DataType for storing the index of a PointVariable.
Fields
value::Int64: The index value.
InfiniteOpt.PointVariableRef — Type
PointVariableRef <: FiniteRefA DataType for variables defined at a transcipted point (e.g., second stage variable at a particular scenario, dynamic variable at a discretized time point).
Fields
model::InfiniteModel: Infinite model.index::PointVariableIndex: Index of the variable in model.
Finite Variables
Note that finite variables simply correspond to using JuMP.ScalarVariable which originates from JuMP.jl as well. In other words, these are defined via JuMP.@variable without specifying any InfOptVariableType.
JuMP.add_variable — Method
JuMP.add_variable(model::InfiniteModel, var::JuMP.ScalarVariable,
[name::String = ""])::GeneralVariableRefExtend the JuMP.add_variable function to accomodate finite (scalar) variable types. Adds a variable to an infinite model model and returns a GeneralVariableRef. Primarily intended to be an internal function of the constructor macro @variable. However, it can be used in combination with JuMP.build_variable to add finite variables to an infinite model object.
Examples
julia> f_var = build_variable(error, info);
julia> fvref = add_variable(m, f_var, "var_name")
var_nameInfiniteOpt.FiniteVariableIndex — Type
FiniteVariableIndex <: ObjectIndexA DataType for storing the index of a JuMP.ScalarVariable.
Fields
value::Int64: The index value.
InfiniteOpt.FiniteVariableRef — Type
FiniteVariableRef <: FiniteRefA DataType for finite fixed variable references (e.g., first stage variables, steady-state variables).
Fields
model::InfiniteModel: Infinite model.index::FiniteVariableIndex: Index of the variable in model.
Queries
General
JuMP.variable_by_name — Method
JuMP.variable_by_name(
model::InfiniteModel,
name::String
)::Union{GeneralVariableRef, Nothing}Extend JuMP.variable_by_name for InfiniteModel objects. Return the variable reference assoociated with a variable name. Errors if multiple variables have the same name. Returns nothing if no such name exists.
Examples
julia> variable_by_name(m, "var_name")
var_name
julia> variable_by_name(m, "fake_name")
JuMP.num_variables — Method
JuMP.num_variables(model::InfiniteModel, [type])::IntExtend JuMP.num_variables to return the number of InfiniteOpt variables assigned to model. By default, the total number of infinite, semi-infinite, point, and finite variables is returned. The amount of a particular type is obtained by specifying the concrete variable type via type. Type options include:
InfiniteVariable: all infinite variablesSemiInfiniteVariable: all semi-infinite variablesPointVariable: all point variablesFiniteVariable: all finite variables
Example
julia> num_variables(model)
3
julia> num_variables(model, InfiniteVariable)
2JuMP.all_variables — Method
JuMP.all_variables(model::InfiniteModel, [type])::Vector{GeneralVariableRef}Extend JuMP.all_variables] to return a list of all the variable references associated with model. By default, all of the infinite, semi-infinite, point, and finite variables is returned. Those of a particular type is obtained by specifying the concrete variable type via type. Type options include:
InfiniteVariable: all infinite variablesSemiInfiniteVariable: all semi-infinite variablesPointVariable: all point variablesFiniteVariable: all finite variables
Examples
julia> all_variables(model)
4-element Array{GeneralVariableRef,1}:
y(t)
w(t, x)
y(0)
z
julia> all_variables(model, PointVariable)
1-element Array{GeneralVariableRef,1}:
y(0)JuMP.has_lower_bound — Method
JuMP.has_lower_bound(vref::UserDecisionVariableRef)::BoolExtend JuMP.has_lower_bound to return a Bool whether an InfiniteOpt variable has a lower bound.
Example
julia> has_lower_bound(vref)
trueJuMP.lower_bound — Method
JuMP.lower_bound(vref::DecisionVariableRef)::Union{Float64, ParameterFunction}Extend JuMP.lower_bound to return the lower bound of an InfiniteOpt variable. Errors if vref doesn't have a lower bound.
Example
julia> lower_bound(vref)
0.0JuMP.LowerBoundRef — Method
JuMP.LowerBoundRef(vref::DecisionVariableRef)::InfOptConstraintRefExtend JuMP.LowerBoundRef to extract a constraint reference for the lower bound of vref.
Example
var ≥ 0.0JuMP.has_upper_bound — Method
JuMP.has_upper_bound(vref::DecisionVariableRef)::BoolExtend JuMP.has_upper_bound to return a Bool whether an InfiniteOpt variable has an upper bound.
Example
julia> has_upper_bound(vref)
trueJuMP.upper_bound — Method
JuMP.upper_bound(vref::DecisionVariableRef)::Union{Float64, ParameterFunction}Extend JuMP.upper_bound to return the upper bound of an InfiniteOpt variable. Errors if vref doesn't have a upper bound.
Example
julia> upper_bound(vref)
0.0JuMP.UpperBoundRef — Method
JuMP.UpperBoundRef(vref::DecisionVariableRef)::InfOptConstraintRefExtend JuMP.UpperBoundRef to extract a constraint reference for the upper bound of vref.
Example
julia> cref = UpperBoundRef(vref)
var ≤ 1.0JuMP.is_fixed — Method
JuMP.is_fixed(vref::DecisionVariableRef)::BoolExtend JuMP.is_fixed to return Bool whether an InfiniteOpt variable is fixed.
Example
julia> is_fixed(vref)
trueJuMP.fix_value — Method
JuMP.fix_value(vref::DecisionVariableRef)::Union{Float64, ParameterFunction}Extend JuMP.fix_value to return the fix value of an InfiniteOpt variable. Errors if variable is not fixed.
Example
julia> fix_value(vref)
0.0JuMP.FixRef — Method
JuMP.FixRef(vref::DecisionVariableRef)::InfOptConstraintRefExtend JuMP.FixRef to return the constraint reference of the fix constraint associated with vref. Errors vref is not fixed.
Examples
julia> cref = FixRef(vref)
var = 1.0JuMP.start_value — Method
JuMP.start_value(vref::DecisionVariableRef)::Union{Nothing, Float64, ParameterFunction}Extend JuMP.start_value to return starting value of InfiniteOpt variable if it has one. Returns nothing otherwise.
Example
julia> start_value(vref)
0.0JuMP.is_binary — Method
JuMP.is_binary(vref::DecisionVariableRef)::BoolExtend JuMP.is_binary to return Bool whether an InfiniteOpt variable is binary.
Example
trueJuMP.BinaryRef — Method
JuMP.BinaryRef(vref::DecisionVariableRef)::InfOptConstraintRefExtend JuMP.BinaryRef to return a constraint reference to the constraint constrainting vref to be binary. Errors if one does not exist.
Example
julia> cref = BinaryRef(vref)
var binaryJuMP.is_integer — Method
JuMP.is_integer(vref::DecisionVariableRef)::BoolExtend JuMP.is_integer to return Bool whether an InfiniteOpt variable is integer.
Example
julia> is_integer(vref)
trueJuMP.IntegerRef — Method
JuMP.IntegerRef(vref::DecisionVariableRef)::InfOptConstraintRefExtend JuMP.IntegerRef to return a constraint reference to the constraint constrainting vref to be integer. Errors if one does not exist.
Example
julia> cref = IntegerRef(vref)
var integerInfiniteOpt.is_used — Method
is_used(vref::DecisionVariableRef)::BoolReturn a Bool indicating if vref is used in the model.
Example
julia> is_used(vref)
trueInfiniteOpt.used_by_constraint — Method
used_by_constraint(vref::DecisionVariableRef)::BoolReturn a Bool indicating if vref is used by a constraint.
Example
julia> used_by_constraint(vref)
falseInfiniteOpt.used_by_measure — Method
used_by_measure(vref::DecisionVariableRef)::BoolReturn a Bool indicating if vref is used by a measure.
Example
julia> used_by_measure(vref)
trueInfiniteOpt.used_by_objective — Method
used_by_objective(vref::DecisionVariableRef)::BoolReturn a Bool indicating if vref is used by the objective.
Example
julia> used_by_objective(vref)
trueInfinite Variables
InfiniteOpt.parameter_refs — Method
parameter_refs(vref::InfiniteVariableRef)::TupleReturn the parameter references associated with the infinite variable vref. This is formatted as a Tuple of containing the parameter references as they inputted to define vref.
Example
julia> @variable(model, T, Infinite(t))
T(t)
julia> parameter_refs(T)
(t,)InfiniteOpt.parameter_list — Method
parameter_list(vref::InfiniteVariableRef)::Vector{GeneralVariableRef}Return a vector of the parameter references that vref depends on. This is primarily an internal method where parameter_refs is intended as the preferred user function.
InfiniteOpt.raw_parameter_refs — Method
raw_parameter_refs(vref::InfiniteVariableRef)::VectorTuple{GeneralVariableRef}Return the raw VectorTuple of the parameter references that vref depends on. This is primarily an internal method where parameter_refs is intended as the preferred user function.
InfiniteOpt.is_used — Method
is_used(vref::Union{InfiniteVariableRef, DerivativeRef})::BoolReturn a Bool indicating if vref is used in the model.
Example
julia> is_used(vref)
falseInfiniteOpt.used_by_derivative — Method
used_by_derivative(vref::Union{InfiniteVariableRef, DerivativeRef})::BoolReturn a Bool indicating if vref is used by a derivative.
Example
julia> used_by_derivative(vref)
trueInfiniteOpt.used_by_point_variable — Method
used_by_point_variable(vref::Union{InfiniteVariableRef, DerivativeRef})::BoolReturn a Bool indicating if vref is used by a point variable.
Example
julia> used_by_point_variable(vref)
falseInfiniteOpt.used_by_semi_infinite_variable — Method
used_by_semi_infinite_variable(vref::Union{InfiniteVariableRef, DerivativeRef})::BoolReturn a Bool indicating if vref is used by a semi-infinite variable.
Example
julia> used_by_semi_infinite_variable(vref)
falseInfiniteOpt.parameter_group_int_indices — Method
parameter_group_int_indices(vref::InfiniteVariableRef)::Vector{Int}Return the list of infinite parameter group integer indices used by vref.
InfiniteOpt.core_object — Method
core_object(vref::InfiniteVariableRef)::InfiniteVariableRetrieve the underlying core InfiniteVariable object for vref. This is intended as an advanced method for developers.
Semi-Infinite Variables
InfiniteOpt.infinite_variable_ref — Method
infinite_variable_ref(vref::SemiInfiniteVariableRef)::GeneralVariableRefReturn the infinite variable/derivative/parameter function reference associated with the semi-infinite variable vref.
Example
julia> infinite_variable_ref(vref)
g(t, x)InfiniteOpt.parameter_refs — Method
parameter_refs(vref::SemiInfiniteVariableRef)::TupleReturn the infinite parameter references associated with the semi-infinite variable vref. This is formatted as a Tuple of containing the parameter references as they were inputted to define the untranscripted infinite variable except, the evaluated parameters are excluded.
Example
julia> parameter_refs(vref)
(t, [x[1], x[2]])InfiniteOpt.parameter_list — Method
parameter_list(vref::SemiInfiniteVariableRef)::Vector{GeneralVariableRef}Return a vector of the parameter references that vref depends on. This is primarily an internal method where parameter_refs is intended as the preferred user function.
InfiniteOpt.raw_parameter_refs — Method
raw_parameter_refs(vref::Union{SemiInfiniteVariableRef, SemiInfiniteVariable})::VectorTupleReturn the raw VectorTuple of the parameter references that vref depends on. This is primarily an internal method where parameter_refs is intended as the preferred user function.
InfiniteOpt.eval_support — Method
eval_support(vref::SemiInfiniteVariableRef)::Vector{Float64}Return the evaluation supports associated with the semi-infinite variable vref. Any element corresponding to an infinite parameter that is not evaluated is filled with a NaN.
Example
julia> supp = eval_support(vref)
[0.0, NaN]InfiniteOpt.is_used — Method
is_used(vref::SemiInfiniteVariableRef)::BoolReturn a Bool indicating if vref is used in the model.
Example
julia> is_used(vref)
trueInfiniteOpt.used_by_derivative — Method
used_by_derivative(vref::SemiInfiniteVariableRef)::BoolReturn a Bool indicating if vref is used by a derivative.
Example
julia> used_by_derivative(vref)
trueInfiniteOpt.parameter_group_int_indices — Method
parameter_group_int_indices(vref::SemiInfiniteVariableRef)::Vector{Int}Return the list of infinite parameter group integer indices used by vref.
InfiniteOpt.core_object — Method
core_object(vref::SemiInfiniteVariableRef)::SemiInfiniteVariableRetrieve the underlying core [SemiInfiniteVariable] object for vref. This is intended as an advanced method for developers.
Point Variables
InfiniteOpt.infinite_variable_ref — Method
infinite_variable_ref(vref::PointVariableRef)::GeneralVariableRefReturn the InfiniteVariableRef associated with the point variable vref.
Example
julia> @variable(model, T, Infinite(t))
T(t)
julia> @variable(model, T0, Point(T, 0))
T0
julia> infinite_variable_ref(T0)
T(t)InfiniteOpt.parameter_values — Method
parameter_values(vref::PointVariableRef)::TupleReturn the support point associated with the point variable vref.
Example
julia> @variable(model, T, Infinite(t))
T(t)
julia> @variable(model, T0, Point(T, 0))
T0
julia> parameter_values(T0)
(0,)InfiniteOpt.raw_parameter_values — Method
raw_parameter_values(vref::PointVariableRef)::Vector{Float64}Return the raw support point values associated with the point variable vref.
InfiniteOpt.core_object — Method
core_object(vref::PointVariableRef)::PointVariableRetrieve the underlying core [PointVariable] object for vref. This is intended as an advanced method for developers.
Finite Variables
InfiniteOpt.core_object — Method
core_object(vref::FiniteVariableRef)::JuMP.ScalarVariableRetrieve the underlying core JuMP.ScalarVariable object for vref. This is intended as an advanced method for developers.
Modification
General
JuMP.set_name — Method
JuMP.set_name(vref::DecisionVariableRef, name::String)::NothingExtend JuMP.set_name to set names of decision variables.
Example
julia> set_name(vref, "var_name")
julia> name(vref)
"var_name"JuMP.set_lower_bound — Method
JuMP.set_lower_bound(vref::DecisionVariableRef, lower::Union{Real, Function})::NothingExtend JuMP.set_lower_bound to specify the lower bound of an InfiniteOpt variable vref. Errors if vref is fixed.
Example
julia> set_lower_bound(vref, -1)
julia> lower_bound(vref)
-1.0JuMP.delete_lower_bound — Method
JuMP.delete_lower_bound(vref::DecisionVariableRef)::NothingExtend JuMP.delete_lower_bound to delete lower bound of vref. Errors if it doesn't have a lower bound.
Example
julia> delete_lower_bound(vref)
julia> has_lower_bound(vref)
falseJuMP.set_upper_bound — Method
JuMP.set_upper_bound(vref::DecisionVariableRef, upper::Union{Real, Function})::NothingExtend JuMP.set_upper_bound to specify the upper bound of an InfiniteOpt variable vref. Errors if vref is fixed.
Example
julia> set_upper_bound(vref, 1)
julia> upper_bound(vref)
1.0JuMP.delete_upper_bound — Method
JuMP.delete_upper_bound(vref::DecisionVariableRef)::NothingExtend JuMP.delete_upper_bound to delete the upper bound of vref. Errors if it doesn't have an upper bound.
Example
julia> delete_upper_bound(vref)
julia> has_upper_bound(vref)
falseJuMP.fix — Method
JuMP.fix(
vref::DecisionVariableRef,
value::Union{Real, Function};
force::Bool = false
)::NothingExtend JuMP.fix to fix the value of an InfiniteOpt variable. Errors if variable has a lower and/or an upper bound(s) unless force = true.
Examples
julia> fix(vref, 3)
julia> fix_value(vref)
3.0
julia> fix(vref2, 2, force = true)
julia> fix_value(vref2)
2.0JuMP.unfix — Method
JuMP.unfix(vref::DecisionVariableRef)::NothingExtend JuMP.unfix to unfix vref. Errors if it is not fixed.
Example
julia> unfix(vref)
julia> is_fixed(vref)
falseJuMP.set_start_value — Method
JuMP.set_start_value(vref::DecisionVariableRef, value::Union{Real, Function})::NothingExtend JuMP.set_start_value to specify the start value of InfiniteOpt variables.
Example
julia> set_start_value(vref, 1)
julia> start_value(vref)
1.0JuMP.set_binary — Method
JuMP.set_binary(vref::DecisionVariableRef)::NothingExtend JuMP.set_binary to specify an InfiniteOpt variable as a binary variable. Errors if vref is an integer variable.
Example
julia> set_binary(vref)
julia> is_binary(vref)
trueJuMP.unset_binary — Method
JuMP.unset_binary(vref::DecisionVariableRef)::NothingExtend JuMP.unset_binary to unset vref as a binary variable. Errors if it is not binary.
julia> unset_binary(vref)
julia> is_binary(vref)
falseJuMP.set_integer — Method
JuMP.set_integer(vref::DecisionVariableRef)::NothingExtend JuMP.set_integer to specify an InfiniteOpt variable as a integer variable. Errors if vref is an binary variable.
Example
julia> set_integer(vref)
julia> is_integer(vref)
trueJuMP.unset_integer — Method
JuMP.unset_integer(vref::DecisionVariableRef)::NothingExtend JuMP.unset_integer to unset vref as an integer variable. Errors if it is not an integer variable.
julia> unset_integer(vref)
julia> is_integer(vref)
falseJuMP.relax_integrality — Method
JuMP.relax_integrality(model::InfiniteModel)::FunctionModifies 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.
- 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> undo_relax = relax_integrality(model);
julia> print(model)
Min x + ∫{t ∈ [0, 10]}(y(t))
Subject to
x ≥ 0.0
y(t) ≥ 1.0
x ≤ 1.0
y(t) ≤ 10.0
julia> undo_relax()
julia> print(model)
Min x + ∫{t ∈ [0, 10]}(y(t))
Subject to
y(t) ≥ 1.0
y(t) ≤ 10.0
y(t) integer
x binaryJuMP.set_start_values — Method
JuMP.set_start_values(
model::InfiniteModel;
[degree::Interpolations.Degree = Interpolations.Linear()],
[kwargs...]
)::NothingSet the start values of all variables in model based on its optimized values. For transcription backends, this will create degree interpolation functions for infinite variables. Note that the Interpolations.jl package must be loaded. This is useful for warmstarts. See also warmstart_backend_start_values to update backend primal and dual start values efficiently without rebuilding the backend.
Example
using Interpolations
optimize!(model)
set_start_values(model)JuMP.delete — Method
JuMP.delete(model::InfiniteModel, vref::DecisionVariableRef)::NothingExtend JuMP.delete to delete InfiniteOpt variables and their dependencies. Errors if variable is invalid, meaning it has already been deleted or it belongs to another model.
Example
julia> print(model)
Min measure(g(t)*t) + z
Subject to
z ≥ 0.0
g(t) + z ≥ 42.0, ∀ t ∈ [0, 6]
g(0.5) = 0
julia> delete(model, g)
julia> print(model)
Min measure(t) + z
Subject to
z ≥ 0.0
z ≥ 42.0Infinite Variables
InfiniteOpt.constant_over_collocation — Method
constant_over_collocation(vref::InfiniteVariableRef, pref::GeneralVariableRef)::NothingAdds constraints such that vref is constant over internal collocation points generated within finite elements for pref. This is prinicipally useful for manipulated variables in control problems that use OrthogonalCollocation. Errors if pref is not a single independent infinite parameter and/or it is not used by vref.
Example
@infinite_parameter(model, t in [0, 1], deriviative_method = OrthogonalCollocation(3))
@variable(model, y_state, Infinite(t))
@variable(model, y_control, Infinite(t))
@constraint(model, ∂(y_state, t) == y_state^2)
@constraint(model, y_state(0) == 0)
constant_over_collocation(y_control, t)Semi-Infinite Variables
JuMP.set_name — Method
JuMP.set_name(vref::DecisionVariableRef, name::String)::NothingExtend JuMP.set_name to set names of decision variables.
Example
julia> set_name(vref, "var_name")
julia> name(vref)
"var_name"