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

Don't re-create the cache in every iteration of Fminbox as it calls the objective too often #850

Merged
merged 3 commits into from
Sep 4, 2020

Conversation

pkofod
Copy link
Member

@pkofod pkofod commented Aug 26, 2020

@codecov
Copy link

codecov bot commented Aug 26, 2020

Codecov Report

Merging #850 into master will increase coverage by 0.03%.
The diff coverage is 87.12%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #850      +/-   ##
==========================================
+ Coverage   81.59%   81.62%   +0.03%     
==========================================
  Files          43       43              
  Lines        2701     2749      +48     
==========================================
+ Hits         2204     2244      +40     
- Misses        497      505       +8     
Impacted Files Coverage Δ
src/types.jl 44.70% <ø> (-1.18%) ⬇️
src/multivariate/solvers/first_order/bfgs.jl 92.98% <66.66%> (-4.85%) ⬇️
src/multivariate/solvers/constrained/fminbox.jl 72.92% <87.67%> (-0.03%) ⬇️
src/multivariate/optimize/optimize.jl 87.27% <100.00%> (+0.23%) ⬆️
src/multivariate/solvers/first_order/cg.jl 100.00% <100.00%> (ø)
...ltivariate/solvers/first_order/gradient_descent.jl 100.00% <100.00%> (ø)
src/multivariate/solvers/first_order/l_bfgs.jl 100.00% <100.00%> (+1.58%) ⬆️
...ultivariate/solvers/zeroth_order/particle_swarm.jl 98.70% <0.00%> (-0.44%) ⬇️
src/multivariate/solvers/constrained/samin.jl 77.92% <0.00%> (+1.29%) ⬆️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d810ad1...e9fffe4. Read the comment docs.

@neoabs
Copy link

neoabs commented Sep 2, 2020

I have it to:

image

My code is:
results = optimize(prices -> objective_function(prices, mdl, method_cube), lower, upper, mdl.Prices , Fminbox(NelderMead() ) )
mdl is a mutable struct method_cube is a string. Using standard simplex.

@pkofod
Copy link
Member Author

pkofod commented Sep 2, 2020

Is that with this branch? That picture looks identical to the other one you posted @neoabs

@neoabs
Copy link

neoabs commented Sep 2, 2020

@pkofod you are correct, I misunderstood you.

I ll try new branch tomorrow and get back to you.

@pkofod
Copy link
Member Author

pkofod commented Sep 2, 2020

Oh no worries, I was just confused if you had run it again and gotten the same thing or if this was the same run. They looked identical which makes sense given that they are identical :)

@pkofod pkofod merged commit f923c36 into master Sep 4, 2020
@pkofod
Copy link
Member Author

pkofod commented Sep 4, 2020

Please report back if you still see issues after the new version is tagged.

@neoabs
Copy link

neoabs commented Sep 11, 2020

ERROR: LoadError: type BarrierWrapper has no field f_calls Stacktrace: [1] getproperty(::Optim.BarrierWrapper{OnceDifferentiable{Float64,Array{Float64,1},Array{Float64,1}},Optim.BoxBarrier{Array{Float64,1},Array{Float64,1}},Float64,Float64,Array{Float64,1}}, ::Symbol) at ./Base.jl:33 [2] value!!(::Optim.BarrierWrapper{OnceDifferentiable{Float64,Array{Float64,1},Array{Float64,1}},Optim.BoxBarrier{Array{Float64,1},Array{Float64,1}},Float64,Float64,Array{Float64,1}}, ::Array{Float64,1}) at /home/szpieg/.julia/packages/NLSolversBase/5oIMo/src/interface.jl:7 [3] initial_state(::NelderMead{Optim.AffineSimplexer,Optim.AdaptiveParameters}, ::Optim.Options{Float64,Nothing}, ::Optim.BarrierWrapper{OnceDifferentiable{Float64,Array{Float64,1},Array{Float64,1}},Optim.BoxBarrier{Array{Float64,1},Array{Float64,1}},Float64,Float64,Array{Float64,1}}, ::Array{Float64,1}) at /home/szpieg/.julia/packages/Optim/KE5Mt/src/multivariate/solvers/zeroth_order/nelder_mead.jl:158 [4] optimize(::OnceDifferentiable{Float64,Array{Float64,1},Array{Float64,1}}, ::Array{Float64,1}, ::Array{Float64,1}, ::Array{Float64,1}, ::Fminbox{NelderMead{Optim.AffineSimplexer,Optim.AdaptiveParameters},Float64,Optim.var"#45#47"}, ::Optim.Options{Float64,Nothing}) at /home/szpieg/.julia/packages/Optim/KE5Mt/src/multivariate/solvers/constrained/fminbox.jl:307 [5] optimize(::Function, ::Array{Float64,1}, ::Array{Float64,1}, ::Array{Float64,1}, ::Fminbox{NelderMead{Optim.AffineSimplexer,Optim.AdaptiveParameters},Float64,Optim.var"#45#47"}, ::Optim.Options{Float64,Nothing}; inplace::Bool, autodiff::Symbol) at /home/szpieg/.julia/packages/Optim/KE5Mt/src/multivariate/solvers/constrained/fminbox.jl:254 [6] optimize(::Function, ::Array{Float64,1}, ::Array{Float64,1}, ::Array{Float64,1}, ::Fminbox{NelderMead{Optim.AffineSimplexer,Optim.AdaptiveParameters},Float64,Optim.var"#45#47"}, ::Optim.Options{Float64,Nothing}) at /home/szpieg/.julia/packages/Optim/KE5Mt/src/multivariate/solvers/constrained/fminbox.jl:253 (repeats 2 times) [7] hans_solver(::ModelInit{Float64}, ::Array{Float64,1}, ::Array{Float64,1}; method_cube::String) at /home/szpieg/Julia/grant/HANS/HANS_solver/solver/solver.base.jl:7 [8] hans_solver(::ModelInit{Float64}, ::Array{Float64,1}, ::Array{Float64,1}) at /home/szpieg/Julia/grant/HANS/HANS_solver/solver/solver.base.jl:5 (repeats 2 times) [9] top-level scope at /home/szpieg/Julia/grant/HANS/HANS_solver/mymodel.jl:19 in expression starting at /home/szpieg/Julia/grant/HANS/HANS_solver/mymodel.jl:19

same code as above. I updated packages prior to that. Am I doing something wrong or is there some other issue?

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

Successfully merging this pull request may close these issues.

None yet

2 participants