constraint programming
Post on 02-Jan-2016
65 Views
Preview:
DESCRIPTION
TRANSCRIPT
CONSTRAINT PROGRAMMING
Computer Science Seminar
April 9th, 2004
Kerem Kacel
OUTLINE
Introduction History The Method Constraint Logic Programming Applications Pros/Cons Discussion
What is Constraint Programming?
Software technologyDescribe and solve large,
combinatorial problems 2 steps
State the constraints of the problemFind 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 valuesDoes restrict values
Properties of Constraints
Express partial informationX > 0
HeterogeneousY = ABS(X)
Non-directionalX = Y+1 also means Y = X-1
Properties of Constraints (2)
AdditiveX<4, X>1 also means X>1, X<4
Declarative“The pen is on the table”
Usually dependentX + 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
CosytecFounder of “Global Constraints”
• Helped solve a large class of problems• Planning, scheduling, sequencing
ILOG SOLVERConstraint 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 ProblemSet of variables X = {x1,…,xn}
Domains Di for each variableSet of constraints
An example CSPA::{1,2}, B::{1,2}, C::{1,2}A = B, A ≠ C, B > C
Solving a CSP
Example CSPA::{1,2}, B::{1,2}, C::{1,2}A = B, A ≠ C, B > C
Generate & TestFor every value assignment in the
domains, check if constraint is mete.g. A = 2, B = 2, C = 1
Solving a CSP
Example CSPA::{1,2}, B::{1,2}, C::{1,2}A = B, A ≠ C, B > C
Back-TrackingStart with a specific assignmentChange 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:CHIPECLiPSe
OUTLINE
Introduction History The Method Constraint Logic Programming Applications Pros/Cons Discussion
APPLICATIONS
Assignment problemsPersonnel assignment
Scheduling problemsClass schedules in schoolsProduction planning
Database SystemsEnsure consistency of data
APPLICATIONS
Natural Language ProcessingConstruction of efficient parsers
Electrical EngineeringLocating faults in circuits
Molecular BiologyDNA sequences
PROS/CONS
+ DeclarativeDescribe the problem, not solution
+ SemanticsClean, elegant languages
- UnpredictableWe 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
top related