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

Relax type of alg in ensemble solve for optimization #534

Merged
merged 10 commits into from
Nov 8, 2023

Conversation

Vaibhavdixit02
Copy link
Member

This will allow using the existing code for Optimization.jl ensembles

@codecov
Copy link

codecov bot commented Oct 30, 2023

Codecov Report

Merging #534 (ebcbae3) into master (ffe68ae) will increase coverage by 1.20%.
The diff coverage is 90.90%.

@@            Coverage Diff             @@
##           master     #534      +/-   ##
==========================================
+ Coverage   41.07%   42.28%   +1.20%     
==========================================
  Files          53       53              
  Lines        4051     4063      +12     
==========================================
+ Hits         1664     1718      +54     
+ Misses       2387     2345      -42     
Files Coverage Δ
src/SciMLBase.jl 70.00% <ø> (ø)
src/ensemble/basic_ensemble_solve.jl 67.56% <ø> (+8.47%) ⬆️
src/solve.jl 73.52% <100.00%> (+1.65%) ⬆️
src/ensemble/ensemble_problems.jl 54.28% <88.88%> (+11.97%) ⬆️

... and 4 files with indirect coverage changes

📣 Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today!

ensemblealg::BasicEnsembleAlgorithm;
trajectories, batch_size = trajectories,
pmap_batch_size = batch_size ÷ 100 > 0 ? batch_size ÷ 100 : 1, kwargs...)
pmap_batch_size = batch_size ÷ 100 > 0 ? batch_size ÷ 100 : 1, kwargs...) where {A}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
pmap_batch_size = batch_size ÷ 100 > 0 ? batch_size ÷ 100 : 1, kwargs...) where {A}
pmap_batch_size = batch_size ÷ 100 > 0 ? batch_size ÷ 100 : 1, kwargs...) where {A <: SciMLAlgorithm}

I think for this to work it needs a dispatch that's not EnsembleAlgorithm?

Copy link
Member Author

Choose a reason for hiding this comment

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

Because of the automatic alg selection in DifferentialEquations.jl?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think I could work around this by making a stuct subtype of SciMLAlgorithm and wrap the optimizer's alg in that and handle it in __solve so we might not need to do this then

Copy link
Member

Choose a reason for hiding this comment

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

Can you double check some cases with this and defaults? Tests seem to pass

EnsembleProblem(prob; prob_func, output_func, reduction, u_init, safetycopy)
end

function EnsembleProblem(; prob,
Copy link
Member Author

Choose a reason for hiding this comment

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


function EnsembleProblem(; prob,
trajectories::Int,
prob_func,
Copy link
Member

Choose a reason for hiding this comment

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

this doesn't define a prob_func?

Copy link
Member Author

Choose a reason for hiding this comment

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

test/runtests.jl Outdated
Comment on lines 81 to 83
# @time @safetestset "Ensemble Optimization and Nonlinear problems" begin
# include("downstream/ensemble_nondes.jl")
# end
Copy link
Member

Choose a reason for hiding this comment

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

Is this intended?

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 it was to show that other tests all pass, to get this one working it needs the dispatches we have been discussing

Copy link
Member

Choose a reason for hiding this comment

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

I'm lost. What's the version that works with all tests?

Copy link
Member Author

Choose a reason for hiding this comment

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

The one without type assertion in the __solve method

Copy link
Member

Choose a reason for hiding this comment

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

Can you put it this in the form you believe works for everything and we can check the downstream tests and these tests?

@ChrisRackauckas ChrisRackauckas merged commit 06d5c2c into master Nov 8, 2023
35 of 39 checks passed
@ChrisRackauckas ChrisRackauckas deleted the optensemble branch November 8, 2023 05:41
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