Helper functions

Work in progress...

Main.OCTHaGOn.deconstructFunction
deconstruct(data::DataFrame, vars::Array, varmap::Array)

Takes in data for input into a Function, and rips it apart into appropriate arrays.

source
Main.OCTHaGOn.data_to_DataFrameFunction
data_to_DataFrame(data::Union{Dict, DataFrame, DataFrameRow})

Gets data with different keys, and returns a DataFrame with string headers.

source
Main.OCTHaGOn.get_varmapFunction
get_varmap(expr_vars::Array, vars::Array)

Helper function to map vars to flatvars. Arguments: flatvars is a flattened Array{JuMP.VariableRef} vars is the unflattened version, usually derived from an Expr. Returns: Dict of ID maps

source
Main.OCTHaGOn.gradientifyFunction
gradientify(expr::Expr, expr_vars::Array)
gradientify(expr::JuMP.ConstraintRef, expr_vars::Array)

Turns an expression into a gradient-able (via ForwardDiff), flattened function. TODO: add option to not use gradients for certain functions or data driven constraints.

source
Main.OCTHaGOn.functionifyFunction
functionify(constraint::Any) -> Union{Nothing, Function}

Returns an "evaluate-able" function from an Expr, or nothing for a JuMP.ConstraintRef. Can extend in the future to other elements.

source
Main.OCTHaGOn.set_paramFunction
set_param(gm::Dict, key::Symbol, val::Any)
set_param(gm::Dict, key::Symbol, val::Any, checks::Any)

Sets the value of a parameter.

source
Main.OCTHaGOn.vars_from_exprFunction
vars_from_expr(expr::Expression, model::JuMP.Model)

Returns the JuMP Variables that are associated with a given expression. Note: Expr's must be defined with a single input or a tuple of inputs, eg:

ex = :(x -> 5*x)
ex = :((x, y, z) -> sum(x[i] for i=1:4) - y[1] * y[2] + z)
source