Time bound solvers #57
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is an implementation of time-bound solvers using cooperative threading. There's no functional change for most of the solvers, but the idea is that each solver can check to see if it has run out of time to find a solution. If so, it should gracefully return. The main loop of a solver using this framework would look like:
Note: it's not possible in modern threading systems, C# included, to abort a thread AND have a consistent system (what if it was holding a lock? a semaphore? etc.). So, the best you can do is cooperative threading where you ask politely for a thread to finish what it's doing and then wait.
It's annoying that interfaces can't define instance variables, which is the only reason I had to modify every solver. I considered using a class, but that was even uglier.
TODO:
closes #56