@@ -15,8 +15,7 @@ SciMLBase.supports_opt_cache_interface(::PRIMASolvers) = true
1515SciMLBase. allowsconstraints (:: Union{LINCOA, COBYLA} ) = true
1616SciMLBase. allowsbounds (opt:: Union{BOBYQA, LINCOA, COBYLA} ) = true
1717SciMLBase. requiresconstraints (opt:: COBYLA ) = true
18- SciMLBase. requiresgradient (opt:: Union{BOBYQA, LINCOA, COBYLA} ) = true
19- SciMLBase. requiresconsjac (opt:: Union{LINCOA, COBYLA} ) = true
18+ SciMLBase. requiresconsjac (opt:: COBYLA ) = true
2019SciMLBase. requiresconshess (opt:: COBYLA ) = true
2120
2221function Optimization. OptimizationCache (prob:: SciMLBase.OptimizationProblem ,
@@ -34,8 +33,14 @@ function Optimization.OptimizationCache(prob::SciMLBase.OptimizationProblem,
3433 throw (" We evaluate the jacobian and hessian of the constraints once to automatically detect
3534 linear and nonlinear constraints, please provide a valid AD backend for using COBYLA." )
3635 else
37- f = Optimization. instantiate_function (
38- prob. f, reinit_cache. u0, prob. f. adtype, reinit_cache. p, num_cons)
36+ if opt isa COBYLA
37+ f = Optimization. instantiate_function (
38+ prob. f, reinit_cache. u0, prob. f. adtype, reinit_cache. p, num_cons,
39+ cons_j = true , cons_h = true )
40+ else
41+ f = Optimization. instantiate_function (
42+ prob. f, reinit_cache. u0, prob. f. adtype, reinit_cache. p, num_cons)
43+ end
3944 end
4045
4146 return Optimization. OptimizationCache (f, reinit_cache, prob. lb, prob. ub, prob. lcons,
0 commit comments