Framework for binary constraint satisfaction problems