Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

BBO always returns retcode Failure #745

Open
mhauru opened this issue May 15, 2024 · 1 comment
Open

BBO always returns retcode Failure #745

mhauru opened this issue May 15, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@mhauru
Copy link

mhauru commented May 15, 2024

Describe the bug 馃悶

BBO optimisers always have a retcode=SciMLBase.ReturnCode.Failure.

Minimal Reproducible Example 馃憞

using Optimization
using OptimizationBBO
rosenbrock(u, p) = (p[1] - u[1])^2 + p[2] * (u[2] - u[1]^2)^2
u0 = zeros(2)
p = [1.0, 100.0]
prob = OptimizationProblem(rosenbrock, u0, p, lb = [-1.0, -1.0], ub = [1.0, 1.0])
sol = solve(prob, BBO_adaptive_de_rand_1_bin_radiuslimited(), abstol=1e-5, maxiters=100_000)
@show sol
@show sol.retcode
@show sol.original.stop_reason

Output 鈿狅笍

sol = retcode: Failure
u: [0.9992571724242105, 0.9984791455592467]
Final objective value:     6.796067936396855e-7

sol.retcode = SciMLBase.ReturnCode.Failure
sol.original.stop_reason = "Delta fitness (3.2333539155770025e-7) below tolerance (1.0e-5)"

The string stop_reason given by BBO indicates convergence to requested threshold, but the retcode is still Failure.

Environment (please complete the following information):

  • Output of using Pkg; Pkg.status()
  [7f7a1694] Optimization v3.25.0
  [3e6eede4] OptimizationBBO v0.2.1
  • Output of using Pkg; Pkg.status(; mode = PKGMODE_MANIFEST)
  [47edcb42] ADTypes v1.2.0
  [1520ce14] AbstractTrees v0.4.5
  [7d9f7c33] Accessors v0.1.36
  [79e6a3ab] Adapt v4.0.4
  [66dad0bd] AliasTables v1.1.3
  [4fba245c] ArrayInterface v7.10.0
  [a134a8b2] BlackBoxOptim v0.6.3
  [a9c8d775] CPUTime v1.0.0
  [49dc2e85] Calculus v0.5.1
  [38540f10] CommonSolve v0.2.4
  [34da2185] Compat v4.15.0
  [a33af91c] CompositionsBase v0.1.2
  [88cd18e8] ConsoleProgressMonitor v0.1.2
  [187b0558] ConstructionBase v1.5.5
  [9a962f9c] DataAPI v1.16.0
  [864edb3b] DataStructures v0.18.20
  [e2d170a0] DataValueInterfaces v1.0.0
  [31c24e10] Distributions v0.25.108
  [ffbed154] DocStringExtensions v0.9.3
  [fa6b7ba4] DualNumbers v0.6.8
  [4e289a0a] EnumX v1.0.4
  [e2ba6199] ExprTools v0.1.10
  [1a297f60] FillArrays v1.11.0
  [069b7b12] FunctionWrappers v1.1.3
  [77dc65aa] FunctionWrappersWrappers v0.1.3
  [46192b85] GPUArraysCore v0.1.6
  [34004b35] HypergeometricFunctions v0.3.23
  [3587e190] InverseFunctions v0.1.14
  [92d709cd] IrrationalConstants v0.2.2
  [82899510] IteratorInterfaceExtensions v1.0.0
  [692b3bcd] JLLWrappers v1.5.0
  [682c06a0] JSON v0.21.4
  [5be7bae1] LBFGSB v0.4.1
  [1d6d02ad] LeftChildRightSiblingTrees v0.2.0
  [2ab3a3ac] LogExpFunctions v0.3.27
  [e6f89c97] LoggingExtras v1.0.3
  [1914dd2f] MacroTools v0.5.13
  [e1d29d7a] Missings v1.2.0
  [77ba4419] NaNMath v1.0.2
  [7f7a1694] Optimization v3.25.0
  [3e6eede4] OptimizationBBO v0.2.1
  [bca83a33] OptimizationBase v0.0.7
  [bac558e1] OrderedCollections v1.6.3
  [90014a1f] PDMats v0.11.31
  [69de0a69] Parsers v2.8.1
  [aea7be01] PrecompileTools v1.2.1
  [21216c6a] Preferences v1.4.3
  [33c8b6b6] ProgressLogging v0.1.4
  [92933f4c] ProgressMeter v1.10.0
  [43287f4e] PtrArrays v1.1.0
  [1fd47b50] QuadGK v2.9.4
  [3cdcf5f2] RecipesBase v1.3.4
  [731186ca] RecursiveArrayTools v3.18.1
  [189a3867] Reexport v1.2.2
  [ae029012] Requires v1.3.0
  [79098fc4] Rmath v0.7.1
  [7e49a35a] RuntimeGeneratedFunctions v0.5.13
  [0bca4576] SciMLBase v2.37.0
  [c0aeaf25] SciMLOperators v0.3.8
  [53ae85a6] SciMLStructures v1.2.0
  [efcf1570] Setfield v1.1.1
  [a2af1166] SortingAlgorithms v1.2.1
  [d4ead438] SpatialIndexing v0.1.6
  [276daf66] SpecialFunctions v2.4.0
  [1e83bf80] StaticArraysCore v1.4.2
  [82ae8749] StatsAPI v1.7.0
  [2913bbd2] StatsBase v0.34.3
  [4c63d2b9] StatsFuns v1.3.1
  [2efcf032] SymbolicIndexingInterface v0.3.21
  [3783bdb8] TableTraits v1.0.1
  [bd369af6] Tables v1.11.1
  [5d786b92] TerminalLoggers v0.1.7
  [81d17ec3] L_BFGS_B_jll v3.0.1+0
  [efe28fd5] OpenSpecFun_jll v0.5.5+0
  [f50d1b31] Rmath_jll v0.4.0+0
  [0dad84c5] ArgTools v1.1.1
  [56f22d72] Artifacts
  [2a0f44e3] Base64
  [ade2ca70] Dates
  [8ba89e20] Distributed
  [f43a241f] Downloads v1.6.0
  [7b1f6079] FileWatching
  [9fa8497b] Future
  [b77e0a4c] InteractiveUtils
  [b27032c2] LibCURL v0.6.4
  [76f85450] LibGit2
  [8f399da3] Libdl
  [37e2e46d] LinearAlgebra
  [56ddb016] Logging
  [d6f4376e] Markdown
  [a63ad114] Mmap
  [ca575930] NetworkOptions v1.2.0
  [44cfe95a] Pkg v1.10.0
  [de0858da] Printf
  [3fa0cd96] REPL
  [9a3f8284] Random
  [ea8e919c] SHA v0.7.0
  [9e88b42a] Serialization
  [6462fe0b] Sockets
  [2f01184e] SparseArrays v1.10.0
  [10745b16] Statistics v1.10.0
  [4607b0f0] SuiteSparse
  [fa267f1f] TOML v1.0.3
  [a4e569a6] Tar v1.10.0
  [8dfed614] Test
  [cf7118a7] UUIDs
  [4ec0a83e] Unicode
  [e66e0078] CompilerSupportLibraries_jll v1.1.0+0
  [deac9b47] LibCURL_jll v8.4.0+0
  [e37daf67] LibGit2_jll v1.6.4+0
  [29816b5a] LibSSH2_jll v1.11.0+1
  [c8ffd9c3] MbedTLS_jll v2.28.2+1
  [14a3606d] MozillaCACerts_jll v2023.1.10
  [4536629a] OpenBLAS_jll v0.3.23+4
  [05823500] OpenLibm_jll v0.8.1+2
  [bea87d4a] SuiteSparse_jll v7.2.1+1
  [83775a58] Zlib_jll v1.2.13+1
  [8e850b90] libblastrampoline_jll v5.8.0+1
  [8e850ede] nghttp2_jll v1.52.0+1
  [3f19e933] p7zip_jll v17.4.0+2
  • Output of versioninfo()
Julia Version 1.10.2
Commit bd47eca2c8a (2024-03-01 10:14 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: macOS (arm64-apple-darwin22.4.0)
  CPU: 10  Apple M1 Pro
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, apple-m1)
Threads: 1 default, 0 interactive, 1 GC (on 8 virtual cores)

Additional context

The issues seems to be that OptimizationBBO takes the stop_reason string, converts it to a Symbol, and passes it as retcode here:

opt_ret = Symbol(opt_res.stop_reason)

but SciMLBase has the fallback behavior of returning Failure when it doesn't recognise the Symbol:
https://github.com/SciML/SciMLBase.jl/blob/541e7fd132f8029c0ef8c1af26eefa6314810a03/src/retcodes.jl#L407

If parsing the strings returned by BBO is too much trouble then maybe returning ReturnCode.Default would be less misleading.

@mhauru mhauru added the bug Something isn't working label May 15, 2024
@ChrisRackauckas
Copy link
Member

We'd need to change these to the retcodes of SciML. In the meantime, it would be good to change this to Default.

ParasPuneetSingh added a commit to ParasPuneetSingh/Optimization.jl that referenced this issue May 29, 2024
The comment edit needs to be performed in SciMLBase and other solver packages.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants