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

Artificial Intelligence Notes

Artificial intelligence notes engineering
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Artificial Intelligence Notes

Artificial intelligence notes engineering
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 34

Artificial Intelligence Notes

Artificial Intelligence is composed of two words Artificial and Intelligence, where Artificial
defines “man-made,” and intelligence defines “thinking power”, hence AI means “a man-
made thinking power.”

❖ Definition of AI
It is a branch of computer science by which we can create intelligent machines which can
behave like a human, think like humans, and able to make decisions.”

Artificial Intelligence exists when a machine can have human based skills such as learning,
reasoning, and solving problems.
With Artificial Intelligence you do not need to pre-program a machine to do some work, despite
that you can create a machine with programmed algorithms which can work with own
intelligence, and that is the awesomeness of AI.
It is believed that AI is not a new technology, and some people says that as per Greek myth,
there were Mechanical men in early days which can work and behave like humans.

❖ Why Artificial Intelligence?


Before learning about Artificial Intelligence, we should know that what is the importance of
AI and why should we learn it. Following are some main reasons to learn about AI:
• With the help of AI, you can create such software or devices which can solve real-world
problems very easily and with accuracy such as health issues, marketing, traffic issues,
etc.
• With the help of AI, you can create your personal virtual Assistant, such as Cortana,
Google Assistant, Siri, etc.
• With the help of AI, you can build such Robots which can work in an environment
where survival of humans can be at risk.
• AI opens a path for other new technologies, new devices, and new Opportunities.

❖ Goals of Artificial Intelligence


Following are the main goals of Artificial Intelligence:
• Replicate human intelligence
• Solve Knowledge-intensive tasks
• An intelligent connection of perception and action
• Building a machine which can perform tasks that requires human intelligence such as:
Artificial Intelligence Notes

✓ Proving a theorem
✓ Playing chess
✓ Plan some surgical operation
✓ Driving a car in traffic
• Creating some system which can exhibit intelligent behaviour, learn new things by
itself, demonstrate, explain, and can advise to its user.

❖ What Comprises to Artificial Intelligence?


Artificial Intelligence is not just a part of computer science even it's so vast and requires lots
of other factors which can contribute to it. To create the AI first we should know that how
intelligence is composed, so the Intelligence is an intangible part of our brain which is a
combination of Reasoning, learning, problem-solving perception, language understanding, etc.
To achieve the above factors for a machine or software Artificial Intelligence requires the
following discipline:
• Mathematics
• Biology
• Psychology
• Sociology
• Computer Science
• Neurons Study
• Statistics
Artificial Intelligence Notes

❖ Advantages of Artificial Intelligence


Following are some main advantages of Artificial Intelligence:
• High Accuracy with less errors: AI machines or systems are prone to less errors and high
accuracy as it takes decisions as per pre-experience or information.
• High-Speed: AI systems can be of very high-speed and fast-decision making, because of
that AI systems can beat a chess champion in the Chess game.
• High reliability: AI machines are highly reliable and can perform the same action multiple
times with high accuracy.
• Useful for risky areas: AI machines can be helpful in situations such as defusing a bomb,
exploring the ocean floor, where to employ a human can be risky.
• Digital Assistant: AI can be very useful to provide digital assistant to the users such as AI
technology is currently used by various E-commerce websites to show the products as per
customer requirement.
• Useful as a public utility: AI can be very useful for public utilities such as a self-driving
car which can make our journey safer and hassle-free, facial recognition for security
purpose, Natural language processing to communicate with the human in human-language,
etc.

❖ Disadvantages of Artificial Intelligence


Every technology has some disadvantages, and the same goes for Artificial intelligence. Being
so advantageous technology still, it has some disadvantages which we need to keep in our mind
while creating an AI system. Following are the disadvantages of AI:
• High Cost: The hardware and software requirement of AI is very costly as it requires lots
of maintenance to meet current world requirements.
• Can't think out of the box: Even we are making smarter machines with AI, but still they
cannot work out of the box, as the robot will only do that work for which they are trained,
or programmed.
• No feelings and emotions: AI machines can be an outstanding performer, but still it does
not have the feeling so it cannot make any kind of emotional attachment with human, and
may sometime be harmful for users if the proper care is not taken.
• Increase dependency on machines: With the increment of technology, people are getting
more dependent on devices and hence they are losing their mental capabilities.
Artificial Intelligence Notes

• No Original Creativity: As humans are so creative and can imagine some new ideas but
still AI machines cannot beat this power of human intelligence and cannot be creative and
imaginative.

❖ Applications of AI
Artificial Intelligence has various applications in today's society. It is becoming essential for
today's time because it can solve complex problems with an efficient way in multiple industries,
such as Healthcare, entertainment, finance, education, etc. AI is making our daily life more
comfortable and faster.
Following are some sectors which have the application of Artificial Intelligence:

1. AI in Astronomy
Artificial Intelligence can be very useful to solve complex universe problems. AI technology
can be helpful for understanding the universe such as how it works, origin, etc.
2. AI in Healthcare
In the last, five to ten years, AI becoming more advantageous for the healthcare industry and
going to have a significant impact on this industry.
Artificial Intelligence Notes

Healthcare Industries are applying AI to make a better and faster diagnosis than humans. AI
can help doctors with diagnoses and can inform when patients are worsening so that medical
help can reach to the patient before hospitalization.
3. AI in Gaming
AI can be used for gaming purpose. The AI machines can play strategic games like chess,
where the machine needs to think of a large number of possible places.
4. AI in Finance
AI and finance industries are the best matches for each other. The finance industry is
implementing automation, chatbot, adaptive intelligence, algorithm trading, and machine
learning into financial processes.
5. AI in Data Security
The security of data is crucial for every company and cyber-attacks are growing very rapidly
in the digital world. AI can be used to make your data more safe and secure. Some examples
such as AEG bot, AI2 platform are used to determine software bug and cyber-attacks in a better
way.
6. AI in Social Media
Social Media sites such as Facebook, Twitter, and Snapchat contain billions of user profiles,
which need to be stored and managed in a very efficient way. AI can organize and manage
massive amounts of data. AI can analyze lots of data to identify the latest trends, hashtag, and
requirement of different users.
7. AI in Travel & Transport
AI is becoming highly demanding for travel industries. AI is capable of doing various travel
related works such as from making travel arrangement to suggesting the hotels, flights, and
best routes to the customers. Travel industries are using AI-powered chatbots which can make
human-like interaction with customers for better and fast response.
8. AI in Automotive Industry
Some Automotive industries are using AI to provide virtual assistant to their user for better
performance. Such as Tesla has introduced TeslaBot, an intelligent virtual assistant.
Various Industries are currently working for developing self-driven cars which can make your
journey more safe and secure.
9. AI in Robotics:
Artificial Intelligence has a remarkable role in Robotics. Usually, general robots are
programmed such that they can perform some repetitive task, but with the help of AI, we can
Artificial Intelligence Notes

create intelligent robots which can perform tasks with their own experiences without pre-
programmed.
Humanoid Robots are best examples for AI in robotics, recently the intelligent Humanoid robot
named as Erica and Sophia has been developed which can talk and behave like humans.
10. AI in Entertainment
We are currently using some AI based applications in our daily life with some entertainment
services such as Netflix or Amazon. With the help of ML/AI algorithms, these services show
the recommendations for programs or shows.
11. AI in Agriculture
Agriculture is an area which requires various resources, labour, money, and time for best result.
Now a day’s agriculture is becoming digital, and AI is emerging in this field. Agriculture is
applying AI as agriculture robotics, solid and crop monitoring, predictive analysis. AI in
agriculture can be very helpful for farmers.
12. AI in E-commerce
AI is providing a competitive edge to the e-commerce industry, and it is becoming more
demanding in the e-commerce business. AI is helping shoppers to discover associated products
with recommended size, colour, or even brand.
13. AI in education:
AI can automate grading so that the tutor can have more time to teach. AI chatbot can
communicate with students as a teaching assistant.
AI in the future can be work as a personal virtual tutor for students, which will be accessible
easily at any time and any place.

❖ History of Artificial Intelligence


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.
Artificial Intelligence Notes

❖ Maturation of Artificial Intelligence (1943-1952)


• Year 1943: The first work which is now recognized as AI was done by Warren
McCulloch and Walter pits in 1943. They proposed a model of artificial neurons.
• Year 1949: Donald Hebb demonstrated an updating rule for modifying the connection
strength between neurons. His rule is now called Hebbian learning.
• Year 1950: The Alan Turing who was an English mathematician and pioneered
Machine learning in 1950. Alan Turing publishes “Computing Machinery and
Intelligence” in which he proposed a test. The test can check the machine's ability to
exhibit intelligent behaviour equivalent to human intelligence, called a Turing test.

❖ The birth of Artificial Intelligence (1952-1956)


• Year 1955: An Allen Newell and Herbert A. Simon created the "first artificial
intelligence program “Which was named as “Logic Theorist”. This program had
proved 38 of 52 Mathematics theorems, and find new and more elegant proofs for some
theorems.
Artificial Intelligence Notes

• Year 1956: The word "Artificial Intelligence" first adopted by American Computer
scientist John McCarthy at the Dartmouth Conference. For the first time, AI coined as
an academic field.
At that time high-level computer languages such as FORTRAN, LISP, or COBOL were
invented. And the enthusiasm for AI was very high at that time.

❖ The golden years-Early enthusiasm (1956-1974)


• Year 1966: The researchers emphasized developing algorithms which can solve
mathematical problems. Joseph Weizenbaum created the first chatbot in 1966, which
was named as ELIZA.
• Year 1972: The first intelligent humanoid robot was built in Japan which was named
as WABOT-1.

❖ The first AI winter (1974-1980)


• The duration between years 1974 to 1980 was the first AI winter duration. AI winter
refers to the time period where computer scientist dealt with a severe shortage of
funding from government for AI researches.
• During AI winters, an interest of publicity on artificial intelligence was decreased.

❖ A boom of AI (1980-1987)
• Year 1980: After AI winter duration, AI came back with "Expert System". Expert
systems were programmed that emulate the decision-making ability of a human expert.
• In the Year 1980, the first national conference of the American Association of Artificial
Intelligence was held at Stanford University.

❖ The second AI winter (1987-1993)


• The duration between the years 1987 to 1993 was the second AI Winter duration.
• Again, investors and government stopped in funding for AI research as due to high cost
but not efficient result. The expert system such as XCON was very cost effective.

❖ The emergence of intelligent agents (1993-2011)


• Year 1997: In the year 1997, IBM Deep Blue beats world chess champion, Gary
Kasparov, and became the first computer to beat a world chess champion.
Artificial Intelligence Notes

• Year 2002: for the first time, AI entered the home in the form of Roomba, a vacuum
cleaner.
• Year 2006: AI came in the Business world till the year 2006. Companies like Facebook,
Twitter, and Netflix also started using AI.

❖ Deep learning, big data and artificial general intelligence (2011-present)


• Year 2011: In the year 2011, IBM's Watson won jeopardy, a quiz show, where it had
to solve the complex questions as well as riddles. Watson had proved that it could
understand natural language and can solve tricky questions quickly.
• Year 2012: Google has launched an Android app feature “Google now”, which was
able to provide information to the user as a prediction.
• Year 2014: In the year 2014, Chatbot “Eugene Goostman” won a competition in the
infamous "Turing test."
• Year 2018: The “Project Debater” from IBM debated on complex topics with two
master debaters and also performed extremely well.
• Google has demonstrated an AI program “Duplex” which was a virtual assistant and
which had taken hairdresser appointment on call, and lady on other side didn't notice
that she was talking with the machine.
Now AI has developed to a remarkable level. The concept of Deep learning, big data, and data
science are now trending like a boom. Nowadays companies like Google, Facebook, IBM, and
Amazon are working with AI and creating amazing devices. The future of Artificial
Intelligence is inspiring and will come with high intelligence.

❖ Classification of Artificial Intelligence

AI (Artificial Intelligence) can be classified into various categories based on different criteria,
such as capabilities, functionality, and techniques. Here's a comprehensive classification:

1. Classification Based on Capabilities

a. Narrow AI (Weak AI)

• Description: AI systems designed and trained for a specific task. They cannot perform
beyond their programming and have a narrow range of abilities.

• Examples: Siri, Alexa, recommendation systems, and image recognition systems.


Artificial Intelligence Notes

b. General AI (Strong AI)

• Description: Hypothetical AI that has the ability to understand, learn, and apply
knowledge across a wide range of tasks, similar to human intelligence.

• Examples: As of now, General AI does not exist. It represents the goal of creating
machines that can perform any intellectual task a human can do.

c. Super AI

• Description: A theoretical concept of AI that surpasses human intelligence and


capabilities. It would be able to outperform humans in virtually every field, including
creativity, decision-making, and problem-solving.

• Examples: This is a future concept and doesn’t exist currently.

2. Classification Based on Functionality

a. Reactive Machines

• Description: These AI systems can only react to current situations based on pre-
programmed rules. They have no memory or ability to use past experiences to inform
present decisions.

• Examples: IBM’s Deep Blue, a chess-playing AI that defeated Garry Kasparov.

b. Limited Memory

• Description: AI systems that can use past experiences to make decisions. They have a
limited memory and can retain some data from previous interactions.

• Examples: Self-driving cars that observe other vehicles and make decisions based on
their observations.

c. Theory of Mind

• Description: This type of AI can understand emotions, beliefs, and intentions. It can
interact with humans on a more personal level by recognizing emotional states.

• Examples: This is still in the research phase and does not exist as a fully realized
technology.
Artificial Intelligence Notes

d. Self-Aware AI

• Description: AI systems with a sense of self. They are aware of their own existence
and can understand their own states, emotions, and potentially the emotions of others.

• Examples: This is purely theoretical and represents the ultimate goal of AI


development.

❖ Expert Systems

An Expert System in AI is a computer program that simulates the decision-making ability


of a human expert. It uses a set of rules and a knowledge base to analyze information and
provide solutions or recommendations for complex problems. Expert systems are designed
to solve specific problems within a particular domain, such as medical diagnosis, financial
planning, or technical troubleshooting.

Key Components of an Expert System:

• Knowledge Base: A collection of facts, rules, and heuristics about a specific


domain. The knowledge base is the core of an expert system and is typically
developed by extracting knowledge from human experts.

• Inference Engine: The component that applies logical rules to the knowledge base
to derive conclusions or make decisions. It mimics the reasoning process of a human
expert.

• User Interface: The interface through which users interact with the expert system.
It allows users to input data and receive advice, explanations, or recommendations
from the system.

• Explanation System: Provides users with explanations about how the expert
system arrived at a particular conclusion or decision, increasing transparency and
trust in the system.

• Knowledge Acquisition Module: A component or tool that facilitates the process


of gathering and updating the knowledge base, often involving collaboration with
human experts.
Artificial Intelligence Notes

Applications of Expert Systems:

• Medical Diagnosis: Assisting doctors in diagnosing diseases by analyzing symptoms,


medical history, and test results.

• Financial Planning: Helping financial advisors to create investment strategies and


manage portfolios.

• Technical Support: Providing troubleshooting advice for technical issues in various


industries, such as computer systems and telecommunications.

• Legal Advisory: Offering legal advice and assisting in the preparation of legal
documents based on existing laws and regulations.

Expert systems are valuable tools in many fields, offering expert-level decision-making
capabilities in specialized domains, which can enhance productivity, accuracy, and consistency
in problem-solving.

❖ Agents in Artificial Intelligence


In artificial intelligence, an agent is a computer program or system that is designed to perceive
its environment, make decisions and take actions to achieve a specific goal or set of goals. The
agent operates autonomously, meaning it is not directly controlled by a human operator.
Artificial intelligence is defined as the study of rational agents. A rational agent could be
anything that makes decisions, such as a person, firm, machine, or software. It carries out an
action with the best outcome after considering past and current percepts (agent’s perceptual
inputs at a given instance). An AI system is composed of an agent and its environment. The
agents act in their environment. The environment may contain other agents.
An agent is anything that can be viewed as:
• Perceiving its environment through sensors and
• Acting upon that environment through actuators
Artificial Intelligence Notes

Fig. Interaction of Agents with the Environment


Autonomous Agents: An agent that is not under the immediate control of humans
▪ An agent whose behaviour depends completely on built-in knowledge lacks autonomy.
▪ An agent whose behaviour is only determined by its own experience has complete autonomy.
o With no experience, requires too much random activity!

❖ Structure of an AI Agent
To understand the structure of Intelligent Agents, we should be familiar with Architecture and
Agent programs. Architecture is the machinery that the agent executes on. It is a device with
sensors and actuators, for example, a robotic car, a camera, and a PC. An agent program is an
implementation of an agent function. An agent function is a map from the percept sequence
(history of all that an agent has perceived to date) to an action.
Agent = Architecture + Agent Program
There are many examples of agents in artificial intelligence. Here are a few:
• Intelligent personal assistants: These are agents that are designed to help users with
various tasks, such as scheduling appointments, sending messages, and setting
reminders. Examples of intelligent personal assistants include Siri, Alexa, and Google
Assistant.
• Autonomous robots: These are agents that are designed to operate autonomously in
the physical world. They can perform tasks such as cleaning, sorting, and delivering
goods. Examples of autonomous robots include the Roomba vacuum cleaner and the
Amazon delivery robot.
• Gaming agents: These are agents that are designed to play games, either against human
opponents or other agents. Examples of gaming agents include chess-playing agents
and poker-playing agents.
Artificial Intelligence Notes

• Fraud detection agents: These are agents that are designed to detect fraudulent
behaviour in financial transactions. They can analyse patterns of behaviour to identify
suspicious activity and alert authorities. Examples of fraud detection agents include
those used by banks and credit card companies.
• Traffic management agents: These are agents that are designed to manage traffic flow
in cities. They can monitor traffic patterns, adjust traffic lights, and reroute vehicles to
minimize congestion. Examples of traffic management agents include those used in
smart cities around the world.
• A software agent has Keystrokes, file contents, received network packages that act as
sensors and displays on the screen, files, and sent network packets acting as actuators.
• A Human-agent has eyes, ears, and other organs which act as sensors, and hands, legs,
mouth, and other body parts act as actuators.
• A Robotic agent has cameras and infrared range finders which act as sensors and
various motors act as actuators.

Fig. Characteristics of an Agent

❖ Types of Agents
Agents can be grouped into five classes based on their degree of perceived intelligence and
capability:
• Simple Reflex Agents
• Model-Based Reflex Agents
Artificial Intelligence Notes

• Goal-Based Agents
• Utility-Based Agents
• Learning Agent
• Multi-agent systems

1. Simple Reflex Agents


Simple reflex agents ignore the rest of the percept history and act only on the basis of the
current percept. Percept history is the history of all that an agent has perceived to date. The
agent function is based on the condition-action rule. A condition-action rule is a rule that maps
a state i.e., a condition to an action. If the condition is true, then the action is taken, else not.
This agent function only succeeds when the environment is fully observable. For simple reflex
agents operating in partially observable environments, infinite loops are often unavoidable. It
may be possible to escape from infinite loops if the agent can randomize its actions.
Problems with Simple reflex agents are:
• Very limited intelligence.
• No knowledge of non-perceptual parts of the state.
• Usually too big to generate and store.
• If there occurs any change in the environment, then the collection of rules needs to be
updated.

Fig. Simple Reflex Agents

Example: Thermostat, Automatic Door, Obstacle-Avoiding Robot, Light-Sensitive Lamp etc

2. Model-Based Reflex Agents

It works by finding a rule whose condition matches the current situation. A model-based agent
can handle partially observable environments by the use of a model about the world. The agent
has to keep track of the internal state which is adjusted by each percept and that depends on the
Artificial Intelligence Notes

percept history. The current state is stored inside the agent which maintains some kind of
structure describing the part of the world which cannot be seen.

Updating the state requires information about:


• How the world evolves independently from the agent?
• How do the agent’s actions affect the world?

Fig. Model-Based Reflex Agents

Example: Chess-Playing Agent

3. Goal-Based Agents
These kinds of agents take decisions based on how far they are currently from their goal
(description of desirable situations). Their every action is intended to reduce their distance from
the goal. This allows the agent a way to choose among multiple possibilities, selecting the one
which reaches a goal state. The knowledge that supports its decisions is represented explicitly
and can be modified, which makes these agents more flexible. They usually require search and
planning. The goal-based agent’s behavior can easily be changed.

Fig. Model-Based Reflex Agents


Artificial Intelligence Notes

Example: Autonomous Drone Navigation Agent

4. Utility-Based Agents
The agents which are developed having their end uses as building blocks are called utility-
based agents. When there are multiple possible alternatives, then to decide which one is best,
utility-based agents are used. They choose actions based on a preference (utility) for each state.
Sometimes achieving the desired goal is not enough. We may look for a quicker, safer, cheaper
trip to reach a destination. Agent happiness should be taken into consideration. Utility describes
how “happy” the agent is. Because of the uncertainty in the world, a utility agent chooses the
action that maximizes the expected utility. A utility function maps a state onto a real number
which describes the associated degree of happiness.

Fig. Utility-Based Agents

Example: Personal Assistant Agent (e.g., Siri, Alexa)

5. Learning Agent
A learning agent in AI is the type of agent that can learn from its past experiences or it has
learning capabilities. It starts to act with basic knowledge and then is able to act and adapt
automatically through learning. A learning agent has mainly four conceptual components,
which are:
a) Learning element: It is responsible for making improvements by learning from the
environment.
b) Critic: The learning element takes feedback from critics which describes how well the
agent is doing with respect to a fixed performance standard.
c) Performance element: It is responsible for selecting external action.
Artificial Intelligence Notes

d) Problem Generator: This component is responsible for suggesting actions that will lead
to new and informative experiences.

wFig. Learning Agent

Example: Image Classification System, Autonomous Vehicle Navigation, Speech Recognition


System etc

6. Multi-Agent Systems

These agents interact with other agents to achieve a common goal. They may have to coordinate
their actions and communicate with each other to achieve their objective.

A multi-agent system (MAS) is a system composed of multiple interacting agents that are
designed to work together to achieve a common goal. These agents may be autonomous or
semi-autonomous and are capable of perceiving their environment, making decisions, and
taking action to achieve the common objective and can help to solve complex problems.

MAS can be used in a variety of applications, including transportation systems, robotics, and
social networks. They can help improve efficiency, reduce costs, and increase flexibility in
complex systems. MAS can be classified into different types based on their characteristics,
such as whether the agents have the same or different goals, whether the agents are cooperative
or competitive, and whether the agents are homogeneous or heterogeneous.

In a homogeneous MAS, all the agents have the same capabilities, goals, and behaviours. This
can make coordination more challenging but can also lead to more flexible and robust systems.

Cooperative MAS involves agents working together to achieve a common goal, while
competitive MAS involves agents working against each other to achieve their own goals. In
some cases, MAS can also involve both cooperative and competitive behaviour, where agents
must balance their own interests with the interests of the group.
Artificial Intelligence Notes

MAS can be implemented using different techniques, such as game theory, machine learning,
and agent-based modelling. Game theory is used to analyse strategic interactions between
agents and predict their behaviour. Machine learning is used to train agents to improve their
decision-making capabilities over time. Agent-based modelling is used to simulate complex
systems and study the interactions between agents.

Example: Traffic Management System, Autonomous Drones for Delivery, Stock Trading
System, Collaborative Robotics (Cobots), Smart Grid Energy Management etc.

❖ Problem Solving Agents


A goal-based agent whose goal is to solve a particular problem
✓ Define problem
✓ Identify solution states - Goal
✓ Task: Find sequence of actions that will allow the agent to go from current state to goal
state - Search
✓ Execute action sequence that the search returns as solution

❖ Well-defined Problems
A problem can be defined formally by four components:
▪ The that the agent starts in.
▪ A description of the possible available to the agent.
– Commonly done using a Successor function. Given a particular state x,
SUCCESSOR-FN(x) returns a set of (action_successor) ordered pairs.
– The initial state and success or function implicitly define the state space of the
problem - the set of all states reachable from the initial state.
▪ The determines whether a given state is a goal state.
– Explicit set of possible goal states or specified by an abstract property
▪ A function that assigns a numeric cost to each path.
– Agent chooses a cost function that reflect sits own performance measure
– Agent attempts to minimize the cost function

❖ Problem Formulation
A to a problem is a path from the initial state to a goal state.
• Solution quality is measured by the path cost.
Artificial Intelligence Notes

• An has the lowest path cost among all solutions.


• Abstraction: process of removing detail from representation.

❖ Search Space Definitions


State
– A description of all possible state of the world.
– Includes all features of the world that are pertinent to the problem.

Initial State
– Description of all pertinent aspects of the state in which the agent starts the search.

Goal Test
– Conditions the agent is trying to meet.

Goal State
– Any state which meets the goal condition.

Problem Formulation
– Describe a general problem as a search problem.

Solution
– Sequence of actions that transitions the world from the initial state to a goal state.

Solution cost (additive)


– Sum of the cost of operators
– Alternative: sum of distances, number of steps,etc.

Search
– Process of looking for a solution.
– Search algorithm takes problem as input and returns solution
– We are searching through a space of possible states

Execution
– Process of executing sequence of actions (solution)
Artificial Intelligence Notes

❖ Examples
Artificial Intelligence Notes

❖ Searching for Solutions


The problem thus defined can be solved by searching the state space.
• Search for goal states in a search tree generated from the initial state using the successor
function.
• Search strategy: Choice (!) of which action to be taken up in order to continue search
for the goal state
– Or, which node to expand next in the collection of nodes that have been
generated (fringe)
Artificial Intelligence Notes

• Information in search node: state; parent node; action; path-cost; depth.


• Branching factor: Maximum number of successor nodes on any node.
• Effectiveness of search can be determined by:
– Search cost: Time taken to reach the goal state
– Total cost

❖ Searching for Solutions: Visualization


• States are nodes.
• Actions are edges.
• Initial state is root
• Solution is path from root to goal node
• Edges sometimes have associated costs
• States resulting from operator are children

❖ Uniformed search strategy


Uninformed search is a class of general-purpose search algorithms which operates in brute
force-way. Uninformed search algorithms do not have additional information about state or
search space other than how to traverse the tree, so it is also called blind search.
Following are the various types of uninformed search algorithms:
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:
• 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.
• 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.
• The breadth-first search algorithm is an example of a general-graph search algorithm.
• Breadth-first search implemented using FIFO queue data structure.
Artificial Intelligence Notes

Advantages:
• BFS will provide a solution if any solution exists.
• If there are more than one solution for a given problem, then BFS will provide the
minimal solution which requires the least number of steps.
Disadvantages:
• It requires lots of memory since each level of the tree must be saved into memory to
expand the next level.
• 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
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.
T (b) = 1 + b2 + b3 + ....... + bd= O (bd)
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.
Artificial Intelligence Notes

More Examples:
Problem 1 Solution

Path Traversed = [A – B – C- D – E – F- G – H]

Problem 2 Solution
Path Traversed = [S - A – B – C- D – G – H - E – F-
I-K]

2. Depth-first Search
• Depth-first search is a recursive algorithm for traversing a tree or graph data structure.
• 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.
• DFS uses a stack data structure for its implementation.
• The process of the DFS algorithm is similar to the BFS algorithm.
Advantage:
• 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.
Artificial Intelligence Notes

• It takes less time to reach to the goal node than BFS algorithm (if it traverses in the
right path).
Disadvantage:
• There is the possibility that many states keep re-occurring, and there is no guarantee of
finding the solution.
• 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:
Root node--->Left node ----> right node.
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:
T(n)= 1+ n2+ n3 +.........+ nm=O(nm)
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
space complexity of DFS is equivalent to the size of the fringe set, which is O(bm).
Artificial Intelligence Notes

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.

Example:
Problem 1: Solution

Path Traversed = [A - B – D – G - E – C – F - H]

Problem 2: Solution

Path Traversed = [A - B – D – G - E – C – F - H]

3. Depth-Limited Search Algorithm:


A depth-limited search algorithm is similar to depth-first search with a predetermined limit.
Depth-limited search can solve the drawback of the infinite path in the Depth-first search. In
this algorithm, the node at the depth limit will treat as it has no successor nodes further.
Depth-limited search can be terminated with two conditions of failure:
• Standard failure value: It indicates that problem does not have any solution.
• Cutoff failure value: It defines no solution for the problem within a given depth limit.
Artificial Intelligence Notes

Advantages:
Depth-limited search is Memory efficient.

Disadvantages:
o Depth-limited search also has a disadvantage of incompleteness.
o It may not be optimal if the problem has more than one solution.

Example:

Completeness: DLS search algorithm is complete if the solution is above the depth-limit.
Time Complexity: Time complexity of DLS algorithm is O(bℓ).
Space Complexity: Space complexity of DLS algorithm is O(b×ℓ).
Optimal: Depth-limited search can be viewed as a special case of DFS, and it is also not
optimal even if ℓ>d.

Problem Solution

For depth (d) =2;


Path Traversed = [X - A – C – D - B – I – J]
Artificial Intelligence Notes

4. Uniform-cost Search Algorithm:


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:
• Uniform cost search is optimal because at every state the path with the least cost is
chosen.
Disadvantages:
• 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*/ε.
Hence, the worst-case time complexity of Uniform-cost search is O (b1 + [C*/ε]).
Artificial Intelligence Notes

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.

Problem 1 Solution

For G is the goal node.


Path Traversed = [A – C – B - E – G]
Total cost =12

For H is the goal node.


Path Traversed = [A – C – B - E – G -
E – F – E – D – H]
Total cost =12
Steps in Uniform Cost Search Algorithm
This algorithm assumes that all the operators have a cost.
1. Initialize: Set OPEN = {s}
CLOSED = {}, set C(s) = 0.
2. Fail: If OPEN = {}, Terminate and fail
3. Select: Select the minimum cost state n from OPEN and save n
to CLOSED
4. Terminate: If 𝑛 𝜖 𝐺, terminate with success.
5. Expand: Generate the successors of 𝑛 using 𝑂.
For each successor of 𝑚;
If 𝑚 𝜖 [𝑂𝑃𝐸𝑁 ∪ 𝐶𝐿𝑆𝑂𝐸𝐷]
Set 𝐶(𝑚) = 𝐶(𝑛) + 𝐶(𝑛, 𝑚) and
insert 𝑚 in OPEN
If 𝑚 𝜖 [𝑂𝑃𝐸𝑁 ∪ 𝐶𝐿𝑆𝑂𝐸𝐷]
Set 𝐶(𝑚) = min {𝐶(𝑚), 𝐶(𝑛) + 𝐶(𝑛, 𝑚)}
If 𝐶(𝑚) has decreased and
𝑚 𝜖 𝐶𝐿𝑂𝑆𝐸𝐷, 𝑚𝑜𝑣𝑒 𝑖𝑡 𝑡𝑜 𝑂𝑃𝐸𝑁
6. Goto Step 2.
Artificial Intelligence Notes

5. Iterative deepening depth-first Search:


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. Generally, this is the preferred
uninformed search method when there is a large search space and the depth of the solution is
not known.
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:
• It combines the benefits of BFS and DFS search algorithm in terms of fast search and
memory efficiency.
Disadvantages:
• 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
Artificial Intelligence Notes

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.

Completeness:
This algorithm is complete is if the branching factor is finite.
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:
The space complexity of IDDFS will be O(bd).
Optimal:
IDDFS algorithm is optimal if path cost is a non- decreasing function of the depth of the node.
Problem Solution

Starting node S, Goal Node G


Using DFS
1 Iteration, d = 0, [S] – starting node
st

2nd Iteration, d = 1, [S – A - C]
3rd Iteration, d = 2, [S – A – D – B – C – E - G]

Performs a depth-limited search by gradually increasing the depth_limit until the goal at the
shallowest depth is found. Usi
1. Perform Depth limited search for depth_limit = 0
2. If solution is found exit, else go to 3
3. Increase depth_limit by 1
4. Go back to 1

6. Bidirectional Search Algorithm:


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
Artificial Intelligence Notes

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:
• Bidirectional search is fast.
• Bidirectional search requires less memory
Disadvantages:
• Implementation of the bidirectional search tree is difficult.
• In bidirectional search, one should know the goal state in advance.

Steps in Bidirectional search


1. Run two simultaneous searches
– one forward from the initial state
– the other backward from the goal
2. Stop when the two searches meet
– check each node before it is expanded to see if it is in the fringe of the other
search tree
3. Searching backwards is not so easy
– 𝑃𝑟𝑒𝑑𝑒𝑐𝑒𝑠𝑠𝑜𝑟(𝑥) function that computes all states that have 𝑥 as a successor.
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.
The algorithm terminates at node 9 where two searches meet.
Artificial Intelligence Notes

Completeness: Bidirectional Search is complete if we use BFS in both searches.


Time Complexity: Time complexity of bidirectional search using BFS is O(bd).
Space Complexity: Space complexity of bidirectional search is O(bd).
Optimal: Bidirectional search is Optimal.

Problem 1 Solution

For G is the goal node.


Path Traversed =
[A – B – C - D – F – E - G]
Total cost =12

Problem 2

Solution

For G is the goal node.

Path Traversed = [A – B – D – C – E – F – H – J – L – I – Y – K - G]

[A – B – C - D – F – E - G]

Total cost =12

You might also like