void stopSolver() {
        if (solverFuture != null) {
            // TODO what happens if solver hasn't started yet (solve() is called asynchronously)
            solver.terminateEarly();
            // make sure solver has terminated and propagate exceptions
            try {
                solverFuture.get();
                solverFuture = null;
            } catch (InterruptedException e) {
                Thread.currentThread().interrupt();
                throw new RuntimeException("Failed to stop solver", e);
            } catch (ExecutionException e) {
                throw new RuntimeException("Failed to stop solver", e);
            }
        }
    }
void stopSolver() {
        if (solverFuture != null) {
           
            solver.terminateEarly();
           
            try {
                solverFuture.get();
                solverFuture = null;
            } catch (InterruptedException e) {
                Thread.currentThread().interrupt();
                throw new RuntimeException("Failed to stop solver", e);
            } catch (ExecutionException e) {
                throw new RuntimeException("Failed to stop solver", e);
            }
        }
    }
void stopsolver() { if (solverfuture != null) { solver.terminateearly(); try { solverfuture.get(); solverfuture = null; } catch (interruptedexception e) { thread.currentthread().interrupt(); throw new runtimeexception("failed to stop solver", e); } catch (executionexception e) { throw new runtimeexception("failed to stop solver", e); } } }