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

Unit3-CSP

Uploaded by

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

Unit3-CSP

Uploaded by

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

Constraint Satisfaction

Problems (CSP)
• Constraint Satisfaction Problems (CSP) play a crucial role in artificial
intelligence (AI) as they help solve various problems that require
decision-making under certain constraints.
• The objective is to assign values to variables to satisfy all the
constraints.
• Common applications of CSPs include:
• Scheduling: Assigning resources like employees or equipment while
respecting time and availability constraints.
• Planning: Organizing tasks with specific deadlines or sequences.
• Resource Allocation: Distributing resources efficiently without overuse.
Components of Constraint
Satisfaction Problems
• Variables: The things that need to be determined are variables. puzzle
cells that need to be filled with numbers in a sudoku puzzle.
• Domains: The range of potential values a variable can have is
represented by domains. For instance, in Sudoku, the set of numbers
from 1 to 9 can serve as the domain of a variable representing a
problem cell.
• Constraints: The guidelines that control how variables relate to one
another are known as constraints. in a sudoku problem, the
restrictions might be that each row, column, and 3×3 box can only
have one instance of each number from 1 to 9.
DEFINING CONSTRAINT
SATISFACTION
PROBLEMS
• A constraint satisfaction problem consists of three components, X, D,
and C:
• X is a set of variables, {X1,...,Xn}.
• D is a set of domains, {D1,...,Dn}, one for each variable.
• C is a set of constraints that specify allowable combinations of values.
• Each domain Di consists of a set of allowable values, {v1,...,vk} for
variable Xi.
• Each constraint Ci consists of a pair <scope, rel>
• Scope: The set of variables involved in the constraint.
• Relation: A list of valid combinations of variable values that satisfy the
constraint.
CSP Algorithms:
• Constraints:
• Neighboring regions must have different colors. This is a binary constraint applied between pairs of
neighboring regions.
• The specific neighboring relationships (edges between regions) define the constraints:
• WA and NT
• WA and SA
• NT and SA
• NT and Q
• SA and Q
• SA and NSW
• SA and V
• Q and NSW
• NSW and V
• How the Forward-Checking Algorithm Applies:
1. Initial Assignment: Start by assigning a color to one of the regions (e.g., WA = red).
2. Forward-Check: After assigning a color to WA, forward-checking will look at NT and SA (neighbors of WA) and
remove red from their domains.
3. Continue Assigning: Assign a color to the next region (say, NT = green), and forward-check by removing green
from Q and SA’s domains if they haven’t yet been assigned a color.
4. Backtrack If Necessary: If forward-checking reduces a neighboring region’s domain to an empty set, it
backtracks and tries a different color assignment.
Real World CSP Problems
• Teaching assignments
• Timetabling
• Hardware configuration (VLSI layout)
• Logistics (transport scheduling)
• Job shop scheduling (Operations research)
Cryptarithmetic puzzles

You might also like