Skip to content

Conversation

@vboussange
Copy link

Hi,
This PR overloads the multiple_shoot function, so that it can be called with problems of type EnsembleProblem.
This is quite useful 😀
It is a suggestion for issue #601.

Comment on lines 155 to 156
loss_function::Function,
continuity_loss::Function,
Copy link
Member

Choose a reason for hiding this comment

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

This stops specialization BTW

Copy link
Author

Choose a reason for hiding this comment

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

I have removed the type specification ::Function. Is that what you had in mind?

Comment on lines 227 to 260
function multiple_shoot(
p::AbstractArray,
ode_data::AbstractArray,
tsteps::AbstractArray,
ensembleprob::EnsembleProblem,
ensemblealg::SciMLBase.BasicEnsembleAlgorithm,
loss_function::Function,
solver::DiffEqBase.AbstractODEAlgorithm,
group_size::Integer;
continuity_term::Real=100,
kwargs...
)
# Continuity loss between last state in previous prediction
# and current initial condition in ode_data
function continuity_loss(û_end, u_0)
return sum(abs, û_end - u_0)
end

return multiple_shoot(
p,
ode_data,
tsteps,
ensembleprob,
ensemblealg,
loss_function,
continuity_loss,
solver,
group_size;
continuity_term,
kwargs...
)

end

Copy link
Member

Choose a reason for hiding this comment

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

we should really move the optional argument to last

Copy link
Author

Choose a reason for hiding this comment

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

I am not sure what you mean by that.

Copy link
Member

Choose a reason for hiding this comment

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

the reason for this dispatch is to handle the optional argument, but it really shouldn't be one of the ones in the middle then.

@ChrisRackauckas ChrisRackauckas merged commit b52ae06 into SciML:master Aug 12, 2021
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