FAI Module - 1
FAI Module - 1
What is AI?
1. Intelligence
2. artificial device
What is intelligence?
Given this scenario different interpretations have been used by different researchers as
defining the scope and view of Artificial Intelligence.
1
FAI Module - 1
1. One view is that artificial intelligence is about designing systems that are as
intelligent as humans.
This view involves trying to understand human thought and an effort to build
machines that emulate the human thought process. This view is the cognitive
science approach to AI.
2
FAI Module - 1
2. The second approach is best embodied by the concept of the Turing Test.
Turing held that in future computers can be programmed to acquire abilities
rivaling human intelligence. As part of his argument Turing put forward the idea
of an 'imitation game', in which a human being and a computer would be
interrogated under conditions where the interrogator would not know which was
which, the communication being entirely by textual messages. Turing argued that
if the interrogator could not distinguish them by questioning, then it would be
unreasonable not to call the computer intelligent. Turing's 'imitation game' is now
usually called 'the Turing test' for intelligence.
3
FAI Module - 1
Turing Test
Consider the following setting. There are two rooms, A and B. One of the rooms contains
a computer. The other contains a human. The interrogator is outside and does not know
which one is a computer. He can ask questions through a teletype and receives answers
from both A and B. The interrogator needs to identify whether A or B are humans. To
pass the Turing test, the machine has to fool the interrogator into believing that it is
human. For more details on the Turing test visit the site
http://cogsci.ucsd.edu/~asaygin/tt/ttest.html
3. Logic and laws of thought deals with studies of ideal or rational thought process and
inference. The emphasis in this case is on the inferencing mechanism, and its
properties. That is how the system arrives at a conclusion, or the reasoning behind its
selection of actions is very important in this point of view. The soundness and
completeness of the inference mechanisms are important here.
4. The fourth view of AI is that it is the study of rational agents. This view deals with
building machines that act rationally. The focus is on how the system acts and
performs, and not so much on the reasoning process. A rational agent is one that acts
rationally, that is, is in the best possible manner.
5
FAI Module - 1
processing heterogeneous lists -- typically a list of symbols. Features of LISP are run-
time type checking, higher order functions (functions that have other functions as
parameters), automatic memory management (garbage collection) and an interactive
environment.
– The second language strongly associated with AI is PROLOG.
PROLOG was developed in the 1970s. PROLOG is based on first order
logic. PROLOG is declarative in nature and has facilities for explicitly
limiting the search space.
– Object-oriented languages are a class of languages more recently
used for AI programming. Important features of object-oriented languages
include: concepts of objects and messages, objects bundle data and
methods for manipulating the data, sender specifies what is to be done
receiver decides how to do it, inheritance (object hierarchy where objects
inherit the attributes of the more general class of objects). Examples of
object-oriented languages are Smalltalk, Objective C, C++. Object
oriented extensions to LISP (CLOS - Common LISP Object System) and
PROLOG (L&O - Logic & Objects) are also used.
Artificial Intelligence is a new electronic machine that stores large amount of
information and process it at very high speed
The computer is interrogated by a human via a teletype It passes if the human
cannot tell if there is a computer or human at the other end
The ability to solve problems
It is the science and engineering of making intelligent machines, especially
intelligent computer programs. It is related to the similar task of using computers
to understand human intelligence
Typical AI problems
While studying the typical range of tasks that we might expect an “intelligent entity” to
perform, we need to consider both “common-place” tasks as well as expert tasks.
Examples of common-place tasks include
These tasks are done matter of factly and routinely by people and some other animals.
These tasks cannot be done by all people, and can only be performed by skilled
specialists.
Now, which of these tasks are easy and which ones are hard? Clearly tasks of the first
type are easy for humans to perform, and almost all are able to master them. The second
range of tasks requires skill development and/or intelligence and only some specialists
can perform them well. However, when we look at what computer systems have been
able to achieve to date, we see that their achievements include performing sophisticated
tasks like medical diagnosis, performing symbolic integration, proving theorems and
playing chess.
On the other hand it has proved to be very hard to make computer systems perform many
routine tasks that all humans and a lot of animals can do. Examples of such tasks include
navigating our way without running into things, catching prey and avoiding predators.
Humans and animals are also capable of interpreting complex sensory information. We
are able to recognize objects and people from the visual image that we receive. We are
also able to perform complex social functions.
Intelligent behaviour
This discussion brings us back to the question of what constitutes intelligent behaviour.
Some of these tasks and applications are:
▪ Perception involving image recognition and computer vision
▪ Reasoning
▪ Learning
▪ Understanding language involving natural language processing, speech processing
▪ Solving problems
▪ Robotics
Practical Impact of AI
AI components are embedded in numerous devices e.g. in copy machines for automatic
correction of operation for copy quality improvement. AI systems are in everyday use for
identifying credit card fraud, for advising doctors, for recognizing speech and in helping
complex planning tasks. Then there are intelligent tutoring systems that provide students
with personalized attention
7
FAI Module - 1
Thus AI has increased understanding of the nature of intelligence and found many
applications. It has helped in the understanding of human reasoning, and of the nature of
intelligence. It has also helped us understand the complexity of modeling human reasoning.
Approaches to AI
Strong AI aims to build machines that can truly reason and solve problems. These machines
should be self aware and their overall intellectual ability needs to be indistinguishable from
that of a human being. Excessive optimism in the 1950s and 1960s concerning strong AI
has given way to an appreciation of the extreme difficulty of the problem. Strong AI
maintains that suitably programmed machines are capable of cognitive mental states.
Weak AI: deals with the creation of some form of computer-based artificial intelligence that
cannot truly reason and solve problems, but can act as if it were intelligent. Weak AI holds
that suitably programmed machines can simulate human cognition.
Applied AI: aims to produce commercially viable "smart" systems such as, for example, a
security system that is able to recognise the faces of people who are permitted to enter a
particular building. Applied AI has already enjoyed considerable success.
Cognitive AI: computers are used to test theories about how the human mind works--for
example, theories about how we recognise faces and other objects, or about how we solve
abstract problems.
Goals of AI
▪ Thinking rationally
▪ Acting rationally
▪ Thinking like a human
▪ Acting like a human
8
FAI Module - 1
• No Original Creativity
HISTORY OF AI
“Artificial Intelligence (AI) is the part of computer science concerned with
designing intelligent computer systems, that is, systems that exhibit characteristics
we associate with intelligence in human behaviour – understanding language,
learning, reasoning, solving problems, and so on.”
Scientific Goal To determine which ideas about knowledge representation,
learning, rule systems, search, and so on, explain various sorts of real intelligence.
Engineering Goal To solve real world problems using AI techniques such as
knowledge representation, learning, rule systems, search, and so on.
Traditionally, computer scientists and engineers have been more interested in the
engineering goal, while psychologists, philosophers and cognitive scientists have
been more interested in the scientific goal.
The Roots - Artificial Intelligence has identifiable roots in a number of older
disciplines, particularly:
✓ Philosophy
✓ Logic/Mathematics
✓ Computation
✓ Psychology/Cognitive Science
✓ Biology/Neuroscience
✓ Evolution
There is inevitably much overlap, e.g. between philosophy and logic, or between
mathematics and computation. By looking at each of these in turn, we can gain a
better understanding of their role in AI, and how these underlying disciplines have
developed to play that role.
Philosophy
✓ ~400 BC Socrates asks for an algorithm to distinguish piety from non-piety.
✓ ~350 BC Aristotle formulated different styles of deductive reasoning, which
9
FAI Module - 1
✓ 1596 – 1650 Rene Descartes idea of mind-body dualism – part of the mind is
exempt from physical laws.
✓ 1646 – 1716 Wilhelm Leibnitz was one of the first to take the materialist
position which holds that the mind operates by ordinary physical processes –
this has the implication that mental processes can potentially be carried out by
machines.
Logic/Mathematics
✓ Earl Stanhope’s Logic Demonstrator was a machine that was able to solve
syllogisms, numerical problems in a logical form, and elementary questions of
probability.
✓ 1815 – 1864 George Boole introduced his formal language for making logical
inference in 1847 – Boolean algebra.
✓ 1848 – 1925 Gottlob Frege produced a logic that is essentially the first-order
logic that today forms the most basic knowledge representation system.
✓ 1906 – 1978 Kurt Gödel showed in 1931 that there are limits to what logic can
do. His Incompleteness Theorem showed that in any formal logic powerful
enough to describe the properties of natural numbers, there are true statements
whose truth cannot be established by any algorithm.
✓ 1995 Roger Penrose tries to prove the human mind has non-computable
capabilities.
Computation
✓ 1869 William Jevon’s Logic Machine could handle Boolean Algebra and Venn
Diagrams, and was able to solve logical problems faster than human beings.
✓ 1912 – 1954 Alan Turing tried to characterise exactly which functions are
capable of being computed. Unfortunately it is difficult to give the notion of
10
FAI Module - 1
✓ Our brains (which give rise to our intelligence) are made up of tens of billions
of neurons, each connected to hundreds or thousands of other neurons.
✓ Each neuron is a simple processing device (e.g. just firing or not firing
depending on the total amount of activity feeding into it). However, large
networks of neurons are extremely powerful computational devices that can
11
FAI Module - 1
13
FAI Module - 1
Current Status of AI
▪ Ethical AI
Some reputed companies such as Google, Microsoft, Apple, Facebook and other tech giants
are building ethical AI to follow an ethical framework with four essential principles for
effective data governance— fairness, accountability, transparency well to explainability. This
is currently the most popular Artificial Intelligence trend in 2021 for providing the inside look
into its own system to stakeholders. These companies are initiating multiple programmes and
research to encourage other companies to adopt ethical AI with personalised strategies as per
the requirements of a business.
▪ Explainable AI
Explainable AI is a part of ethical AI that provides a complete explanation of how the
Artificial Intelligence models and machine learning algorithms are working inside to generate
the appropriate meaningful business insights and predict the future. Companies leveraging
disruptive technologies are required to maintain transparency to stakeholders with a full
explanation. But it is creating controversy because companies do not want to disclose all their
steps and processes to the public for patent purposes in a cut-throat competitive market.
▪ Predictive Analytics
Predictive analytics enables all kinds of businesses to identify the trends of consumers for a
better understanding of consumer behaviour in the current scenario. It predicts all potential
responses from the target audience by employing personalised data that are collected for a
long time. The advancement in Artificial Intelligence and machine learning algorithms are
providing more accurate predictions and insights to maintain better customer engagement and
gain higher ROI from the global market.
▪ Emotional AI
Emotional AI, is one of the most popular Artificial Intelligence trends in 2021because this
technology can sense, learn and interact with multiple human emotions. It is also known as
affective computing that enhances human-robot communication to a whole new level.
14
FAI Module - 1
15
FAI Module - 1
▪ AI with AR and VR
Augmented Reality and Virtual reality are already providing immersive experiences to
consumers as well as industries all around the world in these recent years. The combination of
these three disruptive technologies- Artificial Intelligence, Augmented Reality and Virtual
Reality has the potential to revolutionise the world with its amazing functionalities. The trio
has already started to transform the relationship between customers and companies by
providing extra personalisation and customisation of products and services to meet the needs
and wants of each customer.
▪ AI in Cybersecurity
The data-driven world has created a data explosion in these recent years that is difficult for
organisations to protect the sets from malicious hackers. The integration of Artificial
Intelligence in cybersecurity has created more advanced and powerful defence against
harmful cyberattacks like phishing, ransomware, virus and so on. AI can instantly detect any
unusual activity in the existing systems and alert the employees as soon as possible. It is
making it more difficult for hackers and frauds to enter any system. Artificial Intelligence
enhances cybersecurity through intelligent code analysis and configuration analysis with
activity monitoring.
▪ AI in IoT
Artificial Intelligence, has a tremendous scope in IoT (Internet of Things) with the help of 5G
network. The implementation of Artificial Intelligence into IoT can help smart devices such as
wearable devices, virtual assistance, refrigerators, etc. to analyse data and make smart
decisions efficiently based on the collected data without any human intervention. It is used to
optimise a system and enhance performance to meet the needs and wants of the target
audience.
16
FAI Module - 1
Scope of AI
• Machine Learning
• Expert Systems
• Computer Vision
• Robotics
Though the lines between each of these five disciplines has started to blur as we’ve made
progress towards AGI, this framework serves as a helpful starting point for understanding AI.
In this second section, we’ll offer examples and recent trends across each of these five
disciplines.
Machine Learning
Machine learning (ML) is the science of empowering machines to make decisions without
human intervention. This sub-discipline forms the backbone of AI, enabling computers to learn
and interpret patterns in images, sounds, and structured data using multidimensional arrays.
• Supervised learning: Given an array of features (i.e., week of the year, price, etc.) and a
17
FAI Module - 1
labeled output variable (e.g., sales), predict the best possible estimate of the label variable
18
FAI Module - 1
code, etc.), expose and visualize hidden relationships and anomalies within the array.
output variable, predict the best possible estimates for the missing label variables.
• Reinforcement learning: Given some objective, train an artificial agent to maximize its
Expert Systems
complicated decision tree or nested if-then logic: if x, y, and w happen, we instruct the
computer to do z. Though expert systems don’t enjoy the same hype as machine learning, there
• An expert system can take advantage of human insights discovered through trial and error
• Expert systems are more predictable and are less likely to make extreme errors when
• Expert systems have historically been faster and easier to implement, though ML has
19
FAI Module - 1
Computer Vision
Computer vision (CV) is the automatic extraction, analysis, and interpretation of images or
videos. CV converts photos and videos into numerical arrays, enabling ML algorithms to draw
inferences, make predictions, and even generate new images based on user-defined inputs.
Natural language processing (NLP) is the automatic extraction, analysis, and generation of
human language. NLP algorithms parse sentences in various ways (e.g., splitting by word,
splitting by letter, reading both left-to-right and right-to-left, etc.) to automatically draw
inferences about the writer’s meaning and intent. NLP’s various use cases include:
• Part-of-speech tagging
• Machine translation
Siri and Alexa are great examples of NLP in action: by listening for “wake words”, these tools
allow you to play music, search the Web, create to-do lists, and control popular smart-home
20
FAI Module - 1
products — all while your smart phone stays in your pocket. These virtual assistants will
continue to improve over time as they gather data from existing users, unlocking new use cases
Robotics
Robotics is the science of designing, constructing, operating, and applying robots to solve
human problems. Robots come in thousands of shapes and sizes, making it difficult to nail
down the precise meaning of the term. Joseph Engelberger, a pioneer in industrial robotics,
said it best:
• Boston Dynamics, an early innovator in the humanoid robotics space, continues to inch
• DJI has focused on consumer-grade drones, making it easier than ever for the average
• Amazon Robotics lies at the core of Amazon’s logistics strategy, saving the retail
Most robots rely on expert systems to accomplish their objective, but the robots of tomorrow
will become exponentially more useful by incorporating machine learning, computer vision,
21
FAI Module - 1
AGENTS
• An agent is anything that can be viewed as perceiving its environment
through sensors and SENSOR acting upon that environment through
actuators. This simple idea is illustrated in Figure.
• A human agent has eyes, ears, and other organs for sensors and hands,
legs, mouth, and other body parts for actuators.
• A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators.
• A software agent receives keystrokes, file contents, and network packets
as sensory inputs and acts on the environment by displaying on the
screen, writing files, and sending network packets.
22
FAI Module - 1
• Percept
We use the term percept to refer to the agent's perceptual inputs at any given instant.
• Percept Sequence
An agent's percept sequence is the complete history of everything the agent has ever
perceived.
• Agent function
Mathematically speaking, we say that an agent's behavior is described by the agent
• Function
that maps any given percept
sequence to an action.
f : P*-> A
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:
o The Simple reflex agents are the simplest agents. These agents take decisions on
the basis of the current percepts and ignore the rest of the percept history.
o These agents only succeed in the fully observable environment.
23
FAI Module - 1
o The Simple reflex agent does not consider any part of percepts history during their
decision and action process.
o The Simple reflex agent works on Condition-action rule, which means it maps the
current state to action. Such as a Room Cleaner agent, it works only if there is dirt
in the room.
o Problems for the simple reflex agent design approach:
o They have very limited intelligence
o They do not have knowledge of non-perceptual parts of the current state
o Mostly too big to generate and to store.
o Not adaptive to changes in the environment.
o The Model-based agent can work in a partially observable environment, and track
the situation.
o A model-based agent has two important factors:
o Model: It is knowledge about "how things happen in the world," so it is
called a Model-based agent.
o Internal State: It is a representation of the current state based on
percept history.
24
FAI Module - 1
o These agents have the model, "which is knowledge of the world" and based on
the model they perform actions.
o Updating the agent state requires information about:
a. How the world evolves
b. How the agent's action affects the world.
3. Goal-based agents
25
FAI Module - 1
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.
26
FAI Module - 1
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:
a. Learning element: It is responsible for making improvements by learning from
environment
b. Critic: Learning element takes feedback from critic which describes that how
well the agent is doing with respect to a fixed performance standard.
c. Performance element: It is responsible for selecting external action
d. Problem generator: This component is responsible for suggesting actions that
will lead to new and informative experiences.
Hence, learning agents are able to learn, analyze performance, and look for new
ways to improve the performance.
27
FAI Module - 1
Environments
An environment in artificial intelligence is the surrounding of the agent. The agent takes
input from the environment through sensors and delivers the output to the environment
through actuators. There are several types of environments:
• When an agent sensor is capable to sense or access the complete state of an agent at each
point in time, it is said to be a fully observable environment else it is partially observable.
• Maintaining a fully observable environment is easy as there is no need to keep track of
the history of the surrounding.
• An environment is called unobservable when the agent has no sensors in all
environments.
• Example:
• Chess – the board is fully observable, so are the opponent’s moves
• Driving – the environment is partially observable because what’s around the
corner is not know.
2. Deterministic vs Stochastic
• When a uniqueness in the agent’s current state completely determines the next state of the
agent, the environment is said to be deterministic.
• The stochastic environment is random in nature which is not unique and cannot be
completely determined by the agent.
• Example:
Chess – there would be only a few possible moves for a coin at the current state and these
moves can be determined
Self Driving Cars – the actions of a self-driving car are not unique, it varies time to time
3. Competitive vs Collaborative
28
FAI Module - 1
4. Single-agent vs Multi-agent
• An environment consisting of only one agent is said to be a single-agent environment.
• A person left alone in a maze is an example of the single-agent system.
• An environment involving more than one agent is a multi-agent environment.
• The game of football is multi-agent as it involves 11 players in each team.
5. Dynamic vs Static
• An environment that keeps constantly changing itself when the agent is up with some
action is said to be dynamic.
• A roller coaster ride is dynamic as it is set in motion and the environment keeps changing
every instant.
• An idle environment with no change in its state is called a static environment.
• An empty house is static as there’s no change in the surroundings when an agent enters.
6. Discrete vs Continuous
• If an environment consists of a finite number of actions that can be deliberated in the
environment to obtain the output, it is said to be a discrete environment.
• The game of chess is discrete as it has only a finite number of moves. The number of
moves might vary with every game, but still, it’s finite.
• The environment in which the actions performed cannot be numbered ie. is not discrete, is
said to be continuous.
• Self-driving cars are an example of continuous environments as their actions are driving,
parking, etc. which cannot be numbered.
Problem Formulation
Every problem should be properly formulated in artificial intelligence. Problem formulation is very
important before applying any search algorithm. Every algorithm demands problem is specific form.
Before problem formulation it is very important to know components of problem.
• Problem Statement
• Definition
• Limitation or Constraints or Restrictions
• Problem Solution
• Solution Space
• Operators
Definition of Problem
The information about what is to be done? Why it is important to build AI system? What will be the
advantages of proposed system? For example “I want to predict the price of house using AI
system”.
Problem Limitation
There always some limitations while solving problems. All these limitations or constraints must be
fulfill while creating system. For example “I have only few features, some records are missing.
System must be 90% accurate otherwise will be useless”.
Goal or Solution
What is expected from system? The Goal state or final state or the solution of problem is defined here.
This will help us to proposed appropriate solution for problem. For example “we can use some
machine learning technique to solve this problem”.
Solution Space
Problem can be solve in many ways. Some solution will be efficient than others. Some will consume
less resources, some will be simple etc. There are always alternatives exists. Many possible ways with
which we can solve problem is known as Solution Space. For example “price of house can be predict
using many machine learning algorithms”.
Operators
Operators are the actions taken during solving problem. Complete problem is solved using tiny steps or
actions and all these consecutive actions leads to solution of 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
• Problem Statement
• Problem Definition: You have to measure 4 liter (L) water by using three buckets 8L, 5L and 3L.
• Problem Limitation: You can only use these (8L, 5L and 3L) buckets
• Problem Solution: Measure exactly 4L water
• Solution Space: There are multiple ways doing this.
• Operators: Possible actions are fill water in any bucket and remove water from any bucket.
31
FAI Module - 1
Problem solving components discussed above are applicable to any problem. For AI system
implementation, problem must be well defined. A well-defined problem must have five components:-
1. Vacuum World
• States: Agent can be location A or B, hence 2 possibilities. Dirt can be in none, one or both location, and
hence 4 possibilities. Thus, there are total 2 × 22 = 8 possible world states. For environment with n locations
has (n * 2n) states.
• Initial state: Any state can be designated as the initial state.
• Actions
• Move Left
• Move Right
• And Suck or Clean
• Transition model: This is a function which define transition from one state to another. Consider state 1 in
following diagram is initial state. There 3 actions possible
• If it move LEFT (L) then it will remain in same state
32
FAI Module - 1
• States: A state description specifies the location of each of the eight tiles and the blank in one of the nine
squares.
• Initial state: Any random shuffled state can be designated as initial state
• Actions:
• Slide Left
• or Slide Right
• or Slide Up
• And Slide Down
• Transition model: Given a state and action, this returns the resulting state
• Goal test: This checks whether the state matches the goal
• Path cost: Each step costs 1
33
FAI Module - 1
What is Tree?
A tree is a non-linear data structure that represents the hierarchy. A tree is a collection of nodes that are
linked together to form a hierarchy.
o Root node: The topmost node in a tree data structure is known as a root node. A root node is a node that
does not have any parent.
o Parent of a node: The immediate predecessor of a node is known as a parent of a node. Here
predecessor means the previous node of that particular node.
o Child of a node: The immediate successor of a node is known as a child of a node.
o Leaf node: The leaf node is a node that does not have any child node. It is also known as an external
node.
o Non-leaf node: The non-leaf node is a node that has atleast one child node. It is also known as
an internal node.
o Path: It is a sequence of the consecutive edges from a source node to the destination node. Here edge is
a link between two nodes.
o Ancestor: The predecessor nodes that occur in the path from the root to that node is known as an
ancestor.
o Descendant: The successor nodes that exist in the path from that node to the leaf node.
o Sibling: All the children that have the same parent node are known as siblings.
o Degree: The number of children of a particular node is known as a degree.
o Depth of node: The length of the path from the root to that node is known as a depth of a node.
34
FAI Module - 1
o Height of a node: The number of edges that occur in the longest path from that node to the leaf node is
known as the height of a node.
o Level of node: The number of edges that exist from the root node to the given node is known as a level
of a node.
In the above figure, we can assume the company hierarchy where A represents the CEO of the
company, B, C and D represent the managers of the company, E and F represent the team leaders, and
G and H represent the team members. This type of structure has more than one level, so it is known as
a non-linear data structure.
35
FAI Module - 1
What is a Graph?
A graph is like a tree data structure is a collection of objects or entities known as nodes that are
connected to each other through a set of edges. A tree follows some rule that determines the
relationship between the nodes, whereas graph does not follow any rule that defines the relationship
among the nodes. A graph contains a set of edges and nodes, and edges can connect the nodes in any
possible way.
Mathematically, it can be defined as an ordered pair of a set of vertices, and a set of nodes where
vertices are represented by 'V' and edges are represented by 'E'.
G= (V , E)
Here we are referring to an ordered pair because the first object must be the set of vertices, and the
second object must be a set of edges.
In Graph, each node has a different name or index to uniquely identify each node in the graph. The
graph shown below has eight vertices named as v1, v2, v3, v4, v5, v6, v7, and v8. There is no first
node, a second node, a third node and so on. There is no ordering of the nodes. Now, we will see how
can we represent the edges in a graph?. An edge can be represented by the two endpoints in the graph.
We can write the name of the two endpoints as a pair, that represents the edge in a graph.
o Directed edge: The directed edge represents one endpoint as an origin and another point as a
destination. The directed edge is one-way. For example, there are two vertices U and V; then directed
edge would represent the link or path from U to V, but no path exists from V to U. If we want to create a
path from V to U, then we need to have one more directed edge from V to U.
The directed edge can be represented as an ordered pair in which the first element is the origin, whereas
the second element is the destination.
o Undirected edge: The undirected edge is two-way means that there is no origin and destination. For
example, there are two vertices U and V, then undirected would represent two paths, i.e., from U to V as
well as from V to U. An undirected edge can be represented as an unordered pair because the edge is bi-
directional.
The tree data structure contains only directed edges, whereas the graph can have both types of edges,
i.e., directed as well as undirected. But, we consider the graph in which all the edges are either
directed edges or undirected edges.
Directed graph: The graph with the directed edges known as a directed graph.
Undirected graph: The graph with the undirected edges known as a undirected graph. The directed
graph is a graph in which all the edges are uni-directional, whereas the undirected graph is a graph in
which all the edges are bi-directional.
37
FAI Module - 1
State Space
Percepts
Environment
Agent
Actions
Figure 1
We have earlier discussed about an intelligent agent. Today we will study a type of
intelligent agent which we will call a goal directed agent.
A goal directed agent needs to achieve certain goals. Such an agent selects its actions
based on the goal it has. Many problems can be represented as a set of states and a set of
rules of how one state is transformed to another. Each state is an abstract representation
of the agent's environment. It is an abstraction that denotes a configuration of the agent.
Initial state : The
38
FAI Module - 1
A goal is a description of a set of desirable states of the world. Goal states are often
specified by a goal test which any goal state must satisfy.
The agent must choose a sequence of actions to achieve the desired goal. State Space
Search Notations
An action or an operator takes the agent from one state to another state which is called a
successor state. A state can have a number of successor states.
A plan is a sequence of actions. The cost of a plan is referred to as the path cost. The path
cost is a positive number, and a common path cost may be the sum of the costs of the
steps in the path.
39
FAI Module - 1
Tree Search:
Algorithm
Graph Search
• recognize duplicates:
• when a state is reached on multiple paths,
• only keep one search node search nodes correspond 1:1 reachable states
• search tree bounded, as number of states is finite
Algorithm
40
FAI Module - 1
if closed.lookup(n.state) = none:
closed.insert(n)
if is goal(n.state):
return extract path(n)
41
FAI Module - 1
42