Prevent segfault when no solution is found

Prevent a segfault when the solver fails by throwing an exception. While
it is ambiguous whether the return value of a backend::solve indicates
failure to find any solution or failure to find an optimal solution,
this treats it as the former (and since the only backend, Gurobi, does
not fill in the solution for any status other than optimal). If the
latter is desired, the exception could instead check the length of
solution.