@@ -73,6 +73,7 @@ function restoreoptsum!(
73
73
end
74
74
75
75
function restoreoptsum! (ops:: OptSummary{T} , dict:: AbstractDict ) where {T}
76
+ warn_old_version = true
76
77
allowed_missing = (
77
78
:lowerbd , # never saved, -Inf not allowed in JSON
78
79
:xtol_zero_abs , # added in v4.25.0
@@ -91,7 +92,9 @@ function restoreoptsum!(ops::OptSummary{T}, dict::AbstractDict) where {T}
91
92
throw (ArgumentError (string (" optsum names: " , nmdiff, " not found in io" )))
92
93
end
93
94
if length (setdiff (allowed_missing, keys (dict))) > 1 # 1 because :lowerbd
94
- @warn " optsum was saved with an older version of MixedModels.jl: consider resaving."
95
+ @debug " " setdiff (allowed_missing, keys (dict))
96
+ warn_old_version && @warn " optsum was saved with an older version of MixedModels.jl: consider resaving."
97
+ warn_old_version = false
95
98
end
96
99
97
100
if any (ops. lowerbd .> dict. initial) || any (ops. lowerbd .> dict. final)
@@ -116,13 +119,26 @@ function restoreoptsum!(ops::OptSummary{T}, dict::AbstractDict) where {T}
116
119
fitlog = get (dict, :fitlog , nothing )
117
120
ops. fitlog = if isnothing (fitlog)
118
121
# compat with fits saved before fitlog
119
- [( ops. initial, ops. finitial), (ops. final, ops. fmin)]
122
+ Table (; θ = ( ops. initial, ops. finitial), objective = (ops. final, ops. fmin))
120
123
else
121
- [( convert (Vector{T}, first (entry)), T ( last (entry))) for entry in fitlog]
124
+ _deserialize_fitlog (fitlog, T, warn_old_version)
122
125
end
123
126
return ops
124
127
end
125
128
129
+ # fitlog structure in MixedModels 4.x
130
+ function _deserialize_fitlog (fitlog, T, warn_old_version:: Bool )
131
+ warn_old_version && @warn " optsum was saved with an older version of MixedModels.jl: consider resaving."
132
+ warn_old_version = false
133
+ return Table (( (; θ= convert (Vector{T}, first (entry)),
134
+ objective= T (last (entry))) for entry in fitlog))
135
+ end
136
+
137
+ function _deserialize_fitlog (fitlog:: JSON3.Array{JSON3.Object} , T, :: Bool )
138
+ return Table (( (; θ= convert (Vector{T}, entry. θ),
139
+ objective= T (entry. objective)) for entry in fitlog))
140
+ end
141
+
126
142
StructTypes. StructType (:: Type{<:OptSummary} ) = StructTypes. Mutable ()
127
143
StructTypes. excludes (:: Type{<:OptSummary} ) = (:lowerbd ,)
128
144
0 commit comments