robertfeldt / BlackBoxOptim.jl

Black-box optimization for Julia
Other
439 stars 56 forks source link

Example: ODE Lorenz Attractor, small bugs #116

Closed finmod closed 5 years ago

finmod commented 5 years ago

@robertfeldt Thank you for updating this example in a direction that I welcome. I failed to notice last August.

Just want to flag that in Julia 1.0.3 the syntax for collect has changed to:

t = collect(range(0,stop=100,length=100001)) and

t_Xiang2015 = collect(range(0,stop=3,length=301))

But I have a problem with:

origstates = calc_state_vectors(real_params, lorentz_equations, r0, t) origstates_Xiang2015 = calc_state_vectors(real_params, lorentz_equations, r0, t_Xiang2015)

function subsample(origstates::Array{Float64, 2}, times::Vector{Float64}, lenratio = 0.25) @assert size(origstates, 2) == length(times) N = length(times) stopidx = round(Int, lenratio*N) indexes = 1:stopidx return origstates[:, indexes], times[indexes] end

that gives:

MethodError: no method matching Array(::Type{Float64}, ::Int64, ::Int64) Closest candidates are: Array(!Matched::LinearAlgebra.UniformScaling, ::Integer, ::Integer) at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.0\LinearAlgebra\src\uniformscaling.jl:330

Stacktrace:

finmod commented 5 years ago

@alyst Sorry, I forgot to tag you.

alyst commented 5 years ago

Thanks for the notice. It seems L50 of ode_lorenz_attractor.jl needs updating. I'll take care of this, but in future pls feel free to submit PR with the fixes, as it would speed up the process.