Skip to content

Commit eff11c4

Browse files
committed
do not error if the default callback is passed
1 parent bfcebf1 commit eff11c4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/OptimizationBase/src/solve.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ function _check_opt_alg(prob::SciMLBase.OptimizationProblem, alg; kwargs...)
123123
(isnothing(prob.lcons) || isnothing(prob.ucons)) &&
124124
throw(ArgumentError("Constrained optimization problem requires both `lcons` and `ucons` to be provided to OptimizationProblem. " *
125125
"Example: OptimizationProblem(optf, u0, p; lcons=[-Inf], ucons=[0.0])"))
126-
!allowscallback(alg) && haskey(kwargs, :callback) &&
126+
!allowscallback(alg) && !(get(kwargs, :callback, DEFAULT_CALLBACK) isa NullCallback) &&
127127
throw(IncompatibleOptimizerError("The algorithm $(typeof(alg)) does not support callbacks, remove the `callback` keyword argument from the `solve` call."))
128128
requiresgradient(alg) &&
129129
!(prob.f isa SciMLBase.AbstractOptimizationFunction) &&

0 commit comments

Comments
 (0)