Hi all, I’m trying to minimize a function which has constraint as nonlinear vector function. input of constraint function is vector and output of constraint function is a vector of large size ( more than 500 elements )
Hi. ReverseDiff is an optional dependency. The ReverseDiff backend only becomes available after you have imported ReverseDiff. Is that what you were asking?
I imported it. I don’t know how to change the default option of ADNLPMode .
l want ADNLPMode to use ReverseDiff instead of ForwardDiff. Kindly provide my the syntaxes
@dpo, I have go through the link which you provided. I’m getting error, I have already installed the packages of Zygote and ReverseDiff
‘’’ julia
using ReverseDiff
using Zygote
using ADNLPModels
using Test
ADNLPModels.ADNLPModel
function test_autodiff_backend_error()
@testset "Error without loading package - $adbackend" for adbackend in (ZygoteAD, ReverseDiffAD)
adbackend = if adbackend == ZygoteAD
eval(adbackend)(0, 0)
else
eval(adbackend){Nothing}(0, 0, nothing)
end
@test_throws ArgumentError gradient(adbackend, sum, [1.0])
@test_throws ArgumentError gradient!(adbackend, [1.0], sum, [1.0])
end
end
test_autodiff_backend_error()
‘’’
error message looks like
‘’’ julia
ERROR: UndefVarError: ZygoteAD not defined
Stacktrace:
[1] macro expansion
@ /opt/julia-1.7.2/share/julia/stdlib/v1.7/Test/src/Test.jl:1378 [inlined]
[2] test_autodiff_backend_error()
@ Main ~/Navneeth_Research/Julia_Navneth_Code/testing1.jl:11
[3] top-level scope
@ ~/Navneeth_Research/Julia_Navneth_Code/testing1.jl:25
‘’’
I’m running my julia code in VScode. Any guidance is highly appreciated.