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

Add COLNEW algorithm #159

Merged
merged 2 commits into from
Jan 10, 2024
Merged

Add COLNEW algorithm #159

merged 2 commits into from
Jan 10, 2024

Conversation

ErikQQY
Copy link
Member

@ErikQQY ErikQQY commented Jan 10, 2024

Add COLNEW method from ODEInterface.jl.

  1. The original COLNEW method supports multi-points BVP, its boundary condition must be defined as:
    For example: if in time span $t = [-1, 1]$ we have boundary conditions $u(-1)=1, u'(0)=2.5, u(1)=5$, (here suppose u[1] is $u$, u[2] is $u'$)
zeta = [-1, 0, 1] # points in time span where we want to specify conditions
function bc(i, u, bc)
    if i == 1
        bc[1] = u[1] - 1.0
    elseif i == 2
        bc[1] = u[2] - 2.5
    elseif i == 3
        bc[1] = u[1] - 5.0
    end
end
......
sol, retcode, stats = colnew(tspan, orders, zeta, rhs, Drhs, bc, Dbc, nothing, opt)

the multi-points boundary condition definition in COLNEW makes it hard to convert to the API we are using here, so this PR only implemented the two-point case.

  1. The initial guess is set to nothing because we support initial guess as initial guess value(set u0 as Vector) during problem construction in BoundaryValueDiffEq.jl, whereas the initial guess in COLNEW can be either nothing or the returned value from earlier COLNEW call

Signed-off-by: ErikQQY <[email protected]>
Copy link
Contributor

github-actions bot commented Jan 10, 2024

Benchmark Results

master 865d365... t[master]/t[865d365...]
Simple Pendulum/IIP/MultipleShooting(10, Tsit5; grid_coarsening = false) 1.92 ± 0.66 ms 1.92 ± 0.67 ms 1
Simple Pendulum/IIP/MultipleShooting(10, Tsit5; grid_coarsening = true) 2.64 ± 0.055 ms 2.58 ± 0.061 ms 1.03
Simple Pendulum/IIP/MultipleShooting(100, Tsit5; grid_coarsening = false) 27.4 ± 1.5 ms 27.5 ± 1.4 ms 0.999
Simple Pendulum/IIP/MultipleShooting(100, Tsit5; grid_coarsening = true) 0.898 ± 0.012 s 0.892 ± 0.0065 s 1.01
Simple Pendulum/IIP/Shooting(Tsit5()) 0.174 ± 0.0031 ms 0.174 ± 0.0034 ms 1
Simple Pendulum/OOP/MultipleShooting(10, Tsit5; grid_coarsening = false) 3.03 ± 0.11 ms 3 ± 0.11 ms 1.01
Simple Pendulum/OOP/MultipleShooting(10, Tsit5; grid_coarsening = true) 5.56 ± 2.1 ms 5.53 ± 2.1 ms 1.01
Simple Pendulum/OOP/MultipleShooting(100, Tsit5; grid_coarsening = false) 0.0703 ± 0.0015 s 0.0711 ± 0.0016 s 0.989
Simple Pendulum/OOP/MultipleShooting(100, Tsit5; grid_coarsening = true) 2.66 ± 0.046 s 2.68 ± 0.042 s 0.992
Simple Pendulum/OOP/Shooting(Tsit5()) 0.685 ± 0.017 ms 0.679 ± 0.017 ms 1.01
time_to_load 4.23 ± 0.026 s 4.23 ± 0.008 s 1

Benchmark Plots

A plot of the benchmark results have been uploaded as an artifact to the workflow run for this PR.
Go to "Actions"->"Benchmark a pull request"->[the most recent run]->"Artifacts" (at the bottom).

@ChrisRackauckas
Copy link
Member

It would be nice to get some kind of side channel for its BC definition just to make benchmarking easier. I assume any translation like that would have to be done manually though, i.e. have inside of the colnew algorithm some bc_func option that overrides the BC with the manual translation

@ChrisRackauckas ChrisRackauckas merged commit dc2bd28 into SciML:master Jan 10, 2024
8 of 11 checks passed
@ErikQQY ErikQQY deleted the qqy/colnew branch January 11, 2024 11:44
@ErikQQY
Copy link
Member Author

ErikQQY commented Jan 11, 2024

👍Making bc_func inside colnew to override BC with manual translation is a good idea.

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