CSP Unit-2
CSP Unit-2
Finding a solution that meets a set of constraints is the goal of constraint satisfaction problems
(CSPs), a type of AI issue. Finding values for a group of variables that fulfill a set of restrictions or
rules is the aim of constraint satisfaction problems. For tasks including resource allocation, planning,
scheduling, and decision-making, CSPs are frequently employed in AI.
There are mainly three basic components in the constraint satisfaction problem:
Variables: The things that need to be determined are variables. Variables in a CSP are the objects
that must have values assigned to them in order to satisfy a particular set of constraints. Boolean,
integer, and categorical variables are just a few examples of the various types of variables Variables,
for instance, could stand in for the many puzzle cells that need to be filled with numbers in a sudoku
puzzle.
Domains: The range of potential values that a variable can have is represented by domains.
Depending on the issue, a domain may be finite or limitless. 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. Constraints in a CSP define the ranges of possible values for variables. Unary constraints,
binary constraints, and higher-order constraints are only a few examples of the various sorts of
constraints. For instance, 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.
e.g., V1 ≠ V2
Algorithms for propagating constraints are a class that uses local consistency and inference
to condense the search space. These algorithms operate by propagating restrictions
between variables and removing inconsistent values from the variable domains using the
information obtained.
Vehicle routing: Another example of a CSP problem is the issue of minimizing travel time or
distance by optimizing a fleet of vehicles’ routes. In this domain, the constraints specify each
vehicle’s capacity, delivery locations, and time windows, while the variables indicate the
routes taken by the vehicles.
Assignment: Another typical CSP issue is how to optimally assign assignments or jobs to
humans or machines. In this field, the variables stand in for the tasks, while the constraints
specify the knowledge, capacity, and workload of each person or machine.
Sudoku: The well-known puzzle game Sudoku can be modeled as a CSP problem, where the
variables stand in for the grid’s cells and the constraints specify the game’s rules, such as
prohibiting the repetition of the same number in a row, column, or area.