21cs54-Module 1

Download as pdf or txt
Download as pdf or txt
You are on page 1of 15

ARTIFICIAL INTELLIGENCE

21CS54

INTRODUCTION
DEFINITION:
 Artificial Intelligence, or AI, refers to the development of computer systems capable of
performing tasks that typically require human intelligence.
 These tasks include learning, reasoning, problem-solving, understanding natural
language, and perception.
 AI technologies can be categorized into narrow AI, designed for specific tasks, and
general AI, which aims to replicate human cognitive abilities across various domains.
Machine learning, a subset of AI, involves algorithms that enable systems to learn and
improve from data. AI applications are diverse, ranging from virtual assistants and
image recognition to autonomous vehicles and healthcare diagnostics.

APPLICATIONS OF AI

1. AI in Healthcare

o 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.
o 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.

2. AI in Gaming

o 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.

3. AI in Finance

o 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.
4. AI in Data Security

o 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.

5. AI in Social Media

o 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.

6. AI in Travel & Transport

o 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.

7. AI in Automotive Industry

o 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.
o Various Industries are currently working for developing self-driven cars which can
make your journey more safe and secure.

8. AI in Robotics:

o 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 create intelligent robots which can perform tasks with their own experiences
without pre-programmed.
o 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.
9. AI in Entertainment

o 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.

10. AI in Agriculture

o Agriculture is an area which requires various resources, labor, 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.

11. AI in E-commerce

o 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, color, or even brand.

12. AI in education

o AI can automate grading so that the tutor can have more time to teach. AI chatbot can
communicate with students as a teaching assistant.
o 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.

FORMS OF AI

1. NARROW AI: Generally known as WEAK AI An example would be any computer


game where one player is the user and the other player is the computer. What usually
happens is, the machine is fed with all the rules and regulations of the game and the
possible outcomes of the game manually. In turn, this machine applies these data to
beat whoever is playing against it. A single particular task is carried out to mimic human
intelligence
2. STRONG AI: Generally Known as GENERAL AI. A close example (not the perfect
example) would be the world’s first citizen robot, Sophia. She was introduced to the
world on October 11, 2017. Sophia talks like she has emotions.

APPROACHES OF AI

 Acting Humanly:
1. This is also known as Turing Test Approach
2. Designed by Alen Turing.
3. Mimicking human behaviour to the extent that an observer cannot distinguish between
the machine and a human.

Example: Chatbots engaging in conversation in a way that seems indistinguishable from a


human.

CHATBOTS: Chatbot is a computer program that simulates and processes human conversation
(either written or spoken), allowing humans to interact with digital devices as if they were
communicating with a real person.

The Turing Test Approach

The Turning Test is of 3 Terminals, one terminal is operated by a computer while other two
terminal were operated by human.

The questioner and respondents will interact within a specific subject area using a specific
format after a present length of time, the respondent will be asked to predict which was
computer and which was one human.

 Thinking Humanly:

 The Cognitive Model Approach


 Replicating internal cognitive processes of a human, including emotions,
memories, and reasoning.
 Example: Developing AI models that simulate human-like thought processes
and decision-making.

The Cognitive Model Approach

Human cognition involves real-time analysis of the real-world environment, context, intent and
many other variables that inform a person's ability to solve problems. AI

 Thinking Rationally:
 Applying logical reasoning and problem-solving methods, similar to how a
human think.
Example: Creating AI systems that follow rules of deductive reasoning to draw conclusions or
solve problems.
 Acting Rationally:
 Making decisions and taking actions that are optimal or rational based on
available information.
Example: Designing AI agents that make decisions to achieve specific goals efficiently and
effectively.

Rationally: The ability to make decisions based on logical reasoning and optimize
behaviour to achieve its goals, considering its perception of the environment and the
performance measure.

FOUNDATIONS OF AI

 Philosophy
 Mathematics
 Economics
 Neuroscience
 Psychology
 Computer engineering
 Control theory and cybernetics
 Linguistics

1. Philosophy: Raises fundamental questions about consciousness, ethics, and the nature
of intelligence, influencing AI's ethical considerations and theoretical underpinnings.
2. Mathematics: Provides the theoretical foundation for algorithms and models used in AI,
including statistics, linear algebra, calculus, and discrete mathematics.
3. Economics: Examines the economic implications of AI, including its impact on the job
market, industries, and global economies.
4. Neuroscience: Offers insights into the functioning of the human brain, inspiring neural
network models in AI to simulate aspects of human cognition.
5. Psychology: Contributes to AI's understanding of human behavior, cognition, and
perception, influencing the development of human-centric AI applications.
6. Computer Engineering: Essential for building hardware and software infrastructure,
enabling the practical implementation of AI systems.
7. Control Theory and Cybernetics: Provides principles for designing systems that can
regulate themselves, influencing the development of autonomous AI systems.
8. Linguistics: Essential for natural language processing (NLP) in AI, helping machines
understand, interpret, and generate human language.

HISTORY OF AI

1. 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.
2. Year 1949: Donald Hebb demonstrated an updating rule for modifying the connection strength
between neurons. His rule is now called Hebbian learning.
3. 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 behavior
equivalent to human intelligence, called a Turing test
4. 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.
5. 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.
6. 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.
7. Year 1972: The first intelligent humanoid robot was built in Japan which was named as
WABOT-1.
8. 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.
9. During AI winters, an interest of publicity on artificial intelligence was decreased.
10. 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.
11. In the Year 1980, the first national conference of the American Association of Artificial
Intelligence was held at Stanford University.
12. The duration between the years 1987 to 1993 was the second AI Winter duration
13. 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.
14. 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.
15. Year 2002: for the first time, AI entered the home in the form of Roomba, a vacuum cleaner.
16. Year 2006: AI came in the Business world till the year 2006. Companies like Facebook, Twitter,
and Netflix also started using AI.
17. 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.
18. Year 2012: Google has launched an Android app feature "Google now", which was able to
provide information to the user as a predictionYear 2014: In the year 2014, Chatbot "Eugene
Goostman" won a competition in the infamous "Turing test."
19. Year 2018: The "Project Debater" from IBM debated on complex topics with two master
debaters and also performed extremely well.
20. 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.

PROBLEM SOLVING AGENTS


 a problem-solving refers to a state where we wish to reach to a definite goal from a present state
or condition.
 a problem-solving is a part of artificial intelligence which encompasses a number of techniques
such as algorithms, heuristics to solve a problem

PROBLEM DEFINITION To build a system to solve a particular problem, we need to do four things:
o Define the problem precisely. This definition must include specification of the initial
situations and also final situations which constitute (i.e) acceptable solution to the
problem.
o Analyze the problem (i.e) important features have an immense (i.e) huge impact on the
appropriateness of various techniques for solving the problems.
o Isolate and represent the knowledge to solve the problem.
o Choose the best problem – solving techniques and apply it to the particular problem.

o Goal Formulation: It is the first and simplest step in problem-solving. It organizes the
steps/sequence required to formulate one goal out of multiple goals as well as actions to achieve
that goal. Goal formulation is based on the current situation and the agent’s performance
measure (discussed below).
o Problem Formulation: It is the most important step of problem-solving which decides what
actions should be taken to achieve the formulated goal. There are following five components
involved in problem formulation

WELL DEFINED PROBLEMS AND SOLUTIONS

o Initial State: It is the starting state or initial step of the agent towards its goal.
o Actions: It is the description of the possible actions available to the agent.
o Transition Model: It describes what each action does.
o Goal Test: It determines if the given state is a goal state.
o Path cost: It assigns a numeric cost to each path that follows the goal. The problemsolving agent
selects a cost function, which reflects its performance measure. Remember, an optimal solution
has the lowest path cost among all the solutions
Input: The function SIMPLE-PROBLEM-SOLVING-AGENT takes a percept (perception
of the environment) as input.
Persistent Variables:
seq: An action sequence, initially empty.
state: Some description of the current world state.
goal: A goal, initially null.
problem: A problem formulation.

Steps:
o Update State: The UPDATE-STATE function is called to update the agent's internal
representation of the world state based on the current percept.
o Check if Action Sequence is Empty:
If seq is empty, it means that the agent either just started or has completed th
e previous sequence of actions. In this case:
o Formulate Goal: The agent formulates a goal based on the updated state using the
FORMULATE-GOAL function.
o Formulate Problem: The agent formulates a problem based on the current state and the
goal using the FORMULATE-PROBLEM function.
o Search for Solution: The agent searches for a sequence of actions (seq) to solve the
formulated problem using the SEARCH function.
o Handle Failure:
If the search for a solution (seq) results in failure, the function returns a null action,
indicating that the agent couldn't find a solution.
o Execute Action:
If a valid action sequence is found, the agent takes the first action from the sequence
(FIRST(seq)) and updates the sequence to exclude the executed action (REST(seq)).
o Return Action:
The executed action is returned as the output of the function.
EXAMPLE PROBLEM

Basically, there are two problems:

 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

 Some toy Problem: 8 puzzle Problem

8 Puzzle Problem
 Here, we have a 3×3 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:
1. States: It describes the location of each numbered tiles and the blank tile.
2. Initial State: We can start from any state as the initial state. ROHINI COLLEGE OF
ENGINEERING AND TECHNOLOGY CS3491-ARTIFICIAL INTELLIGENCE
AND MACHINE LEARNING
3. Actions: Here, actions of the blank space is defined, i.e., either left, right, up or
down
4. Transition Model: It returns the resulting state as per the given state and actions.
5. Goal test: It identifies whether we have reached the correct goal-state.
6. 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 QUEESN’S PROBLEM

1. The aim of this problem is to place eight queens on a chessboard in an order where
no queen may attack another.
2. 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:

o Incremental formulation: It starts from an empty state where the operator


augments a queen at each step. Following steps are involved in this
formulation:
1. States: Arrangement of any 0 to 8 queens on the chessboard.
2. Initial State: An empty chessboard
3. Actions: Add a queen to any empty box.
4. Transition model: Returns the chessboard with the queen added in a box.
5. Goal test: Checks whether 8-queens are placed on the chessboard without any attack.
6. Path cost: There is no need for path cost because only final states are counted. In this
formulation, there is approximately 1.8 x 1014 possible sequence to investigate.
o Complete-state formulation: It starts with all the 8-queens on the
chessboard and moves them around, saving from the attacks. Following
steps are involved in this formulation
 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


 Traveling salesperson problem (TSP): It is a touring problem where the salesman can
visit each city only once. The objective is to find the shortest tour and sell-out the stuff
in each city.
 VLSI Layout problem: In this problem, millions of components and connections are
positioned on a chip in order to minimize the area, circuit-delays, stray-capacitances,
and maximizing the manufacturing yield. The layout problem is split into two parts:
 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

SEARCHING FOR SOLUTIONS


For solving different kinds of problem, an agent makes use of different strategies to reach the goal by
searching the best possible algorithms. This process of searching is known as search strategy

Defining the problem

Before formulating a problem, various factors need to be defined to enable the search algorithms to
perform the required course of action. Defining these factors provides the basis for searching and
providing a solution. The following are the factors that need to be defined:
 Initial state: This is the start state in which the search starts.
 State space: These are all the possible states that can be attained from the initial state through
a series of actions.
 Actions: These are the steps, activities, or operations undertaken by AI agents in a particular
state.
 Goal state: This is the endpoint or the desired state.
 Goal test: This is a test conducted to establish whether a particular state is a goal state.
 Path cost: This is the cost associated with a given path taken by the agents.

Searching in the search space

After defining the factors described above, the agents use the search algorithms to perform a search in
the search space. A search space is an abstract configuration that consists of a search tree of possible
solutions.

A search tree is used to configure the series of actions. The initial state is configured as the root of the
search tree. The branches are the actions while the nodes are the outcomes of the actions.
When we have a given problem in AI, the search algorithm will identify the initial state, state space,
actions, goal state, and the path cost. From the initial state, a series of actions will be performed as the
search algorithms search for the goal state.

For every state attained by the AI agents, the search algorithms will conduct a goal test to establish
whether the state is the desired state. If a particular state attained by the agents is not the goal state, then
the search algorithm will continue searching until the goal state is attained.
Infrastructure for search algorithms

Search algorithms require a data structure to keep track of the search tree that is being constructed.
For each node n of the tree, components:
 n.STATE: the state in the state space to which the node corresponds.
 n.PARENT: the node in the search tree that generated this node.
 n.ACTION: the action that was applied to the parent to generate the node.
 n.PATH-COST: the cost, traditionally denoted g(n), of the path from the initial state to the
node, as indicated by the parent pointers.

1. A state is a (representation of) a physical configuration.  A node is a data structure


constituting part of a search tree includes state, parent node, action, path cost g(x), depth.
2. The Expand function creates new nodes, filling in the various fields and using the Successor
function of the problem to create the corresponding states.
Measuring problem-solving performance

A search strategy is defined by picking the order of node expansion  Strategies are evaluated
along the following dimensions:
1. completeness: does it always find a solution when one exists
2. Time complexity: number of nodes generated
3. space complexity maximum number of nodes in memory
4. optimality: does it always find a least-cost solution?

Time and space complexity are measured in terms of


 b: maximum branching factor of the search tree
 d: depth of the least-cost solution
 m: maximum depth of the state space (may be ∞)
 The size of the state space graph (|V|+|E|)

Breadth First search

 Breadth first search is a simple strategy in which the root node is expanded first, then
all the BREADTH-FIRST SEARCH successors of the root node are expanded next,
then their successors, and so on.
 In general, all the nodes are expanded at a given depth in the search tree before any
nodes at the next level are expanded.
 Breadth-first search (BFS) is an algorithm for traversing or searching tree or graph
data structures.
 It starts at the tree root (or some arbitrary node of a graph, sometimes referred to as a
‘search key’) and explores all of the neighbor nodes at the present depth prior to
moving on to the nodes at the next depth level.
 It is implemented using a queue.
Initialization:
 Create the initial node with the state set to the initial state of the problem and the
path cost set to 0.
 Check if the initial state satisfies the goal test. If yes, return a solution with the
initial node.
Frontier and Explored Sets:
 Create a FIFO (First-In-First-Out) queue called frontier and enqueue the initial
node.
 Create an empty set called explored to keep track of explored states.
BFS Loop:
 Enter a loop that continues until the frontier is empty.
 Dequeue a node from the frontier (choosing the shallowest node).
 Add the state of the dequeued node to the explored set.
Goal Test:
 For each action available in the current state, generate child nodes using the
CHILD-NODE function.
 Check if the state of the child node is not in the explored set or the frontier.
Goal Test for Child Nodes:

 If the goal test is satisfied for a child node, return a solution with that node.
Enqueue Child Nodes:

 Enqueue the child node into the frontier.


 The algorithm continues to explore nodes in a breadth-first manner, ensuring that
all nodes at the current depth level are expanded before moving on to the next depth
level. This ensures that the shallowest solution is found first, making BFS complete
and optimal for searching in a tree or graph.

The pseudocode uses the INSERT and POP operations, which are not explicitly defined here. INSERT
likely means inserting a node into the frontier, and POP probably means removing and returning the
front node from the frontier. These operations depend on the specific implementation details of the
queue used.
Depth First Search

 Depth-first search always expands the deepest node in the current frontier of the search
tree. DEPTH-FIRST SEARCH.
 The search proceeds immediately to the deepest level of the search tree, where the
nodes have no successors. As those nodes are expanded, they are dropped from the
frontier, so then the search “backs up” to the next deepest node that still has unexplored
successors.
 Depth-first search (DFS) is an algorithm for traversing or searching tree or graph data
structures.
 The algorithm starts at the root node (selecting some arbitrary node as the root node in
the case of a graph) and explores as far as possible along each branch before
backtracking.
 It uses last in- first-out strategy and hence it is implemented using a stack.
 The properties of depth-first search depend strongly on whether the graph-search or
tree-search version is used.
 The graph-search version, which avoids repeated states and redundant paths, is
complete in finite state spaces because it will eventually expand every node.
 The time complexity of depth-first graph search is bounded by the size of the state
space (which may be infinite, of course). A depth-first tree search, on the other hand,
may generate all of the O(bm) nodes in the search tree, where m is the maximum depth
of any node, this can be much greater than the size of the state space. Note that m itself
can be much larger than d (the depth of the shallowest solution) and is infinite if the
tree is unbounded.

You might also like