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

InfiniteOpt.InfiniteType
Infinite{VT <: VectorTuple} <: InfOptVariableType

A 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::VT: The infinite parameters the variable will depend on.
source
JuMP.build_variableMethod
JuMP.build_variable(_error::Function, info::JuMP.VariableInfo, 
                    var_type::Infinite)::InfiniteVariable{GeneralVariableRef}

Build 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));
source
JuMP.add_variableMethod
JuMP.add_variable(model::InfiniteModel, var::InfiniteVariable,
                  [name::String = ""])::GeneralVariableRef

Extend 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)
source
InfiniteOpt.InfiniteVariableType
InfiniteVariable{F <: Function, VT <: VectorTuple} <: JuMP.AbstractVariable

A 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 info.start should contain a start value function that generates the start value for a given infinite parameter support. This function should map a support to a start value using user-formatting if is_vector_start = false, otherwise it should do the mapping using a single support vector as input.

Fields

  • info::JuMP.VariableInfo{Float64, Float64, Float64, F}: JuMP variable information. Here the start value is a function that maps the parameter values to a start value.
  • parameter_refs::VT: The infinite parameter references that parameterize the variable.
  • parameter_nums::Vector{Int}: The parameter numbers of parameter_refs.
  • object_nums::Vector{Int}: The parameter object numbers associated with parameter_refs.
  • is_vector_start::Bool: Does the start function take support values formatted as vectors?
source
InfiniteOpt.restrictFunction
restrict(ivref::GeneralVariableRef, supps...)::GeneralVariableRef

Restrict 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...) if supps are a complete support point
  • Equivalent to @variable(model, variable_type = SemiInfinite(ivref, supps...) if supps are 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])
source
InfiniteOpt.VariableDataType
VariableData{V <: JuMP.AbstractVariable} <: AbstractDataObject

A 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.
source
InfiniteOpt.InfiniteVariableRefType
InfiniteVariableRef <: DispatchVariableRef

A 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.
source
InfiniteOpt.Collections.VectorTupleType
VectorTuple{T, I <: Tuple}

A collection DataType for storing a Tuple of singular elements of type T and/or AbstractArray{<:T}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> tuple = (3, [-2, 4], ones(2, 2))
(3, [-2, 4], [1.0 1.0; 1.0 1.0])

julia> vt = VectorTuple(tuple) # make by listing items (notice everything is a vector)
([3.0], [3.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> inds = [true, true, true, false, true, true, true];

julia> restricted_copy(vt, delete_locs) # make a copy with deleted elements
([3.0], [-2.0, 4.0], [1.0, 1.0, 1.0])

julia> Tuple(vt) # The 3rd element becomes a SparseAxisArray because of deletion
([3.0], [-2.0, 4.0],   [1, 2]  =  1.0
  [2, 2]  =  1.0
  [2, 1]  =  1.0)
source

Semi-Infinite

InfiniteOpt.SemiInfiniteType
SemiInfinite{V, VT <: VectorTuple} <: InfOptVariableType

A 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::V
  • parameter_values::VT: The infinite parameters and/or infinite parameter support values the variable will depend on.
source
JuMP.build_variableMethod
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));
source
JuMP.build_variableMethod
JuMP.build_variable(_error::Function, ivref::GeneralVariableRef,
                    eval_supports::Dict{Int, Float64}; [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_supports. Will check that input is appropriate if check = true. Errors if ivref is not an infinite variable, eval_supports 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.

source
JuMP.add_variableMethod
JuMP.add_variable(model::InfiniteModel, var::SemiInfiniteVariable,
                  [name::String = ""])::GeneralVariableRef

Extend 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.

source
InfiniteOpt.SemiInfiniteVariableType
SemiInfiniteVariable{I <: GeneralVariableRef} <: JuMP.AbstractVariable

A DataType for storing semi-infinite variables which partially support an infinite variable.

Fields

  • infinite_variable_ref::I: The original infinite/derivvative variable.
  • eval_supports::Dict{Int, Float64}: The original parameter tuple linear indices to the evaluation supports.
  • parameter_nums::Vector{Int}: The parameter numbers associated with the evaluated parameter_refs.
  • object_nums::Vector{Int}: The parameter object numbers associated with the evaluated parameter_refs.
source
InfiniteOpt.SemiInfiniteVariableRefType
SemiInfiniteVariableRef <: DispatchVariableRef

A 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.
source

Point

InfiniteOpt.PointType
Point{V, VT <: VectorTuple} <: InfOptVariableType

A 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::V
  • parameter_values::VT: The infinite parameter support values the variable will depend on.
source
JuMP.build_variableMethod
JuMP.build_variable(_error::Function, info::JuMP.VariableInfo, 
                    var_type::Point)::InfiniteVariable{GeneralVariableRef}

Build 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.

Example

julia> y
y(t)

julia> info = VariableInfo(false, 0, false, 0, false, 0, true, 0, false, false);

julia> pt_var = build_variable(error, info, SemiInfinite(y, 0));
source
JuMP.add_variableMethod
JuMP.add_variable(model::InfiniteModel, var::PointVariable,
                  [name::String = ""])::GeneralVariableRef

Extend 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, info, Point(ivref, 0.5));

julia> pvref = add_variable(m, pt_var, "var_alias")
var_alias
source
InfiniteOpt.PointVariableType
PointVariable{I <: GeneralVariableRef} <: JuMP.AbstractVariable

A 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::JuMP.VariableInfo{Float64, Float64, Float64, Float64}: JuMP Variable information.
  • 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.
source
InfiniteOpt.PointVariableRefType
PointVariableRef <: FiniteRef

A 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.
source

Finite

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_variableMethod
JuMP.add_variable(model::InfiniteModel, var::JuMP.ScalarVariable,
                  [name::String = ""])::GeneralVariableRef

Extend 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_name
source
InfiniteOpt.FiniteVariableRefType
FiniteVariableRef <: FiniteRef

A 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.
source

Queries

General

JuMP.nameMethod
JuMP.name(vref::DecisionVariableRef)::String

Extend JuMP.name to return the names of InfiniteOpt variables.

Example

julia> name(vref)
"var_name"
source
JuMP.variable_by_nameMethod
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")
source
JuMP.num_variablesMethod
JuMP.num_variables(model::InfiniteModel, [type])::Int

Extend 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 variables
  • SemiInfiniteVariable: all semi-infinite variables
  • PointVariable: all point variables
  • FiniteVariable: all finite variables

Example

julia> num_variables(model)
3

julia> num_variables(model, InfiniteVariable)
2
source
JuMP.all_variablesMethod
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 variables
  • SemiInfiniteVariable: all semi-infinite variables
  • PointVariable: all point variables
  • FiniteVariable: 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)
source
JuMP.has_lower_boundMethod
JuMP.has_lower_bound(vref::UserDecisionVariableRef)::Bool

Extend JuMP.has_lower_bound to return a Bool whether an InfiniteOpt variable has a lower bound.

Example

julia> has_lower_bound(vref)
true
source
JuMP.lower_boundMethod
JuMP.lower_bound(vref::UserDecisionVariableRef)::Float64

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.0
source
JuMP.LowerBoundRefMethod
JuMP.LowerBoundRef(vref::UserDecisionVariableRef)::InfOptConstraintRef

Extend JuMP.LowerBoundRef to extract a constraint reference for the lower bound of vref.

Example

var ≥ 0.0
source
JuMP.has_upper_boundMethod
JuMP.has_upper_bound(vref::UserDecisionVariableRef)::Bool

Extend JuMP.has_upper_bound to return a Bool whether an InfiniteOpt variable has an upper bound.

Example

julia> has_upper_bound(vref)
true
source
JuMP.upper_boundMethod
JuMP.upper_bound(vref::UserDecisionVariableRef)::Float64

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.0
source
JuMP.UpperBoundRefMethod
JuMP.UpperBoundRef(vref::UserDecisionVariableRef)::InfOptConstraintRef

Extend JuMP.UpperBoundRef to extract a constraint reference for the upper bound of vref.

Example

julia> cref = UpperBoundRef(vref)
var ≤ 1.0
source
JuMP.is_fixedMethod
JuMP.is_fixed(vref::UserDecisionVariableRef)::Bool

Extend JuMP.is_fixed to return Bool whether an InfiniteOpt variable is fixed.

Example

julia> is_fixed(vref)
true
source
JuMP.fix_valueMethod
JuMP.fix_value(vref::UserDecisionVariableRef)::Float64

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.0
source
JuMP.FixRefMethod
JuMP.FixRef(vref::UserDecisionVariableRef)::InfOptConstraintRef

Extend 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.0
source
JuMP.start_valueMethod
JuMP.start_value(vref::UserDecisionVariableRef)::Union{Nothing, Float64}

Extend JuMP.start_value to return starting value of InfiniteOpt variable if it has one. Returns nothing otherwise.

Example

julia> start_value(vref)
0.0
source
JuMP.is_binaryMethod
JuMP.is_binary(vref::UserDecisionVariableRef)::Bool

Extend JuMP.is_binary to return Bool whether an InfiniteOpt variable is binary.

Example

true
source
JuMP.BinaryRefMethod
JuMP.BinaryRef(vref::UserDecisionVariableRef)::InfOptConstraintRef

Extend 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 binary
source
JuMP.is_integerMethod
JuMP.is_integer(vref::UserDecisionVariableRef)::Bool

Extend JuMP.is_integer to return Bool whether an InfiniteOpt variable is integer.

Example

julia> is_integer(vref)
true
source
JuMP.IntegerRefMethod
JuMP.IntegerRef(vref::UserDecisionVariableRef)::InfOptConstraintRef

Extend 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 integer
source
InfiniteOpt.is_usedMethod
is_used(vref::DecisionVariableRef)::Bool

Return a Bool indicating if vref is used in the model.

Example

julia> is_used(vref)
true
source
InfiniteOpt.used_by_constraintMethod
used_by_constraint(vref::DecisionVariableRef)::Bool

Return a Bool indicating if vref is used by a constraint.

Example

julia> used_by_constraint(vref)
false
source
InfiniteOpt.used_by_measureMethod
used_by_measure(vref::DecisionVariableRef)::Bool

Return a Bool indicating if vref is used by a measure.

Example

julia> used_by_measure(vref)
true
source
InfiniteOpt.used_by_objectiveMethod
used_by_objective(vref::DecisionVariableRef)::Bool

Return a Bool indicating if vref is used by the objective.

Example

julia> used_by_objective(vref)
true
source

Infinite

InfiniteOpt.start_value_functionMethod
start_value_function(vref::Union{InfiniteVariableRef, DerivativeRef})::Union{Nothing, Function}

Return the function that is used to generate the start values of vref for particular support values. Returns nothing if no start behavior has been specified.

Example

julia> start_value_function(vref)
my_start_func
source
InfiniteOpt.parameter_refsMethod
parameter_refs(vref::InfiniteVariableRef)::Tuple

Return 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,)
source
InfiniteOpt.parameter_listMethod
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.

source
InfiniteOpt.is_usedMethod
is_used(vref::Union{InfiniteVariableRef, DerivativeRef})::Bool

Return a Bool indicating if vref is used in the model.

Example

julia> is_used(vref)
false
source
InfiniteOpt.used_by_point_variableMethod
used_by_point_variable(vref::Union{InfiniteVariableRef, DerivativeRef})::Bool

Return a Bool indicating if vref is used by a point variable.

Example

julia> used_by_point_variable(vref)
false
source
InfiniteOpt.used_by_semi_infinite_variableMethod
used_by_semi_infinite_variable(vref::Union{InfiniteVariableRef, DerivativeRef})::Bool

Return a Bool indicating if vref is used by a semi-infinite variable.

Example

julia> used_by_semi_infinite_variable(vref)
false
source

Semi-Infinite

JuMP.lower_boundMethod
JuMP.lower_bound(vref::SemiInfiniteVariableRef)::Float64

Extend JuMP.lower_bound to return the lower bound of the original infinite variable of vref. Errors if vref doesn't have a lower bound.

Example

julia> lower_bound(vref)
0.0
source
JuMP.LowerBoundRefMethod
JuMP.LowerBoundRef(vref::SemiInfiniteVariableRef)::InfOptConstraintRef

Extend JuMP.LowerBoundRef to extract a constraint reference for the lower bound of the original infinite variable of vref.

Example

julia> cref = LowerBoundRef(vref)
var >= 0.0
source
JuMP.has_upper_boundMethod
JuMP.has_upper_bound(vref::SemiInfiniteVariableRef)::Bool

Extend JuMP.has_upper_bound to return a Bool whether the original infinite variable of vref has an upper bound.

Example

julia> has_upper_bound(vref)
true
source
JuMP.upper_boundMethod
JuMP.upper_bound(vref::SemiInfiniteVariableRef)::Float64

Extend JuMP.upper_bound to return the upper bound of the original infinite variable of vref. Errors if vref doesn't have a upper bound.

Example

julia> upper_bound(vref)
0.0
source
JuMP.UpperBoundRefMethod
JuMP.UpperBoundRef(vref::SemiInfiniteVariableRef)::InfOptConstraintRef

Extend JuMP.UpperBoundRef to extract a constraint reference for the upper bound of the original infinite variable of vref.

Example

julia> cref = UpperBoundRef(vref)
var <= 1.0
source
JuMP.is_fixedMethod
JuMP.is_fixed(vref::SemiInfiniteVariableRef)::Bool

Extend JuMP.is_fixed to return Bool whether the original infinite variable of vref is fixed.

Example

julia> is_fixed(vref)
true
source
JuMP.fix_valueMethod
JuMP.fix_value(vref::SemiInfiniteVariableRef)::Float64

Extend JuMP.fix_value to return the fix value of the original infinite variable of vref. Errors if variable is not fixed.

Example

julia> fix_value(vref)
0.0
source
JuMP.FixRefMethod
JuMP.FixRef(vref::SemiInfiniteVariableRef)::InfOptConstraintRef

Extend JuMP.FixRef to return the constraint reference of the fix constraint associated with the original infinite variable of vref. Errors vref is not fixed.

Examples

julia> cref = FixRef(vref)
var == 1.0
source
InfiniteOpt.start_value_functionMethod
start_value_function(vref::SemiInfiniteVariableRef)::Union{Nothing, Function}

Return the function that is used to generate the start values of vref for particular support values. Returns nothing if no start behavior has been specified.

Example

julia> start_value_func(vref)
my_func
source
JuMP.is_binaryMethod
JuMP.is_binary(vref::SemiInfiniteVariableRef)::Bool

Extend JuMP.is_binary to return Bool whether the original infinite variable of vref is binary.

Example

julia> is_binary(vref)
true
source
JuMP.BinaryRefMethod
JuMP.BinaryRef(vref::SemiInfiniteVariableRef)::InfOptConstraintRef

Extend JuMP.BinaryRef to return a constraint reference to the constraint constrainting the original infinite variable of vref to be binary. Errors if one does not exist.

Example

julia> cref = BinaryRef(vref)
var binary
source
JuMP.is_integerMethod
JuMP.is_integer(vref::SemiInfiniteVariableRef)::Bool

Extend JuMP.is_integer to return Bool whether the original infinite variable of vref is integer.

Example

julia> is_integer(vref)
true
source
JuMP.IntegerRefMethod
JuMP.IntegerRef(vref::SemiInfiniteVariableRef)::InfOptConstraintRef

Extend JuMP.IntegerRef to return a constraint reference to the constraint constrainting the original infinite variable of vref to be integer. Errors if one does not exist.

Example

julia> cref = IntegerRef(vref)
var integer
source
InfiniteOpt.infinite_variable_refMethod
infinite_variable_ref(vref::SemiInfiniteVariableRef)::GeneralVariableRef

Return the infinite variable/derivative/parameter function reference associated with the semi-infinite variable vref.

Example

julia> infinite_variable_ref(vref)
g(t, x)
source
InfiniteOpt.parameter_refsMethod
parameter_refs(vref::SemiInfiniteVariableRef)::Tuple

Return 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]])
source
InfiniteOpt.parameter_listMethod
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.

source
InfiniteOpt.eval_supportsMethod
eval_supports(vref::SemiInfiniteVariableRef)::Dict{Int, Float64}

Return the evaluation supports associated with the semi-infinite variable vref.

Example

julia> eval_supports(vref)
Dict{Int64,Float64} with 1 entry:
  1 => 0.5
source

Point

InfiniteOpt.infinite_variable_refMethod
infinite_variable_ref(vref::PointVariableRef)::GeneralVariableRef

Return 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)
source
InfiniteOpt.parameter_valuesMethod
parameter_values(vref::PointVariableRef)::Tuple

Return 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,)
source

Modification

General

JuMP.set_nameMethod
JuMP.set_name(vref::DecisionVariableRef, name::String)::Nothing

Extend JuMP.set_name to set names of decision variables.

Example

julia> set_name(vref, "var_name")

julia> name(vref)
"var_name"
source
JuMP.set_lower_boundMethod
JuMP.set_lower_bound(vref::UserDecisionVariableRef, lower::Real)::Nothing

Extend 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.0
source
JuMP.delete_lower_boundMethod
JuMP.delete_lower_bound(vref::UserDecisionVariableRef)::Nothing

Extend 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)
false
source
JuMP.set_upper_boundMethod
JuMP.set_upper_bound(vref::UserDecisionVariableRef, upper::Real)::Nothing

Extend 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.0
source
JuMP.delete_upper_boundMethod
JuMP.delete_upper_bound(vref::UserDecisionVariableRef)::Nothing

Extend 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)
false
source
JuMP.fixMethod
JuMP.fix(vref::UserDecisionVariableRef, value::Real;
         force::Bool = false)::Nothing

Extend 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.0
source
JuMP.unfixMethod
JuMP.unfix(vref::UserDecisionVariableRef)::Nothing

Extend JuMP.unfix to unfix vref. Errors if it is not fixed.

Example

julia> unfix(vref)

julia> is_fixed(vref)
false
source
JuMP.set_start_valueMethod
JuMP.set_start_value(vref::UserDecisionVariableRef, value::Real)::Nothing

Extend JuMP.set_start_value to specify the start value of InfiniteOpt variables.

Example

julia> set_start_value(vref, 1)

julia> start_value(vref)
1.0
source
JuMP.set_binaryMethod
JuMP.set_binary(vref::UserDecisionVariableRef)::Nothing

Extend 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)
true
source
JuMP.unset_binaryMethod
JuMP.unset_binary(vref::UserDecisionVariableRef)::Nothing

Extend JuMP.unset_binary to unset vref as a binary variable. Errors if it is not binary.

julia> unset_binary(vref)

julia> is_binary(vref)
false
source
JuMP.set_integerMethod
JuMP.set_integer(vref::UserDecisionVariableRef)::Nothing

Extend 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)
true
source
JuMP.unset_integerMethod
JuMP.unset_integer(vref::UserDecisionVariableRef)::Nothing

Extend 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)
false
source
JuMP.relax_integralityMethod
JuMP.relax_integrality(model::InfiniteModel)::Function

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.
  • 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 binary
source
JuMP.deleteMethod
JuMP.delete(model::InfiniteModel, vref::DecisionVariableRef)::Nothing

Extend 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.0
source

Infinite

InfiniteOpt.set_start_value_functionMethod
set_start_value_function(vref::InfiniteVariableRef,
                         start::Union{Real, Function})::Nothing

Set the start value function of vref. If start::Real then a function is generated to such that the start value will be start for the entire infinite domain. If start::Function then this function should map to a scalar start value given a support value arguments matching the format of the parameter elements in parameter_refs(vref).

Example

julia> set_start_value_function(vref, 1) # all start values will be 1

julia> set_start_value_function(vref, my_func) # each value will be made via my_func
source
InfiniteOpt.reset_start_value_functionMethod
reset_start_value_function(vref::InfiniteVariableRef)::Nothing

Remove the existing start value function and return to the default. Generally, this is triggered by deleting an infinite parameter that vref depends on.

Example

julia> reset_start_value_function(vref)
source
InfiniteOpt.constant_over_collocationMethod
constant_over_collocation(vref::InfiniteVariableRef, pref::GeneralVariableRef)::Nothing

Adds 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)
source

Semi-Infinite

JuMP.set_nameMethod
JuMP.set_name(vref::DecisionVariableRef, name::String)::Nothing

Extend JuMP.set_name to set names of decision variables.

Example

julia> set_name(vref, "var_name")

julia> name(vref)
"var_name"
source