JuMP and MOI utilities
These functions act on JuMP and MathOptInterface structures to be able to implement OCTHaGOn.
Main.OCTHaGOn.bound! — Functionbound!(model::JuMP.Model, bound::Pair)
bound!(model::JuMP.Model, bounds::Dict)
bound!(model::GlobalModel, bounds::Union{Pair,Dict})Adds outer bounds to JuMP Model from Dict or Pair of data.
Main.OCTHaGOn.bounded_aux — Functionbounded_aux(x::Array{JuMP.VariableRef}, binary_var::JuMP.VariableRef)
bounded_aux(x::Array{JuMP.VariableRef}, y::JuMP.VariableRef, binary_var::JuMP.VariableRef)Generates binary-bounded auxiliary variables and their bounding constraints of the same size as x + y.
Main.OCTHaGOn.classify_constraints — FunctionSeparates and returns linear and nonlinear constraints in a model.
Main.OCTHaGOn.distance_to_set — Functiondistance_to_set(val::Union{Array{<:Real},<:Real}, set::MOI.AbstractSet)Wrapper around MathOptSetDistances.distancetoset. Distance 0 if val ∈ set. Otherwise, returns Float64.
Main.OCTHaGOn.fetch_variable — Functionfetch_variable(model::JuMP.Model, varkey::Union{Symbol, String, VariableRef, Array})Returns JuMP.VariableRefs that match a given Symbol, String, VariableRef, or array of these.
Main.OCTHaGOn.get_bounds — Functionget_bounds(var::JuMP.VariableRef})
get_bounds(vars::Array{JuMP.VariableRef})Returns bounds of JuMP variables.
get_bounds(model::Union{Model, BlackBoxClassifier, BlackBoxRegressor, GlobalModel, Array{Union{BlackBoxClassifier, BlackBoxRegressor},N} where N}) -> Union{Pair{VariableRef,Array{Float64,1}}, Dict{_A,_B} where _B where _A}
Returns bounds of all variables.
Main.OCTHaGOn.get_constant — Functionget_constant(set::MathOptInterface.AbstractSet) -> Any
Returns constant of MOI.AbstractSet, if it exists.
Main.OCTHaGOn.get_unbounds — Functionget_unbounds(var::JuMP.VariableRef)
get_unbounds(vars::Array{VariableRef})
get_unbounds(gm::Union{JuMP.Model, GlobalModel})Returns variables with no lower and/or upper bounds.
get_unbounds(model::Union{Model, BlackBoxClassifier, BlackBoxRegressor, GlobalModel, Array{Union{BlackBoxClassifier, BlackBoxRegressor},N} where N}) -> Union{Nothing, Dict{Any,Any}, Pair{VariableRef,Array{Float64,1}}}
Returns only unbounded variables.
Main.OCTHaGOn.linearize_objective! — Functionlinearize_objective!(model::JuMP.Model)Makes sure that the objective function is affine.
Main.OCTHaGOn.restrict_to_set — Functionrestrict_to_set(var::JuMP.VariableRef, s::Union{Set, Array})Restricts variable to a set s. Useful for non-integer sets or when taking log of integer variables.
Main.OCTHaGOn.vars_from_constraint — Functionvars_from_constraint(con::JuMP.ConstraintRef)Returns the JuMP Variables that are associated with a JuMP.ConstraintRef. Note: Currently only works for affine and quadratic constraints.
The following functions extend JuMP functions to act on OCTHaGOn's structs.
JuMP.all_variables — FunctionJuMP.all_variables(bbo::Union{GlobalModel, BlackBoxLearner})
JuMP.all_variables(bbls::Array{BlackBoxLearner})Extends JuMP.all_variables to GlobalModels and BlackBoxLearners. TODO: add ability to add variables to GlobalModels.
JuMP.set_optimizer — FunctionExtends JuMP.set_optimizer to GlobalModels.