Add evaluation code to the solver.

This also includes error handling.