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

Fix input for (L)BFGS and PSO #431

Merged
merged 5 commits into from
Jun 17, 2017
Merged

Fix input for (L)BFGS and PSO #431

merged 5 commits into from
Jun 17, 2017

Conversation

pkofod
Copy link
Member

@pkofod pkofod commented Jun 16, 2017

ref #399

@inbounds state.x[i] = state.x[i] + state.dx[i]
@simd for i = 1:n
state.dx[i] .= state.alpha .* state.s[i]
state.x[i] .= state.x[i] .+ state.dx[i]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will it not work to do state.x .= state.x .+ state.dx? (Would dot-notation not work for arbitrary vector-types?)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I got confused. I mean on the state.s: I thought that's meant to be a vector, whilst state.x may be a multidimensional array?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a mistake! I had originally tried to change it to broadcast, but that didn't like mixing vectors and matrices.

I mean, state.x is allowed to be multidimensional. If x is passed as a matrix we want Optim.minimizer(res) to be a matrix as well.

We could store s as the same type as x, and throw vec's around state.s whereever it shows up?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would reshape on state.s work?
Alternatively reshape on Optim.minimizer(res), and then just have state.x as a vector internally

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, ofc you could just do minimizer = similar(initial_x); copy!(minimizer, state.x) in the end, that's another possibility.

@codecov
Copy link

codecov bot commented Jun 16, 2017

Codecov Report

Merging #431 into master will increase coverage by 0.38%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #431      +/-   ##
==========================================
+ Coverage   90.46%   90.84%   +0.38%     
==========================================
  Files          32       32              
  Lines        1562     1562              
==========================================
+ Hits         1413     1419       +6     
+ Misses        149      143       -6
Impacted Files Coverage Δ
src/multivariate/solvers/first_order/bfgs.jl 96.55% <100%> (-0.12%) ⬇️
...ultivariate/solvers/zeroth_order/particle_swarm.jl 98.27% <100%> (+2.62%) ⬆️
src/multivariate/solvers/first_order/l_bfgs.jl 98% <100%> (-0.04%) ⬇️

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 55eabbc...0c0f617. Read the comment docs.

@pkofod pkofod changed the title Fix input for (L)BFGS. Fix input for (L)BFGS and PSO Jun 17, 2017
@test typeof(_minimizer) <: Array{Float64, 3}
@test size(_minimizer) == (2,2,1)
if !(m in (SimulatedAnnealing, ParticleSwarm))
println(typeof(m))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes yes, this is debugging text, will remove... :)

@pkofod pkofod merged commit 89675ad into master Jun 17, 2017
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.

2 participants