Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "InverseAlgos"
uuid = "64ff6778-433b-4901-a403-25308785a0c4"
authors = ["Andrea Zunino <inverseproblem@users.noreply.github.com>"]
version = "0.2.4"
version = "0.2.5"

[deps]
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Expand All @@ -16,14 +16,4 @@ REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"

[compat]
Dates = "1.11.0"
Distributed = "1.11.0"
DocStringExtensions = "0.9.3"
HDF5 = "0.17.2"
JLD2 = "0.5.10"
LinearAlgebra = "1.11.0"
Logging = "1.11.0"
Printf = "1.11.0"
REPL = "1.11.0"
UUIDs = "1.11.0"
julia = ">=1.10"
54 changes: 54 additions & 0 deletions test/optim_tests.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@


using InverseAlgos.Optimizers
using NonlinearOptimizationTestFunctions


function test_bfgs_testfunc()

N = 10
test_funcs = ["rosenbrock","himmelblau","styblinski_tang","sphere",
"ackley"] # Failing on this one...

allpass = true
for tf in test_funcs
testfun = fixed(TEST_FUNCTIONS[tf],n=N)
pass = optimtestfun(testfun,N)
allpass = allpass && pass
end

@show allpass
return allpass
end


function optimtestfun(testfun,N)

println("\n##===>>> Testing $(testfun.name) function, $N dimensions ")
minval = min_value(testfun)
minpos = min_position(testfun)

function fh!(g,x)
phi = testfun.f(x)
testfun.gradient!(g,x)
return phi
end

x0 = start(testfun)
@show x0
@show minpos

xout,misfout = lmbfgs(fh!,x0,
mem=20,
maxiter=50,
saveres=false)

ce1 = isapprox(xout[end],minpos,atol=1e-8)
ce2 = isapprox(misfout[end],minval,atol=1e-8)

# @show ce1,ce2
# @show minval,misfout[end]
# @show xout[end].-minpos
out = ce1 && ce2
return out
end
Loading