Weighted constraint satisfaction problem