Ai Chap 1
Ai Chap 1
Ai Chap 1
INTRODUCTION TO AI
Introduction to AI-Problem formulation, Problem Definition -Production systems, Control
strategies, Search strategies. Problem characteristics - Problem solving methods -Hill
Climbing-Depth first and Breadth first, Constraints satisfaction – Related algorithms,
Measure of performance and analysis of search Algorithms-Genetic Algorithms.
Philosophy of AI
While exploiting the power of the computer systems, the curiosity of human, lead him to
wonder, “Can a machine think and behave like humans do?”
Thus, the development of AI started with the intention of creating similar intelligence in
machines that we find and regard high in humans.
Goals of AI
To Create Expert Systems − The systems which exhibit intelligent behavior, learn,
demonstrate, explain, and advice its users.
1
191AIC403T - ARTIFICIAL INTELLIGENCEUnit-I
A computer program without AI can answer A computer program with AI can answer
the specific questions it is meant to solve. the generic questions it is meant to solve.
What is AI Technique?
In the real world, the knowledge has some unwelcomed properties −
2
191AIC403T - ARTIFICIAL INTELLIGENCEUnit-I
Applications of AI
AI has been dominant in various fields such as −
Gaming − AI plays crucial role in strategic games such as chess, poker, tic-tac-toe,
etc., where machine can think of large number of possible positions based on
heuristic knowledge.
Natural Language Processing − It is possible to interact with the computer that
understands natural language spoken by humans.
Expert Systems − There are some applications which integrate machine, software,
and special information to impart reasoning and advising. They provide explanation
and advice to the users.
Vision Systems − These systems understand, interpret, and comprehend visual input
on the computer. For example,
o A spying aeroplane takes photographs, which are used to figure out spatial
information or map of the areas.
o Doctors use clinical expert system to diagnose the patient.
o Police use computer software that can recognize the face of criminal with the
stored portrait made by forensic artist.
Speech Recognition − Some intelligent systems are capable of hearing and
comprehending the language in terms of sentences and their meanings while a
human talks to it. It can handle different accents, slang words, noise in the
background, change in human’s noise due to cold, etc.
Handwriting Recognition − The handwriting recognition software reads the text
written on paper by a pen or on screen by a stylus. It can recognize the shapes of the
letters and convert it into editable text.
Intelligent Robots − Robots are able to perform the tasks given by a human. They
have sensors to detect physical data from the real world such as light, heat,
temperature, movement, sound, bump, and pressure. They have efficient processors,
multiple sensors and huge memory, to exhibit intelligence. In addition, they are
capable of learning from their mistakes and they can adapt to the new
environment.
3
191AIC403T - ARTIFICIAL INTELLIGENCEUnit-I
Artificial Intelligence can be divided in various types, there are mainly two types of main
categorization which are based on capabilities and based on functionally of AI. Following is
flow diagram which explain the types of AI.
2. General AI:
o General AI is a type of intelligence which could perform any intellectual task with
efficiency like a human.
o The idea behind the general AI to make such a system which could be smarter and
think like a human by its own.
4
191AIC403T - ARTIFICIAL INTELLIGENCEUnit-I
o Currently, there is no such system exist which could come under general AI and can
perform any task as perfect as a human.
o The worldwide researchers are now focused on developing machines with General AI.
o As systems with general AI are still under research, and it will take lots of efforts and
time to develop such systems.
3. Super AI:
o Super AI is a level of Intelligence of Systems at which machines could surpass human
intelligence, and can perform any task better than human with cognitive properties. It
is an outcome of general AI.
o Some key characteristics of strong AI include capability include the ability to think, to
reason,solve the puzzle, make judgments, plan, learn, and communicate by its own.
o Super AI is still a hypothetical concept of Artificial Intelligence. Development of such
systems in real is still world changing task.
2. Limited Memory
o Limited memory machines can store past experiences or some data for a short period
of time.
o These machines can use stored data for a limited time period only.
5
191AIC403T - ARTIFICIAL INTELLIGENCEUnit-I
o Self-driving cars are one of the best examples of Limited Memory systems. These
cars can store recent speed of nearby cars, the distance of other cars, speed limit, and
other information to navigate the road.
3. Theory of Mind
o Theory of Mind AI should understand the human emotions, people, beliefs, and be
able to interact socially like humans.
o This type of AI machines are still not developed, but researchers are making lots of
efforts and improvement for developing such AI machines.
4. Self-Awareness
o Self-awareness AI is the future of Artificial Intelligence. These machines will be
super intelligent, and will have their own consciousness, sentiments, and self-
awareness.
o These machines will be smarter than human mind.
o Self-Awareness AI does not exist in reality still and it is a hypothetical concept.
AGENTS:
An agent is anything that can perceive its environment through sensors and acts upon that
environment through effectors.
A human agent has sensory organs such as eyes, ears, nose, tongue and skin parallel
to the sensors, and other organs such as hands, legs, mouth, for effectors.
A robotic agent replaces cameras and infrared range finders for the sensors, and
various motors and actuators for effectors.
A software agent has encoded bit strings as its programs and actions.
Agent Terminology
Performance Measure of Agent − It is the criteria, which determines how
successful an agent is.
Behaviour of Agent − It is the action that agent performs after any given sequence of
percepts.
Percept − It is agent’s perceptual inputs at a given instance.
Percept Sequence − It is the history of all that an agent has perceived till date.
Agent Function − It is a map from the precept sequence to an action.
6
191AIC403T - ARTIFICIAL INTELLIGENCEUnit-I
Intelligent Agents:
An intelligent agent is an autonomous entity which act upon an environment using sensors
and actuators for achieving goals. An intelligent agent may learn from the environment to
achieve their goals. A thermostat is an example of an intelligent agent.
Rational Agent:
A rational agent is an agent which has clear preference, models uncertainty, and acts in a way
to maximize its performance measure with all possible actions.
A rational agent is said to perform the right things. AI is about creating rational agents to use
for game theory and decision theory for various real-world scenarios.
For an AI agent, the rational action is most important because in AI reinforcement learning
algorithm, for each best possible action, agent gets the positive reward and for each wrong
action, an agent gets a negative reward.
Rationality:
7
191AIC403T - ARTIFICIAL INTELLIGENCEUnit-I
Types of AI Agents
Agents can be grouped into five classes based on their degree of perceived intelligence and
capability. All these agents can improve their performance and generate better action over the
time. These are given below:
8
191AIC403T - ARTIFICIAL INTELLIGENCEUnit-I
9
191AIC403T - ARTIFICIAL INTELLIGENCEUnit-I
3. Goal-based agents
o The knowledge of the current state environment is not always sufficient to decide for
an agent to what to do.
o The agent needs to know its goal which describes desirable situations.
o Goal-based agents expand the capabilities of the model-based agent by having the
"goal" information.
o They choose an action, so that they can achieve the goal.
o These agents may have to consider a long sequence of possible actions before
deciding whether the goal is achieved or not. Such considerations of different scenario
are called searching and planning, which makes an agent proactive.
10
191AIC403T - ARTIFICIAL INTELLIGENCEUnit-I
4. Utility-based agents
o These agents are similar to the goal-based agent but provide an extra component of
utility measurement which makes them different by providing a measure of success at
a given state.
o Utility-based agent act based not only goals but also the best way to achieve the goal.
o The Utility-based agent is useful when there are multiple possible alternatives, and an
agent has to choose in order to perform the best action.
o The utility function maps each state to a real number to check how efficiently each
action achieves the goals.
11
191AIC403T - ARTIFICIAL INTELLIGENCEUnit-I
5. Learning Agents
o A learning agent in AI is the type of agent which can learn from its past experiences,
or it has learning capabilities.
o It starts to act with basic knowledge and then able to act and adapt automatically
through learning.
o A learning agent has mainly four conceptual components, which are:
12
191AIC403T - ARTIFICIAL INTELLIGENCEUnit-I
PEAS Representation
PEAS is a type of model on which an AI agent works upon. When we define an AI agent or
rational agent, then we can group its properties under PEAS representation model. It is made
up of four words:
o P: Performance measure
o E: Environment
o A: Actuators
o S: Sensors
Here performance measure is the objective for the success of an agent's behavior.
1. Medical Keyboard
o Healthy patient o Patient o Tests (Entry of symptoms)
Diagnose
o Minimized o Hospital o Treatments
cost o Staff
2. Vacuum
o Cleanness o Room o Wheels o Camera
Cleaner
o Efficiency o Table o Brushes o Dirt detection
o Battery life o Wood floor o Vacuum sensor
3. Part -
picking
o Percentage of o Conveyor o Jointed o Camera
Robot parts in correct belt with Arms o Joint angle
bins. parts, o Hand sensors.
o Bins
Turing Test in AI
In 1950, Alan Turing introduced a test to check whether a machine can think like a human or
not, this test is known as the Turing Test. In this test, Turing proposed that the computer can
be said to be an intelligent if it can mimic human response under specific conditions.
Turing Test was introduced by Turing in his 1950 paper, "Computing Machinery and
Intelligence," which considered the question, "Can Machine think?"
14
191AIC403T - ARTIFICIAL INTELLIGENCEUnit-I
The Turing test is based on a party game "Imitation game," with some modifications. This
game involves three players in which one player is Computer, another player is human
responder, and the third player is a human Interrogator, who is isolated from other two
players and his job is to find that which player is machine among two of them.
The conversation between all players is via keyboard and screen so the result would not
depend on the machine's ability to convert words as speech.
The test result does not depend on each correct answer, but only how closely its responses
like a human answer. The computer is permitted to do everything possible to force a wrong
identification by the interrogator.
PlayerA (Computer): No
In this game, if an interrogator would not be able to identify which is a machine and which is
human, then the computer passes the test successfully, and the machine is said to be
intelligent and can think like a human.
"In 1991, the New York businessman Hugh Loebner announces the prize competition,
offering a $100,000 prize for the first computer to pass the Turing test. However, no AI
program to till date, come close to passing an undiluted Turing test".
15
191AIC403T - ARTIFICIAL INTELLIGENCEUnit-I
ELIZA: ELIZA was a Natural language processing computer program created by Joseph
Weizenbaum. It was created to demonstrate the ability of communication between machine
and humans. It was one of the first chatterbots, which has attempted the Turing Test.
Parry: Parry was a chatterbot created by Kenneth Colby in 1972. Parry was designed to
simulate a person with Paranoid schizophrenia(most common chronic mental disorder).
Parry was described as "ELIZA with attitude." Parry was tested using a variation of the
Turing Test in the early 1970s.
Eugene Goostman: Eugene Goostman was a chatbot developed in Saint Petersburg in 2001.
This bot has competed in the various number of Turing Test. In June 2012, at an event,
Goostman won the competition promoted as largest-ever Turing test content, in which it has
convinced 29% of judges that it was a human.Goostman resembled as a 13-year old virtual
boy.
There were many philosophers who really disagreed with the complete concept of Artificial
Intelligence. The most famous argument in this list was "Chinese Room."
In the year 1980, John Searle presented "Chinese Room" thought experiment, in his paper
"Mind, Brains, and Program," which was against the validity of Turing's Test. According
to his argument, "Programming a computer may make it to understand a language, but
it will not produce a real understanding of language or consciousness in a computer."
He argued that Machine such as ELIZA and Parry could easily pass the Turing test by
manipulating keywords and symbol, but they had no real understanding of language. So it
cannot be described as "thinking" capability of a machine such as a human.
16
191AIC403T - ARTIFICIAL INTELLIGENCEUnit-I
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.
3. Isolate and represent the task knowledge that is necessary to solve the problem
4. Choose the best problem-solving techniques and apply it to the particular problem.
Problem Statement
Problem Definition: Mouse is hungry, mouse is in a puzzle where there are some
cheese. Mouse will only be satisfied if mouse eat cheese
Problem Limitation: Some paths are close i-e dead end, mouse can only travel
through open paths
Problem Solution: Reach location where is cheese and eat minimum one cheese. There
are possible solutions (cheese pieces)
Solution Space: To reach cheese there are multiple paths possible
Operators: Mouse can move in four possible directions, these directions are operators or
actions which are UP, DOWN, LEFT and RIGHT
17
191AIC403T - ARTIFICIAL INTELLIGENCEUnit-I
Problem Statement
o You are given two jugs, a 4-gallon one and a 3-litre one.
o Neither have any measuring markers on it.
o There is a pump that can be used to fill the jugs with water.
o How can you get exactly 2 gallons of water into 4-gallon jug.
o Let x and y be the amounts of water in 4-gallon and 3-gallon Jugs respectively
o (x,y) refers to water available at any time in 4-gallon, 3-gallon jugs.
o (x,y) (x-d,y+dd) means drop some unknown amount d of water from 4-
gallon jug and add dd onto 3-gallon jug.
The state space for this problem can be described as the set of ordered pairs of integers (x,y)
such that x = 0, 1,2, 3 or 4 and y = 0,1,2 or 3; x represents the number of gallons of water in
the 4-gallon jug and y represents the quantity of water in 3-gallon jug
o The start state is (0,0)
o The goal state is (2,n)
Production rules for Water Jug Problem
Sl No Current state Next State Description
1 (x,y) if x < 4 (4,y) Fill the 4 gallon jug
2 (x,y) if y <3 (x,3) Fill the 3 gallon jug
3 (x,y) if x > 0 (x-d, y) Pour some water out of the 4 gallon jug
4 (x,y) if y > 0 (x, y-d) Pour some water out of the 3-gallon jug
5 (x,y) if x>0 (0, y) Empty the 4 gallon jug
6 (x,y) if y >0 (x,0) Empty the 3 gallon jug on the ground
7 (x,y) if x+y >= 4 and y (4, y-(4-x)) Pour water from the 3 –gallon jug into
>0 the 4 –gallon jug until the 4-gallon jug
is full
8 (x, y) if x+y >= 3 and (x-(3-y), 3) Pour water from the 4-gallon jug into
x>0 the 3-gallon jug until the 3-gallon jug is
full
9 (x, y) if x+y <=4 and (x+y, 0) Pour all the water from the 3-gallon jug
y>0 into the 4-gallon jug
10 (x, y) if x+y <= 3 and (0, x+y) Pour all the water from the 4-gallon jug
x>0 into the 3-gallon jug
Required a control structure that loops through a simple cycle in which some rule
whose left side matches the current state is chosen, the appropriate change to the state is
made as described in the corresponding right side, and the resulting state is checked to see if
it corresponds to goal state. One solution to the water jug problem shortest such sequence will
have a impact on the choice of appropriate mechanism to guide the search for solution.
Problem Statement
Definition: Going from Arad to Bucharest in given map
Limitation: Must travel from location to other if there is path
Problem Solution: Reach Bucharest
Solution Space: There are multiple paths to reach Bucharest.
Operators: Move to other locations
The reflex agents are known as the simplest agents because they directly map states
into actions. Unfortunately, these agents fail to operate in an environment where the
mapping is too large to store and learn. Goal-based agent, on the other hand,
considers future actions and the desired outcomes.
Here, we will discuss one type of goal-based agent known as a problem-solving
agent, which uses atomic representation with no internal states visible to the problem-
solving algorithms.
19
191AIC403T - ARTIFICIAL INTELLIGENCEUnit-I
Note: Initial state, actions, and transition model together define the state-space of the
problem implicitly. State-space of a problem is a set of all states which can be reached from
the initial state followed by any sequence of actions. The state-space forms a directed map or
graph where nodes are the states, links between the nodes are actions, and the path is a
sequence of states connected by the sequence of actions.
Search: It identifies all the best possible sequence of actions to reach the goal state
from the current state. It takes a problem as an input and returns solution as its output.
Solution: It finds the best algorithm out of various algorithms, which may be proven
as the best optimal solution.
Execution: It executes the best optimal solution from the searching algorithms to
reach the goal state from the current state.
Example Problems
Basically, there are two types of problem approaches:
Toy Problem: It is a concise and exact description of the problem which is used by
the researchers to compare the performance of algorithms.
Real-world Problem: It is real-world based problems which require solutions. Unlike
a toy problem, it does not depend on descriptions, but we can have a general
formulation of the problem.
8 Puzzle Problem: Here, we have a 3x3 matrix with movable tiles numbered from 1
to 8 with a blank space. The tile adjacent to the blank space can slide into that space.
The objective is to reach a specified goal state similar to the goal state, as shown in
the below figure.
In the figure, our task is to convert the current state into goal state by sliding digits
into the blank space.
In the above figure, our task is to convert the current(Start) state into goal state by sliding
digits into the blank space.
The problem formulation is as follows:
States: It describes the location of each numbered tiles and the blank tile.
Initial State: We can start from any state as the initial state.
21
191AIC403T - ARTIFICIAL INTELLIGENCEUnit-I
Actions: Here, actions of the blank space is defined, i.e., either left, right, up or
down
Transition Model: It returns the resulting state as per the given state and actions.
Goal test: It identifies whether we have reached the correct goal-state.
Path cost: The path cost is the number of steps in the path where the cost of each step
is 1.
Note: The 8-puzzle problem is a type of sliding-block problem which is used for testing
new search algorithms in artificial intelligence.
8-queens problem: The aim of this problem is to place eight queens on a chessboard
in an order where no queen may attack another. A queen can attack other queens
either diagonally or in same row and column.
From the following figure, we can understand the problem as well as its correct solution.
It is noticed from the above figure that each queen is set into the chessboard in a position
where no other queen is placed diagonally, in same row or column. Therefore, it is one right
approach to the 8-queens problem.
For this problem, there are two main kinds of formulation:
Incremental formulation: It starts from an empty state where the operator augments
a queen at each step.
Complete-state formulation: It starts with all the 8-queens on the chessboard and
moves them around, saving from the attacks.
22
191AIC403T - ARTIFICIAL INTELLIGENCEUnit-I
States: Arrangement of all the 8 queens one per column with no queen attacking the
other queen.
Actions: Move the queen at the location where it is safe from the attacks.
This formulation is better than the incremental formulation as it reduces the state space
from 1.8 x 1014 to 2057, and it is easy to find the solutions.
Some Real-world problems
Cell layout: Here, the primitive components of the circuit are grouped into cells, each
performing its specific function. Each cell has a fixed shape and size. The task is to
place the cells on the chip without overlapping each other.
Channel routing: It finds a specific route for each wire through the gaps between the
cells.
Protein Design: The objective is to find a sequence of amino acids which will fold
into 3D protein having a property to cure some disease.
Production System in AI
23
191AIC403T - ARTIFICIAL INTELLIGENCEUnit-I
Global Database: The primary database which contains all the information necessary to
successfully complete a task. It is further broken down into two parts: temporary and
permanent. The temporary part contains information relevant to the current situation only
whereas the permanent part contains information about the fixed actions.
A set of Production Rules: A set of rules that operates on the global database. Each rule
consists of a precondition and postcondition that the global database either meets or not. For
example, if a condition is met by the global database, then the production rule is applied
successfully.
Control System: A control system that acts as the decision-maker, decides which
production rule should be applied. The Control system stops computation or processing when
a termination condition is met on the database.
1. Simplicity: Due to the use of the IF-THEN structure, each sentence is unique in the
production system. This uniqueness makes the knowledge representation simple to enhance
the readability of the production rules.
2. Modularity: The knowledge available is coded in discrete pieces by the production system,
which makes it easy to add, modify, or delete the information without any side effects.
3. Modifiability: This feature allows for the modification of the production rules. The rules are
first defined in the skeletal form and then modified to suit an application.
4. Knowledge-intensive: As the name suggests, the system only stores knowledge. All the rules
are written in the English language. This type of representation solves the semantics problem.
Monotonic Production System: In a monotonic production system, the use of one rule
never prevents the involvement of another rule when both the rules are selected at the same
time. Hence, it enables the system to apply rules simultaneously.
Partially Commutative Production System: In this production system if a set of rules is
used to change state A to state B then any allowable combination of these rules will also
produce the same results (convert state A to state B).
Non-Monotonic Production System: This production system increases the problem-
solving efficiency of the machine by not keeping a record of the changes made in the
previous search process. These types of production systems are useful from an
24
191AIC403T - ARTIFICIAL INTELLIGENCEUnit-I
implementation point of view as they do not backtrack to the previous state when it is found
that an incorrect path was followed.
Commutative Production System: These type of production systems is used when the
order of operation is not important, and the changes are reversible.
Join the Machine Learning Course online from the World’s top Universities – Masters,
Executive Post Graduate Programs, and Advanced Certificate Program in ML & AI to fast-
track your career.
Offers modularity as all the rules can be added, deleted, or modified individually.
Separate control system and knowledge base.
An excellent and feasible model that imitates human problem-solving skills.
Beneficial in real-time applications and environment.
Offers language independence.
Control strategies:
• Control Strategy in Artificial Intelligence scenario is a technique or strategy, tells us about which
rule has to be applied next while searching for the solution of a problem within problem space. It
helps us to decide which rule has to apply next without getting stuck at any point. These rules
decide the way we approach the problem and how quickly it is solved and even whether a problem
is finally solved.
• Control Strategy helps to find the solution when there is more than one rule or fewer rules for
finding the solution at each point in problem space.
• Requirements for a good Control Strategy
– It should cause motion
In water jug problem, if we apply a simple control strategy of starting each time from the top
of rule list and choose the first applicable one, then we will never move towards solution.
– It should explore the solution space in a systematic manner
If we choose another control strategy, say, choose a rule randomly from the applicable rules
then definitely it causes motion and eventually will lead to a solution. But one may arrive to same
state several times. This is because control strategy is not systematic.
Examples:
Breadth First Search
Algorithm:
1. Create a variable called NODE-LIST and set it to initial state
2. Until a goal state is found or NODE-LIST is empty do
a. Remove the first element from NODE-LIST and call it E. If NODE-LIST
was empty, quit
b. For each way that each rule can match the state described in E do:
i. Apply the rule to generate a new state
ii. If the new state is a goal state, quit and return this state
iii. Otherwise, add the new state to the end of NODE-LIST
25
191AIC403T - ARTIFICIAL INTELLIGENCEUnit-I
Advantages of BFS
• BFS will not get trapped exploring a blind alley. This contrasts with DFS, which may follow
a single unfruitful path for a very long time, perhaps forever, before the path actually
terminates in a state that has no successors.
• If there is a solution, BFS is guaranteed to find it.
26
191AIC403T - ARTIFICIAL INTELLIGENCEUnit-I
27
191AIC403T - ARTIFICIAL INTELLIGENCEUnit-I
Search strategies:
Searching is a process to find the solution for a given set of problems. This in artificial
intelligence can be done by using either uninformed searching strategies of either informed
searching strategies.
Following are the four essential properties of search algorithms to compare the efficiency of
these algorithms:
28
191AIC403T - ARTIFICIAL INTELLIGENCEUnit-I
175.2K
Tesla announces plans for humanoid robot
Optimality: If a solution found for an algorithm is guaranteed to be the best solution (lowest
path cost) among all other solutions, then such a solution for is said to be an optimal solution.
Time Complexity: Time complexity is a measure of time for an algorithm to complete its
task.
Space Complexity: It is the maximum storage space required at any point during the search,
as the complexity of the problem.
Based on the search problems we can classify the search algorithms into uninformed
(Blind search) search and informed search (Heuristic search) algorithms.
Uninformed/Blind Search:
The uninformed search does not contain any domain knowledge such as closeness, the
location of the goal. It operates in a brute-force way as it only includes information about
how to traverse the tree and how to identify leaf and goal nodes. Uninformed search applies a
way in which search tree is searched without any information about the search space like
initial state operators and test for the goal, so it is also called blind search. It examines each
node of the tree until it achieves the goal node.
29
191AIC403T - ARTIFICIAL INTELLIGENCEUnit-I
o Breadth-first search
o Uniform cost search
o Depth-first search
o Iterative deepening depth-first search
o Bidirectional Search
Informed Search
A heuristic is a way which might not always be guaranteed for best solutions but guaranteed
to find a good solution in reasonable time.
Informed search can solve much complex problem which could not be solved in another way.
1. Greedy Search
2. A* Search
1. Breadth-first Search
2. Depth-first Search
3. Depth-limited Search
4. Iterative deepening depth-first search
5. Uniform cost search
6. Bidirectional Search
1. Breadth-first Search:
30
191AIC403T - ARTIFICIAL INTELLIGENCEUnit-I
o Breadth-first search is the most common search strategy for traversing a tree or graph.
This algorithm searches breadthwise in a tree or graph, so it is called breadth-first
search.
o BFS algorithm starts searching from the root node of the tree and expands all
successor node at the current level before moving to nodes of next level.
o The breadth-first search algorithm is an example of a general-graph search algorithm.
o Breadth-first search implemented using FIFO queue data structure.
Advantages:
Disadvantages:
Nested Structure in C
Keep Watching
o It requires lots of memory since each level of the tree must be saved into memory to
expand the next level.
o BFS needs lots of time if the solution is far away from the root node.
Example:
In the below tree structure, we have shown the traversing of the tree using BFS algorithm
from the root node S to goal node K. BFS search algorithm traverse in layers, so it will follow
the path which is shown by the dotted arrow, and the traversed path will be:
S---> A--->B---->C--->D---->G--->H--->E---->F---->I---->K
31
191AIC403T - ARTIFICIAL INTELLIGENCEUnit-I
Time Complexity: Time Complexity of BFS algorithm can be obtained by the number of
nodes traversed in BFS until the shallowest Node. Where the d= depth of shallowest solution
and b is a node at every state.
Space Complexity: Space complexity of BFS algorithm is given by the Memory size of
frontier which is O(bd).
Completeness: BFS is complete, which means if the shallowest goal node is at some finite
depth, then BFS will find a solution.
Optimality: BFS is optimal if path cost is a non-decreasing function of the depth of the node.
2. Depth-first Search
o Depth-first search isa recursive algorithm for traversing a tree or graph data structure.
o It is called the depth-first search because it starts from the root node and follows each
path to its greatest depth node before moving to the next path.
o DFS uses a stack data structure for its implementation.
o The process of the DFS algorithm is similar to the BFS algorithm.
Note: Backtracking is an algorithm technique for finding all possible solutions using
recursion.
Advantage:
o DFS requires very less memory as it only needs to store a stack of the nodes on the
path from root node to the current node.
o It takes less time to reach to the goal node than BFS algorithm (if it traverses in the
right path).
Disadvantage:
o There is the possibility that many states keep re-occurring, and there is no guarantee
of finding the solution.
o DFS algorithm goes for deep down searching and sometime it may go to the infinite
loop.
Example:
In the below search tree, we have shown the flow of depth-first search, and it will follow the
order as:
32
191AIC403T - ARTIFICIAL INTELLIGENCEUnit-I
It will start searching from root node S, and traverse A, then B, then D and E, after traversing
E, it will backtrack the tree as E has no other successor and still goal node is not found. After
backtracking it will traverse node C and then G, and here it will terminate as it found goal
node.
Completeness: DFS search algorithm is complete within finite state space as it will expand
every node within a limited search tree.
Time Complexity: Time complexity of DFS will be equivalent to the node traversed by the
algorithm. It is given by:
Where, m= maximum depth of any node and this can be much larger than d (Shallowest
solution depth)
Space Complexity: DFS algorithm needs to store only single path from the root node, hence
Optimal: DFS search algorithm is non-optimal, as it may generate a large number of steps or
high cost to reach to the goal node.
o Standard failure value: It indicates that problem does not have any solution.
o Cutoff failure value: It defines no solution for the problem within a given depth limit.
33
191AIC403T - ARTIFICIAL INTELLIGENCEUnit-I
Advantages:
Disadvantages:
Example:
Completeness: DLS search algorithm is complete if the solution is above the depth-limit.
Optimal: Depth-limited search can be viewed as a special case of DFS, and it is also not
optimal even if ℓ>d.
Uniform-cost search is a searching algorithm used for traversing a weighted tree or graph.
This algorithm comes into play when a different cost is available for each edge. The primary
goal of the uniform-cost search is to find a path to the goal node which has the lowest
cumulative cost. Uniform-cost search expands nodes according to their path costs form the
root node. It can be used to solve any graph/tree where the optimal cost is in demand. A
uniform-cost search algorithm is implemented by the priority queue. It gives maximum
priority to the lowest cumulative cost. Uniform cost search is equivalent to BFS algorithm if
the path cost of all edges is the same.
Advantages:
34
191AIC403T - ARTIFICIAL INTELLIGENCEUnit-I
o Uniform cost search is optimal because at every state the path with the least cost is
chosen.
Disadvantages:
o It does not care about the number of steps involve in searching and only concerned
about path cost. Due to which this algorithm may be stuck in an infinite loop.
Example:
Completeness:
Uniform-cost search is complete, such as if there is a solution, UCS will find it.
Time Complexity:
Let C* is Cost of the optimal solution, and ε is each step to get closer to the goal node. Then
the number of steps is = C*/ε+1. Here we have taken +1, as we start from state 0 and end to
C*/ε.
Space Complexity:
The same logic is for space complexity so, the worst-case space complexity of Uniform-cost
search is O(b1 + [C*/ε]).
Optimal:
Uniform-cost search is always optimal as it only selects a path with the lowest path cost.
35
191AIC403T - ARTIFICIAL INTELLIGENCEUnit-I
The iterative deepening algorithm is a combination of DFS and BFS algorithms. This search
algorithm finds out the best depth limit and does it by gradually increasing the limit until a
goal is found.
This algorithm performs depth-first search up to a certain "depth limit", and it keeps
increasing the depth limit after each iteration until the goal node is found.
This Search algorithm combines the benefits of Breadth-first search's fast search and depth-
first search's memory efficiency.
The iterative search algorithm is useful uninformed search when search space is large, and
depth of goal node is unknown.
Advantages:
o Itcombines the benefits of BFS and DFS search algorithm in terms of fast search and
memory efficiency.
Disadvantages:
o The main drawback of IDDFS is that it repeats all the work of the previous phase.
Example:
Following tree structure is showing the iterative deepening depth-first search. IDDFS
algorithm performs various iterations until it does not find the goal node. The iteration
performed by the algorithm is given as:
1'st Iteration-----> A
2'nd Iteration----> A, B, C
3'rd Iteration------>A, B, D, E, C, F, G
4'th Iteration------>A, B, D, H, I, E, C, F, K, G
In the fourth iteration, the algorithm will find the goal node.
36
191AIC403T - ARTIFICIAL INTELLIGENCEUnit-I
Completeness:
Time Complexity:
Let's suppose b is the branching factor and depth is d then the worst-case time complexity
is O(bd).
Space Complexity:
Optimal:
IDDFS algorithm is optimal if path cost is a non- decreasing function of the depth of the
node.
Bidirectional search algorithm runs two simultaneous searches, one form initial state
called as forward-search and other from goal node called as backward-search, to find
the goal node. Bidirectional search replaces one single search graph with two small
subgraphs in which one starts the search from an initial vertex and other starts from
goal vertex. The search stops when these two graphs intersect each other.
Bidirectional search can use search techniques such as BFS, DFS, DLS, etc.
Advantages:
Disadvantages:
Example:
In the below search tree, bidirectional search algorithm is applied. This algorithm divides one
graph/tree into two sub-graphs. It starts traversing from node 1 in the forward direction and
starts from goal node 16 in the backward direction.
37
191AIC403T - ARTIFICIAL INTELLIGENCEUnit-I
So far we have talked about the uninformed search algorithms which looked through search
space for all possible solutions of the problem without having any additional knowledge
about search space. But informed search algorithm contains an array of knowledge such as
how far we are from the goal, path cost, how to reach to goal node, etc. This knowledge help
agents to explore less to the search space and find more efficiently the goal node.
The informed search algorithm is more useful for large search space. Informed search
algorithm uses the idea of heuristic, so it is also called Heuristic search.
Heuristics function: Heuristic is a function which is used in Informed Search, and it finds
the most promising path. It takes the current state of the agent as its input and produces the
estimation of how close agent is from the goal. The heuristic method, however, might not
always give the best solution, but it guaranteed to find a good solution in reasonable time.
Heuristic function estimates how close a state is to the goal. It is represented by h(n), and it
calculates the cost of an optimal path between the pair of states. The value of the heuristic
function is always positive.
Here h(n) is heuristic cost, and h*(n) is the estimated cost. Hence heuristic cost should
be less than or equal to the estimated cost.
Pure heuristic search is the simplest form of heuristic search algorithms. It expands nodes
based on their heuristic value h(n). It maintains two lists, OPEN and CLOSED list. In the
CLOSED list, it places those nodes which have already expanded and in the OPEN list, it
places nodes which have yet not been expanded.
On each iteration, each node n with the lowest heuristic value is expanded and generates all
its successors and n is placed to the closed list. The algorithm continues unit a goal state is
found.
In the informed search we will discuss two main algorithms which are given below:
Greedy best-first search algorithm always selects the path which appears best at that moment.
It is the combination of depth-first search and breadth-first search algorithms. It uses the
heuristic function and search. Best-first search allows us to take the advantages of both
algorithms. With the help of best-first search, at each step, we can choose the most promising
node. In the best first search algorithm, we expand the node which is closest to the goal node
and the closest cost is estimated by heuristic function, i.e.
1. f(n)= g(n).
39
191AIC403T - ARTIFICIAL INTELLIGENCEUnit-I
Advantages:
o Best first search can switch between BFS and DFS by gaining the advantages of both
the algorithms.
o This algorithm is more efficient than BFS and DFS algorithms.
Disadvantages:
o It can behave as an unguided depth-first search in the worst case scenario.
o It can get stuck in a loop as DFS.
o This algorithm is not optimal.
Example:
Consider the below search problem, and we will traverse it using greedy best-first search. At
each iteration, each node is expanded using evaluation function f(n)=h(n) , which is given in
the below table.
In this search example, we are using two lists which are OPEN and CLOSED Lists.
Following are the iteration for traversing the above example.
40
191AIC403T - ARTIFICIAL INTELLIGENCEUnit-I
Time Complexity: The worst case time complexity of Greedy best first search is O(bm).
Space Complexity: The worst case space complexity of Greedy best first search is O(bm).
Where, m is the maximum depth of the search space.
Complete: Greedy best-first search is also incomplete, even if the given state space is finite.
A* search is the most commonly known form of best-first search. It uses heuristic function
h(n), and cost to reach the node n from the start state g(n). It has combined features of UCS
and greedy best-first search, by which it solve the problem efficiently. A* search algorithm
finds the shortest path through the search space using the heuristic function. This search
algorithm expands less search tree and provides optimal result faster. A* algorithm is similar
to UCS except that it uses g(n)+h(n) instead of g(n).
In A* search algorithm, we use search heuristic as well as the cost to reach the node. Hence
we can combine both costs as following, and this sum is called as a fitness number.
41
191AIC403T - ARTIFICIAL INTELLIGENCEUnit-I
At each point in the search space, only those node is expanded which have the lowest value
of f(n), and the algorithm terminates when the goal node is found.
Algorithm of A* search:
Step 2: Check if the OPEN list is empty or not, if the list is empty then return failure and
stops.
Step 3: Select the node from the OPEN list which has the smallest value of evaluation
function (g+h), if node n is goal node then return success and stop, otherwise
Step 4: Expand node n and generate all of its successors, and put n into the closed list. For
each successor n', check whether n' is already in the OPEN or CLOSED list, if not then
compute evaluation function for n' and place into Open list.
Step 5: Else if node n' is already in OPEN and CLOSED, then it should be attached to the
back pointer which reflects the lowest g(n') value.
Advantages:
o A* search algorithm is the best algorithm than other search algorithms.
o A* search algorithm is optimal and complete.
o This algorithm can solve very complex problems.
Disadvantages:
o It does not always produce the shortest path as it mostly based on heuristics and
approximation.
o A* search algorithm has some complexity issues.
o The main drawback of A* is memory requirement as it keeps all generated nodes in
the memory, so it is not practical for various large-scale problems.
Example:
42
191AIC403T - ARTIFICIAL INTELLIGENCEUnit-I
In this example, we will traverse the given graph using the A* algorithm. The heuristic value
of all states is given in the below table so we will calculate the f(n) of each state using the
formula f(n)= g(n) + h(n), where g(n) is the cost to reach any node from start state.
Here we will use OPEN and CLOSED list.
Solution:
Iteration3: {(S--> A-->C--->G, 6), (S--> A-->C--->D, 11), (S--> A-->B, 7), (S-->G, 10)}
Iteration 4 will give the final result, as S--->A--->C--->G it provides the optimal path with
cost 6.
Points to remember:
43
191AIC403T - ARTIFICIAL INTELLIGENCEUnit-I
o A* algorithm returns the path which occurred first, and it does not search for all
remaining paths.
o The efficiency of A* algorithm depends on the quality of heuristic.
o A* algorithm expands all nodes which satisfy the condition f(n)<="" li="">
o Admissible: the first condition requires for optimality is that h(n) should be an
admissible heuristic for A* tree search. An admissible heuristic is optimistic in nature.
o Consistency: Second required condition is consistency for only A* graph-search.
If the heuristic function is admissible, then A* tree search will always find the least cost path.
Problem Characteristics
In order to choose the most appropriate method(s) for a particular problem must analyse the problem
along several dimensions.
1. Is the problem decomposable into a set of independent smaller sub problems?
Example: Decomposable Problem
Decomposable problems can be solved by the divide-and-conquer technique. In divide and
conquer technique, divide the problem in to sub-problems, find the solutions for the sub-
problems. Finally, integrate the solutions for the sub-problems, we will get the solution for the
original problem. Suppose we want to solve the problem of computing the integral of the following
expression
∫(x2+ 3x + sin2x * cos2x) dx
44
191AIC403T - ARTIFICIAL INTELLIGENCEUnit-I
2 8 3 1 2 3
1 6 4 8 4
7 5
45
191AIC403T - ARTIFICIAL INTELLIGENCEUnit-I
\ 7 6 5
Initial state Goal state
Solved by backtracking
Irrecoverable ( Chess)
• A stupid move cannot be undone.
• Can be solved by planning process.
3. Is the universe predictable?
There are two types of problems. Certain outcome and uncertain outcome.
46
191AIC403T - ARTIFICIAL INTELLIGENCEUnit-I
Either of two reasoning paths will lead to the answer. We need to find only the answer to the question.
No need to go back and see if some other path might also lead to a solution.
Best path problem
In travelling salesman problem, our goal is to find the shortest route that visits each city
exactly once.
Best path problems are computationally harder than any path problem.
5. Is the solution a state or path?
State
Finding a consistent interpretation for the sentence “The bank president ate a dish of pasta
salad with the fork”. We need to find the interpretation but not the record of the processing.
Path
In water jug problem, it is not sufficient to report that the problem is solved and the goal is
reached, it is (2,0). For this problem, we need the path from the initial state to the goal state.
47
191AIC403T - ARTIFICIAL INTELLIGENCEUnit-I
o 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.
o Greedy approach: Hill-climbing algorithm search moves in the direction which
optimizes the cost.
48
191AIC403T - ARTIFICIAL INTELLIGENCEUnit-I
o 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.
Local Maximum: Local maximum is a state which is better than its neighbor states, but there
is also another state which is higher than it.
Global Maximum: Global maximum is the best possible state of state space landscape. It has
the highest value of objective function.
Flat local maximum: It is a flat space in the landscape where all the neighbor states of
current states have the same value.
49
191AIC403T - ARTIFICIAL INTELLIGENCEUnit-I
Simple hill climbing is the simplest way to implement a hill climbing algorithm. It only
evaluates the neighbor node state at a time and selects the first one which optimizes
current cost and set it as a current state. It only checks it's one successor state, and if it
finds better than the current state, then move else be in the same state. This algorithm has the
following features:
The steepest-Ascent algorithm is a variation of simple hill climbing algorithm. This algorithm
examines all the neighboring nodes of the current state and selects one neighbor node which
is closest to the goal state. This algorithm consumes more time as it searches for multiple
neighbors
a. Let SUCC be a state such that any successor of the current state will be better
than it.
b. For each operator that applies to the current state:
50
191AIC403T - ARTIFICIAL INTELLIGENCEUnit-I
Stochastic hill climbing does not examine for all its neighbor before moving. Rather, this
search algorithm selects one neighbor node at random and decides whether to choose it as a
current state or examine another state.
1. Local Maximum: A local maximum is a peak state in the landscape which is better than
each of its neighboring states, but there is another state also present which is higher than the
local maximum.
Solution: Backtracking technique can be a solution of the local maximum in state space
landscape. Create a list of the promising path so that the algorithm can backtrack the search
space and explore other paths as well.
2. Plateau: A plateau is the flat area of the search space in which all the neighbor states of
the current state contains the same value, because of this algorithm does not find any best
direction to move. A hill-climbing search might be lost in the plateau area.
Solution: The solution for the plateau is to take big steps or very little steps while searching,
to solve the problem. Randomly select a state which is far away from the current state so it is
possible that the algorithm could find non-plateau region.
51
191AIC403T - ARTIFICIAL INTELLIGENCEUnit-I
3. Ridges: A ridge is a special form of the local maximum. It has an area which is higher than
its surrounding areas, but itself has a slope, and cannot be reached in a single move.
Solution: With the use of bidirectional search, or by moving in different directions, we can
improve this problem.
Simulated Annealing:
A hill-climbing algorithm which never makes a move towards a lower value guaranteed to be
incomplete because it can get stuck on a local maximum. And if algorithm applies a random
walk, by moving a successor, then it may complete but not efficient. Simulated Annealing is
an algorithm which yields both efficiency and completeness.
Constraints satisfaction
A constraint satisfaction problem (CSP) consists of
a set of variables,
a domain for each variable, and
a set of constraints.
The aim is to choose a value for each variable so that the resulting possible world satisfies the
constraints; we want a model of the constraints.
A finite CSP has a finite set of variables and a finite domain for each variable. Many of the
methods considered in this chapter only work for finite CSPs, although some are designed for
infinite, even continuous, domains.
The multidimensional aspect of these problems, where each variable can be seen as a separate
dimension, makes them difficult to solve but also provides structure that can be exploited.
Given a CSP, there are a number of tasks that can be performed:
Determine whether or not there is a model.
Find a model.
Find all of the models or enumerate the models.
Count the number of models.
Determine whether some statement holds in all models.
Solving Constraint Satisfaction Problems
The requirements to solve a constraint satisfaction problem (CSP) is:
52
191AIC403T - ARTIFICIAL INTELLIGENCEUnit-I
A state-space
The notion of the solution.
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.
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:
53
191AIC403T - ARTIFICIAL INTELLIGENCEUnit-I
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.
54
191AIC403T - ARTIFICIAL INTELLIGENCEUnit-I
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.
55
191AIC403T - ARTIFICIAL INTELLIGENCEUnit-I
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.
56
191AIC403T - ARTIFICIAL INTELLIGENCEUnit-I
o The MEA analysis process centered on the evaluation of the difference between the
current state and goal state.
The means-ends analysis process can be applied recursively for a problem. It is a strategy to
control search in problem-solving. Following are the main Steps which describes the working
of MEA technique for solving a problem.
a. First, evaluate the difference between Initial State and final State.
b. Select the various operators which can be applied for each difference.
c. Apply the operator at each difference, which reduces the difference between the
current state and goal state.
Operator Subgoaling
In the MEA process, we detect the differences between the current state and goal state. Once
these differences occur, then we can apply an operator to reduce the differences. But
sometimes it is possible that an operator cannot be applied to the current state. So we create
the subproblem of the current state, in which operator can be applied, such type of backward
chaining in which operators are selected, and then sub goals are set up to establish the
preconditions of the operator is called Operator Subgoaling.
Let's we take Current state as CURRENT and Goal State as GOAL, then following are the
steps for the MEA algorithm.
o Step 1: Compare CURRENT to GOAL, if there are no differences between both then
return Success and Exit.
o Step 2: Else, select the most significant difference and reduce it by doing the
following steps until the success or failure occurs.
a. Select a new operator O which is applicable for the current difference, and if there is
no such operator, then signal failure.
b. Attempt to apply operator O to CURRENT. Make a description of two states.
i) O-Start, a state in which O?s preconditions are satisfied.
ii) O-Result, the state that would result if O were applied In O-start.
c. If
(First-Part <------ MEA (CURRENT, O-START)
57
191AIC403T - ARTIFICIAL INTELLIGENCEUnit-I
And
(LAST-Part <----- MEA (O-Result, GOAL), are successful, then signal
Success and return the result of combining FIRST-PART, O, and LAST-
PART.
The above-discussed algorithm is more suitable for a simple problem and not adequate for
solving complex problems.
Let's take an example where we know the initial state and goal state as given below. In this
problem, we need to get the goal state by finding differences between the initial state and
goal state and applying operators.
Solution:
To solve the above problem, we will first find the differences between initial states and goal
states, and for each difference, we will generate a new state and will apply the operators. The
operators we have for this problem are:
o Move
o Delete
o Expand
1. Evaluating the initial state: In the first step, we will evaluate the initial state and will
compare the initial and Goal state to find the differences between both states.
2. Applying Delete operator: As we can check the first difference is that in goal state there
is no dot symbol which is present in the initial state, so, first we will apply the Delete
operator to remove this dot.
58
191AIC403T - ARTIFICIAL INTELLIGENCEUnit-I
3. Applying Move Operator: After applying the Delete operator, the new state occurs which
we will again compare with goal state. After comparing these states, there is another
difference that is the square is outside the circle, so, we will apply the Move Operator.
4. Applying Expand Operator: Now a new state is generated in the third step, and we will
compare this state with the goal state. After comparing the states there is still one difference
which is the size of the square, so, we will apply Expand operator, and finally, it will
generate the goal state.
Genetic Algorithm
Genetic Algorithm is a part of Evolutionary Algorithms, specifically to generate high-quality
solutions to optimization and search problems by relying on biologically inspired operators
such as mutation, crossover, and selection.
Genetic algorithm is majorly used for 2 purposes-
1. Search
2. Optimisation
Genetic algorithms use an iterative process to arrive at the best solution. Finding the best
solution out of multiple best solutions (best of best). Compared with Natural selection, it
is natural for the fittest to survive in comparison with others.
Now let’s try to grab some pointers from the evolution side to clearly correlate with
genetic algorithms.
59
191AIC403T - ARTIFICIAL INTELLIGENCEUnit-I
For example:
1. Initialisation:
Randomly generate a population with multiple chromosomes. Gene is the smallest unit
and can be referred to as a set of characteristics (variables). We aim to join the Genes to
obtain the Chromosomes(solution). The chromosome itself represents one candidate
solution abstractly. The generation of Chromosome is user-defined (combination of
numbers between 0 and 5 or only binary numbers).
Now we need to define the evaluation criteria for best chromosomes(solution). Each
chromosome is assigned with a fitness score by the fitness function, which represents the
goodness of the solution. Let’s say the fitness function is the sum of all the genes. Hence,
60
191AIC403T - ARTIFICIAL INTELLIGENCEUnit-I
the chromosome with the maximum sum is the fittest. In our case, the chromosome has a
sum of 12.
3. Selection:
Selecting the top 2 fittest chromosomes for creating the next generation. These will act as
parents to generate offspring for the next generation which will naturally inherit the
strong features. Two pairs of individuals (parents) are selected based on their fitness
scores. Other chromosomes are dropped. Here are some of the methods of parent
selection-
4. Crossover:
Crossover is the equivalent of two parents having a child. Each chromosome contributes a
certain number of genes to the new individual. Offspring are created by exchanging the
genes of parents among themselves until the crossover point is reached.
5. Mutation:
Disadvantages:
62