Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
odow committed Nov 22, 2024
1 parent 2796ec8 commit 2bf5bf8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/nlp_expr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -693,26 +693,27 @@ function _evaluate_expr(
parent, arg = pop!(stack)
if arg isa MOI.ScalarNonlinearFunction
new_ret = _ConcreteExpression(arg.head)
push!(parent.args, new_ret)
push!(parent.args, (arg, new_ret))
for child in reverse(arg.args)
push!(stack, (new_ret, child))
end

Check warning on line 699 in src/nlp_expr.jl

View check run for this annotation

Codecov / codecov/patch

src/nlp_expr.jl#L695-L699

Added lines #L695 - L699 were not covered by tests
else
push!(parent.args, _evaluate_expr(registry, f, arg))
end
end
return _evaluate_expr(registry, f, ret)
return _evaluate_expr(registry, f, (expr, ret))
end

function _evaluate_expr(
registry::MOI.Nonlinear.OperatorRegistry,
::Function,
expr::_ConcreteExpression,
input::Tuple{<:GenericNonlinearExpr,_ConcreteExpression},
)
f, expr = input
op, args, nargs = expr.head, expr.args, length(expr.args)
# TODO(odow): uses private function
if !MOI.Nonlinear._is_registered(registry, op, nargs)
model = owner_model(expr)
model = owner_model(f)
udf = MOI.get(model, MOI.UserDefinedFunction(op, nargs))
if udf === nothing
return error(
Expand Down

0 comments on commit 2bf5bf8

Please sign in to comment.