Nonlinear constraints

Work in progress...

Main.OCTHaGOn.add_nonlinear_constraintFunction
add_nonlinear_constraint(gm::GlobalModel,
                 constraint::Union{JuMP.ConstraintRef, Expr};
                 vars::Union{Nothing, Array{JuMP.VariableRef, 1}} = nothing,
                 expr_vars::Union{Nothing, Array} = nothing,
                 dependent_var::Union{Nothing, JuMP.VariableRef} = nothing,
                 name::String = gm.name * " " * string(length(gm.bbls) + 1),
                 equality::Bool = false)

Adds a new nonlinear constraint to Global Model. Standard method for adding BlackBoxClassifiers and BlackBoxRegressors.

Note: If adding constraints via an Expr, please define the appropriate vector indices. Eg. expr = :((x) -> -x[1:$(N)]'*$(Q)*x[1:$(N)] - $(c)'*x[1:$(N)]), instead of expr = :((x) -> -x'*$(Q)*x - $(c)'*x), to avoid vectorization errors.

source
Main.OCTHaGOn.add_nonlinear_or_compatibleFunction
function add_nonlinear_or_compatible(gm::GlobalModel,
    constraint::Union{JuMP.ConstraintRef, Expr};
    vars::Union{Nothing, Array{JuMP.VariableRef, 1}} = nothing,
    expr_vars::Union{Nothing, Array} = nothing,
    dependent_var::Union{Nothing, JuMP.VariableRef} = nothing,
    name::String = gm.name * "_" * string(length(gm.bbls) + 1),
    equality::Bool = false)

Extends add_nonlinear_constraint to recognize JuMP compatible linear constraints and add them as linear JuMP constraints instead.

source
Main.OCTHaGOn.add_linked_constraintFunction
add_linked_constraint(gm::GlobalModel, bbc::BlackBoxClassifier, linked_vars::Array{JuMP.Variable})
add_linked_constraint(gm::GlobalModel, bbr::BlackBoxRegressor, linked_vars::Array{JuMP.Variable}, linked_dependent::JuMP.Variable)

Adds a linked constraint of the same structure as the BlackBoxLearner. When a nonlinear constraint is repeated more than once, this function allows the underlying approximator to be replicated without retraining trees for each constraint. Note that the bounds used for sampling are for the original variables of the BlackBoxLearner, so be careful!

source

Data driven constraints

Main.OCTHaGOn.add_datadriven_constraintFunction
add_datadriven_constraint(gm::GlobalModel,
                 X::DataFrame, Y::Array;
                 constraint::Union{Nothing, JuMP.ConstraintRef, Expr} = nothing, 
                 vars::Union{Nothing, Array{JuMP.VariableRef, 1}} = nothing,
                 dependent_var::Union{Nothing, JuMP.VariableRef} = nothing,
                 name::String = "bbl" * string(length(gm.bbls) + 1),
                 equality::Bool = false)

Adds a data-driven constraint to GlobalModel. Data driven BBLs do not allow for resampling.

source
Main.OCTHaGOn.bound_to_data!Function
bound_to_data!(gm::Union{JuMP.Model, GlobalModel},
              X::DataFrame)

Constrains the domain of relevant variables to the box interval defined by X.

source