Implement a refinment loop in the solver heuristic.

The firt side-effect of this change is to improve the minimality of installed packages. I guess it could help in other situations as well (and at least, it cannot make things worse).