I have an MTK model solution that I want to store temporarily. For that I can easily use Serialization.jl and it works nicely.
However, when I want to store the solution object using JLD2 it saves the object, but on load I get the following error:
julia> @load "shi_sol.jld2" shi_sol
ERROR: setfield!: const field .bits of type BitSet cannot be changed
Stacktrace:
[1] macro expansion
@ ~/.julia/packages/JLD2/k9Gt0/src/data/reconstructing_datatypes.jl:528 [inlined]
[2] jlconvert(#unused#::JLD2.ReadRepresentation{BitSet, JLD2.OnDiskRepresentation{(0, 8), Tuple{Vector{UInt64}, Int64}, Tuple{JLD2.RelOffset, Int64}}()}, f::JLD2.JLDFile{JLD2.MmapIO}, ptr::Ptr{Nothing}, header_offset::JLD2.RelOffset)
Stacktrace is longer (very long), but I didn’t want to put that all here for now. Can provide it if needed.
With a simpler model this works, but not with the complex one. Is there a way to store these solutions?
Or is the best option to use Serialization.jl for short term storage (I understand that it will not work between versions or machines) and use other data-formats for long-term storage?
If there is a way around this, is JLD2 still the best way to store data objects or is there another option?