Professional Documents
Culture Documents
AI Handout For CS by Mengistu E Mod
AI Handout For CS by Mengistu E Mod
AI is accomplished by studying how human brain thinks, and how humans learn, decide,
and work while trying to solve a problem, and then using the outcomes of this study as
a basis of developing intelligent software and systems.
Sha
Mengistu Estifanos | Department of Computer Science JKU Page 1
Intro to Artificial Intelligence C o S c -3112 2022
Gaming − AI plays crucial role in strategic games such as chess, poker, tic-tac-toe, etc.,
where machine can think of large number of possible positions based on heuristic
knowledge.
Expert Systems − There are some applications which integrate machine, software, and
special information to impart reasoning and advising. They provide explanation and
advice to the users.
Vision Systems − These systems understand, interpret, and comprehend visual input
on the computer. For example,
Sha
Mengistu Estifanos | Department of Computer Science JKU Page 2
Intro to Artificial Intelligence C o S c -3112 2022
A spying aeroplane takes photographs, which are used to figure out spatial
information or map of the areas.
Police use computer software that can recognize the face of criminal with the
stored portrait made by forensic artist.
Intelligent Robots − Robots are able to perform the tasks given by a human. They
have sensors to detect physical data from the real world such as light, heat,
temperature, movement, sound, bump, and pressure. They have efficient processors,
multiple sensors and huge memory, to exhibit intelligence. In addition, they are
capable of learning from their mistakes and they can adapt to the new environment.
In simple words, it is developed to make human life easy in different aspects and perform
enormous works with more accuracy. It has become an intelligent part of today‟s
industry which is crucial as data is growing Big. It can perform tasks such as identifying
patterns in data more effectively than humans thus making business more profitable.
Knowledge Engineering and Machine learning is a core part of AI. Some of the objectives
of AI are:
Know the three areas of research of AI, and give examples of problems from
each area.
Understand in a general way how a neural network is designed and trained.
Know the components of a formal system.
Understand how depth first, breadth first, and bi-directional searches are
performed.
Use evaluation functions to expedite the search process.
Programming a computer to act like a human is a difficult task and requires that the
computer system be able to understand and process commands in natural language, store
knowledge, retrieve and process that knowledge in order to derive conclusions and
make decisions, learn to adapt to new situations, perceive objects through computer
vision, and have robotic capabilities to move and manipulate objects. Although this
approach was inspired by the Turing Test, most programs have been developed with the
goal of enabling computers to interact with humans in a natural way rather than passing
the Turing Test.
The Turing Test is used as a theoretical standard to determine whether a human judge
can distinguish via a conversation with one machine and one human which a human is
and which is a machine. If a machine can trick the human judge into thinking it is human
then it passes the Turing Test
Sha
Mengistu Estifanos | Department of Computer Science JKU Page 4
Intro to Artificial Intelligence C o S c -3112 2022
1.7 What are the advantages and disadvantages of artificial intelligence?
Artificial neural networks and deep learning artificial intelligence technologies are quickly evolving,
primarily because AI processes large amounts of data much faster and makes predictions more accurately
than humanly possible.
While the huge volume of data being created on a daily basis would bury a human researcher, AI
applications that use machine learning can take that data and quickly turn it into actionable information. As
of this writing, the primary disadvantage of using AI is that it is expensive to process the large amounts of
data that AI programming requires.
Advantages
Disadvantages
Expensive;
Weak AI, also known as narrow AI, is an AI system that is designed and trained to complete a specific
task. Industrial robots and virtual personal assistants, such as Apple's Siri, use weak AI.
Strong AI, also known as artificial general intelligence (AGI), describes programming that can replicate
the cognitive abilities of the human brain. When presented with an unfamiliar task, a strong AI system
can use fuzzy logic to apply knowledge from one domain to another and find a solution
autonomously. In theory, a strong AI program should be able to pass both a Turing Test and the
Chinese room test.
Type 2: Limited memory. These AI systems have memory, so they can use past experiences to inform
future decisions. Some of the decision-making functions in self-driving cars are designed this way.
Type 3: Theory of mind. Theory of mind is a psychology term. When applied to AI, it means that the
system would have the social intelligence to understand emotions. This type of AI will be able to infer
human intentions and predict behavior, a necessary skill for AI systems to become integral members of
human teams.
Type 4: Self-awareness. In this category, AI systems have a sense of self, which gives them
consciousness. Machines with self-awareness understand their own current state. This type of AI does
not yet exist.
Automation. When paired with AI technologies, automation tools can expand the volume and types of
tasks performed. An example is robotic process automation (RPA), a type of software that automates
repetitive, rules-based data processing tasks traditionally done by humans. When combined with
machine learning and emerging AI tools, RPA can automate bigger portions of enterprise jobs, enabling
RPA's tactical bots to pass along intelligence from AI and respond to process changes.
Machine learning. This is the science of getting a computer to act without programming. Deep learning
is a subset of machine learning that, in very simple terms, can be thought of as the automation of
predictive analytics. There are three types of machine learning algorithms:
Sha
Mengistu Estifanos | Department of Computer Science JKU Page 6
Intro to Artificial Intelligence C o S c -3112 2022
o Supervised learning. Data sets are labeled so that patterns can be detected and used to label new
data sets.
o Unsupervised learning. Data sets aren't labeled and are sorted according to similarities or
differences.
o Reinforcement learning. Data sets aren't labeled but, after performing an action or several actions,
the AI system is given feedback.
Machine vision. This technology gives a machine the ability to see. Machine vision captures and
analyzes visual information using a camera, analog-to-digital conversion and digital signal processing. It
is often compared to human eyesight, but machine vision isn't bound by biology and can be
programmed to see through walls, for example. It is used in a range of applications from signature
identification to medical image analysis. Computer vision, which is focused on machine-based image
processing, is often conflated with machine vision.
Natural language processing (NLP). This is the processing of human language by a computer program.
One of the older and best-known examples of NLP is spam detection, which looks at the subject line
and text of an email and decides if it's junk. Current approaches to NLP are based on machine learning.
NLP tasks include text translation, sentiment analysis and speech recognition.
Robotics. This field of engineering focuses on the design and manufacturing of robots. Robots are often
used to perform tasks that are difficult for humans to perform or perform consistently. For example,
robots are used in assembly lines for car production or by NASA to move large objects in space.
Researchers are also using machine learning to build robots that can interact in social settings.
Self-driving cars. Autonomous vehicles use a combination of computer vision, image recognition and
deep learning to build automated skill at piloting a vehicle while staying in a given lane and avoiding
unexpected obstructions, such as pedestrians.
Karel Čapek play named “Rossum's Universal Robots” (RUR) opens in London,
1923
first use of the word "robot" in English.
1945 Isaac Asimov, a Columbia University alumni, coined the term Robotics.
The Assembly Robotics group at Edinburgh University built Freddy, the Famous
1973 Scottish Robot, capable of using vision to locate and assemble models.
Sha
Mengistu Estifanos | Department of Computer Science JKU Page 8
Intro to Artificial Intelligence C o S c -3112 2022
The Deep Blue Chess Program beats the then world chess champion, Garry
1997 Kasparov.
Sha
Mengistu Estifanos | Department of Computer Science JKU Page 9
Intro to Artificial Intelligence C o S c -3112 2022
1.10 The applications of AI
Artificial intelligence has made its way into a wide variety of markets. Here are nine examples.
AI in healthcare. The biggest bets are on improving patient outcomes and reducing costs. Companies are
applying machine learning to make better and faster diagnoses than humans. One of the best-known
healthcare technologies is IBM Watson. It understands natural language and can respond to questions asked
of it. The system mines patient data and other available data sources to form a hypothesis, which it then
presents with a confidence scoring schema. Other AI applications include using online virtual health
assistants and chatbots to help patients and healthcare customers find medical information, schedule
appointments, understand the billing process and complete other administrative processes. An array of AI
technologies is also being used to predict, fight and understand pandemics such as COVID-19.
AI in business. Machine learning algorithms are being integrated into analytics and customer relationship
management (CRM) platforms to uncover information on how to better serve customers. Chatbots have
been incorporated into websites to provide immediate service to customers. Automation of job positions
has also become a talking point among academics and IT analysts.
AI in education. AI can automate grading, giving educators more time. It can assess students and adapt to
their needs, helping them work at their own pace. AI tutors can provide additional support to students,
ensuring they stay on track. And it could change where and how students learn, perhaps even replacing
some teachers.
AI in finance. AI in personal finance applications, such as Intuit Mint or TurboTax, is disrupting financial
institutions. Applications such as these collect personal data and provide financial advice. Other programs,
such as IBM Watson, have been applied to the process of buying a home. Today, artificial
intelligence software performs much of the trading on Wall Street.
AI in law. The discovery process -- sifting through documents -- in law is often overwhelming for humans.
Using AI to help automate the legal industry's labor-intensive processes is saving time and improving client
service. Law firms are using machine learning to describe data and predict outcomes, computer vision to
classify and extract information from documents and natural language processing to interpret requests for
information.
AI in manufacturing. Manufacturing has been at the forefront of incorporating robots into the workflow.
For example, the industrial robots that were at one time programmed to perform single tasks and
separated from human workers, increasingly function as cobots: Smaller, multitasking robots that
collaborate with humans and take on responsibility for more parts of the job in warehouses, factory floors
and other workspaces.
AI in banking. Banks are successfully employing chatbots to make their customers aware of services and
offerings and to handle transactions that don't require human intervention. AI virtual assistants are being
used to improve and cut the costs of compliance with banking regulations. Banking organizations are also
using AI to improve their decision-making for loans, and to set credit limits and identify investment
opportunities.
Sha
Mengistu Estifanos | Department of Computer Science JKU Page 10
Intro to Artificial Intelligence C o S c -3112 2022
AI in transportation. In addition to AI's fundamental role in operating autonomous vehicles, AI
technologies are used in transportation to manage traffic, predict flight delays, and make ocean shipping
safer and more efficient.
Security. AI and machine learning are at the top of the buzzword list security vendors use today to
differentiate their offerings. Those terms also represent truly viable technologies. Organizations use machine
learning in security information and event management (SIEM) software and related areas to detect
anomalies and identify suspicious activities that indicate threats. By analyzing data and using logic to
identify similarities to known malicious code, AI can provide alerts to new and emerging attacks much
sooner than human employees and previous technology iterations. The maturing technology is playing a
big role in helping organizations fight off cyber-attacks.
Sha
Mengistu Estifanos | Department of Computer Science JKU Page 11
Intro to Artificial Intelligence C o S c -3112 2022
Sha
Mengistu Estifanos | Department of Computer Science JKU Page 12
Intro to Artificial Intelligence C o S c -3112 2022
Agent Rationality
Rationality is nothing but status of being reasonable, sensible, and having good sense of
judgment.
Rationality is concerned with expected actions and results depending upon what the
agent has perceived. Performing actions with the aim of obtaining useful information is
an important part of rationality.
A rational agent always performs right action, where the right action means the action
that causes the agent to be most successful in the given percept sequence. The problem
the agent solves is characterized by Performance Measure, Environment, Actuators, and
Sensors (PEAS).
Sha
Mengistu Estifanos | Department of Computer Science JKU Page 13
Intro to Artificial Intelligence C o S c -3112 2022
Types of Agents
Agents can be grouped into four classes based on their degree of perceived intelligence
and capability:
Sha
Mengistu Estifanos | Department of Computer Science JKU Page 14
Intro to Artificial Intelligence C o S c -3112 2022
Sha
Mengistu Estifanos | Department of Computer Science JKU Page 15
Intro to Artificial Intelligence C o S c -3112 2022
There are conflicting goals, out of which only few can be achieved.
Goals have some uncertainty of being achieved and you need to weigh
likelihood of success against the importance of a goal.
Turing Test
The success of an intelligent behavior of a system can be measured with Turing Test.
Two persons and a machine to be evaluated participate in the test. Out of the two
Sha
Mengistu Estifanos | Department of Computer Science JKU Page 17
Intro to Artificial Intelligence C o S c -3112 2022
persons, one plays the role of the tester. Each of them sits in different rooms. The
tester is unaware of who is machine and who is a human. He interrogates the questions
by typing and sending them to both intelligences, to which he receives typed responses.
This test aims at fooling the tester. If the tester fails to determine machine‟s response
from the human response, then the machine is said to be intelligent.
Properties of Environment
The environment has multifold properties:
Static / Dynamic − If the environment does not change while an agent is acting,
then it is static; otherwise it is dynamic.
Single agent / Multiple agents − The environment may contain other agents
which may be of the same or different kind as that of the agent.
Accessible / Inaccessible − If the agent‟s sensory apparatus can have access to the
complete state of the environment, then the environment is accessible to that
agent.
Sha
Mengistu Estifanos | Department of Computer Science JKU Page 18
Intro to Artificial Intelligence C o S c -3112 2022
Chapter 3
Searching and Planning
3.1 Classical Approach of Problem Solving
The classical approach to solving a problem is pretty simple; given a problem at hand use
hit and trial method to check for various solutions to that problem. This hit and trial
approach usually works well for trivial problems and is referred to as the classical
approach to problem solving.
Consider the maze searching problem where the mouse travels though one path and
finds that the path leads to a dead end, it then back tracks somewhat and goes along
some other path and again finds that there is no way to proceed. It goes on performing
such search, trying different solutions to solve the problem until a sequence of turns in
the maze takes it to the cheese. Hence, of all the solutions the mouse tries, the one that
reached the cheese was the one that solved the problem.
Consider that a child is to switch on the light in a dark room. He sees the switchboard
having a number of buttons on it. He presses one, nothing happens, he presses the
second one, the fan gets on, he goes on trying different buttons till at last the room gets
lighted and his problem gets solved. Consider another situation when we have to open
a combinational lock of a briefcase. It is a lock which probably most of you would have
seen where we have different numbers and we adjust the individual dials/digits to obtain
a combination that opens the lock. However, if we don‟t know the correct combination
of digits that open the lock, we usually try 0-0-0, 7-7-7, 7-8-6 or any such combination
for opening the lock. We are solving this problem in the same manner as the child did in
thelight switch example.
All this discussion has one thing in common. That different intelligent species use a similar
approach to solve the problem at hand. This approach is essentially the classical way in
which intelligent species solve problems. Technically we call this hit and trial approaches
the “Generate and Test” approach.
Components of Problem Solving
There are four components of Problem solving such as Problem Statement, Goal State,
Solution Space and Operators.
Sha
Mengistu Estifanos | Department of Computer Science JKU Page 19
Intro to Artificial Intelligence C o S c -3112 2022
Problem Statement
This is the very essential component whereby we get to know what exactly the problem
at hand is. The two major things that we get to know about the problem is the
information about what is to be done and constraints to which our solution should
comply. For example we might just say that given infinite amount of time, one will
be able to solve any problem he wishes to solve. But the constraint “infinite amount of
time” is not a practical one. Hence whenever addressing a problem we have to see that
how much time shall out solution take at max. Time is not the only constraint.
Availability of resources, and all the other parameters laid down in the problem
statement actually tells us about all the rules that have to be followed while solving a
problem. For example, taking the same example of the mouse, are problem statements
that will tell us things like, the mouse has to reach the cheese as soon as possible and in
case it is unable to find a path within an hour, it might die of hunger. The statement
might as well tell us that the mouse is located in the lower left corner of the maze and the
cheese in the top left corner, the mouse can turn left, right and might or might not be
allowed to move backward and things like that. Thus it is the problem statement that
gives us a feel of what exactly to do and helps us start thinking of how exactly things will
work in the solution.
Problem Solution/Goal State
While solving a problem, this should be known that what will be our ultimate aim. That
is what should be the output of our procedure in order to solve the problem. For
example in the case of mouse, the ultimate aim is to reach the cheese. The state of word
when mouse will be beside the cheese and probably eating it defines the aim. This state
of word is also referred to as the Goal State or the state that represents the solution of
the problem.
Solution Space
In order to reach the solution we need to check various strategies. We might or might
not follow a systematic strategy in all the cases. Whatever we follow, we have to go
through a certain amount of states of nature to reach the solution. For example when
the mouse was in the lower left corner of the maze, represents a state i.e. the start state.
When it was stuck in some corner of the maze represents a state. When it was stuck
somewhere else represents another state. When it was travelling on a path represents
Sha
Mengistu Estifanos | Department of Computer Science JKU Page 20
Intro to Artificial Intelligence C o S c -3112 2022
some other state and finally when it reaches the cheese represents a state called the goal
state. The set of the start state, the goal state and all the intermediate states constitutes
something which is called a solution space.
Sha
Mengistu Estifanos | Department of Computer Science JKU Page 21
Intro to Artificial Intelligence C o S c -3112 2022
Execute
After finding a suitable action sequence, the actions can be carried out.
To solve a problem: “Formulate, Search, and Execute”.
The other examples of single agent path finding problems are Travelling Salesman
Problem, Rubik‟s Cube, and Theorem Proving.
Its complexity depends on the number of nodes. It can check duplicate nodes.
Sha
Mengistu Estifanos | Department of Computer Science JKU Page 23
Intro to Artificial Intelligence C o S c -3112 2022
Bidirectional Search
It searches forward from initial state and backward from goal state till both meet to
identify a common state.
The path from initial state is concatenated with the inverse path from the goal state.
Each search is done only up to half of the total path.
Sha
Mengistu Estifanos | Department of Computer Science JKU Page 24
Intro to Artificial Intelligence C o S c -3112 2022
Interactive
Criterion Breadth First Depth First Bidirectional Uniform Cost
Deepening
Time bd bm bd/2 bd bd
Space bd bm bd/2 bd bd
Sha
Mengistu Estifanos | Department of Computer Science JKU Page 25
Intro to Artificial Intelligence C o S c -3112 2022
They calculate the cost of optimal path between two states. A heuristic function for
sliding-tiles games is computed by counting number of moves that each tile makes from
its goal state and adding these numbers of moves for all tiles.
It expands nodes in the order of their heuristic values. It creates two lists, a closed list for
the already expanded nodes and an open list for the created but unexpanded nodes.
In each iteration, a node with a minimum heuristic value is expanded; all its child nodes
are created and placed in the closed list. Then, the heuristic function is applied to the
child nodes and they are placed in the open list according to their heuristic value. The
shorter paths are saved and the longer ones are disposed.
A * Search
It is best-known form of Best First search. It avoids expanding paths that are already
expensive, but expands most promising paths first.
o f(n) estimated total cost of path through n to goal. It is implemented using priority
queue by increasing f (n).
It expands the node that is estimated to be closest to goal. It expands nodes based on
f(n) = h(n). It is implemented using priority queue.
Sha
Mengistu Estifanos | Department of Computer Science JKU Page 26
Intro to Artificial Intelligence C o S c -3112 2022
end
Sha
Mengistu Estifanos | Department of Computer Science JKU Page 27
Intro to Artificial Intelligence C o S c -3112 2022
start with k randomly generated states
loop
generate all successors of all k states
if any of the states = solution, then return the state
else select the k best successors
end
In this algorithm, the objective is to find a low-cost tour that starts from a city, visits all
cities en-route exactly once and ends at the same starting city.
Start
Find out all (n -1)! Possible solutions, where n is the total number of cities.
Determine the minimum cost by finding out the cost of each of these (n -1)! solutions.
Finally, keep the one with the minimum cost.
end
Sha
Mengistu Estifanos | Department of Computer Science JKU Page 28
Intro to Artificial Intelligence C o S c -3112 2022
Simulated Annealing
Annealing is the process of heating and cooling a metal to change its internal structure
for modifying its physical properties. When the metal cools, its new structure is seized,
and the metal retains its newly obtained properties. In simulated annealing process, the
temperature is kept variable.
We initially set the temperature high and then allow it to „cool' slowly as the algorithm
proceeds. When the temperature is high, the algorithm is allowed to accept worse
solutions with high frequency.
Sha
Mengistu Estifanos | Department of Computer Science JKU Page 29