0% found this document useful (0 votes)
3 views

CSP and Constraint Propagation

Constraint propagation is a technique used in AI and constraint satisfaction problems (CSPs) to reduce the search space by enforcing constraints on variable domains, thereby improving efficiency. It can be applied as a preprocessing step or integrated with the search process, and includes methods like node, arc, and path consistency. The technique is widely used in various applications, including scheduling, Sudoku, and automated reasoning, but has limitations such as computational expense and difficulty in generalization.

Uploaded by

basit
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

CSP and Constraint Propagation

Constraint propagation is a technique used in AI and constraint satisfaction problems (CSPs) to reduce the search space by enforcing constraints on variable domains, thereby improving efficiency. It can be applied as a preprocessing step or integrated with the search process, and includes methods like node, arc, and path consistency. The technique is widely used in various applications, including scheduling, Sudoku, and automated reasoning, but has limitations such as computational expense and difficulty in generalization.

Uploaded by

basit
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 17

Constraint Propagation in AI and CSPs

• Understanding how constraints reduce the


search space in problem-solving.
Key Idea –expand enforcement constraint (step by step) and reduce search
space---to incerse efficiency

Constraint propagation may be done as a preprocess before the search starts


or may be integrated(or intertwined) with the search.
Some time the preprocessing solves the problem no need of search
Introduction to Constraint Propagation
• Definition: Reduces search space by enforcing
constraints on variable domains.
• Objective: Improve efficiency in solving CSPs.
• Applications: AI, scheduling, SAT solvers,
Sudoku, cryptarithmetic.
Components of a CSP
• Variables (V): Unknowns that need
assignments.
• Domains (D): Possible values for each variable.
• Constraints (C): Rules restricting value
assignments.
• Example: Sudoku - each cell must hold a
unique value in row, column, and grid.
What is Constraint Propagation?
• Process: Eliminates values violating
constraints.
• Goal: Reduce choices before exhaustive
search.
• Example: In Sudoku, placing '5' in a cell
removes it from related row, column, and box
domains.
Local Consistency in constraint satisfaction problems
(CSPs) refers to ensuring that constraints hold within a
limited scope (e.g., one variable, a pair of variables, or a
small subset). It helps in reducing the search space by
eliminating inconsistent values before or during the
search process.

Types of Local Consistency

1. Node Consistency
2. Arc Consistency
3. Path Consistency
4. k-Consistency
Types of Local Consistency
Node Consistency (Simplified)
• Definition: A variable is node consistent if
every value in its domain satisfies its single-
variable constraints.(Unary constraint)
• Example: If X’s domain is {1,2,3,4,5} and the
constraint is 'X > 2', remove {1,2}, leaving
{3,4,5}.
A constraint graph is called node consistent , if every variable in
the graph is node consistent
Arc Consistency (AC-3 Algorithm)
• Definition: A CSP is arc consistent(edged
consistent) if each value in X has a valid
corresponding value in Y.
• OR A variable in a csp is arc consistent if every
value in its domain satisfies variables binary
constraint
• Xi is arc consistent with respect to another
variable Xj if for every value in the current domain
Di there is a some value in the domain Dj that
satisfies the binary constant on the arc (Xi,Xj)
• .
Arc consistency

Algorithm:

1. Add all arcs to a queue.


2. Remove inconsistent values.
3. If domain changes, reprocess constraints.
Example: X < Y, X={1,2,3,4}, Y={2,4}. Remove 4 from X
since 4 < Y is not possible
Path Consistency
• Path consistency is a method in constraint satisfaction
problems (CSPs) where it is ensured that for any two
variables, there is a third variable that can satisfy the
constraints between all three variables. It helps reduce
inconsistent values by checking triples of variables.
• A path of length 2 between variables {Xi, Xj} is path-
consistent with respect to a third variable Xm if, for
every constistent assignment {Xi = a, Xj= b}, there is an
assignment to Xm that satisfies the constraints on {Xi,
Xm} and {Xm, Xj}.
Example:
•Variables: A, B, and C.
•Constraints:
• A ≠ B (A and B must have different values).
• B + C = 10 (The sum of B and C must be 10).
To check path consistency:
1.For A = 3 and B = 4, check if there’s a C such that B + C = 10. Here,
C = 6 satisfies the constraint.
2.For A = 7 and B = 5, check if there’s a C such that B + C = 10. Here,
C = 5 satisfies the constraint.
Constraint Propagation in Sudoku
• 1. Identify given numbers.
• 2. Remove conflicting values in row, column,
and box.
• 3. If a cell's domain reduces to one value,
assign it and continue propagation.
Boolean Constraint Propagation (BCP)
• Definition: Simplifies Boolean formulas by
eliminating false literals.
• Process:
• 1. Assign values based on constraints.
• 2. Remove satisfied clauses.
• 3. Continue until stable or contradiction
found.
Applications of Constraint Propagation
• AI & ML: Automated reasoning, NLP.
• Operations Research: Timetabling, scheduling.
• Computer Vision: Object recognition.
• Robotics: Motion planning.
Advantages and Limitations
• Advantages:
• ✔️Reduces search space.
• ✔️Detects inconsistencies early.
• ✔️Improves backtracking efficiency.
• Limitations:
• ❌ Not always sufficient.
• ❌ Can be computationally expensive.
• ❌ Hard to generalize for all constraints.
Conclusion
• Key Takeaways:
• - Constraint propagation prunes search space.
• - Techniques like node, arc, and path
consistency improve efficiency.
• - Applied in AI, scheduling, and reasoning.

You might also like