Model
Index
- SLiDE.fix!
- SLiDE.fix_lower_bound!
- SLiDE.lower_bound
- SLiDE.set_bounds!
- SLiDE.set_lower_bound!
- SLiDE.set_upper_bound!
- SLiDE.upper_bound
- SLiDE.zero_negative!
Functions
These functions were developed to set and update JuMP.Model variables.
SLiDE.set_lower_bound! — Functionset_lower_bound!(model::JuMP.Model, var, idx; kwargs...)This function sets a JuMP Model variable's lower bound as calculated by SLiDE.lower_bound.
Arguments
- model::JuMP.Modelto update
- var::Symbolor- var::AbstractArray: variable or list of variables to update
- idx::Symbol,- idx::Tuple, or- idx::AbstractArray: index or list of indices overwhich to set bounds.
Keyword Arguments
Consistent with SLiDE.lower_bound
SLiDE.lower_bound — Functionlower_bound(x::Real; kwargs...)This function calculates a lower bound on x:
\[x_{lower} = \begin{cases} \max\left\{0,\, factor \cdot x \right\} & \texttt{allow_negative} \ factor \cdot x & \texttt{!allow_negative} \end{cases}\]
Arguments
- x::Realreference value to calculate lower bound
Keyword Arguments
- factor::Real=0to use to calculate lower bound.
- value::Real=NaN: If a value is given, set lower bound to this value.
- allow_negative::Bool=true: Do we want to set negative values to zero?
Returns
- x::Real: calculted lower bound
SLiDE.set_upper_bound! — Functionset_upper_bound!(model::JuMP.Model, var, idx; kwargs...)This function sets a JuMP Model variable's upper bound as calculated by SLiDE.upper_bound.
Arguments
- model::JuMP.Modelto update
- var::Symbolor- var::AbstractArray: variable or list of variables to update
- idx::Symbol,- idx::Tuple, or- idx::AbstractArray: index or list of indices overwhich to set bounds.
Keyword Arguments
Consistent with SLiDE.upper_bound
SLiDE.upper_bound — Functionupper_bound(x::Real; kwargs...)This function returns an upper bound on x:
\[x_{upper} = \begin{cases} \abs\left\{factor \cdot x \right\} & \texttt{allow_negative} \ factor \cdot x & \texttt{!allow_negative} \end{cases}\]
Arguments
- x::Realreference value to calculate upper bound
Keyword Arguments
- factor::Real=0to use to calculate upper bound.
- value::Real=NaN: If a value is given, set upper bound to this value.
- allow_negative::Bool=true: Do we want to make negative values positive?
Returns
- x::Real: calculted upper bound
SLiDE.set_bounds! — Functionset_bounds!(model::JuMP.Model, var, idx; kwargs...)This function sets upper and lower bound on the specified JuMP Model variable(s).
Arguments
- model::JuMP.Modelto update
- var::Symbolor- var::AbstractArray: variable or list of variables to update
- idx::Symbol,- idx::Tuple, or- idx::AbstractArray: index or list of indices overwhich to set bounds.
Keyword Arguments
- lower_factor::Real=0: passed to- SLiDE.lower_boundas- factor
- upper_factor::Real=0: passed to- SLiDE.upper_boundas- factor
- allow_negative::Bool=true: passed to- SLiDE.lower_boundand- SLiDE.upper_bound
SLiDE.fix! — Functionfix!(model::JuMP.Model, var, idx; kwargs...)This function fixes a model variable model[var][idx] if its start value meets a specified condition.
Arguments
- model::JuMP.Modelto update
- var::Symbolor- var::AbstractArray: variable or list of variables to update
- idx::Symbol,- idx::Tuple, or- idx::AbstractArray: index or list of indices overwhich to set bounds.
Keyword Arguments
- values::Real=NaN, to which to fix the JuMP Variable if it meets the condition. If- value==NaN, as is specified by default, fix the variable based on its start value.
- condition::Function=isreal, that determines whether to fix the value. By default, all Real-valued start values will be fixed. If, for instance,- condition=iszero, is given, all variables with start values of zero will be fixed to zero. Non-zero values will not be fixed.
- force::true, passed to JuMP.fix
SLiDE.fix_lower_bound! — Functionfix_lower_bound!(model::JuMP.Model, var, idx; kwargs...)This function fixes a model variable model[var][idx] if its start value meets a specified condition using SLiDE.fix!, OR sets its lower bound using SLiDE.set_lower_bound!.
Arguments
- model::JuMP.Modelto update
- var::Symbolor- var::AbstractArray: variable or list of variables to update
- idx::Symbol,- idx::Tuple, or- idx::AbstractArray: index or list of indices overwhich to set bounds.
Keyword Arguments
See [SLiDE.fix!] and [SLiDE.lower_bound]
SLiDE.zero_negative! — FunctionThis function sets negative values to zero.
Arguments
zero_negative!(d)
zero_negative!(d, var)- d::Dict{Symbol,DataFrame}to edit
- var::Symbolor- var::AbstractArray: variable or list of variables to editzeronegative!(df) zeronegative!(df, subset)
- df::DataFrameto edit
- subset::Pair: If given, only zero negative values for this- idx => valuepair.
Returns
- df::DataFrameor- d::Dict{Symbol,DataFrame}with negative values set to zero.