Skip to content

Commit 7e9c6cb

Browse files
authored
Update mathoptinterface_api.jl
1 parent 707ab59 commit 7e9c6cb

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Nonlinear/ReverseAD/mathoptinterface_api.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,10 @@ function MOI.initialize(d::NLPEvaluator, requested_features::Vector{Symbol})
138138
end
139139
# 10 is hardcoded upper bound to avoid excess memory allocation
140140
max_chunk = min(max_chunk, 10)
141-
max_expr_with_sub_length =
142-
maximum(d.subexpression_order; init = max_expr_length) do k
143-
return length(d.subexpressions[k].nodes)
144-
end
141+
max_expr_with_sub_length = max(
142+
max_expr_length,
143+
maximum(x -> length(x.nodes), d.subexpressions; init = 0),
144+
)
145145
if d.want_hess || want_hess_storage
146146
d.input_ϵ = zeros(max_chunk * N)
147147
d.output_ϵ = zeros(max_chunk * N)

0 commit comments

Comments
 (0)