@@ -113,8 +113,16 @@ function MOIOptimizationNLPCache(prob::OptimizationProblem,
113113 reinit_cache = OptimizationBase. ReInitCache (prob. u0, prob. p) # everything that can be changed via `reinit`
114114
115115 num_cons = prob. ucons === nothing ? 0 : length (prob. ucons)
116- f = Optimization. instantiate_function (prob. f, reinit_cache, prob. f. adtype, num_cons;
117- g = true , h = true , cons_j = true , cons_vjp = true , lag_h = true )
116+ if prob. f. adtype isa ADTypes. AutoSymbolics || (prob. f. adtype isa ADTypes. AutoSparse &&
117+ prob. f. adtype. dense_ad isa ADTypes. AutoSymbolics)
118+ f = Optimization. instantiate_function (
119+ prob. f, reinit_cache, prob. f. adtype, num_cons;
120+ g = true , h = true , cons_j = true , cons_h = true )
121+ else
122+ f = Optimization. instantiate_function (
123+ prob. f, reinit_cache, prob. f. adtype, num_cons;
124+ g = true , h = true , cons_j = true , cons_vjp = true , lag_h = true )
125+ end
118126 T = eltype (prob. u0)
119127 n = length (prob. u0)
120128
@@ -290,7 +298,8 @@ function MOI.eval_constraint_jacobian(evaluator::MOIOptimizationNLPEvaluator, j,
290298 return
291299end
292300
293- function MOI. eval_constraint_jacobian_product (evaluator:: MOIOptimizationNLPEvaluator , y, x, w)
301+ function MOI. eval_constraint_jacobian_product (
302+ evaluator:: MOIOptimizationNLPEvaluator , y, x, w)
294303 if evaluator. f. cons_jvp != = nothing
295304 evaluator. f. cons_jvp (y, x, w)
296305
0 commit comments