Skip to content
This repository was archived by the owner on Aug 25, 2025. It is now read-only.

Commit ec3067b

Browse files
Traits based boolean switching in instantiate_function call
1 parent ec157c3 commit ec3067b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/cache.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ function OptimizationCache(prob::SciMLBase.OptimizationProblem, opt, data = DEFA
3535
kwargs...)
3636
reinit_cache = OptimizationBase.ReInitCache(prob.u0, prob.p)
3737
num_cons = prob.ucons === nothing ? 0 : length(prob.ucons)
38-
f = OptimizationBase.instantiate_function(prob.f, reinit_cache, prob.f.adtype, num_cons)
38+
f = OptimizationBase.instantiate_function(prob.f, reinit_cache, prob.f.adtype, num_cons,
39+
g = SciMLBase.requiresgradient(opt), h = SciMLBase.requireshessian(opt), fg = SciMLBase.allowsfg(opt),
40+
fgh = SciMLBase.allowsfgh(opt), cons_j = SciMLBase.requiresconsjac(opt), cons_h = SciMLBase.requiresconshess(opt),
41+
cons_vjp = SciMLBase.allowsconsjvp(opt), cons_jvp = SciMLBase.allowsconsjvp(opt), lag_h = SciMLBase.requireslagh(opt))
3942

4043
if (f.sys === nothing ||
4144
f.sys isa SymbolicIndexingInterface.SymbolCache{Nothing, Nothing, Nothing}) &&

0 commit comments

Comments
 (0)