Ai Unit1
Ai Unit1
In today's world, technology is growing very fast, and we are getting in touch with different new
technologies day by day.
Here, one of the booming technologies of computer science is Artificial Intelligence which is
ready to create a new revolution in the world by making intelligent machines.The Artificial
Intelligence is now all around us. It is currently working with a variety of sub fields, ranging from
general to specific, such as self-driving cars, playing chess, proving theorems, playing music,
Painting, etc.
The definitions of AI according to some text books are categorized into four
approaches and are summarized in the table below :
which can behave like a human, think like humans, and able to make
decisions."
1
The Foundations of Artificial Intelligence
The disciplines that contributed ideas, viewpoints, and techniques to AI. It is forced to concentrate
on a small number of people, events, and ideas and to ignore others that also were important. I’ll
1. Philosophy
2. Mathematics
2
The main three fundamental areas are logic, computation and probability.
3. Economics
How should we do this when the payoff may be far in the future?
4. Neuroscience
How do brains process information? Neuroscience is the study of the nervous system,
especially the brain. We are still a long way from understanding how cognitive processes
actually work. The truly amazing conclusion is that a collection of simple cells can lead to
thought, action, and consciousness or, brains cause minds.The only real alternative theory is
mysticism: that minds operate in some mystical realm that is beyond physical science.
5. Psychology
6. why do humans and animals think and act?✒️ Behaviourism, Cognitive psychology.
3
II. the representation is manipulated by cognitive processes to derive internal
representations
6. Computer engineering
AI has pioneered many ideas that have made their way back to mainstream computer science,
including time sharing, interactive interpreters, personal computers with windows and mice, rapid
development environments, the linked list data type, automatic storage management, and key
7. Linguistics
How can artifacts operate under their own control?✒️ control Theory, Homeostatic and
objective function.
5
-------------------------------------------------------------------------------------------------
4
History of AI
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.
1957 First programming language for numeric and scientific computing (FORTRAN)
1959 John McCarthy and Marvin Minsky founded the MIT Artificial Intelligence Project
1961 First industrial Robot (Unimate) on the assembly line at General Motors
1965 ELIZA by Joseph Weizenbaum was the first program that could communicate on
any topic
2011 A neural network wins over humans in traffic sign recognition (99.46% vs 99.22%)
5
2014 Microsoft Cortana
2015 Google AlphaGo defeated various human champions in the board game Go
8
-----------------------------------------------------------------------------------------------------------
The State of the Art or The Applications of AI
ROBOTIC VEHICLES:
The history of robotic vehicles stretches back to radio-controlled cars of the 1920s, but
the first demonstrations of autonomous road driving without special guides
occurred in the 1980s. A driverless robotic car named STANLEY outfitted with
cameras, radar, and laser rangefinders to sense the environment and onboard software
to command the steering, braking, and acceleration.
Speech recognition: A traveler calling United Airlines to book a flight can have the
entire conversation guided by an automated speech recognition and dialog
management system.
Autonomous planning and scheduling: A hundred million miles from Earth, NASA’s
Remote Agent program became the first on-board autonomous planning program to
control the scheduling of operations for a spacecraft . REMOTE AGENT generated plans
from high-level goals specified from the ground and monitored the execution of those
plans—detecting, diagnosing, and recovering from problems as they occurred.
Successor program MAPGEN plans the daily operations for NASA’s Mars Exploration
Rovers, and MEXAR2 did mission planning—both logistics and science planning—for the
European Space Agency’s Mars Express mission in 2008. Game playing: IBM’s DEEP
BLUE became the first computer program to defeat the world champion in a chess
match when it bested Garry Kasparov by a score of 3.5 to 2.5 in an exhibition match.
Spam fighting: Each day, learning algorithms classify over a billion messages as spam,
saving the recipient from having to waste time deleting what, for many users, could
comprise 80% or 90% of all messages, if not classified away by algorithms. Because the
spammers are continually updating their tactics, it is difficult for a static programmed
approach to keep up, and learning algorithms work best
Logistics planning: During the Persian Gulf crisis of 1991, U.S. forces deployed a
Dynamic Analysis and Replanning Tool, DART to do automated logistics planning and
scheduling for transportation.
Robotics: The iRobot Corporation has sold over two million Roomba robotic vacuum
cleaners for home use. The company also deploys the more rugged PackBot to Iraq and
Afghanistan, where it is used to handle hazardous materials, clear explosives, and identify
the location of snipers.
Machine Translation: A computer program automatically translates one language to another.
-----------------------------------------------------------------------------------------------------------
6
10
The advantages range from streamlining, saving time, eliminating biases, and automating
repetitive tasks, just to name a few. The disadvantages are things like costly implementation,
potential human job loss, and lack of emotion and creativity.
Artificial Intelligence (AI) has now become a part of our day-to-day lives. The scope for
innovation and development in AI is enormous and will continue changing the world in diverse
ways in the future.As with everything else, there are positives and negatives that come with AI.
Here are some remarkable benefits and risks of Artificial Intelligence that continue reshaping the
world of today.
Benefits
Automation
Smart Decision Making
Enhanced Customer Experience
Data Analysis
Managing Repetitive Tasks
Risks
Job Loss
Privacy Violation
Malicious Use of AI
Safety Considerations
Fairness and Bias Concerns
-----------------------------------------------------------------------------------------------------------
7
sensors and acting upon that environment through actuators. This simple idea is
illustrated in Figure
Figure :Agents interact with environments through sensors and actuators.
A human agent has eyes, ears, and other organs for sensors and hands, legs,
vocal tract, and so on for actuators.
A robotic agent might have cameras and infrared range finders for sensors and
various motors for actuators.
A software agent receives file contents, network packets, and human input
(keyboard/mouse/touchscreen/voice) as sensory inputs and acts on the
environment by writing files, sending network packets, and displaying
information or generating sounds.
The term percept to refer to the content an agent’s sensors are perceiving. An agent’s
percept sequence is the complete history of everything the agent has ever perceived.
An agent’s behavior is described by the agent function that maps any given percept
sequence to an action.
Task environments are essentially the “problems” to which rational agents are the
“solutions.” The nature of the task environment directly affects the appropriate design
for the agent program. Specifying the task environment
When designing an agent, the first step is to specify the task environment as fully as possible
using
PEAS(Performance Measure Environment Actuator Sensor)
Example :PEAS description of the task environment for an automated taxi
driver. Performance Measure
Desirable qualities include getting to the correct destination; minimizing fuel
8
consumption and wear and tear; minimizing the trip time or cost; minimizing violations
of traffic laws and disturbances to other drivers; maximizing safety and passenger
comfort; maximizing profits.
Environment
Any taxi driver must deal with a variety of roads, ranging from rural lanes and urban
alleys to 12- lane freeways. The roads contain other traffic, pedestrians, stray animals,
road works, police cars, puddles, and potholes.
The actuators for an automated taxi include those available to a human driver: control
over the engine through the accelerator and control over steering and braking. In
addition, it will need output to a display screen or voice synthesizer to talk back to the
passengers, and perhaps some way to communicate with other vehicles, politely or
otherwise.
The basic sensors for the taxi will include one or more video cameras and ultrasound
sensors to detect distances to other cars and obstacles.
9
Figure: Examples of agent types and their PEAS descriptions
10
14
11
defective parts on an assembly line bases each decision on the current part,
regardless of previous decisions; moreover, the current decision doesn’t affect
whether the next part is defective.
In sequential environments, on the other hand, the current decision could affect
all future decisions.
Chess and taxi driving are sequential: in both cases, short-term actions can have
5
long-term consequences.
12
Figure: Examples of task environments and their characteristics.
-----------------------------------------------------------------------------------------------------------
Agent architecture is a program that runs on some sort of computing device with
physical sensors and actuators.
In general, the architecture makes the percepts from the sensors available to the
program, runs the program, and feeds the program’s action choices to the actuators as
they are generated.
agent = architecture + program
Agent programs
The agent programs all have the same skeleton: they take the current
percept as input from the sensors and return an action to the actuators.
The difference between the agent program and the agent function is, the agent
program takes the current percept as input, and the agent function, which may
depend on the entire percept history.
The agent program has no choice but has to take just the current percept as
input because nothing more is available from the environment; if the agent’s
actions need to depend on the entire percept sequence, the agent will have to
remember the percepts.
13
For example, Figure shows a trivial agent program that keeps track of the
percept sequence and then uses it to index into a table of actions to
decide what to do.
The four basic kinds of agent programs that embody the principles underlying
almost all intelligent systems:
Simple reflex agents;
Model-based reflex agents;
Goal-based agents; and
Utility-based agents.
When the correct action to take is not immediately obvious, an agent may need to to
plan ahead: to consider a sequence of actions that form a path to a goal state. Such an
agent is called a problem- solving agent, and the computational process it undertakes
is called search.
PROBLEM FORMULATION: The agent devises a description of the states and actions
necessary to reach the goal—an abstract model of the relevant part of the world.
SEARCH: Before taking any action in the real world, the agent simulates sequences of
actions in its model, searching until it finds a sequence of actions that reaches the goal.
Such a sequence is called a solution. The agent might have to simulate multiple
sequences that do not reach the goal, but eventually it will find a solution (such as going
from Arad to Sibiu to Fagaras to Bucharest), or it will find that no solution is possible.
EXECUTION: The agent can now execute the actions in the solution, one at a time.
14
once the agent has found a solution, it can ignore its percepts while it is executing the
actions—because the solution is guaranteed to lead to the goal. Control theorists call
this an open-loop system: ignoring the percepts breaks the loop between agent and
environment. If there is a chance that the model is incorrect, or the environment is
nondeterministic, then the agent would be safer
using a closed-loop approach that monitors the percepts
-----------------------------------------------------------------------------------------------------------
Formulating problems
A model—an abstract mathematical description—and not the real thing. The process of
removing detail from a representation is called abstraction. A good problem formulation
has the right level of detail. The abstraction is valid if it can elaborate any abstract
solution into a solution in the more detailed world; The abstraction is useful if carrying
out each of the actions in the solution is easier than the original problem. The choice of a
good abstraction thus involves removing as much detail as possible while retaining
validity and ensuring that the abstract actions are easy to carry out.
Uninformed Search Strategies(Blind Search)
The term blind means that the strategies have no additional information about states
beyond that is provided in the problem definition. All they can do is generate successors
and distinguish a goal state from a non-goal state. All search strategies are distinguished
by the order in which nodes are expanded. Strategies that know whether one non-goal
state is “more promising” than another are called informed search or heuristic search
strategies
There are five uninformed search strategies as given below.
o Breadth-first search
o Uniform-cost search
o Depth-first search
o Depth-limited search
BFS is a graph traversal approach in which you start at a source node and layer by layer through
the graph, analyzing the nodes directly related to the source node. Then, in BFS traversal, you
must move on to the next-level neighbor nodes.
According to the BFS, you must traverse the graph in a breadthwise direction:
To begin, move horizontally and visit all the current layer's nodes.
Following the definition of breadth-first search, you will look at why we need a breadth-first
search algorithm.
Breadth-First Search uses a queue data structure technique to store the vertices. And the queue
follows the First In First Out (FIFO) principle, which means that the neighbors of the node will be
displayed, beginning with the node that was put first.
The transverse of the BFS algorithm is approaching the nodes in two ways.
Visited node
16
How Does the Algorithm Operate?
Add that node at the front of the queue to the visited list.
Make a list of the nodes as visited that are close to that vertex.
Pseudocode
mark s as visited.
while ( Q is not empty)
//Removing that vertex from queue,whose neighbour will be visited now
v = Q.dequeue( )
----------------------------------------------------------------------------------------------------------
Dijkstra's algorithm finds the shortest path from one vertex to all other vertices.
It does so by repeatedly selecting the nearest unvisited vertex and calculating the distance to all
the unvisited neighboring vertices.
Dijkstra's algorithm is often considered to be the most straightforward algorithm for solving the
shortest path problem.
17
Dijkstra's algorithm is used for solving single-source shortest path problems for directed or
undirected paths. Single-source means that one vertex is chosen to be the start, and the
algorithm will find the shortest path from that vertex to all other vertices.
Dijkstra's algorithm does not work for graphs with negative edges. For graphs with negative
edges, the Bellman-Ford algorithm that is described on the next page, can be used instead.
To find the shortest path, Dijkstra's algorithm needs to know which vertex is the source, it needs a
way to mark vertices as visited, and it needs an overview of the current shortest distance to each
vertex as it works its way through the graph, updating these distances when a shorter distance is
found.
-----------------------------------------------------------------------------------------------------------
18
successors are reached. Suppose the node with unexpanded successors is encountered then the
search backtracks to the next deepest node to explore alternative paths.
Depth-first search (DFS) explores a graph by selecting a path and traversing it as deeply as
possible before backtracking.
Originally it starts at the root node, then it expands all of its one branch until it reaches a
dead end, then backtracks to the most recent unexplored node, repeating until all nodes are
visited or a specific condition is met. ( As shown in the above image, starting from node A,
DFS explores its successor B, then proceeds to its descendants until reaching a dead end at
node D. It then backtracks to node B and explores its remaining successors i.e E. )
This systematic exploration continues until all nodes are visited or the search terminates.
(In our case after exploring all the nodes of B. DFS explores the right side node i.e C then F
and and then G. After exploring the node G. All the nodes are visited. It will terminate.
19
Depth-Limited Search Algorithm:
o Standard failure value: It indicates that problem does not have any solution.
o Cutoff failure value: It defines no solution for the problem within a given depth limit.
Advantages:
o Depth-Limited Search will restrict the search depth of the tree, thus, the algorithm will
require fewer memory resources than the straight BFS (Breadth-First Search) and IDDFS
(Iterative Deepening Depth-First Search). After all, this implies automatic selection of more
segments of the search space and the consequent why consumption of the resources. Due
to the depth restriction, DLS omits a predicament of holding the entire search tree within
memory which contemplatively leaves room for a more memory-efficient vice for solving a
particular kind of problems.
o When there is a leaf node depth which is as large as the highest level allowed, do not
describe its children, and then discard it from the stack.
o Depth-Limited Search does not explain the infinite loops which can arise in classical when
there are cycles in graph of cities.
Disadvantages:
20
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ℓ) where b is the branching factor of
the search tree, and l is the depth limit.
Space Complexity: Space complexity of DLS algorithm is O(b×ℓ) where b is the branching factor
of the search tree, and l is the depth limit.Optimal: Depth-limited search can be viewed as a
special case of DFS, and it is also not optimal even if ℓ>d.
21