Skip to content

Allow to cancel optimization from cost & constraint functions#19

Open
gollth wants to merge 1 commit intoadwhit:masterfrom
gollth:usable-force-stop
Open

Allow to cancel optimization from cost & constraint functions#19
gollth wants to merge 1 commit intoadwhit:masterfrom
gollth:usable-force-stop

Conversation

@gollth
Copy link

@gollth gollth commented Jul 25, 2025

Addressing the problem in #11

I need this feature for a project, so thought I'll give it a shot. I went with this trait Termination style approach suggested in the issue and implemented it for f64, so that there are no breaking changes to user code. However now users can return Results from cost & constraint functions, to let the optimization gracefully stop.

Note also that the S: Termination in the constraints function is different from the R: Termination from the cost function, so that users can only cancel in one of the two, or with different error types even.

Let me know what you thing (=

@gollth gollth force-pushed the usable-force-stop branch from 020ea59 to 7c1a97c Compare July 27, 2025 10:17
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.

1 participant