Skip to content

Commit

Permalink
switch to diffbase
Browse files Browse the repository at this point in the history
  • Loading branch information
jrising committed Feb 26, 2018
1 parent fd47983 commit 0aefdb0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/OptiMimi.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module OptiMimi

using NLopt
using ForwardDiff
using ForwardDiff, DiffBase
using MathProgBase
using Compat

Expand Down Expand Up @@ -106,13 +106,13 @@ function autodiffobjective(model::Model, components::Vector{Symbol}, names::Vect
end
else
function myobjective(xx::Vector, grad::Vector)
out = GradientResult(xx)
out = DiffBase.GradientResult(xx)
ForwardDiff.gradient!(out, myunaryobjective, xx)
if any(isnan(ForwardDiff.gradient(out)))
if any(isnan(DiffBase.gradient(out)))
error("objective gradient is NaN")
end
copy!(grad, ForwardDiff.gradient(out))
ForwardDiff.value(out)
copy!(grad, DiffBase.gradient(out))
DiffBase.value(out)
end
end

Expand Down

0 comments on commit 0aefdb0

Please sign in to comment.