Skip to content

Commit

Permalink
Update solve.jl
Browse files Browse the repository at this point in the history
updated error messages.
  • Loading branch information
ParasPuneetSingh authored Apr 9, 2024
1 parent faf258d commit 807a5a6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/solve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,11 @@ function _check_opt_alg(prob::OptimizationProblem, alg; kwargs...)
!requiresgradient(alg) && !(prob.f::OptimizationFunction) &&

Check warning on line 119 in src/solve.jl

View check run for this annotation

Codecov / codecov/patch

src/solve.jl#L119

Added line #L119 was not covered by tests
throw(IncompatibleOptimizerError("The algorithm $(typeof(alg)) requires gradients, hence use `OptimizationFunction` to generate them with an automatic differentiation backend e.g. `OptimizationFunction(f, AutoForwardDiff())` or pass it in with `grad` kwarg."))
!requireshessian(alg) && !(prob.f::OptimizationFunction) &&

Check warning on line 121 in src/solve.jl

View check run for this annotation

Codecov / codecov/patch

src/solve.jl#L121

Added line #L121 was not covered by tests
throw(IncompatibleOptimizerError("The algorithm $(typeof(alg)) requires hessians, pass them in `OptimizationFunction`."))
throw(IncompatibleOptimizerError("The algorithm $(typeof(alg)) requires hessians, hence use `OptimizationFunction` to generate them with an automatic differentiation backend e.g. `OptimizationFunction(f, AutoFiniteDiff(); kwargs...)` or pass them in with `hess` kwarg."))
!requiresconsjac(alg) && !(prob.f::OptimizationFunction) &&

Check warning on line 123 in src/solve.jl

View check run for this annotation

Codecov / codecov/patch

src/solve.jl#L123

Added line #L123 was not covered by tests
throw(IncompatibleOptimizerError("The algorithm $(typeof(alg)) requires constraint jacobian, pass them with the `cons` kwarg in `OptimizationFunction`."))
throw(IncompatibleOptimizerError("The algorithm $(typeof(alg)) requires constraint jacobians, hence use `OptimizationFunction` to generate them with an automatic differentiation backend e.g. `OptimizationFunction(f, AutoFiniteDiff(); kwargs...)` or pass them in with `cons` kwarg."))
!requiresconshess(alg) && !(prob.f::OptimizationFunction) &&

Check warning on line 125 in src/solve.jl

View check run for this annotation

Codecov / codecov/patch

src/solve.jl#L125

Added line #L125 was not covered by tests
throw(IncompatibleOptimizerError("The algorithm $(typeof(alg)) requires constraint hessian, pass them with the `cons` kwarg in `OptimizationFunction`."))
throw(IncompatibleOptimizerError("The algorithm $(typeof(alg)) requires constraint hessians, hence use `OptimizationFunction` to generate them with an automatic differentiation backend e.g. `OptimizationFunction(f, AutoFiniteDiff(), AutoFiniteDiff(hess=true); kwargs...)` or pass them in with `cons` kwarg."))
return
end

Expand Down

0 comments on commit 807a5a6

Please sign in to comment.