… and I’m not really sure why.
To keep things simple, we’ve simply used two macros to repeat some fields which are in all Optimizers. The approach is the following (with gradient descent as an example):
type GradientDescentState{T}
@add_generic_fields
x_previous::Array{T}
g::Array{T}
f_x_previous::T
s::Array{T}
@add_linesearch_fields
end
macro add_generic_fields()
quote
method_string::String
n::Int64
x::Array{T}
f_x::T
f_calls::Int64
g_calls::Int64
h_calls::Int64
end
end
macro add_linesearch_fields()
quote
x_ls::Array{T}
g_ls::Array{T}
alpha::T
mayterminate::Bool
lsr::LineSearches.LineSearchResults
end
end
On v0.4 and v0.5 this works fine, but on v0.6 this fails. See Travis CI - Test and Deploy Your Code with Confidence and http://pkg.julialang.org/logs/DiffEqParamEstim_0.6.log for packages whose tests fail on master due to Optim failing to be precompiled. We don’t support v0.6 at all yet, but I’d rather fix it now than later.
I can simply go back to repeating the field names in all Optimizer definitions, but I’m not really sure what the problem is or why it is prepending the Optim.
in the Optim.method_string
in the error. Any ideas?