Model

Index

Functions

These functions were developed to set and update JuMP.Model variables.

SLiDE.set_lower_bound!Function
set_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.Model to update
  • var::Symbol or 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

source
SLiDE.lower_boundFunction
lower_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::Real reference value to calculate lower bound

Keyword Arguments

  • factor::Real=0 to 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
source
SLiDE.set_upper_bound!Function
set_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.Model to update
  • var::Symbol or 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

source
SLiDE.upper_boundFunction
upper_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::Real reference value to calculate upper bound

Keyword Arguments

  • factor::Real=0 to 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
source
SLiDE.set_bounds!Function
set_bounds!(model::JuMP.Model, var, idx; kwargs...)

This function sets upper and lower bound on the specified JuMP Model variable(s).

Arguments

  • model::JuMP.Model to update
  • var::Symbol or 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

source
SLiDE.fix!Function
fix!(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.Model to update
  • var::Symbol or 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
source
SLiDE.fix_lower_bound!Function
fix_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.Model to update
  • var::Symbol or 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]

source
SLiDE.zero_negative!Function

This function sets negative values to zero.

Arguments

zero_negative!(d)
zero_negative!(d, var)
  • d::Dict{Symbol,DataFrame} to edit
  • var::Symbol or var::AbstractArray: variable or list of variables to editzeronegative!(df) zeronegative!(df, subset)
  • df::DataFrame to edit
  • subset::Pair: If given, only zero negative values for this idx => value pair.

Returns

  • df::DataFrame or d::Dict{Symbol,DataFrame} with negative values set to zero.
source