Skip to content

Commit

Permalink
[POC] Allow array in nonlinear expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
blegat committed Aug 16, 2023
1 parent 86a15ca commit 7439e4c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/nlp_expr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,10 @@ for f in MOI.Nonlinear.DEFAULT_UNIVARIATE_OPERATORS
end
end

function LinearAlgebra.det(A::LinearAlgebra.Symmetric{<:AbstractJuMPScalar})
return GenericNonlinearExpr{variable_ref_type(eltype(A))}(:det, A)
end

# Multivariate operators

# The multivariate operators in MOI are +, -, *, ^, /, ifelse, atan
Expand Down Expand Up @@ -460,6 +464,8 @@ function moi_function(f::GenericNonlinearExpr)
end
elseif arg isa Number
push!(parent.args, arg)
elseif arg isa AbstractArray
push!(parent.args, moi_function.(arg))
else
push!(parent.args, moi_function(arg))
end
Expand All @@ -484,6 +490,8 @@ function jump_function(model::GenericModel, f::MOI.ScalarNonlinearFunction)
end
elseif arg isa Number
push!(parent.args, arg)
elseif arg isa AbstractArray
push!(parent.args, jump_function.(model, arg))
else
push!(parent.args, jump_function(model, arg))
end
Expand Down

0 comments on commit 7439e4c

Please sign in to comment.