Added definition of constraint satisfaction + some tools functions