Hello and welcome to the community ![]()
The error message seems pretty clear to me, the non-standard number type ForwardDiff.Dual appears because you are using AutoForwardDiff. You could try to make use of finite differences for computing the gradient instead of ForwardDiff, i.e., change
into Optimization.AutoFiniteDiff().