constraint satisfaction problem algorithm