CONSTRAINT PROGRAMMING Computer Science Seminar April 9 th, 2004 Kerem Kacel
OUTLINE Introduction History The Method Constraint Logic Programming Applications Pros/Cons Discussion
What is Constraint Programming? Software technology Describe and solve large, combinatorial problems 2 steps State the constraints of the problem Find a solution satisfying all of the constraints
What is a Constraint? Defined on a set of variables A relation on their domains e.g. “The circle is inside the square” Does NOT necessarily specify values Does restrict values
Properties of Constraints Express partial information X > 0 Heterogeneous Y = ABS(X) Non-directional X = Y+1 also means Y = X-1
Properties of Constraints (2) Additive X 1 also means X>1, X<4 Declarative “The pen is on the table” Usually dependent X + Y = 5, X * Y = 6
OUTLINE Introduction History The Method Constraint Logic Programming Applications Pros/Cons Discussion
Some History Constraint Satisfaction Problems (CSPs) were formalized in early 70s Constraint Logic Programming (CLP) emerged in early 80s, named by IBM Prolog II was the first Later CHIP (Constraints Handling in Prolog) Prolog III
Some History Cosytec Founder of “Global Constraints” Helped solve a large class of problems Planning, scheduling, sequencing ILOG SOLVER Constraint programming classes for C++, Java
OUTLINE Introduction History The Method Constraint Logic Programming Applications Pros/Cons Discussion
METHOD Define the problem as a CSP (Constraint Satisfaction Problem) Solve the CSP
What is a CSP? Constraint Satisfaction Problem Set of variables X = {x 1,…,x n } Domains D i for each variable Set of constraints An example CSP A::{1,2}, B::{1,2}, C::{1,2} A = B, A ≠ C, B > C
Solving a CSP Example CSP A::{1,2}, B::{1,2}, C::{1,2} A = B, A ≠ C, B > C Generate & Test For every value assignment in the domains, check if constraint is met e.g. A = 2, B = 2, C = 1
Solving a CSP Example CSP A::{1,2}, B::{1,2}, C::{1,2} A = B, A ≠ C, B > C Back-Tracking Start with a specific assignment Change values one by one until a solution is reached
Solving a CSP Problem: These methods are inefficient Other methods are being researched to optimize
OUTLINE Introduction History The Method Constraint Logic Programming Applications Pros/Cons Discussion
Constraint Logic Programming Constraints + LP = CLP Platforms: CHIP ECLiPSe
OUTLINE Introduction History The Method Constraint Logic Programming Applications Pros/Cons Discussion
APPLICATIONS Assignment problems Personnel assignment Scheduling problems Class schedules in schools Production planning Database Systems Ensure consistency of data
APPLICATIONS Natural Language Processing Construction of efficient parsers Electrical Engineering Locating faults in circuits Molecular Biology DNA sequences
PROS/CONS + Declarative Describe the problem, not solution + Semantics Clean, elegant languages - Unpredictable We don’t know how efficient
DISCUSSION “Were you to ask me which programming paradigm is likely to gain most in commercial significance over the next 5 years I’d have to pick Constraint Logic Programming, even though it’s perhaps currently one of the least known and understood.” Dick Pountain, BYTE, February 1995