A framework for solving exact cover problems