Add virtual destructor to Solver class