diff --git a/previews/PR64/reference/index.html b/previews/PR64/reference/index.html index 9a2daaf..b9ba598 100644 --- a/previews/PR64/reference/index.html +++ b/previews/PR64/reference/index.html @@ -1,74 +1,74 @@ -Reference · ExpressionTreeForge.jl

Reference

Contents

Index

ExpressionTreeForge.Complete_expr_treeType
Complete_expr_tree{T} <: AbstractTree

Implementation of an expression tree. Complete_expr_tree is the same than Type_expr_tree with the additions in each node of a Bounds and Convexity_wrapper. A Complete_expr_tree has fields:

  • field::Complete_node{T} representing an operator, a constant or a variable alongide its bounds and its convexity status;
  • children::Vector{Complete_expr_tree{T}} a vector of children, each of them being a Complete_expr_tree{T}.
source
ExpressionTreeForge.Type_expr_treeType
Type_expr_tree{T} <: AbstractTree

Basic implementation of an expression tree. Every expression tree supported must be able to return Type_expr_tree with transform_to_expr_tree. A Type_expr_tree has fields:

  • field::Abstract_expr_node representing an operator, a constant or a variable;
  • children::Vector{Type_expr_tree{T}} a vector of children, each of them being a Type_expr_tree{T}.
source
ExpressionTreeForge.Type_nodeType
Type_node{T} <: AbstractTree

Basic implementation of a tree. A Type_node has fields:

  • field gathering the informations about the current node;
  • children a vector of children, each of them being a Type_node.
source
ExpressionTreeForge.evaluate_expr_treeMethod
evaluate_expr_tree(expr_tree::Type_expr_tree, x::AbstractVector)
+Reference · ExpressionTreeForge.jl

Reference

Contents

Index

ExpressionTreeForge.Complete_expr_treeType
Complete_expr_tree{T} <: AbstractTree

Implementation of an expression tree. Complete_expr_tree is the same than Type_expr_tree with the additions in each node of a Bounds and Convexity_wrapper. A Complete_expr_tree has fields:

  • field::Complete_node{T} representing an operator, a constant or a variable alongide its bounds and its convexity status;
  • children::Vector{Complete_expr_tree{T}} a vector of children, each of them being a Complete_expr_tree{T}.
source
ExpressionTreeForge.Type_expr_treeType
Type_expr_tree{T} <: AbstractTree

Basic implementation of an expression tree. Every expression tree supported must be able to return Type_expr_tree with transform_to_expr_tree. A Type_expr_tree has fields:

  • field::Abstract_expr_node representing an operator, a constant or a variable;
  • children::Vector{Type_expr_tree{T}} a vector of children, each of them being a Type_expr_tree{T}.
source
ExpressionTreeForge.Type_nodeType
Type_node{T} <: AbstractTree

Basic implementation of a tree. A Type_node has fields:

  • field gathering the informations about the current node;
  • children a vector of children, each of them being a Type_node.
source
ExpressionTreeForge.evaluate_expr_treeMethod
evaluate_expr_tree(expr_tree::Type_expr_tree, x::AbstractVector)
 evaluate_expr_tree(expr_tree::Complete_expr_tree, x::AbstractVector)

Evaluate the expr_tree given the vector x.

Example:

julia> evaluate_expr_tree(:(x[1] + x[2]), ones(2))
-2.
source
ExpressionTreeForge.extract_element_functionsMethod
separated_terms = extract_element_functions(expr_tree)

Return the element functions of expr_tree as a vector of its subexpressions. expr_tree may be an Expr, a Type_expr_tree or a Complete_expr_tree.

Example:

julia> extract_element_functions(:(x[1] + x[2] + x[3]*x[4]))
+2.
source
ExpressionTreeForge.extract_element_functionsMethod
separated_terms = extract_element_functions(expr_tree)

Return the element functions of expr_tree as a vector of its subexpressions. expr_tree may be an Expr, a Type_expr_tree or a Complete_expr_tree.

Example:

julia> extract_element_functions(:(x[1] + x[2] + x[3]*x[4]))
 3-element Vector{Expr}:
  :(x[1])
  :(x[2])
- :(x[3] * x[4])
source
ExpressionTreeForge.get_UiMethod
Ui = get_Ui(indices::Vector{Int}, n::Int)

Create a SparseMatrix Ui from indices computed by get_elemental_variables. Every index i (of indices) form a line of Ui corresponding to i-th Euclidian vector.

source
ExpressionTreeForge.get_convexity_statusMethod
convexity_status = get_convexity_status(convexity_tree::M_convexity_detection.Convexity_tree)
-convexity_status = get_convexity_status(complete_tree::Complete_expr_tree)

Return the convexity status of either a convexity_tree or a complete_tree. The status can be:

  • constant
  • linear
  • convex
  • concave
  • unknown
source
ExpressionTreeForge.get_elemental_variablesMethod
indices = get_elemental_variables(expr_tree)

Return the indices of the variable appearing in expr_tree. This function is used to find the elemental variables from the expression tree of an element function. expr_tree may be an Expr, a Type_expr_tree or a Complete_expr_tree.

Example:

julia> get_elemental_variables(:(x[1] + x[3]) )
+ :(x[3] * x[4])
source
ExpressionTreeForge.get_UiMethod
Ui = get_Ui(indices::Vector{Int}, n::Int)

Create a SparseMatrix Ui from indices computed by get_elemental_variables. Every index i (of indices) form a line of Ui corresponding to i-th Euclidian vector.

source
ExpressionTreeForge.get_convexity_statusMethod
convexity_status = get_convexity_status(convexity_tree::M_convexity_detection.Convexity_tree)
+convexity_status = get_convexity_status(complete_tree::Complete_expr_tree)

Return the convexity status of either a convexity_tree or a complete_tree. The status can be:

  • constant
  • linear
  • convex
  • concave
  • unknown
source
ExpressionTreeForge.get_elemental_variablesMethod
indices = get_elemental_variables(expr_tree)

Return the indices of the variable appearing in expr_tree. This function is used to find the elemental variables from the expression tree of an element function. expr_tree may be an Expr, a Type_expr_tree or a Complete_expr_tree.

Example:

julia> get_elemental_variables(:(x[1] + x[3]) )
 [1, 3]
 julia> get_elemental_variables(:(x[1]^2 + x[6] + x[2]) )
-[1, 6, 2]
source
ExpressionTreeForge.get_expression_treeMethod
expr = get_expression_tree(monlp::MathOptNLPModel)
 expr = get_expression_tree(adnlp::ADNLPModel)
 expr = get_expression_tree(model::JuMP.Model)
-expr = get_expression_tree(evaluator::MOI.Nonlinear.Evaluator)

Return the objective function as a Type_expr_tree for: a MathOptNLPModel, a ADNLPModel, a JuMP.Model or a MOI.Nonlinear.Evaluator.

source
ExpressionTreeForge.get_type_treeMethod
type = get_type_tree(expr_tree)

Return the type of expr_tree. It can either be: constant, linear, quadratic, cubic or more. expr_tree may be an Expr, a Type_expr_tree or a Complete_expr_tree.

Example:

julia> get_type_tree(:(5+4)) == constant
+expr = get_expression_tree(evaluator::MOI.Nonlinear.Evaluator)

Return the objective function as a Type_expr_tree for: a MathOptNLPModel, a ADNLPModel, a JuMP.Model or a MOI.Nonlinear.Evaluator.

source
ExpressionTreeForge.get_type_treeMethod
type = get_type_tree(expr_tree)

Return the type of expr_tree. It can either be: constant, linear, quadratic, cubic or more. expr_tree may be an Expr, a Type_expr_tree or a Complete_expr_tree.

Example:

julia> get_type_tree(:(5+4)) == constant
 true
 julia> get_type_tree(:(x[1])) == linear
 true
 julia> get_type_tree(:(x[1]* x[2])) == quadratic
-true
source
ExpressionTreeForge.gradient_forwardMethod
gradient = gradient_forward(expr_tree, x)

Evaluate the gradient of expr_tree at the point x with a forward automatic differentiation method.

Example:

julia> gradient_forward(:(x[1] + x[2]), rand(2))
-[1.0 1.0]
source
ExpressionTreeForge.gradient_reverseMethod
gradient = gradient_reverse(expr_tree, x)

Evaluate the gradient of expr_tree at the point x with a reverse automatic differentiation method.

Example:

julia> gradient_reverse(:(x[1] + x[2]), rand(2))
-[1.0 1.0]
source
ExpressionTreeForge.hessianMethod
hess = hessian(expr_tree, x)

Evaluate the Hessian of expr_tree at the point x with a forward automatic differentiation.

Example:

julia> hessian(:(x[1]^2 + x[2]), rand(2))
-[2.0 0.0; 0.0 0.0]
source
ExpressionTreeForge.is_concaveMethod
bool = is_concave(status::Convexity_type)
-bool = is_concave(convexity::Convexity_wrapper)

Check if convexity or status is equal to concave.

source
ExpressionTreeForge.is_constantMethod
bool = is_constant(status::Convexity_type)
-bool = is_constant(convexity::Convexity_wrapper)

Check if convexity or status is equal to constant.

source
ExpressionTreeForge.is_convexMethod
bool = is_convex(status::Convexity_type)
-bool = is_convex(convexity::Convexity_wrapper)

Check if convexity or status is equal to convex.

source
ExpressionTreeForge.is_linearMethod
bool = is_linear(status::Convexity_type)
-bool = is_linear(convexity::Convexity_wrapper)

Check if convexity or status is equal to linear.

source
ExpressionTreeForge.is_not_treatedMethod
bool = is_not_treated(status::Convexity_type)
-bool = is_not_treated(convexity::Convexity_wrapper)

Check if convexity or status is equal to not_treated.

source
ExpressionTreeForge.is_treatedMethod
bool = is_treated(status::Convexity_type)
-bool = is_treated(convexity::Convexity_wrapper)

Check if convexity or status is equal to different of not_treated.

source
ExpressionTreeForge.is_unknownMethod
bool = is_unknown(status::Convexity_type)
-bool = is_unknown(convexity::Convexity_wrapper)

Check if convexity or status is equal to unknown.

source
ExpressionTreeForge.non_linear_JuMP_model_evaluatorMethod
evaluator = non_linear_JuMP_model_evaluator(expr_tree; variables::Vector{Int})

Return a MathOptInterface.Nonlinear.Model and its initialized evaluator for any expr_tree supported. variables informs the indices of the variables appearing in expr_tree. If variables is not provided, it is determined automatically through sort!(get_elemental_variables(expr_tree)). Warning: variables must be sorted! Example:

expr_tree = :(x[1]^2 + x[3]^3)
+true
source
ExpressionTreeForge.gradient_forwardMethod
gradient = gradient_forward(expr_tree, x)

Evaluate the gradient of expr_tree at the point x with a forward automatic differentiation method.

Example:

julia> gradient_forward(:(x[1] + x[2]), rand(2))
+[1.0 1.0]
source
ExpressionTreeForge.gradient_reverseMethod
gradient = gradient_reverse(expr_tree, x)

Evaluate the gradient of expr_tree at the point x with a reverse automatic differentiation method.

Example:

julia> gradient_reverse(:(x[1] + x[2]), rand(2))
+[1.0 1.0]
source
ExpressionTreeForge.hessianMethod
hess = hessian(expr_tree, x)

Evaluate the Hessian of expr_tree at the point x with a forward automatic differentiation.

Example:

julia> hessian(:(x[1]^2 + x[2]), rand(2))
+[2.0 0.0; 0.0 0.0]
source
ExpressionTreeForge.is_concaveMethod
bool = is_concave(status::Convexity_type)
+bool = is_concave(convexity::Convexity_wrapper)

Check if convexity or status is equal to concave.

source
ExpressionTreeForge.is_constantMethod
bool = is_constant(status::Convexity_type)
+bool = is_constant(convexity::Convexity_wrapper)

Check if convexity or status is equal to constant.

source
ExpressionTreeForge.is_convexMethod
bool = is_convex(status::Convexity_type)
+bool = is_convex(convexity::Convexity_wrapper)

Check if convexity or status is equal to convex.

source
ExpressionTreeForge.is_linearMethod
bool = is_linear(status::Convexity_type)
+bool = is_linear(convexity::Convexity_wrapper)

Check if convexity or status is equal to linear.

source
ExpressionTreeForge.is_not_treatedMethod
bool = is_not_treated(status::Convexity_type)
+bool = is_not_treated(convexity::Convexity_wrapper)

Check if convexity or status is equal to not_treated.

source
ExpressionTreeForge.is_treatedMethod
bool = is_treated(status::Convexity_type)
+bool = is_treated(convexity::Convexity_wrapper)

Check if convexity or status is equal to different of not_treated.

source
ExpressionTreeForge.is_unknownMethod
bool = is_unknown(status::Convexity_type)
+bool = is_unknown(convexity::Convexity_wrapper)

Check if convexity or status is equal to unknown.

source
ExpressionTreeForge.non_linear_JuMP_model_evaluatorMethod
evaluator = non_linear_JuMP_model_evaluator(expr_tree; variables::Vector{Int})

Return a MathOptInterface.Nonlinear.Model and its initialized evaluator for any expr_tree supported. variables informs the indices of the variables appearing in expr_tree. If variables is not provided, it is determined automatically through sort!(get_elemental_variables(expr_tree)). Warning: variables must be sorted! Example:

expr_tree = :(x[1]^2 + x[3]^3)
 variables = [1,3]
 evaluator = non_linear_JuMP_model_evaluator(expr_tree; variables)

Afterward, you may evaluate the function and the gradient from expr_tree with:

x = rand(2)
 MOI.eval_objective(evaluator, x)
 grad = similar(x)
-MOI.eval_objective_gradient(evaluator, grad, x)

Warning: The size of x depends on the number of variables of expr_tree and not from the highest variable's index.

source
ExpressionTreeForge.normalize_indices!Method
normalize_indices!(expr_tree, vector_indices::Vector{Int})

Change the indices of the variables from expr_tree to follow the order given by vector_indices. It is paired with get_elemental_variables to define the elemental element function expression tree. expr_tree may be an Expr, a Type_expr_tree or a Complete_expr_tree.

Example:

julia> normalize_indices!(:(x[4] + x[5]), [4,5])
-:(x[1] + x[2])
source
ExpressionTreeForge.set_bounds!Method
set_bounds!(tree::Type_expr_tree, bound_tree::Bound_tree)
-set_bounds!(complete_tree::Complete_expr_tree)

Set the bounds of bound_tree by walking tree and propagate the bounds' computation from the leaves to the root. As a Complete_expr_tree contains a precompiled bound_tree, it can be used alone.

source
ExpressionTreeForge.set_convexity!Method
set_convexity!(tree::Type_expr_tree, convexity_tree::Convexity_tree, bound_tree::Bound_tree)
-set_convexity!(complete_tree::Complete_expr_tree)

Deduce from elementary rules the convexity status of tree nodes or complete_tree nodes. complete_tree stores a bounds tree and can run the convexity detection standalone whereas tree requires the bound_tree (see create_bounds_tree) and convexity_tree (see create_convex_tree).

source
ExpressionTreeForge.sparse_jacobian_JuMP_modelMethod
evaluator = sparse_jacobian_JuMP_model(expr_trees)

Return the evaluator of a MathOptInterface.Nonlinear.Model defined by expr_tree, as long as it is supported. The evaluator considers the objective function as the sum of expr_trees and a constraint for each expr_tree contained in expr_trees. If the expression trees in expr_trees depend on a subset of variables, the Jacobian of the constraints will be sparse.

source
ExpressionTreeForge.transform_to_ExprMethod
expr = transform_to_Expr(expr_tree)

Transform expr_tree into an Expr. expr_tree may be a Type_expr_tree or a Complete_expr_tree. Warning: This function return an Expr with variables as MathOptInterface.VariableIndex. In order to get an standard Expr use transform_to_Expr_julia.

source
ExpressionTreeForge.M_abstract_expr_tree.create_ExprMethod
expr = create_expr_tree(tree)

Create an Expr from tree. Several types of tree are supported. For now, it supports Expr and ModelingToolkit.Operation, as well as the internal expression trees defined. The variables of the Expr use MathOptInterface variables.

source
ExpressionTreeForge.M_abstract_expr_tree.create_Expr_JuMPMethod
expr = create_expr_tree(tree)

Create an Expr from tree. Several types of tree are supported. For now, it supports Expr and ModelingToolkit.Operation, as well as the internal expression trees defined. The variables of the Expr use MathOptInterface.VariableIndex(i).

source
ExpressionTreeForge.M_implementation_expr_tree.Type_expr_treeType
Type_expr_tree{T} <: AbstractTree

Basic implementation of an expression tree. Every expression tree supported must be able to return Type_expr_tree with transform_to_expr_tree. A Type_expr_tree has fields:

  • field::Abstract_expr_node representing an operator, a constant or a variable;
  • children::Vector{Type_expr_tree{T}} a vector of children, each of them being a Type_expr_tree{T}.
source
ExpressionTreeForge.M_implementation_complete_expr_tree.Complete_expr_treeType
Complete_expr_tree{T} <: AbstractTree

Implementation of an expression tree similar to Type_expr_tree. Complete_expr_tree considers a Complete_node which adds the Bounds and a Convexity_wrapper to each node. A Complete_expr_tree has fields:

  • field::Complete_node{T} representing an operator, a constant or a variable alongide its bounds and its convexity status;
  • children::Vector{Complete_expr_tree{T}} a vector of children, each of them being a Complete_expr_tree{T}.
source
ExpressionTreeForge.M_implementation_complete_expr_tree.Complete_nodeType
Complete_node{T <: Number}

Gather in a single structure:

  • op::M_abstract_expr_node.Abstract_expr_node an arithmetic operator;
  • bounds::M_abstract_expr_tree.Bounds{T} the bounds of this operator depending on its children;
  • convexity_status::M_implementation_convexity_type.Convexity_wrapper the convexity status of this operator depending on its children.
source
ExpressionTreeForge.M_bound_propagations.set_bounds!Method
set_bounds!(tree, bound_tree::Bound_tree)
-set_bounds!(complete_tree::Complete_expr_tree)

Set the bounds of bound_tree by walking tree and by propagating the computations from the leaves to the root. A Complete_expr_tree contains a precompiled bound_tree, and then can be use alone.

source
ExpressionTreeForge.M_convexity_detection.get_convexity_statusMethod
convexity_status = get_convexity_status(convexity_tree::M_convexity_detection.Convexity_tree)
-convexity_status = get_convexity_status(complete_tree::M_implementation_complete_expr_tree.Complete_expr_tree)

Return the convexity status of either a convexity_tree or a complete_tree. The status can be:

  • constant
  • linear
  • strictly convex
  • strictly concave
  • unknown
source
ExpressionTreeForge.M_convexity_detection.set_convexity!Method
set_convexity!(tree, convexity_tree, bound_tree)
-set_convexity!(complete_tree)

Deduce from elementary rules the convexity status of tree nodes or complete_tree nodes. complete_tree stores a bounds tree and can run the convexity detection standalone whereas tree requires the bound_tree (see create_bounds_tree) and convexity_tree (see create_convex_tree).

source
ExpressionTreeForge.M_algo_expr_tree.N_to_NiMethod
dic = N_to_Ni(elemental_var::Vector{Int}; initial_index=0)

Return a dictionnary informing the index changes of an element expression tree. If element_var = [4,5] then dic == Dict([4=>initial_index+1, 5=>initial_index+2]).

source
ExpressionTreeForge.M_algo_expr_tree.extract_element_functionsMethod
separated_terms = extract_element_functions(expr_tree)

Divide the expression tree as a terms of a sum if possible. It returns a vector where each component is a subexpression tree of expr_tree.

Example:

julia> extract_element_functions(:(x[1] + x[2] + x[3]*x[4] ) )
+MOI.eval_objective_gradient(evaluator, grad, x)

Warning: The size of x depends on the number of variables of expr_tree and not from the highest variable's index.

source
ExpressionTreeForge.normalize_indices!Method
normalize_indices!(expr_tree, vector_indices::Vector{Int})

Change the indices of the variables from expr_tree to follow the order given by vector_indices. It is paired with get_elemental_variables to define the elemental element function expression tree. expr_tree may be an Expr, a Type_expr_tree or a Complete_expr_tree.

Example:

julia> normalize_indices!(:(x[4] + x[5]), [4,5])
+:(x[1] + x[2])
source
ExpressionTreeForge.set_bounds!Method
set_bounds!(tree::Type_expr_tree, bound_tree::Bound_tree)
+set_bounds!(complete_tree::Complete_expr_tree)

Set the bounds of bound_tree by walking tree and propagate the bounds' computation from the leaves to the root. As a Complete_expr_tree contains a precompiled bound_tree, it can be used alone.

source
ExpressionTreeForge.set_convexity!Method
set_convexity!(tree::Type_expr_tree, convexity_tree::Convexity_tree, bound_tree::Bound_tree)
+set_convexity!(complete_tree::Complete_expr_tree)

Deduce from elementary rules the convexity status of tree nodes or complete_tree nodes. complete_tree stores a bounds tree and can run the convexity detection standalone whereas tree requires the bound_tree (see create_bounds_tree) and convexity_tree (see create_convex_tree).

source
ExpressionTreeForge.sparse_jacobian_JuMP_modelMethod
evaluator = sparse_jacobian_JuMP_model(expr_trees)

Return the evaluator of a MathOptInterface.Nonlinear.Model defined by expr_tree, as long as it is supported. The evaluator considers the objective function as the sum of expr_trees and a constraint for each expr_tree contained in expr_trees. If the expression trees in expr_trees depend on a subset of variables, the Jacobian of the constraints will be sparse.

source
ExpressionTreeForge.transform_to_ExprMethod
expr = transform_to_Expr(expr_tree)

Transform expr_tree into an Expr. expr_tree may be a Type_expr_tree or a Complete_expr_tree. Warning: This function return an Expr with variables as MathOptInterface.VariableIndex. In order to get an standard Expr use transform_to_Expr_julia.

source
ExpressionTreeForge.M_abstract_expr_tree.create_ExprMethod
expr = create_expr_tree(tree)

Create an Expr from tree. Several types of tree are supported. For now, it supports Expr and ModelingToolkit.Operation, as well as the internal expression trees defined. The variables of the Expr use MathOptInterface variables.

source
ExpressionTreeForge.M_abstract_expr_tree.create_Expr_JuMPMethod
expr = create_expr_tree(tree)

Create an Expr from tree. Several types of tree are supported. For now, it supports Expr and ModelingToolkit.Operation, as well as the internal expression trees defined. The variables of the Expr use MathOptInterface.VariableIndex(i).

source
ExpressionTreeForge.M_implementation_expr_tree.Type_expr_treeType
Type_expr_tree{T} <: AbstractTree

Basic implementation of an expression tree. Every expression tree supported must be able to return Type_expr_tree with transform_to_expr_tree. A Type_expr_tree has fields:

  • field::Abstract_expr_node representing an operator, a constant or a variable;
  • children::Vector{Type_expr_tree{T}} a vector of children, each of them being a Type_expr_tree{T}.
source
ExpressionTreeForge.M_implementation_complete_expr_tree.Complete_expr_treeType
Complete_expr_tree{T} <: AbstractTree

Implementation of an expression tree similar to Type_expr_tree. Complete_expr_tree considers a Complete_node which adds the Bounds and a Convexity_wrapper to each node. A Complete_expr_tree has fields:

  • field::Complete_node{T} representing an operator, a constant or a variable alongide its bounds and its convexity status;
  • children::Vector{Complete_expr_tree{T}} a vector of children, each of them being a Complete_expr_tree{T}.
source
ExpressionTreeForge.M_implementation_complete_expr_tree.Complete_nodeType
Complete_node{T <: Number}

Gather in a single structure:

  • op::M_abstract_expr_node.Abstract_expr_node an arithmetic operator;
  • bounds::M_abstract_expr_tree.Bounds{T} the bounds of this operator depending on its children;
  • convexity_status::M_implementation_convexity_type.Convexity_wrapper the convexity status of this operator depending on its children.
source
ExpressionTreeForge.M_bound_propagations.set_bounds!Method
set_bounds!(tree, bound_tree::Bound_tree)
+set_bounds!(complete_tree::Complete_expr_tree)

Set the bounds of bound_tree by walking tree and by propagating the computations from the leaves to the root. A Complete_expr_tree contains a precompiled bound_tree, and then can be use alone.

source
ExpressionTreeForge.M_convexity_detection.get_convexity_statusMethod
convexity_status = get_convexity_status(convexity_tree::M_convexity_detection.Convexity_tree)
+convexity_status = get_convexity_status(complete_tree::M_implementation_complete_expr_tree.Complete_expr_tree)

Return the convexity status of either a convexity_tree or a complete_tree. The status can be:

  • constant
  • linear
  • strictly convex
  • strictly concave
  • unknown
source
ExpressionTreeForge.M_convexity_detection.set_convexity!Method
set_convexity!(tree, convexity_tree, bound_tree)
+set_convexity!(complete_tree)

Deduce from elementary rules the convexity status of tree nodes or complete_tree nodes. complete_tree stores a bounds tree and can run the convexity detection standalone whereas tree requires the bound_tree (see create_bounds_tree) and convexity_tree (see create_convex_tree).

source
ExpressionTreeForge.M_algo_expr_tree.N_to_NiMethod
dic = N_to_Ni(elemental_var::Vector{Int}; initial_index=0)

Return a dictionnary informing the index changes of an element expression tree. If element_var = [4,5] then dic == Dict([4=>initial_index+1, 5=>initial_index+2]).

source
ExpressionTreeForge.M_algo_expr_tree.extract_element_functionsMethod
separated_terms = extract_element_functions(expr_tree)

Divide the expression tree as a terms of a sum if possible. It returns a vector where each component is a subexpression tree of expr_tree.

Example:

julia> extract_element_functions(:(x[1] + x[2] + x[3]*x[4] ) )
 3-element Vector{Expr}:
  :(x[1])
  :(x[2])
- :(x[3] * x[4])
source
ExpressionTreeForge.M_algo_expr_tree.get_UiMethod
Ui = get_Ui(indices::Vector{Int}, n::Int)

Create a SparseMatrix Ui from indices computed by get_elemental_variables. Every index i (of indices) form a line of Ui corresponding to i-th Euclidian vector.

source
ExpressionTreeForge.M_algo_expr_tree.get_elemental_variablesMethod
indices = get_elemental_variables(expr_tree)

Return the indices of the variable appearing in expr_tree. This function finds the elemental variables from the expression tree of an element function.

Example:

julia> get_elemental_variables(:(x[1] + x[3]) )
+ :(x[3] * x[4])
source
ExpressionTreeForge.M_algo_expr_tree.get_UiMethod
Ui = get_Ui(indices::Vector{Int}, n::Int)

Create a SparseMatrix Ui from indices computed by get_elemental_variables. Every index i (of indices) form a line of Ui corresponding to i-th Euclidian vector.

source
ExpressionTreeForge.M_algo_expr_tree.get_elemental_variablesMethod
indices = get_elemental_variables(expr_tree)

Return the indices of the variable appearing in expr_tree. This function finds the elemental variables from the expression tree of an element function.

Example:

julia> get_elemental_variables(:(x[1] + x[3]) )
 [1, 3]
 julia> get_elemental_variables(:(x[1]^2 + x[6] + x[2]) )
-[1, 6, 2]
source
ExpressionTreeForge.M_algo_expr_tree.get_type_treeMethod
type = get_type_tree(expr_tree)

Return the type of expr_tree. It can either be: constant, linear, quadratic, cubic or more.

Example:

julia> get_type_tree(:(5+4)) == constant
 true
 julia> get_type_tree(:(x[1])) == linear
 true
 julia> get_type_tree(:(x[1]* x[2])) == quadratic
-true
source
ExpressionTreeForge.M_algo_expr_tree.non_linear_JuMP_model_evaluatorMethod
evaluator = non_linear_JuMP_model_evaluator(expr_tree; variables::Vector{Int})

Return the evaluator of a MOI.Nonlinear.Model defined by expr_tree, as long as it is supported. variables informs the indices of the variables appearing in expr_tree. If variables is not provided, it is determined automatically through sort!(get_elemental_variables(expr_tree)). Warning: variables must be sorted! Example:

expr_tree = :(x[1]^2 + x[3]^3)
+true
source
ExpressionTreeForge.M_algo_expr_tree.non_linear_JuMP_model_evaluatorMethod
evaluator = non_linear_JuMP_model_evaluator(expr_tree; variables::Vector{Int})

Return the evaluator of a MOI.Nonlinear.Model defined by expr_tree, as long as it is supported. variables informs the indices of the variables appearing in expr_tree. If variables is not provided, it is determined automatically through sort!(get_elemental_variables(expr_tree)). Warning: variables must be sorted! Example:

expr_tree = :(x[1]^2 + x[3]^3)
 variables = [1,3]
 evaluator = non_linear_JuMP_model_evaluator(expr_tree; variables)

Afterward, you may evaluate the function and the gradient from expr_tree with:

x = rand(2)
 MOI.eval_objective(evaluator, x)
 grad = similar(x)
-MOI.eval_objective_gradient(evaluator, grad, x)

Warning: The size of x depends on the number of variables of expr_tree and not from the highest variable's index.

source
ExpressionTreeForge.M_algo_expr_tree.normalize_indices!Method
normalize_indices!(expr_tree, vector_indices; initial_index=0)

Change the indices of the variables from expr_tree to follow the order given by vector_indices. It is paired with get_elemental_variables to define the elemental element function expression tree.

Example:

julia> normalize_indices!(:(x[4] + x[5]), [4,5]; initial_index::Int)
-:(x[1+initial_index] + x[2+initial_index])
source
ExpressionTreeForge.M_algo_expr_tree.sparse_jacobian_JuMP_modelMethod
evaluator = sparse_jacobian_JuMP_model(expr_trees)

Return the evaluator of a MOI.Nonlinear.Model defined by expr_tree, as long as it is supported. The evaluator considers the objective function as the sum of expr_trees and a constraint for each expr_tree contained in expr_trees. If the expression trees in expr_trees depend on a subset of variables, the Jacobian of the constraints will be sparse.

source
ExpressionTreeForge.M_trait_expr_node.get_type_nodeMethod
type = get_type_node(node::Abstract_expr_node, children_types::AbstractVector{Type_expr_basic})

Return the type of node given the type of its children children_types. The types avaible areconstant, linear, quadratic, cubic or more.

source
ExpressionTreeForge.M_trait_expr_node.node_to_ExprMethod
bool = node_to_Expr(node::Abstract_expr_node)

Return the information required to build later on a Julia Expr. An operator node returns the operator symbol (ex: + -> :+). A variable node returns a variable as a MathOptInterface variable. A constant node returns its value.

source
ExpressionTreeForge.M_trait_expr_node.node_to_Expr2Method
bool = node_to_Expr2(node::Abstract_expr_node)

Return the information required to build later on a Julia Expr. An operator node returns the operator symbol (ex: + -> :+). A variable return a variable. A constant node returns its value.

source
ExpressionTreeForge.M_trait_expr_node.node_to_Expr_JuMPMethod
bool = _node_to_Expr_JuMP(node::Abstract_expr_node)

Return the information required to build later on a Julia Expr. An operator node returns the operator symbol (ex: + -> :+). A variable parametrized with the index i returns a variable as a MathOptInterface.Variable(i). A constant node returns its value.

source
ExpressionTreeForge.M_interface_expr_node._node_to_ExprMethod
[symbols] = _node_to_Expr(node::Abstract_expr_node)

Return the information required to build later on a Julia Expr. An operator node returns the operator symbol (ex: + -> :+). A variable node returns a variable as a MathOptInterface variable. A constant node returns its value.

source
ExpressionTreeForge.M_interface_expr_node._node_to_Expr2Method
[symbols] = _node_to_Expr2(node::Abstract_expr_node)

Return the information required to build later on a Julia Expr. An operator node returns the operator symbol (ex: + -> :+). A variable return a variable. A constant node returns its value.

source
ExpressionTreeForge.M_interface_expr_node._node_to_Expr_JuMPMethod
[symbols] = _node_to_Expr2(node::Abstract_expr_node)

Return the information required to build later on a Julia Expr. An operator node returns the operator symbol (ex: + -> :+). A variable return a MathOptInterface.VariableIndex(). A constant node returns its value.

source
ExpressionTreeForge.M_algo_expr_tree.normalize_indices!Method
normalize_indices!(expr_tree, vector_indices; initial_index=0)

Change the indices of the variables from expr_tree to follow the order given by vector_indices. It is paired with get_elemental_variables to define the elemental element function expression tree.

Example:

julia> normalize_indices!(:(x[4] + x[5]), [4,5]; initial_index::Int)
+:(x[1+initial_index] + x[2+initial_index])
source
ExpressionTreeForge.M_algo_expr_tree.sparse_jacobian_JuMP_modelMethod
evaluator = sparse_jacobian_JuMP_model(expr_trees)

Return the evaluator of a MOI.Nonlinear.Model defined by expr_tree, as long as it is supported. The evaluator considers the objective function as the sum of expr_trees and a constraint for each expr_tree contained in expr_trees. If the expression trees in expr_trees depend on a subset of variables, the Jacobian of the constraints will be sparse.

source
ExpressionTreeForge.M_trait_expr_node.get_type_nodeMethod
type = get_type_node(node::Abstract_expr_node, children_types::AbstractVector{Type_expr_basic})

Return the type of node given the type of its children children_types. The types avaible areconstant, linear, quadratic, cubic or more.

source
ExpressionTreeForge.M_trait_expr_node.node_to_ExprMethod
bool = node_to_Expr(node::Abstract_expr_node)

Return the information required to build later on a Julia Expr. An operator node returns the operator symbol (ex: + -> :+). A variable node returns a variable as a MathOptInterface variable. A constant node returns its value.

source
ExpressionTreeForge.M_trait_expr_node.node_to_Expr2Method
bool = node_to_Expr2(node::Abstract_expr_node)

Return the information required to build later on a Julia Expr. An operator node returns the operator symbol (ex: + -> :+). A variable return a variable. A constant node returns its value.

source
ExpressionTreeForge.M_trait_expr_node.node_to_Expr_JuMPMethod
bool = _node_to_Expr_JuMP(node::Abstract_expr_node)

Return the information required to build later on a Julia Expr. An operator node returns the operator symbol (ex: + -> :+). A variable parametrized with the index i returns a variable as a MathOptInterface.Variable(i). A constant node returns its value.

source
ExpressionTreeForge.M_interface_expr_node._node_to_ExprMethod
[symbols] = _node_to_Expr(node::Abstract_expr_node)

Return the information required to build later on a Julia Expr. An operator node returns the operator symbol (ex: + -> :+). A variable node returns a variable as a MathOptInterface variable. A constant node returns its value.

source
ExpressionTreeForge.M_interface_expr_node._node_to_Expr2Method
[symbols] = _node_to_Expr2(node::Abstract_expr_node)

Return the information required to build later on a Julia Expr. An operator node returns the operator symbol (ex: + -> :+). A variable return a variable. A constant node returns its value.

source
ExpressionTreeForge.M_interface_expr_node._node_to_Expr_JuMPMethod
[symbols] = _node_to_Expr2(node::Abstract_expr_node)

Return the information required to build later on a Julia Expr. An operator node returns the operator symbol (ex: + -> :+). A variable return a MathOptInterface.VariableIndex(). A constant node returns its value.

source
ExpressionTreeForge.M_trait_tree.is_type_trait_treeMethod
Type_trait_tree = is_type_trait_tree(a::AbstractTree)
 Type_trait_tree = is_type_trait_tree(a::Expr)
 Type_trait_tree = is_type_trait_tree(a::Number)
-Type_not_trait_tree = is_type_trait_tree(a::Any)

Return a Type_trait_tree only for AbstractTree, Expr or Number (a leaf of a tree). In the other cases it returns Type_not_trait_tree.

source
Base.showMethod
show(tree::AbstractTree; deepth)
-show(io::IO, tree::AbstractTree; deepth)

Print tree in the Julia console with a suitable form.

source
ExpressionTreeForge.M_abstract_tree.create_treeMethod
tree = create_tree(field::T, children::Vector{Type_node{T}}) where {T}
+Type_not_trait_tree = is_type_trait_tree(a::Any)

Return a Type_trait_tree only for AbstractTree, Expr or Number (a leaf of a tree). In the other cases it returns Type_not_trait_tree.

source
Base.showMethod
show(tree::AbstractTree; deepth)
+show(io::IO, tree::AbstractTree; deepth)

Print tree in the Julia console with a suitable form.

source
ExpressionTreeForge.M_abstract_tree.create_treeMethod
tree = create_tree(field::T, children::Vector{Type_node{T}}) where {T}
 tree = create_tree(field::T, children::Array{Any, 1}) where {T}
-tree = create_tree(ex::Expr)

Create a tree of type Type_node. field will be the root node with some children. create_tree can also translate an Expr to a Type_node.

source
+tree = create_tree(ex::Expr)

Create a tree of type Type_node. field will be the root node with some children. create_tree can also translate an Expr to a Type_node.

source