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

Control-c does not stop optimization #8

Closed
gbruer15 opened this issue Mar 19, 2024 · 1 comment · Fixed by #9
Closed

Control-c does not stop optimization #8

gbruer15 opened this issue Mar 19, 2024 · 1 comment · Fixed by #9

Comments

@gbruer15
Copy link

I think this bit in the line search code catches too many exceptions.

try
return ls(ϕ, dϕ, ϕdϕ, t, funRef, gtd)
catch e
@info "Line search failed"
return 0, funRef
end

Specifically, when I'm running an optimization interactively and want to stop it, control-c simply prints that the line search failed and then the optimization continues. Because my forward model takes several seconds to run, I can do another control-c to kill the optimization. But if my forward model was very fast, I may very well get into another line search before I can send the interrupt signal again.

Can I make a PR to add e isa InterruptException && rethrow(e) to this catch?

@mloubout
Copy link
Member

I actually have a local change I forgot to push cuz I ran into some small debug issue as well.


    # Line search. Prevents it to throw error.
    try
        return ls(ϕ, dϕ, ϕdϕ, t, funRef, gtd)
    catch e
        if isa(e, LineSearchException)
            @info "Line search failed"
            return 0, funRef
        else
            throw(e)
        end
    end

This way it only continues if the line search ended with no solution. Current one is indeed bad as if any of the f/df/fdf function error it thinks it's just the line search

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 a pull request may close this issue.

2 participants