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

Intro to Artificial Intelligence C o S c -3112 2022

Chapter 1 – Introduction to Artificial Intelligence


Since the invention of computers or machines, their capability to perform various tasks
went on growing exponentially. Humans have developed the power of computer
systems in terms of their diverse working domains, their increasing speed, and reducing
size with respect to time. A branch of Computer Science named Artificial Intelligence
pursues creating the computers or machines as intelligent as human beings.

1. What is Artificial Intelligence?


According to the father of Artificial Intelligence, John McCarthy, it is “The science and
engineering of making intelligent machines, especially intelligent computer programs”.

Artificial Intelligence is a way of making a computer, a computer-controlled robot, or a


software think intelligently, in the similar manner the intelligent humans think.

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.

1.1 Goals of Artificial Intelligence


 To Create Expert Systems − The systems which exhibit intelligent behavior, learn,
demonstrate, explain, and advice its users.

 To Implement Human Intelligence in Machines − Creating systems that understand,


think, learn, and behave like humans.

1.2 What is Artificial Intelligence Technique?


In the real world, the knowledge has some unwelcomed properties −
 Its volume is huge, next to unimaginable.
 It is not well-organized or well-formatted.
 It keeps changing constantly.
AI Technique is a manner to organize and use the knowledge efficiently in such a way
that −
 It should be perceivable by the people who provide it.

Sha
Mengistu Estifanos | Department of Computer Science JKU Page 1
Intro to Artificial Intelligence C o S c -3112 2022

 It should be easily modifiable to correct errors.


 It should be useful in many situations though it is incomplete or inaccurate.
AI techniques elevate the speed of execution of the complex program it is equipped
with.
1.3 Programming with and without Artificial Intelligence
Programming without AI Programming with AI
A computer program without AI can
A computer program with AI can answer
answer the specific questions it is meant
the generic questions it is meant to solve.
to solve.
AI programs can absorb new modifications
by putting highly independent pieces of
Modification in the program leads to
information together. Hence you can modify
change in its structure.
even a minute piece of information of
program without affecting its structure.
Modification is not quick and easy. It
may lead to affecting the program Quick and Easy program modification.
adversely.

1.4 Applications of Artificial Intelligence


AI has been dominant in various fields such as −

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

 Natural Language Processing − It is possible to interact with the computer that


understands natural language spoken by humans.

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

 Doctors use clinical expert system to diagnose the patient.

 Police use computer software that can recognize the face of criminal with the
stored portrait made by forensic artist.

 Speech Recognition − Some intelligent systems are capable of hearing and


comprehending the language in terms of sentences and their meanings while a human
talks to it. It can handle different accents, slang words, noise in the background,
change in human‟s noise due to cold, etc.

 Handwriting Recognition − The handwriting recognition software reads the text


written on paper by a pen or on screen by a stylus. It can recognize the shapes of
the letters and convert it into editable text.

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

1.5 Objectives of Artificial Intelligence


Artificial Intelligence is a science and engineering to develop intelligent machines that
works like human to do tasks such as speech recognition, decision-making, reasoning,
learning, problem solving and translation between languages.

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 difficulties that arise from attempting to define AI.


Sha
Mengistu Estifanos | Department of Computer Science JKU Page 3
Intro to Artificial Intelligence C o S c -3112 2022

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

1.6 Approaches of Artificial Intelligence


Following are the approaches to the goal of AI:

 Computer systems that act like humans,


 Programs that simulate the human mind,
 Knowledge representation and mechanistic reasoning, and
 Intelligent or rational agent design.
The first two approaches focus on studying humans and how they solve problems, while
the latter two approaches focus on studying real-world problems and developing
rationalsolutions regardless of how a human would solve the same problems.

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

 Good at detail-oriented jobs;

 Reduced time for data-heavy tasks;

 Delivers consistent results; and

 AI-powered virtual agents are always available.

Disadvantages

 Expensive;

 Requires deep technical expertise;

 Limited supply of qualified workers to build AI tools;

 Only knows what it's been shown; and

 Lack of ability to generalize from one task to another.

Strong AI vs. weak AI


AI can be categorized as either weak or strong.

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

1.8 The 4 types of artificial intelligence


Arend Hintze, an assistant professor of integrative biology and computer science and engineering at
Michigan State University, explained in a 2016 article that AI can be categorized into four types, beginning
with the task-specific intelligent systems in wide use today and progressing to sentient systems, which do
not yet exist. The categories are as follows:
Sha
Mengistu Estifanos | Department of Computer Science JKU Page 5
Intro to Artificial Intelligence C o S c -3112 2022
 Type 1: Reactive machines. These AI systems have no memory and are task specific. An example is
Deep Blue, the IBM chess program that beat Garry Kasparov in the 1990s. Deep Blue can identify pieces
on the chessboard and make predictions, but because it has no memory, it cannot use past experiences
to inform future ones.

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

What are examples of AI technology and how is it used today?


AI is incorporated into a variety of different types of technology. Here are six examples:

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

AI is not just one technology.


Sha
Mengistu Estifanos | Department of Computer Science JKU Page 7
Intro to Artificial Intelligence C o S c -3112 2022

1.9 History of Artificial Intelligence


The concept of AI began around 1943 and became a field of study in 1956 at
Dartmouth. AI is not limited to the Computer Sciences disciplines, but can be seen in countless
disciplines such as Mathematics, Philosophy, Economics, Neuroscience, psychology and
various other areas. The areas of interest in the Computer Science and Engineering field are
focused on how we can build more efficient computers. Great advancements have been made
in the area of hardware and software. Here is the history of AI during 20th century:
Year Milestone / Innovation

Karel Čapek play named “Rossum's Universal Robots” (RUR) opens in London,
1923
first use of the word "robot" in English.

1943 Foundations for neural networks laid.

1945 Isaac Asimov, a Columbia University alumni, coined the term Robotics.

Alan Turing introduced Turing Test for evaluation of intelligence and


1950 published Computing Machinery and Intelligence. Claude Shannon
published Detailed Analysis of Chess Playing as a search.

John McCarthy coined the term Artificial Intelligence. Demonstration of the


1956 firstrunning AI program at Carnegie Mellon University.

1958 John McCarthy invents LISP programming language for AI.

Danny Bobrow's dissertation at MIT showed that computers can understand


1964 natural language well enough to solve algebra word problems correctly.

Joseph Weizenbaum at MIT built ELIZA, an interactive problem that carries on a


1965 dialogue in English.

Scientists at Stanford Research Institute Developed Shakey, a robot, equipped


1969 with locomotion, perception, and problem solving.

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

Major advances in all areas of AI −

 Significant demonstrations in machine learning


 Case-based reasoning
 Multi-agent planning
1990  Scheduling
 Data mining, Web Crawler
 natural language understanding and translation
 Vision, Virtual Reality
 Games

The Deep Blue Chess Program beats the then world chess champion, Garry
1997 Kasparov.

Interactive robot pets become commercially available. MIT displays Kismet, a


2000 robot with a face that expresses emotions. The robot Nomad explores remote
regions of Antarctica and locates meteorites.

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

Chapter 2 – Introduction to Intelligent Agents


2.1 An agent is anything that can perceive its environment through sensors and acts
upon that environment through effectors.
 A human agent has sensory organs such as eyes, ears, nose, tongue and skin
parallel to the sensors, and other organs such as hands, legs, mouth, for effectors.
 A robotic agent replaces cameras and infrared range finders for the sensors, and
various motors and actuators for effectors.
 A software agent has encoded bit strings as its programs and actions.

An intelligent agent is an AI hardware and/or software system with some degree of


autonomy and the capacity to make decisions and take actions. Intelligent agents are
more advanced than conventional agents whose actions are completely programmed. An
agent program might, for example, use human-defined parameters to search a
knowledge base or the Internet and organize that information for presentation to the
user.
Intelligent agents, at their most complexes, include physical systems, such as AI- equipped
android (humanoid) robots. Although it has not yet been demonstrated, some believe
that a future system could not only look like a human but could also replicate human
cognitive powers in artificial general intelligence (AGI) or even overwhelmingly surpass it
in artificial super intelligence (ASI). At the lower end of the scale lie more task-specific
software programs, such as expert systems that work similarly to conventional agent
programs but nevertheless some degree of autonomy and physical agents that take in
sensor data and act on it.

Sha
Mengistu Estifanos | Department of Computer Science JKU Page 12
Intro to Artificial Intelligence C o S c -3112 2022

2.2 Agent Terminology


 Performance Measure of Agent − It is the criteria, which determines how
successful an agent is.
 Behavior of Agent − It is the action that agent performs after any given sequence
of percepts.
 Percept − It is agent‟s perceptual inputs at a given instance.
 Percept Sequence − It is the history of all that an agent has perceived till date.
 Agent Function − It is a map from the precept sequence to an action.

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.

Ideal Rational Agent


An ideal rational agent is the one, which is capable of doing expected actions to

maximize its performance measure, on the basis of:

 Its percept sequence

 Its built-in knowledge base

Rationality of an agent depends on the following:

 The performance measures, which determine the degree of success.

 Agent‟s Percept Sequence till now.

 The agent‟s prior knowledge about the environment.

 The actions that the agent can carry out.

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

2.3 Structure of Intelligent Agents


Agent‟s structure can be viewed as:
 Agent = Architecture + Agent Program

 Architecture = the machinery that an agent executes on.

 Agent Program = an implementation of an agent function.

Types of Agents
Agents can be grouped into four classes based on their degree of perceived intelligence
and capability:

 Simple Reflex Agents


 Model-Based Reflex Agents
 Goal-Based Agents
 Utility-Based Agents
Simple Reflex Agents
Simple reflex agents ignore the rest of the percept history and act only on the basis of the
current percept. Percept history is the history of all that an agent has perceived till date.
The agent function is based on the condition-action rule. A condition-action rule is a rule
that maps a state i.e, condition to an action. If the condition is true, then the action is
taken, else not. This agent function only succeeds when the environment is fully
observable. For simple reflex agents operating in partially observable environments,
infinite loops are often unavoidable. It may be possible to escape from infinite loops if
the agent can randomize its actions. Problems with Simple reflex agents are:

Sha
Mengistu Estifanos | Department of Computer Science JKU Page 14
Intro to Artificial Intelligence C o S c -3112 2022

 They choose actions only based on the current percept.


 They are rational only if a correct decision is made only on the basis of current
precept.
 Their environment is completely observable.
 Very limited intelligence.
 No knowledge of non-perceptual parts of state.
 Usually too big to generate and store.
 If there occurs any change in the environment, then the collections of rules need
to be updated.

Model Based Reflex Agent


It works by finding a rule whose condition matches the current situation. A model-based
agent can handle partially observable environments by use of model about the world.
The agent has to keep track of internal state which is adjusted by each percept and
that depends on the percept history. The current state is stored inside the agent which
maintains some kind of structure describing the part of the world which cannot be seen.
Updating the state requires the information about:
 how the world evolves in-dependently from the agent, and
 how the agent actions affects the world.

Sha
Mengistu Estifanos | Department of Computer Science JKU Page 15
Intro to Artificial Intelligence C o S c -3112 2022

Goal Based Agent


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

Utility Based Agents


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

Goals are inadequate when:

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

2.4 Nature of Environment


Some programs operate in the entirely artificial environment confined to keyboard
input, database, computer file systems and character output on a screen.
In contrast, some software agents (software robots or softbots) exist in rich, unlimited
softbots domains. The simulator has a very detailed, complex environment. The
software agent needs to choose from a long array of actions in real time. A softbot
designed to scan the online preferences of the customer and show interesting items to
the customer works in the real as well as an artificial environment.
The most famous artificial environment is the Turing Test environment, in which one
real and other artificial agent are tested on equal ground. This is a very challenging
environment as it is highly difficult for a software agent to perform as well as a human.

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:

 Discrete / Continuous − If there are a limited number of distinct, clearly defined,


states of the environment, the environment is discrete (For example, chess);
otherwise it is continuous (For example, driving).

 Observable / Partially Observable − If it is possible to determine the complete


state of the environment at each time point from the percepts it is observable;
otherwise it is only partially observable.

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

 Deterministic / Non-deterministic − If the next state of the environment is


completely determined by the current state and the actions of the agent, then the
environment is deterministic; otherwise it is non-deterministic.

 Episodic / Non-episodic − In an episodic environment, each episode consists of


the agent perceiving and then acting. The quality of its action depends just on the
episode itself. Subsequent episodes do not depend on the actions in the previous
episodes. Episodic environments are much simpler because the agent does not
need to think ahead.

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.

 Operators (Travelling in the Solution Space)


We have to travel inside this solution space in order to find a solution to our problem.
The travelling inside a solution space requires something called as “operators”. In case of
the mouse example, turn left, turn right, and go straight are the operators which help us
travelling inside the solution space. In short the action that takes us from one state to the
other is referred to as an operator. So while solving a problem we should clearly know
that what are the operators that we can use in order to reach the goal state from the
starting state. The sequence of these operators is actually the solution to our problem.

3.2 Problem Solving Agents


There are four general steps for problem solving which are also referred as Goal based
agents. Here we will take an example of travelling from Teppi to Addis Ababa.
 Goal Formulation
 Declaring the Goal.
 Ignoring the some actions.
 Limits the objective that agent is trying to achieve.
 Goal can be defined as set of world states.
 Problem Formulation
 What actions and states to consider given the goal.
 It can change the world states size, enormously.
 It depends on how the agent is connected to its environment.
 Search
 Now, our agent knows the goal and actions.
 Which action to choose (with map or with-out map)?
 What action should be chosen in a state with unknown value?
 Process of looking for such a sequence is called Search.
 Search Algorithm takes problem as input and returns a solution in form of an
action sequence.

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

3.3 Search Strategies Algorithm


Searching is the universal technique of problem solving in AI. There are some single-
player games such as tile games, Sudoku, crossword, etc. The search algorithms help you
to search for a particular position in such games.
Single Agent Path finding Problems
The games such as 3X3 eight-tile, 4X4 fifteen-tile, and 5X5 twenty four tile puzzles are
single-agent-path-finding challenges. They consist of a matrix of tiles with a blank tile.
The player is required to arrange the tiles by sliding a tile either vertically or horizontally
into a blank space with the aim of accomplishing some objective.

The other examples of single agent path finding problems are Travelling Salesman
Problem, Rubik‟s Cube, and Theorem Proving.

Brute Force Search Strategies


They are most simple, as they do not need any domain-specific knowledge. They work
fine with small number of possible states.
Requirements −
 State description
 A set of valid operators
 Initial state
 Goal state description
This search strategy includes Breadth First Search, Depth First Search, Bidirectional Search,
Uniform Cost Search, and Iterative Deepening Depth First Search.

 Breadth First Search


It starts from the root node, explores the neighboring nodes first and moves towards the
next level neighbors. It generates one tree at a time until the solution is found. It can be
implemented using FIFO (First In First Out) queue data structure. This method provides
shortest path to the solution.
If branching factor (average number of child nodes for a given node) = b and depth =
Sha
Mengistu Estifanos | Department of Computer Science JKU Page 22
Intro to Artificial Intelligence C o S c -3112 2022
d,then number of nodes at level d = b d.
The total no of nodes created in worst case is b + b2 + b3 + … + bd.
Disadvantage − Since each level of nodes is saved for creating next one, it consumes a
lot of memory space. Space requirement to store nodes is exponential.

Its complexity depends on the number of nodes. It can check duplicate nodes.

 Depth First Search


It is implemented in recursion with LIFO (Last In First Out) stack data structure. It creates
the same set of nodes as Breadth-First method, only in the different order. As the nodes
on the single path are stored in each iteration from root to leaf node, the space
requirement to store nodes is linear. With branching factor band depth as m, the storage
space is bm.
Disadvantage − this algorithm may not terminate and go on infinitely on one path. The
solution to this issue is to choose a cut-off depth. If the ideal cut-off is d, and if chosen
cut-off is lesser than d, then this algorithm may fail. If chosen cut-off is more than d,
then execution time increases.
Its complexity depends on the number of paths. It cannot 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.

 Uniform Cost Search


Sorting is done in increasing cost of the path to a node. It always expands the least cost
node. It is identical to Breadth First search if each transition has the same cost.
It explores paths in the increasing order of cost.
Disadvantage − There can be multiple long paths with the cost ≤ C*. Uniform Cost
search must explore them all.

 Iterative Deepening Depth First Search


It performs depth-first search to level 1, starts over, executes a complete depth-first
search to level 2, and continues in such way till the solution is found. It never creates a
node until all lower nodes are generated. It only saves a stack of nodes. The algorithm
ends when it finds a solution at depth d. The number of nodes created at depth d is
bd and at depth d-1 is bd-1.

Comparison of Various Algorithms Complexities

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

Optimality Yes No Yes Yes Yes

Completeness Yes No Yes Yes Yes

Sha
Mengistu Estifanos | Department of Computer Science JKU Page 25
Intro to Artificial Intelligence C o S c -3112 2022

3.4 Informed (Heuristic) Search Strategies


To solve large problems with large number of possible states, problem-specific knowledge
needs to be added to increase the efficiency of search algorithms.

 Heuristic Evaluation Functions

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.

 Pure Heuristic Search

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.

f(n) = g(n) + h(n), where

o g(n) the cost (so far) to reach the node

o h(n) estimated cost to get from the node to the goal

o f(n) estimated total cost of path through n to goal. It is implemented using priority
queue by increasing f (n).

 Greedy Best First Search

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

Disadvantage − It can get stuck in loops. It is not optimal.

3.5 Local Search Algorithms


They start from a prospective solution and then move to a neighboring solution. They
can return a valid solution even if it is interrupted at any time before they end.
Hill-Climbing Search
It is an iterative algorithm that starts with an arbitrary solution to a problem and
attempts to find a better solution by changing a single element of the solution
incrementally. If the change produces a better solution, an incremental change is taken as
a new solution. This process is repeated until there are no further improvements.
function Hill-Climbing (problem), returns a state that is a local maximum.
inputs: problem, a problem
local variables: current, a node
neighbor, a node
current <-Make_Node(Initial-State[problem])
loop
do neighbor <- a highest_valued successor of current
if Value[neighbor] ≤ Value[current] then
return State[current]
current <- neighbor

end

Disadvantage − this algorithm is neither complete, nor optimal.

 Local Beam Search


In this algorithm, it holds k number of states at any given time. At the start, these states
are generated randomly. The successors of these k states are computed with the help of
objective function. If any of these successors is the maximum value of the objective
function, then the algorithm stops.
Otherwise the (initial k states and k number of successors of the states = 2k) states are
placed in a pool. The pool is then sorted numerically. The highest k states are selected as
new initial states. This process continues until a maximum value is reached.
function Beam Search ( problem, k), returns a solution state.

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

 Travelling Salesman Problem


The traveling salesman problem (TSP) is an algorithmic problem tasked with finding the
shortest route between a set of points and locations that must be visited. In the problem
statement, the points are the cities a salesperson might visit. The salesman„s goal is to
keep both the travel costs and the distance traveled as low as possible.

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

You might also like