Refactor solver to be more controllable.

- Split the all-in-one solver worker function into start, run-one-generation and finish functions.
- start function sets up the solver and runs first generation.
- When each generation is run, it posts its progress back to solver service.
- When solver service receives the progress, it decides whether to tell the solver worker to run another generation, or finish.
- When user clicks Stop Solver button, it sets a flag in solver service to finish on the next progress update.