@@ -44,6 +44,7 @@ function MOI.initialize(d::NLPEvaluator, requested_features::Vector{Symbol})
4444 want_hess_storage = (:HessVec in requested_features) || d. want_hess
4545 coloring_storage = Coloring. IndexedSet (N)
4646 max_expr_length = 0
47+ max_expr_with_sub_length = 0
4748 #
4849 main_expressions = [c. expression. nodes for (_, c) in d. data. constraints]
4950 if d. data. objective != = nothing
@@ -71,6 +72,8 @@ function MOI.initialize(d::NLPEvaluator, requested_features::Vector{Symbol})
7172 )
7273 d. subexpressions[k] = subex
7374 d. subexpression_linearity[k] = subex. linearity
75+ max_expr_with_sub_length =
76+ max (max_expr_with_sub_length, length (subex. nodes))
7477 if d. want_hess
7578 empty! (coloring_storage)
7679 _compute_gradient_sparsity! (coloring_storage, subex. nodes)
@@ -138,10 +141,8 @@ function MOI.initialize(d::NLPEvaluator, requested_features::Vector{Symbol})
138141 end
139142 # 10 is hardcoded upper bound to avoid excess memory allocation
140143 max_chunk = min (max_chunk, 10 )
141- max_expr_with_sub_length = max (
142- max_expr_length,
143- maximum (x -> length (x. nodes), d. subexpressions; init = 0 ),
144- )
144+ max_expr_with_sub_length =
145+ max (max_expr_with_sub_length, max_expr_length)
145146 if d. want_hess || want_hess_storage
146147 d. input_ϵ = zeros (max_chunk * N)
147148 d. output_ϵ = zeros (max_chunk * N)
0 commit comments