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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error Restarting the Optimization #186

Open
zxjroger opened this issue Jun 6, 2021 · 2 comments
Open

Error Restarting the Optimization #186

zxjroger opened this issue Jun 6, 2021 · 2 comments

Comments

@zxjroger
Copy link

zxjroger commented Jun 6, 2021

I use BSON to save the optimization progress stored in bbsetup and then restart the optimization. My latest saved optimization progress was done in [email protected]. Then, I update the package to the master version. However, I can no longer load the optimization progress using BSON. It gives me the following error:

TypeError: in Type, in FS, expected FS<:FitnessScheme, got Type{ContinuousRectSearchSpace}
constructtype(T::Type, Ts::Vector{Any}) at extensions.jl:51
(::BSON.var"#35#36")(d::Dict{Symbol, Any}, init::Module) at extensions.jl:54
_raise_recursive(d::Dict{Symbol, Any}, cache::IdDict{Any, Any}, init::Module) at read.jl:80
raise_recursive(d::Dict{Symbol, Any}, cache::IdDict{Any, Any}, init::Module) at read.jl:93
(::BSON.var"#23#24"{IdDict{Any, Any}, Module})(x::Dict{Symbol, Any}) at read.jl:98
applychildren!(f::BSON.var"#23#24"{IdDict{Any, Any}, Module}, x::Vector{Any}) at BSON.jl:28
raise_recursive at read.jl:98 [inlined]
(::BSON.var"#17#20"{IdDict{Any, Any}, Module})(x::Vector{Any}) at read.jl:80
applychildren!(f::BSON.var"#17#20"{IdDict{Any, Any}, Module}, x::Dict{Symbol, Any}) at BSON.jl:21
_raise_recursive(d::Dict{Symbol, Any}, cache::IdDict{Any, Any}, init::Module) at read.jl:80
raise_recursive(d::Dict{Symbol, Any}, cache::IdDict{Any, Any}, init::Module) at read.jl:93
(::BSON.var"#45#46")(d::Dict{Symbol, Any}, cache::IdDict{Any, Any}, init::Module) at extensions.jl:139
raise_recursive(d::Dict{Symbol, Any}, cache::IdDict{Any, Any}, init::Module) at read.jl:92
(::BSON.var"#23#24"{IdDict{Any, Any}, Module})(x::Dict{Symbol, Any}) at read.jl:98
applychildren!(f::BSON.var"#23#24"{IdDict{Any, Any}, Module}, x::Vector{Any}) at BSON.jl:28
raise_recursive at read.jl:98 [inlined]
(::BSON.var"#41#42"{IdDict{Any, Any}, Module})(x::Vector{Any}) at extensions.jl:125
iterate at generator.jl:47 [inlined]
collect_to!(dest::Vector{Vector{Any}}, itr::Base.Generator{Vector{Any}, BSON.var"#41#42"{IdDict{Any, Any}, Module}}, offs::Int64, st::Int64) at array.jl:724
collect_to_with_first!(dest::Vector{Vector{Any}}, v1::Vector{Any}, itr::Base.Generator{Vector{Any}, BSON.var"#41#42"{IdDict{Any, Any}, Module}}, st::Int64) at array.jl:702
_collect(c::Vector{Any}, itr::Base.Generator{Vector{Any}, BSON.var"#41#42"{IdDict{Any, Any}, Module}}, #unused#::Base.EltypeUnknown, isz::Base.HasShape{1}) at array.jl:696
collect_similar(cont::Vector{Any}, itr::Base.Generator{Vector{Any}, BSON.var"#41#42"{IdDict{Any, Any}, Module}}) at array.jl:606
map(f::Function, A::Vector{Any}) at abstractarray.jl:2294
newstruct_raw(cache::IdDict{Any, Any}, T::Type, d::Dict{Symbol, Any}, init::Module) at extensions.jl:125
(::BSON.var"#45#46")(d::Dict{Symbol, Any}, cache::IdDict{Any, Any}, init::Module) at extensions.jl:141
raise_recursive(d::Dict{Symbol, Any}, cache::IdDict{Any, Any}, init::Module) at read.jl:92
raise_recursive at read.jl:103 [inlined]
load at read.jl:108 [inlined]
load(x::String) at read.jl:108
top-level scope at Notes.jl:4184
eval at boot.jl:360 [inlined]
@robertfeldt
Copy link
Owner

Hmm, not sure what the effect of BSON is here but is the problem to load the state saved with an old version of BBO or is the problem also there if you both save and load (using BSON) with the current master? Julia's Serialization seems to work as expected see example here (I just tried and this works as expected on 1.6.1):

https://github.com/robertfeldt/BlackBoxOptim.jl/blob/master/examples/save_and_load_optimization_state_to_disc.jl

@Libbum
Copy link
Contributor

Libbum commented Jun 7, 2021

I'd also try pinning your BSON version to 0.2.6 and see if you get the same issues. I've had some problems with later versions that I cannot seem to identify the root cause of.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants