Principles and Practice of Constraint Programming