Professional Documents
Culture Documents
UNIT 1 Notes
UNIT 1 Notes
UNIT 1 Notes
Learning processes. This aspect of AI programming focuses on acquiring data and creating
rules for how to turn the data into actionable information.
Reasoning processes. This aspect of AI programming focuses on choosing the right algorithm to
reach a desired outcome.
AI is important because it can give enterprises insights into their operations that they may not
have been aware of previously and because, in some cases, AI can perform tasks better than
humans.
Advantages
Type 1: Reactive machines. These AI systems have no memory and are task specific.
Type 2: Limited memory. These AI systems have memory, so they can use past experiences to
inform future decisions.
Type 3: Theory of mind. Theory of mind is a psychology term. When applied to AI, it means
that the system would have the social intelligence to understand emotions.
Type 4: Self-awareness. In this category, AI systems have a sense of self, which gives them
consciousness.
Artificial Intelligence is not a new word and not a new technology for researchers. This
technology is much older than you would imagine. Even there are the myths of Mechanical men
in Ancient Greek and Egyptian Myths. Following are some milestones in the history of AI which
defines the journey from the AI generation to till date development.
To begin with, an AI system accepts data input in the form of speech, text, image, etc. The
system then processes data by applying various rules and algorithms, interpreting, predicting,
and acting on the input data. Upon processing, the system provides an outcome, i.e., success or
failure, on data input. The result is then assessed through analysis, discovery, and feedback.
Lastly, the system uses its assessments to adjust input data, rules and algorithms, and target
outcomes. This loop continues until the desired result is achieved.
How AI Works
Key components of AI
Intelligence has a broader context that reflects a deeper capability to comprehend the
surroundings. However, for it to qualify as AI, all its components need to work in conjunction
with each other. Let’s understand the key components of AI.
Key Components of AI
5. Natural language processing (NLP): NLP is a tool that allows computers to comprehend,
recognize, interpret, and produce human language and speech.
6. Computer vision: Computer vision employs deep learning and pattern identification to
interpret image content (graphs, tables, PDF pictures, and videos).
Types of AI
Artificial Intelligence can be broadly divided into two categories: AI based on capability and AI
based on functionality. Let’s understand each type in detail.
Types of AI
PROBLEM CHARACTERISTICS
In order to solve a problem, it need to be analyzed on the following lines:
1. Is the program decomposable into a set of independent smaller or easier sub-problems?
2. Can the solution steps be ignored or undone if they prove fruit less?
The reflex agent of AI directly maps states into action. Whenever these agents fail to operate in
an environment where the state of mapping is too large and not easily performed by the agent,
then the stated problem dissolves and sent to a problem-solving domain which breaks the large
stored problem into the smaller storage area and resolves one by one. The final integrated action
will be the desired outcomes.
On the basis of the problem and their working domain, different types of problem-solving agent
defined and use at an atomic level without any internal state visible with a problem-solving
algorithm. The problem-solving agent performs precisely by defining problems and several
solutions. So we can say that problem solving is a part of artificial intelligence that encompasses
a number of techniques such as a tree, B-tree, heuristic algorithms to solve a problem.
We can also say that a problem-solving agent is a result-driven agent and always focuses on
satisfying the goals.
Steps problem-solving in AI: The problem of AI is directly associated with the nature of
humans and their activities. So we need a number of finite steps to solve a problem which makes
human easy works.
Goal Formulation: This one is the first and simple step in problem-solving. It organizes
finite steps to formulate a target/goals which require some action to achieve the goal.
Today the formulation of the goal is based on AI agents.
Problem formulation: It is one of the core steps of problem-solving which decides what
action should be taken to achieve the formulated goal. In AI this core part is dependent
upon software agent which consisted of the following components to formulate the
associated problem.
Initial State: This state requires an initial state for the problem which starts the AI agent
towards a specified goal. In this state new methods also initialize problem domain solving
by a specific class.
Action: This stage of problem formulation works with function with a specific class
taken from the initial state and all possible actions done in this stage.
Transition: This stage of problem formulation integrates the actual action done by the
previous action stage and collects the final stage to forward it to their next stage.
Goal test: This stage determines that the specified goal achieved by the integrated
transition model or not, whenever the goal achieves stop the action and forward into the
next stage to determines the cost to achieve the goal.
Path costing: This component of problem-solving numerical assigned what will be the
cost to achieve the goal. It requires all hardware software and human working cost.
Problem solving in AI
PRODUCTION SYSTEMS:
A production system is an artificial intelligence program that consists of some rules and the
procedures or processes for following them. This set of rules can be termed as 'production'.
They enhance action selection and automated planning.
Definition:
Knowledge representation formalism consists of collections of condition-action
rules(Production Rules or Operators), a database which is modified in accordance with
the rules, and a Production System Interpreter which controls the operation of the rules
i.e the 'control mechanism' of a Production System, determining the order in which
Production Rules are fired.
A system that uses this form of knowledge representation is called a production system.
A production system consists of following components.
(a)A set of production rules, which are of the form A→B. Each rule consists of left hand side
constituent that represent the current problem state and a right hand side that represent an output
state. A rule is applicable if its left hand side matches with the current problem state.
(b) A database, which contains all the appropriate information for the particular task. Some part
of the database may be permanent while some part of this may pertain only to the solution of the
current problem.
(c) A control strategy, which specifies order in which the rules will be compared to the
database of rules and a way of resolving the conflicts that arise when several rules match
simultaneously.
(d) A rule applier, which checks the capability of rule by matching the content state with the left
hand
Four classes of production systems:
Partially commutative, monotonic production systems are useful for solving ignorable
problems.
4. A commutative production system: A commutative production system is a productio
n system that is both monotonic and partially commutative.
1. One important disadvantage is the fact that it may be very difficult analyse the flow of control
within a production system because the individual rules don’t call each other.
2. Production systems describe the operations that can be performed in a search for a solution to
the problem.
CONTROL STRATEGIES:
Though the strategy applied should create the motion but if do not follow some systematic
strategy than we are likely to reach the same state number of times before reaching the solution
which increases the number of steps. Taking care of only first strategy we may go through
particular useless sequences of operators several times. Control Strategy should be systematic
implies a need for global motion (over the course of several steps) as well as for local motion
(over the course of single step).
Examples:
Breadth-First Search: It searches along the breadth and follows first-in-first-out queue data
structure approach. It will start to scan node A first and then B-C-D-E-F.
Depth-First Search: It searches along the depth and follows the stack approach. The sequence
for scanning nodes will be A-B-D-E-C-F, it scans all the sub-nodes of parent nodes and then
moves to another node.
Widely used Control Strategies are Breadth-First Search, Depth-First Search, Generate and Test,
Hill-Climbing, Best-first search, Problem Reduction and many more.
SEARCH STRATEGIES :
Search Terminology
Problem Space − It is the environment in which the search takes place. (A set of states
and set of operators to change those states)
Problem Instance − It is Initial state + Goal state.
Problem Space Graph − It represents problem state. States are shown by nodes and
operators are shown by edges.
Depth of a problem − Length of a shortest path or shortest sequence of operators from
Initial State to goal state.
Space Complexity − The maximum number of nodes that are stored in memory.
Time Complexity − The maximum number of nodes that are created.
Admissibility − A property of an algorithm to always find an optimal solution.
Branching Factor − The average number of child nodes in the problem space graph.
Depth − Length of the shortest path from initial state to goal state.
Requirements −
State description
A set of valid operators
Initial state
Goal state description
Breadth-First Search
It starts from the root node, explores the neighboring nodes first and moves towards the next
level neighbors. It generates one tree at a time until the solution is found. It can be implemented
using FIFO queue data structure. This method provides shortest path to the solution.
If branching factor (average number of child nodes for a given node) = b and depth = d, then
number of nodes at level d = bd.
Disadvantage − Since each level of nodes is saved for creating next one, it consumes a lot of
memory space. Space requirement to store nodes is exponential.
Its complexity depends on the number of nodes. It can check duplicate nodes.
Depth-First Search
It is implemented in recursion with LIFO stack data structure. It creates the same set of nodes as
Breadth-First method, only in the different order.
As the nodes on the single path are stored in each iteration from root to leaf node, the space
requirement to store nodes is linear. With branching factor b and depth as m, the storage space is
bm.
Disadvantage − This algorithm may not terminate and go on infinitely on one path. The solution
to this issue is to choose a cut-off depth. If the ideal cut-off is d, and if chosen cut-off is lesser
than d, then this algorithm may fail. If chosen cut-off is more than d, then execution time
increases.
Its complexity depends on the number of paths. It cannot check duplicate nodes.
Bidirectional Search
It searches forward from initial state and backward from goal state till both meet to identify a
common state.
The path from initial state is concatenated with the inverse path from the goal state. Each search
is done only up to half of the total path.
Sorting is done in increasing cost of the path to a node. It always expands the least cost node. It
is identical to Breadth First search if each transition has the same cost.
Disadvantage − There can be multiple long paths with the cost ≤ C*. Uniform Cost search must
explore them all.
It performs depth-first search to level 1, starts over, executes a complete depth-first search to
level 2, and continues in such way till the solution is found.
It never creates a node until all lower nodes are generated. It only saves a stack of nodes. The
algorithm ends when it finds a solution at depth d. The number of nodes created at depth d is bd
and at depth d-1 is bd-1.
Interactive
Criterion Breadth First Depth First Bidirectional Uniform Cost
Deepening
Time bd bm bd/2 bd bd
Space bd bm bd/2 bd bd
Optimality Yes No Yes Yes Yes
Completeness Yes No Yes Yes Yes
They calculate the cost of optimal path between two states. A heuristic function for sliding-tiles
games is computed by counting number of moves that each tile makes from its goal state and
adding these number of moves for all tiles.
It expands nodes in the order of their heuristic values. It creates two lists, a closed list for the
already expanded nodes and an open list for the created but unexpanded nodes.
In each iteration, a node with a minimum heuristic value is expanded, all its child nodes are
created and placed in the closed list. Then, the heuristic function is applied to the child nodes and
they are placed in the open list according to their heuristic value. The shorter paths are saved and
the longer ones are disposed.
A * Search
It is best-known form of Best First search. It avoids expanding paths that are already expensive,
but expands most promising paths first.
It expands the node that is estimated to be closest to goal. It expands nodes based on f(n) = h(n).
It is implemented using priority queue.
Hill-Climbing Search
It is an iterative algorithm that starts with an arbitrary solution to a problem and attempts to find
a better solution by changing a single element of the solution incrementally. If the change
produces a better solution, an incremental change is taken as a new solution. This process is
repeated until there are no further improvements.
end
In this algorithm, it holds k number of states at any given time. At the start, these states are
generated randomly. The successors of these k states are computed with the help of objective
function. If any of these successors is the maximum value of the objective function, then the
algorithm stops.
Otherwise the (initial k states and k number of successors of the states = 2k) states are placed in a
pool. The pool is then sorted numerically. The highest k states are selected as new initial states.
This process continues until a maximum value is reached.
Simulated Annealing
Annealing is the process of heating and cooling a metal to change its internal structure for
modifying its physical properties. When the metal cools, its new structure is seized, and the
metal retains its newly obtained properties. In simulated annealing process, the temperature is
kept variable.
We initially set the temperature high and then allow it to ‘cool' slowly as the algorithm proceeds.
When the temperature is high, the algorithm is allowed to accept worse solutions with high
frequency.
Start
End
In this algorithm, the objective is to find a low-cost tour that starts from a city, visits all cities en-
route exactly once and ends at the same starting city.
Start
Find out all (n -1)! Possible solutions, where n is the total number of cities.
Determine the minimum cost by finding out the cost of each of these (n -1)! solutions.
Finally, keep the one with the minimum cost.
end
Developers worldwide are using artificial intelligence to automate systems for efficient
utilization of time and resources. Some of the most common problems encountered in day-to-day
life are games and puzzles. These can be solved efficiently by using artificial intelligence
algorithms. Ranging from mathematical puzzles including crypto-arithmetic and magic squares,
logical puzzles including Boolean formulas and N-Queens to popular games like Sudoku and
Chess, these problem-solving techniques are used to form a solution for all these. Therefore,
some of the most prevalent problems that artificial intelligence has resolved are the following:
Chess
N-Queen problem
Tower of Hanoi Problem
Travelling Salesman Problem
Water-Jug Problem
Graph matching problems are very common in daily activities. From online matchmaking and
dating sites, to medical residency placement programs, matching algorithms are used in areas
spanning scheduling, planning, pairing of vertices, and network flows. More specifically,
matching strategies are very useful in flow network algorithms such as the Ford-Fulkerson
algorithm and the Edmonds-Karp algorithm.
Graph matching algorithms often use specific properties in order to identify sub-optimal areas in
a matching, where improvements can be made to reach a desired goal. Two famous properties
are called augmenting paths and alternating paths, which are used to quickly determine
whether a graph contains a maximum, or minimum, matching, or the matching can be further
improved.
Graph 1Graph 1 shows all the edges, in blue, that connect the bipartite graph. The goal of a
matching algorithm, in this and all bipartite graph cases, is to maximize the number of
connections between vertices in subset AA, above, to the vertices in subset BB, below.
Most algorithms begin by randomly creating a matching within a graph, and further refining the
matching in order to attain the desired objective.
Graph 1Graph 1, with the matching, MM, is said to have an alternating path if there is a path
whose edges are in the matching, MM, and not in the matching, in an alternating fashion. An
alternating path usually starts with an unmatched vertex and terminates once it cannot append
another edge to the tail of the path while maintaining the alternating sequence.
An augmenting path, then, builds up on the definition of an alternating path to describe a path
whose endpoints, the vertices at the start and the end of the path, are free, or unmatched, vertices;
vertices not included in the matching. Finding augmenting paths in a graph signals the lack of a
maximum matching.
The matching, MM, for Graph 1Graph 1, does not start and end on free vertices, so it does not
have an augmenting path. This implies that the matching MM is a maximum matching.
Breadth first search is a general technique of traversing a graph. Breadth first search may
use more memory but will always find the shortest path first.
In this type of search the state space is represented inform of a tree. The solution is
obtained by traversing through the tree.
The nodes of the tree represent the start value or starting state, various intermediate states
and the final state.
In this search a queue data structure is used and it is level by level traversal.
Breadth first search expands nodes in order of their distance from the root. It is a path
finding algorithm that is capable of always finding the solution if one exists.
The solution which is found is always the optional solution. This task is completed in a
very memory intensive manner. Each node in the search tree is expanded in a breadth
wise at each level.
Concept:
Step 1: Traverse the root node
Step 2: Traverse all neighbours of root node.
Step 3: Traverse all neighbours of neighbours of the root node.
Step 4: This process will continue until we are getting the goal node.
Algorithm:
Step 1: Place the root node inside the queue.
Step 2: If the queue is empty then stops and return failure.
Step 3: If the FRONT node of the queue is a goal node then stop and return success.
Step 4: Remove the FRONT node from the queue. Process it and find all its neighbours that are
in readystate then place them inside the queue in any order.
Step 5: Go to Step 3.
Step 6: Exit.
Implementation:
Let us implement the above algorithm of BFS by taking the following suitable example.
Figure
Consider the graph in which let us take A as the starting node and F as the goal node (*)
Step 1:
Place the root node inside the queue i.e. A
A
Step 2:
Now the queue is not empty and also the FRONT node i.e. A is not our goal node. So move to
step 3.
A
Step 3:
So remove the FRONT node from the queue i.e. A and find the neighbour of A i.e. B and C
B C A
Step 4:
Now B is the FRONT node of the queue .So process B and finds the neighbours of B i.e. D.
C D B
Step 5:
Now find out the neighbours of C i.e. E
D E C
Step 6:
Next find out the neighbours of D as D is the FRONT node of the queue
E F D
Step 7:
Now E is the front node of the queue. So the neighbour of E is F which is our goal node.
F E
Step 8:
Finally F is our goal node which is the FRONT of the queue. So exit.
F
Advantages:
In this procedure at any way it will find the goal.
It does not follow a single unfruitful path for a long time.
It finds the minimal solution in case of multiple paths.
Disadvantages:
BFS consumes large memory space.
Its time complexity is more.
It has long pathways, when all paths to a destination are on approximately the same
search depth.
The depth-first search or DFS algorithm traverses or explores data structures, such as
trees and graphs. The algorithm starts at the root node (in the case of a graph, you can use any
random node as the root node) and examines each branch as far as possible before backtracking
Concept:
Step 1: Traverse the root node.
Step 2: Traverse any neighbour of the root node.
Step 3: Traverse any neighbour of neighbour of the root node.
Step 4: This process will continue until we are getting the goal node.
Algorithm:
Step 1: PUSH the starting node into the stack.
Step 2: If the stack is empty then stop and return failure.
Step 3: If the top node of the stack is the goal node, then stop and return success.
Step 4: Else POP the top node from the stack and process it. Find all its neighbours that are in
ready stateand PUSH them into the stack in any order.
Step 5: Go to step 3.
Step 6: Exit.
Implementation:
Let us take an example for implementing the above DFS algorithm.
Figure
Examples of DFS
Consider A as the root node and L as the goal node in the graph figure
Step 1: PUSH the starting node into the stack i.e.
Step 2: Now the stack is not empty and A is not our goal node. Hence move to next step.
A
Step 3: POP the top node from the stack i.e. A and find the neighbours of A i.e. B and C.
B C A
Step 4: Now C is top node of the stack. Find its neighbours i.e. F and G.
B F G C
Step 5: Now G is the top node of the stack. Find its neighbour i.e. M
B F M G
Step 6: Now M is the top node and find its neighbour, but there is no neighbours of M in the
graph so
POP it from the stack.
B F M
Step 7: Now F is the top node and its neighbours are K and L. so PUSH them on to the stack.
B K L F
Step 8: Now L is the top node of the stack, which is our goal node.
B K L
Also you can traverse the graph starting from the root A and then insert in the order C and B into
the
stack.
Advantages:
DFSconsumes very less memory space.
It will reach at the goal node in a less time period than BFS if it traverses in a right path.
It may find a solution without examining much of search because we may get the desired
solutionin the very first go.
Disadvantages:
It is possible that may states keep reoccurring.
There is no guarantee of finding the goal node.
Sometimes the states may also enter into infinite loops.
HILL CLIMBING :
Generate and Test variant: Hill Climbing is the variant of Generate and Test method.
The Generate and Test method produce feedback which helps to decide which direction
to move in the search space.
Greedy approach: Hill-climbing algorithm search moves in the direction which
optimizes the cost.
No backtracking: It does not backtrack the search space, as it does not remember the
previous states.
On Y-axis we have taken the function which can be an objective function or cost function, and
state-space on the x-axis. If the function on Y-axis is cost then, the goal of search is to find the
global minimum and local minimum. If the function of Y-axis is Objective function, then the
goal of the search is to find the global maximum and local maximum.
Hill climbing is often used when a good heuristic function is available for evaluating
states but when no other useful knowledge is available.
Searching for a goal state = Climbing to the top of a hill
• Generate-and-test + direction to move.
• Heuristic function to estimate how close a given state is to a goal state.
Example:
Suppose you are in an unfamiliar city without a map and you want to get downtown which
consists of tall buildings.
You simply aim for the tall buildings.
Getting downtown is an example of such a problem. For these problems, hill climbing can
terminate whenever a goal state is reached. Only relative solutions exist.
Algorithm:
1. Evaluate the initial state.
2. Loop until a solution is found or there are no new operators left to be applied:
a) Select and apply a new operator
b) Evaluate the new state:
i. goal-> quit
ii. better than current state-> new current state
iii. not better than the current state->Continue the loop
Steepest-Ascent Hill Climbing
A useful variation on simple hill climbing considers all the moves from the current state
and selects the best one as the next state. This method is called steepest-ascenthill climbing
or gradient search.
Considers all the moves from the current state.
Selects the best one as the next state.
Algorithm: Steepest-Ascent Hill Climbing
1. Evaluate the initial state.
2. Loop until a solution is found or a complete iteration produces no change to current state:
a. SUCC = a state such that any possible successor of the
current state will be better than SUCC (the worst state).
b. For each operator that applies to the current state, evaluatethe new state:
i. goal-> quit
ii. better than SUCC-> set SUCC to this state
c. SUCC is better than the current state-> set the currentstate to SUCC.
Plateau
It is a flat area of the search space in which all neighbouring states have the
same value.
Ridge
It is a special kind of local maximum. It is an area of the search space that is
higher than surrounding areas and that itself has slope.
Ways Out:
Backtrack to some earlier node and try going in a different direction.
Make a big jump to try to get in a new section.
Moving in several directions at once.
movement from initial state to the goal state quite easily. So we can say that various problems
like planning, learning, theorem proving etc. are all essentially search problems only.
State space search is a process used in the field of computer science, including artificial
intelligence (AI), in which successive configurations or states of an instance are considered, with
the goal of finding a goal state with a desired property.
Example1:
The eight tile puzzle problem formulation. The eight tile puzzle consist of a 3 by 3 (3*3) square
frame board which holds 8 movable tiles numbered 1 to 8. One square is empty, allowing the
adjacent tiles to be shifted. The objective of the puzzle is to find a sequence of tile movements
that leads from a starting configuration to a goal configuration.
The states of 8 tile puzzle are the different permutations of the tiles within frame.
States: It specifies the location of each of the 8 tiles and the blank in one of the nice squares.
Initial state: Any state can be designated as the initial state.
Goal: Many goal configurations are possible one such is shown in the figure
Legal moves (or state): They generate legal states that result from trying the four actions-
Path cost: Each step costs 1, so the path cost is the number of steps in the path.
The tree diagram showing the search space is shown in figure.
A*SEARCHALGORITHM?
A* Search Algorithm is a simple and efficient search algorithm that can be used to find the
optimal path between two nodes in a graph. It will be used for the shortest path finding. It is
an extension of Dijkstra's shortest path algorithm (Dijkstra's Algorithm).
A* Search algorithm is one of the best and popular technique used in path-finding and graph
traversals.
Why A* Search Algorithm ?
Informally speaking, A* Search algorithms, unlike other traversal techniques, it has “brains”.
What it means is that it is really a smart algorithm which separates it from the other conventional
algorithms. This fact is cleared in detail in below sections.
And it is also worth mentioning that many games and web-based maps use this algorithm to find
the shortest path very efficiently (approximation).
(A* Algorithm)
Algorithm
We create two lists – Open List and Closed List (just like Dijkstra Algorithm)
// A* Search Algorithm
1. Initialize the open list
2. Initialize the closed list
put the starting node on the open
problems are typically identified with problems based on constraints on a finite domain. Such
problems are usually solved via search, in particular a form of backtracking or local
search. Constraint propagation are other methods used on such problems; most of them are
incomplete in general, that is, they may solve the problem or prove it unsatisfiable, but not
always. Constraint propagation methods are also used in conjunction with search to make a given
problem simpler to solve. Other considered kinds of constraints are on real or rational numbers;
solving problems on these constraints is done via variable elimination or the simplex algorithm.
Constraint satisfaction problems on finite domains are typically solved using a form of search.
The most used techniques are variants of backtracking, constraint propagation, and local search.
These techniques are used on problems with nonlinear constraints.
Variable elimination and the simplex algorithm are used for
solving linear and polynomial equations and inequalities, and problems containing variables with
infinite domain. These are typically solved as optimization problems in which the optimized
function is the number of violated constraints.
We have seen so many techniques like Local search, Adversarial search to solve different
problems. The objective of every problem-solving technique is one, i.e., to find a solution to
reach the goal. Although, in adversarial search and local search, there were no constraints on the
agents while solving the problems and reaching to its solutions.
In this section, we will discuss another type of problem-solving technique known as Constraint
satisfaction technique. By the name, it is understood that constraint satisfaction means solving a
problem under certain constraints or rules.
Constraint satisfaction is a technique where a problem is solved when its values satisfy certain
constraints or rules of the problem. Such type of technique leads to a deeper understanding of
the problem structure as well as its complexity.
X: It is a set of variables.
D: It is a set of domains where the variables reside. There is a specific domain for each
variable.
C: It is a set of constraints which are followed by the set of variables.
In constraint satisfaction, domains are the spaces where the variables reside, following the
problem specific constraints. These are the three main elements of a constraint satisfaction
technique. The constraint value consists of a pair of {scope, rel}. The scope is a tuple of
variables which participate in the constraint and rel is a relation which includes a list of values
which the variables can take to satisfy the constraints of the problem.
A state-space
The notion of the solution.
Consistent or Legal Assignment: An assignment which does not violate any constraint
or rule is called Consistent or legal assignment.
Complete Assignment: An assignment where every variable is assigned with a value,
and the solution to the CSP remains consistent. Such assignment is known as Complete
assignment.
Partial Assignment: An assignment which assigns values to some of the variables only.
Such type of assignments are called Partial assignments.
There are following two types of domains which are used by the variables :
Discrete Domain: It is an infinite domain which can have one state for multiple
variables. For example, a start state can be allocated infinite times for each variable.
Finite Domain: It is a finite domain which can have continuous states describing one
domain for one specific variable. It is also called a continuous domain.
With respect to the variables, basically there are following types of constraints:
Unary Constraints: It is the simplest type of constraints that restricts the value of a
single variable.
Binary Constraints: It is the constraint type which relates two variables. A value x2 will
contain a value which lies between x1 and x3.
Global Constraints: It is the constraint type which involves an arbitrary number of
variables.
Some special types of solution algorithms are used to solve the following types of
constraints:
Constraint Propagation
In local state-spaces, the choice is only one, i.e., to search for a solution. But in CSP, we have
two choices either:
Constraint propagation is a special type of inference which helps in reducing the legal number
of values for the variables. The idea behind constraint propagation is local consistency.
In local consistency, variables are treated as nodes, and each binary constraint is treated as an
arc in the given problem. There are following local consistencies which are discussed below:
Node Consistency: A single variable is said to be node consistent if all the values in the
variable’s domain satisfy the unary constraints on the variables.
Arc Consistency: A variable is arc consistent if every value in its domain satisfies the
binary constraints of the variables.
Path Consistency: When the evaluation of a set of two variable with respect to a third
variable can be extended over another variable, satisfying all the binary constraints. It is
similar to arc consistency.
k-consistency: This type of consistency is used to define the notion of stronger forms of
propagation. Here, we examine the k-consistency of the variables.
CSP Problems
Constraint satisfaction includes those problems which contains some constraints while solving
the problem. CSP includes the following problems:
Graph Coloring: The problem where the constraint is that no adjacent sides can have the
same color.
Sudoku Playing: The gameplay where the constraint is that no number from 0-9 can be
repeated in the same row or column.
n-queen problem: In n-queen problem, the constraint is that no queen should be placed
either diagonally, in the same row or column.
Crossword: In crossword problem, the constraint is that there should be the correct
formation of the words, and it should be meaningful.
Latin square Problem: In this game, the task is to search the pattern which is occurring
several times in the game. They may be shuffled but will contain the same digits.
Cryptarithmetic Problem: This problem has one most important constraint that is, we
cannot assign a different digit to the same character. All digits should contain a unique
alphabet.