The document provides an overview of Constraint Satisfaction Problems (CSP), detailing their definition, applications, and the types of constraints involved. It explains concepts such as domain categories, constraint propagation, and various forms of consistency (node, arc, path, and k-consistency) that help in solving CSPs efficiently. Additionally, it highlights the importance of CSPs in problem-solving frameworks and their wide applicability in fields like scheduling and resource allocation.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
4 views
AI Applications
The document provides an overview of Constraint Satisfaction Problems (CSP), detailing their definition, applications, and the types of constraints involved. It explains concepts such as domain categories, constraint propagation, and various forms of consistency (node, arc, path, and k-consistency) that help in solving CSPs efficiently. Additionally, it highlights the importance of CSPs in problem-solving frameworks and their wide applicability in fields like scheduling and resource allocation.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 30
Course Name: Introduction to Artificial Intelligence
Topic: Constraint Satisfaction Problems
Prepared By: Ms. Harshil Sharma, Assistant Professor Department of FCE CONSTRAINT SATISFACTION PROBLEMS (CSP)
CSP is a specific type of problem-solving approach that
involves identifying constraints that must be satisfied and finding a solution that satisfies all the constraints. CSP has been used in a variety of applications, including scheduling, planning, resource allocation, and automated reasoning. DEFINING CONSTRAINT SATISFACTION PROBLEMS (CSP)
• A domain, Di, consists of a set of allowable values, {v1,…, vk} , for
variable Xi. • For example, a Boolean variable would have the domain true false • Different variables can have different domains of different sizes. DEFINING CONSTRAINT SATISFACTION PROBLEMS (CSP)
Each constraint Cj consists of a pair <scope, rel> ,
Where, scope is a tuple of variables that participate in the constraint and rel is a relation that defines the values that those variables can take on. A relation can be represented as an explicit set of all tuples of values that satisfy the constraint, or as a function that can compute whether a tuple is a member of the relation. For example, if X1 and X2 both have the domain {1,2,3}, then the constraint saying that X1 must be greater than X2 can be written as < (X1,X2) (3,1) (3,2) (2,1)> or as <(X1,X2),X1 >X2 > DEFINING CONSTRAINT SATISFACTION PROBLEMS (CSP)
CSPs deal with assignments of values to variables,
{Xi =vi, Xj =vj,….} An assignment that does not violate any constraints is called a consistent or legal assignment. A complete assignment is one in which every variable is assigned a value, and a solution to a CSP is Complete. A partial assignment is one that leaves some variables unassigned, and a partial solution is a partial assignment that is consistent. EXAMPLE PROBLEM: MAP COLORING EXAMPLE PROBLEM:
The 8-queens problem can also be viewed as a finite-
domain CSP, where the variables Q1,…,Q8 correspond to the queens in columns 1 to 8, and the domain of each variable specifies the possible row numbers for the queen in that column, Di = {1,2,3,4,5,6,7,8} . The constraints say that no two queens can be in the same row or diagonal. DOMAIN CATEGORIES WITHIN CSP: The domain of a variable in a CSP in AI can be categorized into three types: finite, infinite, and continuous. Finite domains have a finite number of possible values, such as colors or integers. Infinite domains have an infinite number of possible values, such as real numbers. Continuous domains have an infinite number of possible values, but they can be represented by a finite set of parameters, such as the coefficients of a polynomial function. In mathematics, a continuous domain is a set of values that can be described as a continuous range of real numbers. TYPES OF CONSTRAINTS IN CSP: Unary Constraints: A unary constraint is a constraint on a single variable. For example, Variable A not equal to “Red”. Binary Constraints: A binary constraint involves two variables and specifies a constraint on their values. For example, a constraint that two tasks cannot be scheduled at the same time would be a binary constraint. Global Constraints: Global constraints involve more than two variables and specify complex relationships between them. For example, a constraint that no two tasks can be scheduled at the same time if they require the same resource would be a global constraint. WHY DO WE NEED TO CONSIDER CSP? :
1. Generalized Problem-Solving Framework: CSPs provide a uniform
framework for solving a wide range of problems, such as scheduling, planning, and resource allocation. 2. Efficiency in Solving Combinatorial Problems : Many real-world problems involve a large search space. CSPs enable systematic constraint propagation and pruning techniques (e.g., backtracking, forward checking) to reduce computational effort. 3. Declarative Representation: Unlike traditional procedural approaches, CSPs allow problems to be described in terms of variables, domains, and constraints, making them more intuitive and modular. WHY DO WE NEED TO CONSIDER CSP? :
4. Optimization and Feasibility Checking
CSP techniques can determine whether a feasible solution exists and also optimize solutions based on additional constraints (e.g., minimizing costs in a scheduling problem). 5. Wide Applicability CSPs are used in various AI applications, including: Sudoku and crossword puzzles (constraint-based games) Timetable and workforce scheduling Resource allocation in networks CONSTRAINT PROPAGATION:
Constraint propagation is a fundamental concept in constraint
satisfaction problems (CSPs). A CSP involves variables that must be assigned values from a given domain while satisfying a set of constraints. Constraint propagation aims to simplify these problems by reducing the domains of variables, thereby making the search for solutions more efficient. CONSTRAINT PROPAGATION:
Consider a simple CSP with two variables, X and Y, each with
domains {1, 2, 3}, and a constraint X ≠ Y. Constraint propagation will iteratively reduce the domains as follows: If X is assigned 1, then Y cannot be 1, so Y's domain becomes {2, 3}. If Y is then assigned 2, X cannot be 2, so X's domain is reduced to {1, 3}. This process continues until a stable state is reached. CONSTRAINT PROPAGATION:
Local consistency is a property that helps reduce the number of
possible solutions. There are different types of local consistency: Node consistency Arc Consistency Path consistency K consistency CONSTRAINT PROPAGATION:
If we treat each variable as a node in a graph and each binary
constraint as an edge, then the process of enforcing local consistency in each part of the graph causes inconsistent values to be eliminated throughout the graph. NODE CONSISTENCY:
In a CSP, "node consistency" refers to a state where every
single variable within the problem has a domain that satisfies all its unary constraints, meaning each value within a variable's domain is individually valid according to its own constraints, without considering relationships with other variables. NODE CONSISTENCY:
For example, in the variant of the map-coloring problem
where A dislike green, the variable A starts with domain red, green, blue , and we can make it node consistent by eliminating green, leaving SA with the reduced domain red, blue. ARC CONSISTENCY:
Arc consistency ensures that for every value of one
variable, there is a consistent value in another variable connected by a constraint. A variable in a CSP is arc-consistent, if every value in its domain satisfies the variable’s binary constraints. ARC CONSISTENCY:
More formally, Xi is arc-consistent with respect to another
variable Xj if for every value in the current domain Di there is some value in the domain Dj that satisfies the binary constraint on the arc (Xi Xj). ARC CONSISTENCY: For example, consider the constraint Y = X2 where the domain of both X and Y is the set of decimal digits. We can write this constraint explicitly as <{(X,Y), (0,0), (1,1), (2,4), (3,9)}> To make X arc-consistent with respect to Y, we reduce X’s domain to {0,1,2,3} . If we also make Y arc-consistent with respect to X, then Y’s domain becomes {0,1,4,9}, and the whole CSP is arc- consistent. ARC CONSISTENCY:
More formally, Xi is arc-consistent with respect to another
variable Xj if for every value in the current domain Di there is some value in the domain Dj that satisfies the binary constraint on the arc (Xi Xj). ARC CONSISTENCY: HOMEWORK QUESTION: Consider the decision variables y with an initial domain [0..16], x with an initial domain [0..4]and the constraints over these two variables y=x2 x !=y x>2 What are the final domains after applying constraint propagation? PATH CONSISTENCY:
Path consistency extends arc consistency by considering
triples of variables. It ensures that for every pair of variables, there is a consistent value in the third variable. This further reduces the domains and simplifies the problem. PATH CONSISTENCY:
A two-variable set {Xi, Xj} is path-consistent with respect
to a third variable Xm if, for every assignment {Xi =a, Xj =b} consistent with the constraints (if any) on {Xi, Xj} , there is an assignment to Xm that satisfies the constraints on {Xi, Xm} and {Xm,Xj}. The name refers to the overall consistency of the path from Xi to Xj with Xm in the middle. K CONSISTENCY:
In a CSP, "k-consistency" refers to a property where for
any set of k-1 variables with consistent assignments, there exists a consistent value for any kth variable. Meaning you can always find a value for a new variable that satisfies all constraints with the previously assigned k- 1 variables; essentially, it guarantees that a partial assignment to any set of k variables can be extended to a consistent assignment for the next variable. K CONSISTENCY: 1-consistency (node consistency): Each variable's value is consistent with its own unary constraints. 2-consistency (arc consistency): Every pair of variables has consistent values with respect to the binary constraint between them. 3-consistency (path consistency): For any set of three variables, if you assign values to the first two, there exists a value for the third that satisfies the constraints between all three. Strong k-consistency: A CSP is considered strongly k-consistent if it is i-consistent for all values of i from 1 to k. K CONSISTENCY:
Achieving higher levels of k-consistency helps reduce the
search space during constraint satisfaction problem solving by eliminating inconsistent values early on, making the search process faster. REFERENCE BOOK
ArtificialIntelligence: A Modern Approach S.
Russell and P. Norvig Prentice Hall Artificial Intelligence: Rich and Knight , 3rd edition Thank You!!