You are on page 1of 119

What is Artificial Intelligence?

Artificial intelligence (AI) is wide-ranging branch of computer science concerned with building smart
machines capable of performing tasks that typically require human intelligence. AI is an interdisciplinary
science with multiple approaches, but advancements in machine learning and deep learning are creating a
paradigm shift in virtually every sector of the tech industry
OW DOES ARTIFICIAL INTELLIGENCE WORK?
Can machines think? — Alan Turing, 1950
Less than a decade after breaking the Nazi encryption machine Enigma and helping the Allied Forces win
World War II, mathematician Alan Turing changed history a second time with a simple question: "Can
machines think?"
Turing's paper "Computing Machinery and Intelligence" (1950), and it's subsequent Turing Test,
established the fundamental goal and vision of artificial intelligence.

At it's core, AI is the branch of computer science that aims to


answer Turing's question in the affirmative. It is the endeavor to replicate or simulate human intelligence
in machines.
The expansive goal of artificial intelligence has given rise to many questions and debates. So much so,
that no singular definition of the field is universally accepted.
The major limitation in defining AI as simply "building machines that are intelligent" is that it doesn't
actually explain what artificial intelligence is? What makes a machine intelligent?
In their groundbreaking textbook Artificial Intelligence: A Modern Approach, authors Stuart Russell and
Peter Norvig approach the question by unifying their work around the theme of intelligent agents in
machines. With this in mind, AI is "the study of agents that receive percepts from the environment and
perform actions." (Russel and Norvig viii)
Norvig and Russell go on to explore four different approaches that have historically defined the field of
AI:
1. Thinking humanly
2. Thinking rationally
3. Acting humanly
4. Acting rationally
The first two ideas concern thought processes and reasoning, while the others deal with behavior. Norvig
and Russell focus particularly on rational agents that act to achieve the best outcome, noting "all the skills
needed for the Turing Test also allow an agent to act rationally." (Russel and Norvig 4).
Patrick Winston, the Ford professor of artificial intelligence and computer science at MIT, defines AI as
"algorithms enabled by constraints, exposed by representations that support models targeted at loops that
tie thinking, perception and action together."

While these definitions may seem abstract to the average person, they help focus the field as an area of
computer science and provide a blueprint for infusing machines and programs with machine learning and
other subsets of artificial intelligence.
While addressing a crowd at the Japan AI Experience in 2017, DataRobot CEO Jeremy Achin began his
speech by offering the following definition of how AI is used today:
"AI is a computer system able to perform tasks that ordinarily require human intelligence... Many of these
artificial intelligence systems are powered by machine learning, some of them are powered by deep
learning and some of them are powered by very boring things like rules."
HOW IS AI USED?
Artificial intelligence generally falls under two broad categories:
 Narrow AI: Sometimes referred to as "Weak AI," this kind
of artificial intelligence operates within a limited context
and is a simulation of human intelligence. Narrow AI is
often focused on performing a single task extremely well
and while these machines may seem intelligent, they are
operating under far more constraints and limitations than
even the most basic human intelligence.

 Artificial General Intelligence (AGI): AGI, sometimes


referred to as "Strong AI," is the kind of artificial
intelligence we see in the movies, like the robots
from Westworld or Data from Star Trek: The Next
Generation. AGI is a machine with general
intelligence and, much like a human being, it can apply
that intelligence to solve any problem.
ARTIFICIAL INTELLIGENCE EXAMPLES
 Smart assistants (like Siri and Alexa)
 Disease mapping and prediction tools
 Manufacturing and drone robots
 Optimized, personalized healthcare treatment recommendations
 Conversational bots for marketing and customer service
 Robo-advisors for stock trading
 Spam filters on email
 Social media monitoring tools for dangerous content or false news
 Song or TV show recommendations from Spotify and Netflix
Narrow Artificial Intelligence
Narrow AI is all around us and is easily the most successful realization of artificial intelligence to date.
With its focus on performing specific tasks, Narrow AI has experienced numerous breakthroughs in the
last decade that have had "significant societal benefits and have contributed to the economic vitality of the
nation," according to "Preparing for the Future of Artificial Intelligence," a 2016 report released by the
Obama Administration.
A few examples of Narrow AI include:
 Google search
 Image recognition software
 Siri, Alexa and other personal assistants
 Self-driving cars
 IBM's Watson
Machine Learning & Deep Learning
Much of Narrow AI is powered by breakthroughs in machine learning and deep learning. Understanding
the difference between artificial intelligence, machine learning and deep learning can be confusing.
Venture capitalist Frank Chen provides a good overview of how to distinguish between them, noting:
"Artificial intelligence is a set of algorithms and intelligence to try to mimic human intelligence. Machine
learning is one of them, and deep learning is one of those machine learning techniques."
Simply put, machine learning feeds a computer data and uses statistical techniques to help it "learn" how
to get progressively better at a task, without having been specifically programmed for that task,
eliminating the need for millions of lines of written code. Machine learning consists of both supervised
learning (using labeled data sets) and unsupervised learning (using unlabeled data sets).
Deep learning is a type of machine learning that runs inputs through a biologically-inspired neural
network architecture. The neural networks contain a number of hidden layers through which the data is
processed, allowing the machine to go "deep" in its learning, making connections and weighting input for
the best results.
Artificial General Intelligence
The creation of a machine with human-level intelligence that can be applied to any task is the Holy Grail
for many AI researchers, but the quest for AGI has been fraught with difficulty.
The search for a "universal algorithm for learning and acting in any environment," (Russel and Norvig
27) isn't new, but time hasn't eased the difficulty of essentially creating a machine with a full set of
cognitive abilities.
AGI has long been the muse of dystopian science fiction, in which super-intelligent robots overrun
humanity, but experts agree it's not something we need to worry about anytime soon.
HISTORY OF AI
Intelligent robots and artificial beings first appeared in the ancient Greek myths of Antiquity. Aristotle's
development of the syllogism and it's use of deductive reasoning was a key moment in mankind's quest to
understand its own intelligence. While the roots are long and deep, the history of artificial intelligence as
we think of it today spans less than a century. The following is a quick look at some of the most important
events in AI.
1943
 Warren McCullough and Walter Pitts publish "A Logical
Calculus of Ideas Immanent in Nervous Activity." The
paper proposed the first mathematic model for building a
neural network.
1949
 In his book The Organization of Behavior: A
Neuropsychological Theory, Donald Hebb proposes the
theory that neural pathways are created from experiences
and that connections between neurons become stronger the
more frequently they're used. Hebbian learning continues
to be an important model in AI.
1950
 Alan Turing publishes "Computing Machinery and
Intelligence, proposing what is now known as the Turing
Test, a method for determining if a machine is intelligent.
 Harvard undergraduates Marvin Minsky and Dean
Edmonds build SNARC, the first neural network computer.
 Claude Shannon publishes the paper "Programming a
Computer for Playing Chess."
 Isaac Asimov publishes the "Three Laws of Robotics."
1952
 Arthur Samuel develops a self-learning program to play
checkers.
1954
 The Georgetown-IBM machine translation experiment
automatically translates 60 carefully selected Russian
sentences into English.
1956
 The phrase artificial intelligence is coined at the
"Dartmouth Summer Research Project on Artificial
Intelligence." Led by John McCarthy, the conference,
which defined the scope and goals of AI, is widely
considered to be the birth of artificial intelligence as we
know it today.
 Allen Newell and Herbert Simon demonstrate Logic
Theorist (LT), the first reasoning program.
1958
 John McCarthy develops the AI programming language
Lisp and publishes the paper "Programs with Common
Sense." The paper proposed the hypothetical Advice Taker,
a complete AI system with the ability to learn from
experience as effectively as humans do.
1959
 Allen Newell, Herbert Simon and J.C. Shaw develop the
General Problem Solver (GPS), a program designed to
imitate human problem-solving.
 Herbert Gelernter develops the Geometry Theorem Prover
program.
 Arthur Samuel coins the term machine learning while at
IBM.
 John McCarthy and Marvin Minsky found the MIT
Artificial Intelligence Project.
1963
 John McCarthy starts the AI Lab at Stanford.
1966
 The Automatic Language Processing Advisory Committee
(ALPAC) report by the U.S. government details the lack of
progress in machine translations research, a major Cold
War initiative with the promise of automatic and
instantaneous translation of Russian. The ALPAC report
leads to the cancellation of all government-funded MT
projects.
1969
 The first successful expert systems are developed in
DENDRAL, a XX program, and MYCIN, designed to
diagnose blood infections, are created at Stanford.
1972
 The logic programming language PROLOG is created.
1973
 The "Lighthill Report," detailing the disappointments in AI
research, is released by the British government and leads to
severe cuts in funding for artificial intelligence projects.
1974-1980
 Frustration with the progress of AI development leads to
major DARPA cutbacks in academic grants. Combined
with the earlier ALPAC report and the previous year's
"Lighthill Report," artificial intelligence funding dries up
and research stalls. This period is known as the "First AI
Winter."
1980
 Digital Equipment Corporations develops R1 (also known
as XCON), the first successful commercial expert system.
Designed to configure orders for new computer systems,
R1 kicks off an investment boom in expert systems that
will last for much of the decade, effectively ending the first
"AI Winter."
1982
 Japan's Ministry of International Trade and Industry
launches the ambitious Fifth Generation Computer
Systems project. The goal of FGCS is to develop
supercomputer-like performance and a platform for AI
development.
1983
 In response to Japan's FGCS, the U.S. government
launches the Strategic Computing Initiative to provide
DARPA funded research in advanced computing and
artificial intelligence.
1985
 Companies are spending more than a billion dollars a year
on expert systems and an entire industry known as the Lisp
machine market springs up to support them. Companies
like Symbolics and Lisp Machines Inc. build specialized
computers to run on the AI programming language Lisp.
1987-1993
 As computing technology improved, cheaper alternatives
emerged and the Lisp machine market collapsed in 1987,
ushering in the "Second AI Winter." During this period,
expert systems proved too expensive to maintain and
update, eventually falling out of favor.
 Japan terminates the FGCS project in 1992, citing failure
in meeting the ambitious goals outlined a decade earlier.
 DARPA ends the Strategic Computing Initiative in 1993
after spending nearly $1 billion and falling far short of
expectations.
1991
 U.S. forces deploy DART, an automated logistics planning
and scheduling tool, during the Gulf War.
1997
 IBM's Deep Blue beats world chess champion Gary
Kasparov
2005
 STANLEY, a self-driving car, wins the DARPA Grand
Challenge.
 The U.S. military begins investing in autonomous robots
like Boston Dynamic's "Big Dog" and iRobot's "PackBot."
2008
 Google makes breakthroughs in speech recognition and
introduces the feature in its iPhone app.
2011
 IBM's Watson trounces the competition on Jeopardy!.
2012
 Andrew Ng, founder of the Google Brain Deep Learning
project, feeds a neural network using deep learning
algorithms 10 million YouTube videos as a training set.
The neural network learned to recognize a cat without
being told what a cat is, ushering in breakthrough era for
neural networks and deep learning funding.
2014
 Google makes first self-driving car to pass a state driving
test.
2016
 Google DeepMind's AlphaGo defeats world champion Go
player Lee Sedol. The complexity of the ancient Chinese
game was seen as a major hurdle to clear in AI.

Artificial Intelligence (AI)


What Is Artificial Intelligence (AI)?
Artificial intelligence (AI) refers to the simulation of human intelligence in machines that are
programmed to think like humans and mimic their actions. The term may also be applied to any machine
that exhibits traits associated with a human mind such as learning and problem-solving.
The ideal characteristic of artificial intelligence is its ability to rationalize and take actions that have the
best chance of achieving a specific goal.
Understanding Artificial Intelligence
When most people hear the term artificial intelligence, the first thing they usually think of is robots. That's
because big-budget films and novels weave stories about human-like machines that wreak havoc on
Earth. But nothing could be further from the truth.
Artificial intelligence is based on the principle that human intelligence can be defined in a way that a
machine can easily mimic it and execute tasks, from the most simple to those that are even more complex.
The goals of artificial intelligence include learning, reasoning, and perception.
As technology advances, previous benchmarks that defined artificial intelligence become outdated. For
example, machines that calculate basic functions or recognize text through optimal character recognition
are no longer considered to embody artificial intelligence, since this function is now taken for granted as
an inherent computer function.
AI is continuously evolving to benefit many different industries. Machines are wired using a cross-
disciplinary approach based in mathematics, computer science, linguistics, psychology, and more.

Algorithms often play a very important part in the structure of artificial intelligence, where simple
algorithms are used in simple applications, while more complex ones help frame strong artificial
intelligence.
Applications of Artificial Intelligence
The applications for artificial intelligence are endless. The technology can be applied to many different
sectors and industries. AI is being tested and used in the healthcare industry for dosing drugs and different
treatment in patients, and for surgical procedures in the operating room.
Other examples of machines with artificial intelligence include computers that play chess and self-driving
cars. Each of these machines must weigh the consequences of any action they take, as each action will
impact the end result. In chess, the end result is winning the game. For self-driving cars, the computer
system must account for all external data and compute it to act in a way that prevents a collision.
Artificial intelligence also has applications in the financial industry, where it is used to detect and flag
activity in banking and finance such as unusual debit card usage and large account deposits—all of which
help a bank's fraud department. Applications for AI are also being used to help streamline and make
trading easier. This is done by making supply, demand, and pricing of securities easier to estimate.
KEY TAKEAWAYS

 Artificial intelligence refers to the simulation of human intelligence in machines.


 The goals of artificial intelligence include learning, reasoning, and perception.
 AI is being used across different industries including finance and healthcare.
 Weak AI tends to be simple and single-task oriented, while strong AI carries on tasks that are
more complex and human-like.
Categorization of Artificial Intelligence
Artificial intelligence can be divided into two different categories: weak and strong. Weak artificial
intelligence embodies a system designed to carry out one particular job. Weak AI systems include video
games such as the chess example from above and personal assistants such as Amazon's Alexa and Apple's
Siri. You ask the assistant a question, it answers it for you.
Strong artificial intelligence systems are systems that carry on the tasks considered to be human-like.
These tend to be more complex and complicated systems. They are programmed to handle situations in
which they may be required to problem solve without having a person intervene. These kinds of systems
can be found in applications like self-driving cars or in hospital operating rooms.
Special Considerations
Since its beginning, artificial intelligence has come under scrutiny from scientists and the public alike.
One common theme is the idea that machines will become so highly developed that humans will not be
able to keep up and they will take off on their own, redesigning themselves at an exponential rate.
Another is that machines can hack into people's privacy and even be weaponized. Other arguments debate
the ethics of artificial intelligence and whether intelligent systems such as robots should be treated with
the same rights as humans.
Self-driving cars have been fairly controversial as their machines tend to be designed for the lowest
possible risk and the least casualties. If presented with a scenario of colliding with one person or another
at the same time, these cars would calculate the option that would cause the least amount of damage.
Another contentious issue many people have with artificial intelligence is how it may affect human
employment. With many industries looking to automate certain jobs through the use of intelligent
machinery, there is a concern that people would be pushed out of the workforce. Self-driving cars may
remove the need for taxis and car-share programs, while manufacturers may easily replace human labor
with machines, making people's skills more obsolete.

artificial intelligence

Artificial intelligence (AI) is the simulation of human intelligence processes by machines, especially
computer systems. Specific applications of AI include expert systems, natural language processing (NLP),
speech recognition and machine vision.

AI programming focuses on three cognitive skills: learning, reasoning and self-correction.

Learning processes. This aspect of AI programming focuses on acquiring data and creating rules for how
to turn the data into actionable information. The rules, which are called algorithms, provide computing
devices with step-by-step instructions for how to complete a specific task.
Reasoning processes. This aspect of AI programming focuses on choosing the right algorithm to reach a
desired outcome.

Self-correction processes. This aspect of AI programming is designed to continually fine-tune algorithms


and ensure they provide the most accurate results possible.
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.
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.
Augmented intelligence vs. artificial intelligence

Some industry experts believe the term artificial intelligence is too closely linked to popular culture, and
this has caused the general public to have improbable expectations about how AI will change the
workplace and life in general. Some researchers and marketers hope the label augmented intelligence,
which has a more neutral connotation, will help people understand that most implementations of AI will
be weak and simply improve products and services.
The concept of the technological singularity -- a future ruled by an artificial superintelligence that far
surpasses the human brain's ability to understand it or how it is shaping our reality -- remains within the
realm of science fiction.
Ethical use of artificial intelligence

While AI tools present a range of new functionality for businesses, the use of artificial intelligence also
raises ethical questions because, for better or worse, an AI system will reinforce what it has already
learned.

This can be problematic because machine learning algorithms, which underpin many of the most
advanced AI tools, are only as smart as the data they are given in training. Because a human being selects
what data is used to train an AI program, the potential for machine learning bias is inherent and must be
monitored closely.

Anyone looking to use machine learning as part of real-world, in-production systems needs to factor
ethics into their AI training processes and strive to avoid bias. This is especially true when using AI
algorithms that are inherently unexplainable in deep learning and generative adversarial network (GAN)
applications.

Explainability is a potential stumbling block to using AI in industries that operate under strict regulatory
compliance requirements. For example, financial institutions in the United States operate under
regulations that require them to explain their credit-issuing decisions. When a decision to refuse credit is
made by AI programming, however, it can be difficult to explain how the decision was arrived at because
the AI tools used to make such decisions operate by teasing out subtle correlations between thousands of
variables. When the decision-making process cannot be explained, the program may be referred to
as black box AI.
Components of AI

As the hype around AI has accelerated, vendors have been scrambling to promote how their products and
services use AI. Often what they refer to as AI is simply one component of AI, such as machine learning.
AI requires a foundation of specialized hardware and software for writing and training machine learning
algorithms. No one programming language is synonymous with AI, but a few, including Python, R and
Java, are popular.
AI is not just one technology.
AI as a service (AIaaS)

Because hardware, software and staffing costs for AI can be expensive, many vendors are including AI
components in their standard offerings or providing access to artificial intelligence as a service (AIaaS)
platforms. AIaaS allows individuals and companies to experiment with AI for various business purposes
and sample multiple platforms before making a commitment.

Popular AI cloud offerings include the following:

 Amazon AI

 IBM Watson Assistant

 Microsoft Cognitive Services

 Google AI
Four 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:
 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.

Cognitive computing and AI

The terms AI and cognitive computing are sometimes used interchangeably, but, generally speaking, the
label AI is used in reference to machines that replace human intelligence by simulating how we sense,
learn, process and react to information in the environment.
The label cognitive computing is used in reference to products and services that mimic and augment
human thought processes
Examples of AI technology

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:

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. 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.
History of AI

The concept of inanimate objects endowed with intelligence has been around since ancient times. The
Greek god Hephaestus was depicted in myths as forging robot-like servants out of gold. Engineers in
ancient Egypt built statues of gods animated by priests. Throughout the centuries, thinkers from Aristotle
to the 13th century Spanish theologian Ramon Llull to René Descartes and Thomas Bayes used the tools
and logic of their times to describe human thought processes as symbols, laying the foundation for AI
concepts such as general knowledge representation.

The late 19th and first half of the 20th centuries brought forth the foundational work that would give rise to
the modern computer. In 1836, Cambridge University mathematician Charles Babbage and Augusta Ada
Byron, Countess of Lovelace, invented the first design for a programmable machine. In the 1940s,
Princeton mathematician John Von Neumann conceived the architecture for the stored-program computer
-- the idea that a computer's program and the data it processes can be kept in the computer's memory. And
Warren McCulloch and Walter Pitts laid the foundation for neural networks.

With the advent of modern computers, scientists could test their ideas about machine intelligence. One
method for determining whether a computer has intelligence was devised by the British mathematician
and World War II code-breaker Alan Turing in 1950. The Turing Test focused on a computer's ability to
fool interrogators into believing its responses to their questions were made by a human being.

The modern field of artificial intelligence is widely cited as starting in 1956 during a summer conference
at Dartmouth College. Sponsored by the Defense Advanced Research Projects Agency (DARPA), the
conference was attended by 10 luminaries in the field, including AI pioneers Marvin Minsky, Oliver
Selfridge and John McCarthy, who is credited with coining the term artificial intelligence. Also in
attendance were Allen Newell, a computer scientist, and Herbert A. Simon, an economist, political
scientist and cognitive psychologist, who presented their groundbreaking Logic Theorist, a computer
program capable of proving certain mathematical theorems and referred to as the first AI program.

In the wake of the Dartmouth College conference, leaders in the fledgling field of AI predicted that a
man-made intelligence equivalent to the human brain was around the corner, attracting major government
and industry support. Indeed, nearly 20 years of well-funded basic research generated significant
advances in AI: For example, in the late 1950s, Newell and Simon published the General Problem Solver
(GPS) algorithm, which fell short of solving complex problems but laid the foundations for developing
more sophisticated cognitive architectures; McCarthy developed Lisp, a language for AI programming
that is still used today. In the mid-1960s MIT Professor Joseph Weizenbaum developed ELIZA, an early
natural language processing program that laid the foundation for today's chatbots.

But the achievement of artificial general intelligence proved elusive, not imminent, hampered by
limitations in computer processing and memory and by the complexity of the problem. Government and
corporations backed away from their support of AI research, leading to a fallow period lasting from 1974
to 1980 and known as the first "AI Winter." In the 1980s, research on deep learning techniques and
industry's adoption of Edward Feigenbaum's expert systems sparked a new wave of AI enthusiasm, only
to be followed by another collapse of government funding and industry support. The second AI winter
lasted until the mid-1990s.

Support for the modern field of AI, 1956 to the present.

Increases in computational power and an explosion of data sparked an AI renaissance in the late 1990s
that has continued to present times. The latest focus on AI has given rise to breakthroughs in natural
language processing, computer vision, robotics, machine learning, deep learning and more. Moreover, AI
is becoming ever more tangible, powering cars, diagnosing disease and cementing its role in popular
culture. In 1997, IBM's Deep Blue defeated Russian chess grandmaster Garry Kasparov, becoming the
first computer program to beat a world chess champion. Fourteen years later, IBM's Watson captivated the
public when it defeated two former champions on the game show Jeopardy!. More recently, the historic
defeat of 18-time World Go champion Lee Sedol by Google DeepMind's AlphaGo stunned the Go
community and marked a major milestone in the development of intelligent machines.
Applications of AI
Artificial intelligence has made its way into a wide variety of markets. Here are eight 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.

 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.
AI in 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. Artificial intelligence and machine
learning in cybersecurity products are adding real value for security teams looking for ways to identify
attacks, malware and other threats.

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.

As a result, AI security technology both dramatically lowers the number of false positives and gives
organizations more time to counteract real threats before damage is done. The maturing technology is
playing a big role in helping organizations fight off cyberattacks.
Regulation of AI technology

Despite potential risks, there are currently few regulations governing the use of AI tools, and where laws
do exist, they typically pertain to AI indirectly. For example, as previously mentioned, United States Fair
Lending regulations require financial institutions to explain credit decisions to potential customers. This
limits the extent to which lenders can use deep learning algorithms, which by their nature are opaque and
lack explainability.
The Europe Union's General Data Protection Regulation (GDPR) puts strict limits on how enterprises can
use consumer data, which impedes the training and functionality of many consumer-facing AI
applications.

In October 2016, the National Science and Technology Council issued a report examining the potential
role governmental regulation might play in AI development, but it did not recommend specific legislation
be considered.

Crafting laws to regulate AI will not be easy, in part because AI comprises a variety of technologies that
companies use for different ends, and partly because regulations can come at the cost of AI progress and
development. The rapid evolution of AI technologies is another obstacle to forming meaningful regulation
of AI. Technology breakthroughs and novel applications can make existing laws instantly obsolete. For
example, existing laws regulating the privacy of conversations and recorded conversations do not cover
the challenge posed by voice assistants like Amazon's Alexa and Apple's Siri that gather but do not
distribute conversation -- except to the companies' technology teams which use it to improve machine
learning algorithms. And, of course, the laws that governments do manage to craft to regulate AI don't
stop criminals from using the technology with malicious intent.

efinition - What does Artificial Intelligence (AI) mean?


Artificial intelligence (AI), also known as machine intelligence, is a branch of computer science that aims
to imbue software with the ability to analyze its environment using either predetermined rules and search
algorithms, or pattern recognizing machine learning models, and then make decisions based on those
analyses.
In this way, AI attempts to mimic biological intelligence to allow the software application or system to act
with varying degrees of autonomy, thereby reducing manual human intervention for a wide range of
functions.

Thinking Outside the Box -- How to Dramatically Improve SQL Performance

Techopedia explains Artificial Intelligence (AI)


While AI often invokes images of the sentient computer overlord of science fiction, the current reality is
far different. At its heart, AI uses the same basic algorithmic functions that drive traditional software, but
applies them in a different way.
A standard warehouse management system, for example, can show the current levels of various products,
while an intelligent one could identify shortages, analyze the cause and its effect on the overall supply
chain, and even take steps to correct it.
Artificial intelligence can be allowed to replace a whole system, making all decisions end-to-end, or it can
be used to enhance a specific process.
For example, analyzing video footage to recognize gestures, or replacing peripheral devices (keyboard,
mouse, touchscreen) with a speech to text system., giving the impression that one is interacting with a
sentient being.
Just as philosophers debate the nature of man and the existence of free will, computer science experts
debate the various types of AI.

The Evolving Stages of Artificial Intelligence

Narrow (Weak) AI
Capable of performing only a limited set of predetermined functions; think, autonomous cars, retail
kiosks, etc.;

General (Strong) AI
Said to equal the human mind’s ability to function autonomously according to a wide set of stimuli;

Super AI
Which will one day exceed human intelligence (and conceivably take over the world).
At the moment, Narrow AI is only beginning to enter mainstream computing applications.

Four Distinct Categories of Artificial Intelligence

Reactive AI
Can only react to existing situations, not past experiences.

Limited Memory AI
Relies on stored data to learn from recent experiences to make decisions.

Theory of Mind AI
Capable of comprehending conversational speech, emotions, non-verbal cues and other intuitive
elements;

Self-Aware AI
Human-level consciousness with its own desires, goals and objectives.
A good way to visualize these distinctions would be an AI-driven poker player. A reactive machine would
base decisions only on the current hand in play, while a limited memory version would consider past
decisions and player profiles.
Using Theory of Mind, however, the program would pick up on speech and facial cues, and a self-aware
AI might start to consider if there is something more worthwhile to do than play poker.

Artificial Intelligence On a Practical Level


AI is currently being applied to a range of functions both in the lab and in commercial/consumer settings:

Speech Recognition
Allows intelligent systems to convert human speech into text or code.

Natural Language Processing


A subset of speech recognition, enables conversational interaction between humans and computers.
Computer Vision
Allows a machine to scan an image and identify it using comparative analysis.
Perhaps the most revolutionary aspect of AI, however, is that it allows software to rewrite itself as it
adapts to its environment.
Unlike traditional upgrade programs that take years and are often buggy, or even newer DevOps processes
that push changes quickly with less disruption, AI allows a given program to optimize itself to highly
specialized use cases.
This should not only lower the cost of software licensing and support, it should provide steadily
improving performance and the development of unique processes that deliver crucial advantages in an
increasingly competitive economy.

intelligent agent

INTELLIGENT AGENT
An intelligent agent is a program that can make decisions or perform a service based on its environment,
What is an intelligent agent?
Generally speaking, the aim of cognitive science is to understand the nature and workings of intelligent
systems. An intelligent system is something that processes internal information in order to do something
purposeful. A great many things satisfy that description: People, computers, robots, cats, sensory systems,
the list is endless. One sort of intelligent system of particular interest to cognitive scientists is that of an
artificial autonomous intelligent agent.
But what are they? Well, let's break the term down. An agent is anything that is capable of acting upon
information it perceives. An intelligent agent is an agent capable of making decisions about how it acts
based on experience. An autonomous intelligent agent is an intelligent agent that is free to choose
between different actions. As the term 'artificial' suggests, the sort of autonomous intelligent agents of
interest to us here are not the sorts of things we find in the wild. Rather, they are created. Hence, an
artificial autonomous intelligent agent is anything we create that is capable of actions based on
information it perceives, its own experiences, and its own decisions about which action it performs. Since
'artificial autonomous intelligent agent' is quite a mouthful, let's follow the convention of using 'intelligent
agent' or 'autonomous agent' for short.
Whether you are surfing the internet, shopping online, seeking a medical diagnosis, arranging for the
transport of some commodity, or planning a space mission to explore the asteroid belt, intelligent agents
are likely to play a key role in the process. These agents seize the initiative to seek the best plan of action
to accomplish their assigned goals in light of the current situation and past experience, and then act on
their environments. Intelligent agents are today being applied in a variety of areas, including: Distributed
Project Management, Electronic Commerce, Information Retrieval, Medical field, Military,
Manufacturing, Networking, Planning and Scheduling, and NASA Missions. (For articles and examples
of these applications see CLICK HERE.)
What disciplines support research and implementation of these special types of programs? The field of
computer agent theory combines research in cognitive science and artificial intelligence.
Cognitive science provides the information processing model of mental processes used to describe the
rational behavior of these agents in functional terms. Functional terms basically focus on what an agent
does in pursuit of its goals. For example, a web search agent may have the goal of obtaining web site
addresses that would best match the query or history of queries made by a customer. It could operate in
the background and deliver recommendations to the customer on a weekly basis. So its function is to map
a history of queries to recommended web sites and deliver these recommendations via email or some
other means of transmission. Diagrams can be used to represent the different modules that show how the
agent receives input (web site visit history of customer), interacts with the environment (e.g. the internet),
determines recommended web sites (decision procedure), communicates with other agents or data bases
(communication protocol), and acts on the environment (using its effectors (something that produces an
effect), e.g., transmission of email).
The field of artificial intelligence provides the technical skills for translating desired types of agent
behaviors into programming language, related software, and the appropriate architecture (hardware and
related software) for implementing the agent in a real or simulated world.
Since we are concerned first with the basic idea of agents, we begin by focusing on some basic concepts
employed in agent theory. The aim of agent theory is to define and understand the distinguishing features
of computer agents. Again, following what is now a convention, we will refer to such computer programs
as intelligent or autonomous agents.
In order to understand how such programs are different from other software programs, we will begin by
defining intelligent agents and then articulate this definition in more detail.
In order to get started, we first need a basic understanding of a generic agent, of which intelligent agents
are just one type. Then we can begin to specialize later.
Generic agent
An agent is anything that perceives an environment through sensors and acts upon it through effectors
(see Russel and Norvig, p. 31). This sounds simple enough.
This definition of agent covers a broad spectrum of machines, from thermostats (which do not learn
anything new) to worms (which can actually learn a small repertoire of behaviors) to humans (with the
greatest learning capacity, so far, on earth).
How does an agent perceive an environment? Sensors are the instruments employed by the agent to
gather information about its world. A keyboard and a video camera can function as sensors if they are
linked to an agent program. At the response end of the system, effectors are the instruments used by the
agent to act on its environment. A monitor, a printer, and a robotic arm are examples of effectors. Let us
look at the simplest type of agent, one that has a single mission, the thermostat.

Fig. 1: Thermostat agent


Notice that the thermostat agent responds to a very specific feature of the environment with only three
possible actions: turn heat on or turn heat off or take no action. Such an agent does not really qualify as
intelligent or autonomous, for as we shall see shortly, its repertoire of behaviors and lack of flexibility and
adaptability are just too limited to qualify as autonomous by definition.
Notice that even with a simple thermostat the environment determines the action of the agent and the
agent's action, in turn, modifies the environment, in a relationship of mutual determination. When the
temperature falls to 68 degrees Fahrenheit, the heat is turned on, but this brings the ambient temperature
of the room to 80 degrees, which triggers an action to turn the heater off. Mechanical governors on steam
and other types of engines function in a similar fashion.
The environment is generally the domain or world of the agent. These domains, at least for now, must be
limited to specific types of situations in order to avoid the unlimited possibilities of the every day world.
It is useful to distinguish two types of environments that impact on the computational challenges of agent
programs.
If the environment is effectively accessible, the agent's sensors give it complete information about the
state of affairs that are relevant to the agent's goals. The thermostat always has complete access to the
room temperature and does not have to store any information. Its model of the world is really the world
itself. Since such agents have access to whatever knowledge they need at any time, there is no need to
store the state of affairs internally. A motion detector need not store information about objects because at
any given time, all the relevant information is available to the sensors. It is when relevant information is
not effectively accessible that an agent may need to store information and be equipped with a priori
knowledge about certain features of its environment.
If the environment is deterministic, the future state of affairs is deducible from the current state of affairs;
nothing is left to chance. Board games have this feature, even though the trees of possibilities may extend
out into the billions of possible moves and counter-moves. Of course a non-deterministic world is in
principle unpredictable. Different environments pose different challenges to agent designers.
As we increase the complexity of the environment and the variety of problems that must be solved in
order for the agent to attain its goals, more flexibility and adaptability is required in the problem solving
computational processes of the agent.
We are now prepared to examine a more refined definition of intelligent or autonomous agent, one that
will better account for its distinguishing features.
Autonomous agent
Notice how the following definition includes the impact of the agent's own current behaviors on its own
future behaviors.
An autonomous agent is "a system situated within and a part of an environment that senses that
environment and acts on it, over time, in pursuit of its own agenda and so as to effect what it senses in the
future" (Franklin and Graesser).
This definition captures all of the basic features of intelligent agents except their sociability. It provides a
good approximation of the basic features of the large variety of intelligent agents now under development.
Let us take a close look at this definition.
Intelligent agents sense their environments. We have seen this feature of agents in the first definition. But
here the sensory data or percepts include not only data about other objects, but also about the impact of
the agent itself on the state of affairs in the environment. The sensors could be organic, like eyes and ears
and their neural processors, or artificial, like video and audio processors integrated into a digital
computer. The environment could be a very limited domain, like a blocks world, or very sophisticated
one, like the stock market or a set of asteroids. The sensors must be appropriate to the sort of objects with
which the agent is designed to interact. Whatever the sensors, the history of all percepts sensed by the
agent is critical to its future interaction with the environment.
The set of all percepts that an agent has to start with plus those gained by interaction with the
environment (experience) is the percept sequence of the agent. An intelligent agent consults its percept
sequence and the current state of affairs (which may be considered part of the total percept sequence) in
light of its goals before taking action. This means that intelligent computer agents, like human agents,
consult past experience and the current situation before deciding what course of action will further its
goals.
In order to save computational power, it is possible to narrow down the search for relevant percepts by
using short cuts. These short cuts, or heuristics, group percepts into classes of events so that the agent
need not consult all classes of events, but only those that might assist in attaining its goals given the
current state of affairs. If I am looking for two seats in a crowded movie theatre, I do not check every seat
one at a time to see if it is empty. I use a simple heuristic: look for gaps between people's heads and check
to see if those gaps indicate empty seats. This short cut will save me time so I do not miss the entire
movie.
Now that we have some understanding of a percept sequence, we may ask: In what way does the agent's
own actions form part of this sequence. The second definition states that the agent is considered a part of
the environment. This means the agent inhabits a world or domain. It is situated. And it senses the impact
of its own habitation. If I am waiting on line for a slice of pizza, my own behavior impacts on the overall
length of the line. It may happen that because I have joined the line another cashier is called to work a
second line. Thus my own impact on the world has changed the state of affairs to require a different sort
of behavior from all agents behind me as well as myself. Another example is familiar to anyone who
enjoys jumping in water. If I make a big splash in the pool, I then get to experience the series of ripples
generated by my antecedent action. Another example comes from the medical field. If a drug dispensing
agent has already administered half its prescribed dose to a patient, the amount already given alters the
amount to be given in the future (unless there is a computational malfunction, in which case the tragic
occurs). So when an agent acts on the environment, it senses the impact of its own acts, along with other
events that fall within its domain.
The intelligent agent also reacts to its environment. Just as the generic agent has both sensor and effector,
so too does the intelligent agent. But here things get a bit more interesting. A thermostat can react to its
environment by turning the heater off when it ÒsensesÓ the air temperature reach the threshold of 72
degrees Fahrenheit. A thermostat, however, is not an intelligent agent. A mechanical thermostat does not
even have a program. It is a dynamic system that is immediately related to the temperature of the
environment. By complicating the relation between sensing the environment and effecting the
environment, we can build up our concept of agency to the level of intelligence and autonomy. To see this
clearly, we will distinguish between a reflex agent, a goal-based agent, and a utility-based agent.
Reflex agent
A reflex agent is more complex then a mechanical thermostat. Rather than an immediate dynamic
relationship to its environment, the reflex agent basically looks up what it should do in a list of rules. A
reflex agent responds to a given percept with a pre-programmed response. Even if there are thousands of
possible reactions to a given percept, the agent has a built in list of situation action rules to execute those
reactions that have already been considered by the programmer. A situation action rule is basically a
hypothetical imperative. If situation X is the current state of affairs and goal Z requires plan Y, than
execute Y. Or even more simply, given X, execute Y. Thus for a medical diagnostic agent, if a certain set
of symptoms is present, given a certain medical history, offer X diagnosis. Some expert systems fall under
the category of reflex agent.

Fig. 2: Reflex Agent.


Reflex agents are really not very bright. They just cannot deal with novelty. If SARS is not in the database
of pathogens, and the patient has symptoms associated with SARS, the reflex agent will not seek to
update its records by consulting other agents. It will not accumulate experience that may indicate a new
disease is present. It will not proactively check on patients to see if there may be some better diagnosis. It
will not learn from its experience. If the percept is not in the reflex agent's database, the agent cannot
react appropriately to the situation.
One might argue that the simple mercury type thermostat also is a reflex agent with only three rules. If the
temperature reaches x, then turn the heater on. If the temperature reaches y, then turn the heater off.
Otherwise, do nothing. The main difference is that the reflex agent requires a program that is not itself
immediately and mechanically linked to the environment.
Goal based agent
An intelligent agent contains features of its less complex relatives, but it is not so limited. It acts in
accordance with an agenda. It has a goal or set of goals that it actively pursues. A goal-based agent has a
representation of the current state of the environment and how that environment generally works. It
pursues basic policies or goals that may not be immediately attainable. Such agents do not ÒliveÓ merely
in the moment as a thermostat does. These agents consider different scenarios before acting on their
environments, to see which action will probably attain a goal. This consideration of different scenarios is
called search and planning. It makes the agent proactive, not just reactive.
Another interesting feature of the goal-based agent is that it already has some model of how the objects in
its environment usually behave, so it can perform searches and identify plans based on this knowledge
about the world. Among the actions that can occur in the world are the agent's own actions. So the agent's
own possible actions are among the factors that will determine possible future scenarios.
An intelligent agent called Remote Agent (we are interested only in its Mode Identification and Recovery
feature, MIR) was used in 1999 to monitor the mechanical health of the Deep Space One NASA
spacecraft, among other tasks. (Click for MORE INFO.) In a report on technology used in this mission,
the software designers described the domain and concept as follows:

Fig. 3: Deep Space One (NASA photo)

DOMAIN:
Maintenance of internal spacecraft functioning, including automated vehicle health
maintenance.

CONCEPT:
Model-based vehicle health management uses sensor data plus a stored model of spacecraft
components and functions to reason about current state and to plan for recovery from system
faults. The Livingstone fault diagnosis and recovery kernel proved its value in the successful
Remote Agent Experiment (RAX) demonstration on Deep Space 1 (DS-1) in 1999.
Livingstone Model-based Health Management System, NASA Ames Research Center. Lee
Brownston (QSS/ARC), James Kurien (PARC), Pandu Nayak (RIACS), David Smith
(ARC/IC), Will Taylor (QSS/ARC). Group Lead: Mark Shirley (ARC/IC)

A health and safety agent on board a NASA spacecraft monitors the technical (not human) systems on
board the spacecraft for any faults or signs of danger. If Remote Agent were a mere reflex agent, it would
have to have a look up table for every possible scenario, which would take up too many computational
resources and probably tax any engineer's imagination. As the agent developers of Remote Space pointed
out in their report:
Software systems for vehicle monitoring, diagnosis, and control can be very complex, difficult to develop,
difficult to debug and validate, and difficult or dangerous to modify during a mission. The software must
allow for multiple simultaneous component failures -- possibly including sensor noise or failures -- and
provide rapid response even to situations unforeseen [sic] by design engineers.
Remote Agent then, has the adaptability and flexibility to respond to novel faults in the technical systems
on board the spacecraft. This does not mean Remote Agent was perfect. The behavior of even the ideal
goal-based agent is not going to always be perfect with regard to attaining all of its goals. In the limited
world of games, good moves can sometimes be deduced with certainty. But in the real life word we live
in, nothing is certain, and operations on the environment only get us, at best, likely success. The same
kind of limitations impact on the intelligent computer agents in analogous ways, even in the very limited
domains in which, so far, they are designed to operate. (To see a simulation of Remote Agent in action,
see http://ic.arc.nasa.gov/projects/remote-agent/applet/TimelineApplet.html)
Let us now look at a basic goal-based agent in more detail. In the following diagram notice how the
agent's own actions modify the environment, thereby causing the agent to update its percept sequence.

Fig. 4: Goal-based agent, adapted and simplified, from Russel and Norvig, p. 44.
Notice that the sensors proactively receive percepts to form a percept sequence. This percept sequence,
combined with a model of the environment, brings about an updated model of the agents world. Now
given the current state of the world and the goals of the agent, the agent can decide on an appropriate
action to change its environment. The matching of the agent's percept sequence with an appropriate action
is called mapping.
If the mapping procedure goes well, the percept sequence should lead to actions which further the goals
of the agent, given the current state of affairs. This raises an interesting question about how the sensors
gather percepts. How is it that relevant precepts are collected by the sensors and not just irrelevant
garbage?
The autonomous agent is pro-active. Its percepts come about because of the manner in which it probes the
environment. The sensors of the agent do not aim at just any data from the environment, but useful data,
that is, percepts that may enhance its chances of performing future actions that promote its goals. Thus an
agent that measures light waves from its environment will employ a spectrometer, not an oscilloscope, to
probe its environment. In this sense, the agent effects what it will sense in the future, for it positions itself,
by aiming at the right percepts, for future opportunities to achieve its goals. Of course the agent also
generally effects what it will sense in the future merely by acting on its environment, for these very acts
will bring about a new state of affairs that will itself be sensed by the agent.
Mapping raises a very important issue about autonomous agents versus other types of software. If a
program is designed with a look up table that provides a specific action for all possible percepts of its
world, we would have a program that always performs the right actions. The main problem with such a
program is that it requires a very predictable world. Another problem is that, even if its world were
predictable, it may be humanly impossible to create a table for all possible percepts. Even a chess game,
with a limited number of pieces, would generate millions of possible percepts, making it impractical to
design a master level chess playing program with mere look up tables. This is why agent designers
introduce flexibility and adaptability into their agents.
Flexibility is the capability to assess the probable outcomes to different possible actions as opposed to
following one pre-scripted plan. Adaptability is the capability to make adjustments, including changing
the current intention or action plan, given significant changes in the state of affairs, in order to promote
the goal or goals. Both of these features rely on decision procedures to arrive at productive, rational
decisions.
The two main fields of AI that study decision procedures based on percepts are Search and Planning. For
our purposes here, the decision procedures used by the agent program determines the general manner in
which the percept sequence leads to actions. It gives us the formula for mapping. I say general manner,
because with intelligent agents, the programmer does not always know exactly what its progeny will do,
given the large amount of computations that might involve just a few moments of activity.
How does mapping get to have some impact on the environment? The agent architecture is the machinery
and software that runs the agent program. The architecture might be a Digital Computer with audio
processors. Or it may be a robot with audio, visual, and even tactile sensors and programs that link the
sensors to the agent program and the agent effectors. The effectors are the instruments the agent's uses to
effect the world. This could be a simple email communication, the use of sophisticated scientific
instruments, or a manipulation of objects in the world.
Utility-based agent
We will now add one more feature to our goal-based agent, to make it even more adaptive. In the more
sophisticated agents, a utility measure is applied to the different possible actions that can be performed in
the environment. This sophisticated planner is a utility-based agent. The utility-based agent will rate each
scenario to see how well it achieves certain criteria with regard to the production of a good outcome.
Things like the probability of success, the resources needed to execute the scenario, the importance of the
goal to be achieved, the time it will take, might all be factored in to the utility function calculations.

Fig. 5: Utility-based agent, adapted from Russel and Norvig, p. 45.


So far we have conceived of intelligent agents as rational utility maximizers that proactively pursue their
goals. But what exactly makes them autonomous? They are autonomous, in part, because their behaviors
are based not only on built in knowledge about their world, but also on their percept sequence. This
percept sequence is not always predictable, especially in the case of non-deterministic, dynamic
environments. It is the sensors of the agent which allow it to take input from the constantly changing
world so that it can employ a decision procedure to map its percept sequence on to a plan of action in
pursuit of its goals. Learning programs may also be implemented in the agent in order that the agent,
through trial and error in novel situations, may still pursue its goals.
Since the programmer cannot generally predict every state of the world that will be confronted by the
agent, the number of rules she would have to write for a reflex agent would be astronomical even in very
simple domains, like scheduling meetings or arranging transportation routes and deliveries. But by giving
the agent some goals, the ability to constantly reassess its situation, the ability to learn through trial and
error, and in addition giving it a number of plans and ways of evaluating those plans as they become
possible paths to the goal, the agent gets an enormous amount of flexibility and adaptability.
With our definition of intelligent agent in view, we are now prepared to examine the basic control loop
written by agent theorist Michael Wooldridge (2000):

BASIC CONTROL LOOP OF AN AUTONOMOUS AGENT


while true
2. observe the world;
3. update internal world model;
4. deliberate about what intention to achieve;
5. use means/ends reasoning to get a plan for the intention
6. execute the plan
7. end while

This model needs some interpretation. The agent observes the world means the agent, using its sensors,
collects percepts. A sensor may be the keyboard attached to a digital computer or a visual processor
attached to a robot. It can be anything that enables the agent to collect percepts about the world.
Updating the internal world model means the agent adds the new percept to its percept sequence and pre-
programmed information about the world. Such additions may alter the world model in small or large
ways.
Deliberation about what intention to achieve, given the updated world model, is based on the overall
goals of the agent. A new percept may alter the opportunities for achieving certain goals and call for a
change of plans.
Once a decision is made about what intention to achieve, the agent consults its plan library and/or its
decision procedures (e.g., means/ends reasoning) for determining what means to use to reach its end.
Finally, the agent executes the plan, provided no new percept calls for an altering of its current intention.
If we add to this model the ability to learn from interacting with other agents, human and computer, we
increase the flexibility and adaptability of the agent and add to its computational resources.
What is missing from the second definition of intelligent agent is the sociability of intelligent agents.
Most agent theory now employs multi-agent system (MAS) design that employs a community of agents to
pursue the goals. MAS helps to overcome resource limitations of isolated agents by having agents share
information and complement each other's functions. (SEE MODULE 2 on MAS)
Taxonomy of agents
There is no consensus on how to classify agents. This is because there is no agreed upon taxonomy of
agents. With this in mind, let us begin to classify the different types of agents, using some suggestions
from the field of agent theory. Charles Pettrie, Stan Franklin, Art Glaesser, and other agent theorists,
suggest that we provide an operational definition. So we will try to describe the agent's basic components
and specify what the agent seeks to accomplish. Using the above definition as a guide, we specify an
autonomous agent by describing its:
Environment (this must be a dynamic description, that is, a description of a state of affairs that changes
over time as real life situations do).
Sensing capabilities (this depends on the sensor equipment; it determines the sort of data the agent is
capable of receiving as input).
Actions (this would be a change in the environment brought about by the agent, requiring the agent to
update its model of the world, which in turn may cause the agent to change its immediate intention).
Desires (these are the overall policies or goals of the agent).
Action Selection Architecture (the agent decides what to due next by consulting both its internal state,
the state of the world, and its current goal; then it uses decision making procedures to select an action).
Using these guidelines, we might define the MIR component of Remote Agent in the following manner:

MIR Component of Remote Agent


Environment: Spacecraft mechanical systems
Sensing Capabilities: Telemetry points (monitors are placed in every on- board system).
Actions: Detect faults and correct faults; report to earth station
Desires: Maintain health and safety of spacecraft systems.
Action Selection Architecture: According to NASA, this agent "compares the sensor data with
its model of what the components should be doing given the spacecraft's current activities." If
there is an inconsistency, it diagnoses the most likely cause and sends that information to a
separate module for action. (The hardware and specific software used are here omitted.)

What Is an Intelligent Agent?


Siri and Alexa are intelligent agents because they use sensors, such as microphones and other inputs, to
perceive a request and they draw on their collective experience and knowledge via supercomputers and
data banks all over the world to make a decision. The amount of information these intelligent agents are
exposed to grows and develops as they get to know more about their users and gather new data as it is
presented in the world.
By definition, an intelligent agent is anything that can make decisions about how to react or respond
based on how it perceives its environment and its experiences. Siri is able to retrieve information about
the weather, scores, or world capitals (or anything you ask) based on its perception of its environment.
It does so through the use of sensors and delivers the end result through actuators. If you compare
sensors and actuators to the human world, sensors would be things like ears or eyes we use to observe or
perceive the world around us. Actuators are items like our voice that we can use to respond to something
we've heard, for example. With intelligent agents, sensors are things like cameras and microphones that
can receive, and actuators include speakers and voice files that perform tasks such as transmit information
or put other devices into action.
Think about the world of self-driving cars. These are types of intelligent agents. They make decisions
about their environment (the highways and roads they travel) based on sensors such as GPS, cameras and
computer applications in order to maneuver the car through steering and braking (actuators) to help
passengers arrive their destination safely.

Agents in Artificial Intelligence


Artificial intelligence is defined as a study of rational agents. A rational agent could be anything which
makes decisions, as a person, firm, machine, or software. It carries out an action with the best outcome
after considering past and current percepts(agent’s perceptual inputs at a given instance).
An AI system is composed of an agent and its environment. The agents act in their environment. The
environment may contain other agents. An agent is anything that can be viewed as :
 perceiving its environment through sensors and
 acting upon that environment through actuators
Note : Every agent can perceive its own actions (but not always the effects)

To understand the structure of Intelligent Agents, we should be familiar with Architecture and Agent
Program. Architecture is the machinery that the agent executes on. It is a device with sensors and
actuators, for example : a robotic car, a camera, a PC. Agent program is an implementation of an agent
function. An agent function is a map from the percept sequence(history of all that an agent has perceived
till date) to an action.
Agent = Architecture + Agent Program

Examples of Agent:-
A software agent has Keystrokes, file contents, received network packages which act as sensors and
displays on the screen, files, sent network packets acting as actuators.
A Human agent has eyes, ears, and other organs which act as sensors and hands, legs, mouth, and other
body parts acting as actuators.
A Robotic agent has Cameras and infrared range finders which act as sensors and various motors acting
as actuators.

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
 Learning Agent

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 :
 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 collection of rules need to be updated.

Model-based reflex agents


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 information about :
 how the world evolves in-dependently from the agent, and
 how the agent actions affects the world.
Goal-based agents
These kind 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 the 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 a 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.

Learning Agent
A learning agent in AI is the type of agent which can learn from its past experiences or it has learning
capabilities.
It starts to act with basic knowledge and then able to act and adapt automatically through learning.
A learning agent has mainly four conceptual components, which are:
1. Learning element :It is responsible for making improvements by learning from the environment
2. Critic: Learning element takes feedback from critic which describes how well the agent is doing
with respect to a fixed performance standard.
3. Performance element: It is responsile for selecting external action
4. Problem Generator: This component is responsible for suggesting actions that will lead to new
and informative experiences.

AI - Popular Search Algorithms


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 Pathfinding 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 pathfinding problems are Travelling Salesman Problem, Rubik’s
Cube, and Theorem Proving.

Search Terminology
 Problem Space − It is the environment in which the search takes place. (A set of states and set of
operators to change those states)
 Problem Instance − It is Initial state + Goal state.
 Problem Space Graph − It represents problem state. States are shown by nodes and operators
are shown by edges.
 Depth of a problem − Length of a shortest path or shortest sequence of operators from Initial
State to goal state.
 Space Complexity − The maximum number of nodes that are stored in memory.
 Time Complexity − The maximum number of nodes that are created.
 Admissibility − A property of an algorithm to always find an optimal solution.
 Branching Factor − The average number of child nodes in the problem space graph.
 Depth − Length of the shortest path from initial state to goal state.

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

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
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 = d, then number of
nodes at level d = bd.
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 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 b and 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.

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.

Understanding Search Algorithms In Artificial Intelligence

Anything you do, it start with a search! AI has solutions to these everyday problems. Lets understand

BFS, DFS and more…

Throughout history, humans have been searching for something. Search made us who we are today. In

ancient times, foragers used to search for the essential things to live. They created some tools to make this

search easier. The human brain also evolved in this process. Now it could create a mental map of the

territory and foragers could map the regions into their own mind and search more efficiently. Even in

modern times, we are basically using the same strategy we used before. But now, we have more advanced

tools and our minds have evolved more. We use maps to find the way, tools like google maps are the best

example of how we have developed ourselves to search more efficiently.

The most significant advancement we have done in our search is due to our change in technique. In

computer science we call this term an Algorithm. As our brain became more capable, we created more

complex and more efficient algorithms. We developed these to tackle more complex problems. Algorithms

can make our lives simpler and make us more efficient. From the day to day tasks to even creating a world

class Artificial Intelligence, searching algorithms are the basis of all human endeavour. In this blog we

will see two of the most basic searching algorithms that will build the foundation of our understanding

towards more complex algorithms.


Let’s not make this explanation bland. We will take a real-life(LoL) example to understand the evolution of

the search itself. Alright(?)

So apparently I have a girlfriend, Lisa(at least in my imagination). She’s smart and extremely picky about

all the things she uses. The other day, she lost her lipstick somewhere. It was her favourite shade. Like I

said she’s extremely picky, she won’t settle for other shade or any other brand. But the problem is that

lipstick is extremely rare and she’s freaked out. Now she’s planning to buy a new one. Stores near us are

very generous; they will guide her to the other stores if they don’t have it. There are few ways she can start

her search, let’s understand them one by one.

Breadth First Search (BFS)

fig 1. Step 1 in BFS

Lisa is an organised girl. Also, knows some beauty shops near her house. She lists down their names on a

paper. Let’s say there is some shop A, shop B and shop C. She will enter the names of shops on the list and

will visit one by one in a sequential order from top to bottom, starting with shop A. Alas!, shop A don’t

have that shade but they suggested her other shops where they might have it. She listed down those names

as Shop D and Shop E. She will follow the list. Next stop, Shop B. Again they don’t have it but they

suggested her some other shops. She listed them as well, Shop F and Shop G. Next, Shop C. Now she went

to Shop C. They don’t have it either but they couldn't suggest any shops to her. In the end Lisa’s list looks

like this.
fig 2. Step 2 in BFS

In the next step she will visit the Shop D which was suggested by Shop A’s owner. If they don’t have it

they will suggest her some other shops too. She will add these shops in the list and continue visiting the

shops one by one in a sequential manner until she finds that damn lipstick. And she got successful. She

found it in some shop which was suggested by shop G’s owner. That was Shop J. Let’s draw a map of all

these shops she visited. A connection between two shops signifies that particular shop is suggested by the

other shop. In formal terms we call this map as a Graph or in this case, a Tree.

fig 3. BFS MAP (The digits on the lines represents the sequence in which she visited those shops.)
It was not the easy task but she got her favourite lipstick. You can observe that Lisa went to the shops

suggested by the same shop owner in sequential order. We call this approach the Breadth First

Search(BFS) algorithm as we search first all the options available that are previously known and add new

options to visit down the road. But the problem with this approach is that it can create redundancy. Observe

the case of shop K where shop it can be reached from both shop F and G. And both the times she will visit

the shop(consider she’s dumb). The BFS has this rule to visit all the nodes in the way. It doesn’t matter if

they have been visited already.

Depth First Search (DFS)

In our previous approach, Lisa had to visit almost 10 shops to get lipstick. Let’s see if we can make Lisa’s

search more efficient. Let’s try another approach.This time Lisa will list down the suggested shops in a

different way than before. This time when she will get the suggestion from a certain shop, she will add it to

the top of the list. Initial list will have three shops, same as BFS. After visiting shop A, her list would look

like this.

fig 4. step 1 in DFS


She will mark the shops she has visited already. She will follow the same top-down approach. So her next

stop would be shop D. She will add shop D and shop E on the top. Shop D’s owner told her to visit the

shop I. She went there but couldn’t find lipstick and the shop I’s owner didn’t tell her any other shop. Lisa

has visited all the shops above shop E. Now her list looks like this.

fig 5. Step 2 in DFS

This process of going back to the shop A’s suggestion is called Backtracking in formal terms. Shop E’s

owner would tell her to go shop J(added on the top of the list) and bingo! She found her favourite lipstick.
Let’s put that graph again.

fig 6. DFS MAP (The digits on the lines represents the sequence in which she visited those shops.)

Lisa went in the depth of the search tree instead of going to the shops on the same level. We call this

approach the Depth First Search algorithm. You can see in the graph that Lisa has to visit only 5 shops,

much less as compared to our BFS approach. So, we can say that our DFS approach is better than BFS.

Also, if she would have visited shop K through shop F then she wouldn’t have visited it through shop G.

Because she would have marked it already. Hence, there she will not visit the same shop more than once by

this approach.
Stack and Queue

Let’s focus on Lisa’s list. Just by changing the way she enters new entries, she improved her search

significantly. We call this list a data structure. A data structure is a way to store data somewhere in the

computer memory. In Lisa’s case, she stored it on the paper. But this storing of data is different for BFS

and DFS.

In BFS, she added the new elements at the end of her list and followed the list in the top-down approach.

The shops that are added newly in her list are visited after the previous ones i.e. First In First

Out(FIFO) approach. We call this type of data structure a Queue. It works the same as the queue we make

at the airport. The first customer gets the service first. In the queue new elements are added from the back

while older elements are removed from the front and this is what Lisa did exactly in BFS.

In DFS, Lisa added new elements at the top of the list. She did not change her top-down order. In this

approach, newer elements are visited before the older ones i.e. Last In First Out(LIFO). We call this data

structure a Stack. In stack, elements are added from the one end and from that same end they are removed,

in Lisa’s case it was the top of her list where she added the new shops and visited the shops sequentially.

Conclusion

DFS is a better algorithm than the BFS because of two reasons.

1. It does not create redundancy in the data structure thus it does not visit the same node that has been

visited already.

2. It is computationally easier and more efficient than BFS.

Although, there are some problems with our both algorithms. If we have a larger map with thousands of

nodes(shops), these algorithms are not efficient to find the target node. Look at the DFS map, if we had
shop L as target node, the performance of DFS would not be much significantly better than BFS. While

BFS has a problem of searching for all the nodes, DFS can waste its time searching in the wrong direction.

To solve these problems we have much better algorithms such as Heuristic algorithms that are actually

being used in AI systems. But that’s the blog for another day.

In the previous series of blogs, we have seen the different structures of the agents based on the nature of

the environment it is operating in. In the current series, we will discuss more on the goal-based agent, and

the search algorithms that gives the ‘solution’ to the ‘problem’ in these agents.

As mentioned previously, these blogs are very similar to the book “Artificial Intelligence: A Modern

Approach”. In fact, this series can be seen as a shorthand version of the book.

Types of Goal-based agents

We have seen that the reflex agents, whose actions are a direct mapping from the states of the environment,

consumes a large space to store the mapping table and is inflexible. The goal-based agents consider the

long-term actions and the desirability of the outcome, which is easier to train and is adaptable to the

changing environment.

There are two kinds of goal-based agents: problem-solving agents and planning agents. Problem-solving

agents consider each states of the world as indivisible, with no internal structure of the states visible to the

problem-solving algorithms. Planning agents split up each state into variables and

establishes relationship between them.

In this series, we will discuss more on problem-solving agents and the algorithms associated with them.

We’ll keep the discussion on the planning agents for some other time.
In this post (and further too), as an example to explain the various algorithms, we consider the problem of

traveling from one place to another (single-source single-destination path). Figure 1 gives the road-map of

a part of Romania.

Figure 1: A simplified road map of part of Romania.

The problem is to travel from Arad to Bucharest in a day. For the agent, the goal will be to reach Bucharest

the following day. Courses of action that doesn’t make agent to reach Bucharest on time can be rejected

without further consideration, making the agent’s decision problem simplified.

Problem definition and formulation

Before we jump on to finding the algorithm for evaluating the problem and searching for the solution, we

first need to define and formulate the problem.

Problem formulation involves deciding what actions and states to consider, given the goal. For example, if

the agent were to consider the action to be at the level of “move the left foot by one inch” or “turn the

steering wheel by 1 degree left”, there would be too many steps for the agent to leave the parking lot, let

alone to Bucharest. In general, we need to abstract the state details from the representation.
A problem can be defined formally by 5 components:

1. The initial state of the agent. In this case, the initial state can be described as In: Arad

2. The possible actions available to the agent, corresponding to each of the state the agent resides in.

For example, ACTIONS(In: Arad) = {Go: Sibiu, Go: Timisoara, Go: Zerind}

3. The transition model describing what each action does. Let us represent it by RESULT(s, a)

where s is the state the action is currently in and a is the action performed by the agent. In this

example, RESULT(In: Arad, Go: Zerind) = In: Zerind.

4. The goal test, determining whether the current state is a goal state. Here, the goal state is {In:

Bucharest}

5. The path cost function, which determine the cost of each path, which is reflecting in the

performance measure. For the agent trying to reach Bucharest, time is essential, so we can set the cost

function to be the distance between the places. (Here, we are ignoring the other factors that influence

the traveling time). By convention, we define the cost function as c(s, a, s’), where s is the current

state and a is the action performed by the agent to reach state s’.

The initial state, the actions and the transition model together define the state space of the problem — the

set of all states reachable by any sequence of actions. Figure 1 is the graphical representation of the state

space of the traveling problem. A path in the state space is a sequence of states connected by a sequence of

actions.

The solution to the given problem is defined as the sequence of actions from the initial state to the goal

states. The quality of the solution is measured by the cost function of the path, and an optimal solution has

the lowest path cost among all the solutions.


Searching for Solutions

We can form a search tree from the state space of the problem to aid us in finding the solution. The initial

state forms the root node and the branches from each node are the possible actions from the current node

(state) to the child nodes (next states).

Figure 2: Partial search tree for finding route from Arad to Bucharest. The nodes Arad and Sibiu are
opened

The six nodes in Figure 2, which don’t have any children (at least until now) are leaf nodes. The set of all

leaf nodes available for expansion at any given point is called the frontier. The search strategy involves

the expansion of the nodes in the frontier until the solution (or the goal state) is found (or there are no more

nodes to expand).

We have to notice one peculiar thing in the search tree in Figure 2. There is a path from Arad to Sibiu, and

back to Arad again. We say that In(Arad) is a repeated state, generated by a loopy path. This means that

the search tree for Romania is infinite, even though the search space is limited. These loopy paths makes

some of the algorithms to fail, making the problem seem unsolvable. In fact, a loopy path is a special case

of redundant paths, where there are more than one paths from one state to another (for example, Arad —

Sibiu and Arad — Zerind — Oradea — Sibiu).


The redundant path situation occurs in almost every problem, and often makes the solution algorithm less

efficient, worsening the performance of the searching agent. One way to eliminate the redundancy is to

utilize the advantage given by the problem definition itself. For example, in the case of traveling from Arad

to Bucharest, since the path costs are additive and step costs are non-negative, only one path among the

various redundant paths has the least cost (and it is the shortest distance between the two states), and loopy

paths are never better than the same path with loops removed.

Another idea to avoid exploring redundant paths is to remember which states have been visited previously.

Along with the search tree, an explored set is maintained which contains all the states previously visited.

Newly generates which matches the previously generated nodes can be discarded. In this way, every step

moves the states in the frontier into the explored region, and some states in the unexplored region into the

frontier, until the solution is found.

Figure 3: The separation property of the above mentioned algorithm, as exploration is increased from the
root (leftmost image) to its immediate successors (rightmost image). The frontier (white nodes) always
separates the explores states (black) and the unexplored ones (gray).

Performance measure of Problem-solving Algorithms

We can evaluate an algorithm’s performance with these metrics:

1. Completeness: Is the algorithm guaranteed to find a solution if there exist one?

2. Optimality: Does the algorithm find the optimal solution?


3. Time complexity: How long does it take for the algorithm to find a solution?

4. Space complexity: How much memory is consumed in finding the solution?

In graph theory, the time and space complexity is measured using |V| and |E|, where V and E are the

number of vertices and the number of edges in the graph respectively. But in AI, we explore the state space

(which is a graph) of the problem using its equivalent search tree. So it is meaningful if we use b and d to

measure the complexity, where b is the branching factor of the tree (maximum number of successors of

any node) and d is the depth of the shallowest goal node.

Summary

In this post we have discussed how to define the problem so as to assist in formulation of the problem and

to effectively find a solution. We have also seen the use of search tree in finding the solution and the ways

to avoid the problem of redundancy. Finally, we have listed the metrics for measuring the performance of

the search algorithms.

In the next blog, we will discuss the classical search algorithms,starting with uninformed search algorithms

and then moving on to heuristic, or informed search algorithms.


Comparison of Various Algorithms Complexities
Let us see the performance of algorithms based on various criteria −
Breadth Depth First Uniform Interactive Deepening
Criterion Bidirectional
First Cost

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

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 number
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

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


 h(n) estimated cost to get from the node to the goal
 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.
Disadvantage − It can get stuck in loops. It is not optimal.
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 BeamSearch( problem, k), returns a solution state.
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

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.
Start
 Initialize k = 0; L = integer number of variables;
 From i → j, search the performance difference Δ.
 If Δ <= 0 then accept else if exp(-Δ/T(k)) > random(0,1) then accept;
 Repeat steps 1 and 2 for L(k) steps.
 k = k + 1;
Repeat steps 1 through 4 till the criteria is met.
End

Travelling Salesman Problem


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

Problem-solving in Artificial Intelligence


The reflex agents are known as the simplest agents because they directly map states into actions.
Unfortunately, these agents fail to operate in an environment where the mapping is too large to store and
learn. Goal-based agent, on the other hand, considers future actions and the desired outcomes.
Here, we will discuss one type of goal-based agent known as a problem-solving agent, which uses
atomic representation with no internal states visible to the problem-solving algorithms.
Problem-solving agent
The problem-solving agent perfoms precisely by defining problems and its several solutions.
According to psychology, “a problem-solving refers to a state where we wish to reach to a definite goal
from a present state or condition.”
According to computer science, a problem-solving is a part of artificial intelligence which encompasses a
number of techniques such as algorithms, heuristics to solve a problem.
Therefore, a problem-solving agent is a goal-driven agent and focuses on satisfying the goal.
Steps performed by Problem-solving agent
 Goal Formulation: It is the first and simplest step in problem-solving. It organizes the
steps/sequence required to formulate one goal out of multiple goals as well as actions to achieve
that goal. Goal formulation is based on the current situation and the agent’s performance measure
(discussed below).
 Problem Formulation: It is the most important step of problem-solving which decides what
actions should be taken to achieve the formulated goal. There are following five components
involved in problem formulation:
 Initial State: It is the starting state or initial step of the agent towards its goal.
 Actions: It is the description of the possible actions available to the agent.
 Transition Model: It describes what each action does.
 Goal Test: It determines if the given state is a goal state.
 Path cost: It assigns a numeric cost to each path that follows the goal. The problem-solving agent
selects a cost function, which reflects its performance measure. Remember, an optimal solution
has the lowest path cost among all the solutions.
Note: Initial state, actions, and transition model together define the state-space of the problem
implicitly. State-space of a problem is a set of all states which can be reached from the initial state
followed by any sequence of actions. The state-space forms a directed map or graph where nodes are the
states, links between the nodes are actions, and the path is a sequence of states connected by the sequence
of actions.
 Search: It identifies all the best possible sequence of actions to reach the goal state from the
current state. It takes a problem as an input and returns solution as its output.
 Solution: It finds the best algorithm out of various algorithms, which may be proven as the best
optimal solution.
 Execution: It executes the best optimal solution from the searching algorithms to reach the goal
state from the current state.
Example Problems
Basically, there are two types of problem approaches:
 Toy Problem: It is a concise and exact description of the problem which is used by the
researchers to compare the performance of algorithms.
 Real-world Problem: It is real-world based problems which require solutions. Unlike a toy
problem, it does not depend on descriptions, but we can have a general formulation of the
problem.
Some Toy Problems
 8 Puzzle Problem: Here, we have a 3×3 matrix with movable tiles numbered from 1 to 8 with a
blank space. The tile adjacent to the blank space can slide into that space. The objective is to
reach a specified goal state similar to the goal state, as shown in the below figure.
 In the figure, our task is to convert the current state into goal state by sliding digits into the blank
space.
In the above figure, our task is to convert the current(Start) state into goal state by sliding digits into the
blank space.
The problem formulation is as follows:
 States: It describes the location of each numbered tiles and the blank tile.
 Initial State: We can start from any state as the initial state.
 Actions: Here, actions of the blank space is defined, i.e., either left, right, up or down
 Transition Model: It returns the resulting state as per the given state and actions.
 Goal test: It identifies whether we have reached the correct goal-state.
 Path cost: The path cost is the number of steps in the path where the cost of each step is 1.
Note: The 8-puzzle problem is a type of sliding-block problem which is used for testing new search
algorithms in artificial intelligence.
 8-queens problem: The aim of this problem is to place eight queens on a chessboard in an order
where no queen may attack another. A queen can attack other queens either diagonally or in
same row and column.
From the following figure, we can understand the problem as well as its correct solution.
It is noticed from the above figure that each queen is set into the chessboard in a position where no other
queen is placed diagonally, in same row or column. Therefore, it is one right approach to the 8-queens
problem.
For this problem, there are two main kinds of formulation:
 Incremental formulation: It starts from an empty state where the operator augments a queen at
each step.
Following steps are involved in this formulation:
 States: Arrangement of any 0 to 8 queens on the chessboard.
 Initial State: An empty chessboard
 Actions: Add a queen to any empty box.
 Transition model: Returns the chessboard with the queen added in a box.
 Goal test: Checks whether 8-queens are placed on the chessboard without any attack.
 Path cost: There is no need for path cost because only final states are counted.
In this formulation, there is approximately 1.8 x 1014 possible sequence to investigate.
 Complete-state formulation: It starts with all the 8-queens on the chessboard and moves them
around, saving from the attacks.
Following steps are involved in this formulation
 States: Arrangement of all the 8 queens one per column with no queen attacking the other queen.
 Actions: Move the queen at the location where it is safe from the attacks.
This formulation is better than the incremental formulation as it reduces the state space from 1.8 x
1014 to 2057, and it is easy to find the solutions.
Some Real-world problems
 Traveling salesperson problem(TSP): It is a touring problem where the salesman can visit
each city only once. The objective is to find the shortest tour and sell-out the stuff in each city.
 VLSI Layout problem: In this problem, millions of components and connections are positioned
on a chip in order to minimize the area, circuit-delays, stray-capacitances, and maximizing the
manufacturing yield.
The layout problem is split into two parts:
 Cell layout: Here, the primitive components of the circuit are grouped into cells, each performing
its specific function. Each cell has a fixed shape and size. The task is to place the cells on the chip
without overlapping each other.
 Channel routing: It finds a specific route for each wire through the gaps between the cells.
 Protein Design: The objective is to find a sequence of amino acids which will fold into 3D
protein having a property to cure some disease.
Searching for solutions
We have seen many problems. Now, there is a need to search for solutions to solve them.
In this section, we will understand how searching can be used by the agent to solve a problem.
For solving different kinds of problem, an agent makes use of different strategies to reach the goal by
searching the best possible algorithms. This process of searching is known as search strategy.
Measuring problem-solving performance
Before discussing different search strategies, the performance measure of an algorithm should be
measured. Consequently, there are four ways to measure the performance of an algorithm:
Completeness: It measures if the algorithm guarantees to find a solution (if any solution exist).
Optimality: It measures if the strategy searches for an optimal solution.
Time Complexity: The time taken by the algorithm to find a solution.
Space Complexity: Amount of memory required to perform a search.
The complexity of an algorithm depends on branching factor or maximum number of
successors, depth of the shallowest goal node (i.e., number of steps from root to the path) and the
maximum length of any path in a state space.
Search Strategies
There are two types of strategies that describe a solution for a given problem:
Uninformed Search (Blind Search)
This type of search strategy does not have any additional information about the states except the
information provided in the problem definition. They can only generate the successors and distinguish a
goal state from a non-goal state. These type of search does not maintain any internal state, that’s why it is
also known as Blind search.
There are following types of uninformed searches:
 Breadth-first search
 Uniform cost search
 Depth-first search
 Depth-limited search
 Iterative deepening search
 Bidirectional search
Informed Search (Heuristic Search)
This type of search strategy contains some additional information about the states beyond the problem
definition. This search uses problem-specific knowledge to find more efficient solutions. This search
maintains some sort of internal states via heuristic functions (which provides hints), so it is also
called heuristic search.
There are following types of informed searches:
 Best first search (Greedy search)
 A* search
Uninformed Search Strategies – Artificial Intelligence
July 9, 2019
by

Breadth-first search (BFS)


It is a simple search strategy where the root node is expanded first, then covering all other successors of
the root node, further move to expand the next level nodes and the search continues until the goal node is
not found.
BFS expands the shallowest (i.e., not deep) node first using FIFO (First in first out) order. Thus, new
nodes (i.e., children of a parent node) remain in the queue and old unexpanded node which are shallower
than the new nodes, get expanded first.
In BFS, goal test (a test to check whether the current state is a goal state or not) is applied to each
node at the time of its generation rather when it is selected for expansion.

Breadth-first
search tree
In the above figure, it is seen that the nodes are expanded level by level starting from the root node A till
the last node I in the tree. Therefore, the BFS sequence followed is: A->B->C->D->E->F->G->I.
BFS Algorithm
 Set a variable NODE to the initial state, i.e., the root node.
 Set a variable GOAL which contains the value of the goal state.
 Loop each node by traversing level by level until the goal state is not found.
 While performing the looping, start removing the elements from the queue in FIFO order.
 If the goal state is found, return goal state otherwise continue the search.
The performance measure of BFS is as follows:
 Completeness: It is a complete strategy as it definitely finds the goal state.
 Optimality: It gives an optimal solution if the cost of each node is same.
 Space Complexity: The space complexity of BFS is O(bd), i.e., it requires a huge amount of
memory. Here, b is the branching factor and d denotes the depth/level of the tree
 Time Complexity: BFS consumes much time to reach the goal node for large instances.
Disadvantages of BFS
 The biggest disadvantage of BFS is that it requires a lot of memory space, therefore it is a
memory bounded strategy.
 BFS is time taking search strategy because it expands the nodes breadthwise.
Note: BFS expands the nodes level by level, i.e., breadthwise, therefore it is also known as a Level
search technique.
Uniform-cost search
Unlike BFS, this uninformed search explores nodes based on their path cost from the root node. It
expands a node n having the lowest path cost g(n), where g(n) is the total cost from a root node to node n.
Uniform-cost search is significantly different from the breadth-first search because of the following two
reasons:
 First, the goal test is applied to a node only when it is selected for expansion not when it is first
generated because the first goal node which is generated may be on a suboptimal path.
 Secondly, a goal test is added to a node, only when a better/optimal path is found.
Thus, uniform-cost search expands nodes in a sequence of their optimal path cost because before
exploring any node, it searches the optimal path. Also, the step cost is positive so, paths never get shorter
when a new node is added in the search.

Uniform-cost search on a binary tree


In the above figure, it is seen that the goal-state is F and start/initial state is A. There are three paths
available to reach the goal node. We need to select an optimal path which may give the lowest total cost
g(n). Therefore, A->B->E->F gives the optimal path cost i.e., 0+1+3+4=8.
Uniform-cost search Algorithm
 Set a variable NODE to the initial state, i.e., the root node and expand it.
 After expanding the root node, select one node having the lowest path cost and expand it further.
Remember, the selection of the node should give an optimal path cost.
 If the goal node is searched with optimal value, return goal state, else carry on the search.
The performance measure of Uniform-cost search
 Completeness: It guarantees to reach the goal state.
 Optimality: It gives optimal path cost solution for the search.
 Space and time complexity: The worst space and time complexity of the uniform-cost search
is O(b1+LC*/ᵋ˩).
Note: When the path cost is same for all the nodes, it behaves similar to BFS.
Disadvantages of Uniform-cost search
 It does not care about the number of steps a path has taken to reach the goal state.
 It may stick to an infinite loop if there is a path with infinite zero cost sequence.
 It works hard as it examines each node in search of lowest cost path.
Depth-first search
This search strategy explores the deepest node first, then backtracks to explore other nodes. It uses LIFO
(Last in First Out) order, which is based on the stack, in orderto expand the unexpanded nodes in the
search tree. The search proceeds to the deepest level of the tree where it has no successors. This search
expands nodes till infinity, i.e., the depth of the tree.

DFS search tree


In the above figure, DFS works starting from the initial node A (root node) and traversing in one direction
deeply till node I and then backtrack to B and so on. Therefore, the sequence will be A->B->D->I->E-
>C->F->G.
DFS Algorithm
 Set a variable NODE to the initial state, i.e., the root node.
 Set a variable GOAL which contains the value of the goal state.
 Loop each node by traversing deeply in one direction/path in search of the goal node.
 While performing the looping, start removing the elements from the stack in LIFO order.
 If the goal state is found, return goal state otherwise backtrack to expand nodes in other
direction.
The performance measure of DFS
 Completeness: DFS does not guarantee to reach the goal state.
 Optimality: It does not give an optimal solution as it expands nodes in one direction deeply.
 Space complexity: It needs to store only a single path from the root node to the leaf node.
Therefore, DFS has O(bm) space complexity where b is the branching factor(i.e., total no. of
child nodes, a parent node have) and m is the maximum length of any path.
 Time complexity: DFS has O(bm) time complexity.
Disadvantages of DFS
 It may get trapped in an infinite loop.
 It is also possible that it may not reach the goal state.
 DFS does not give an optimal solution.
Note: DFS uses the concept of backtracking to explore each node in a search tree.
Depth-limited search
This search strategy is similar to DFS with a little difference. The difference is that in depth-limited
search, we limit the search by imposing a depth limit l to the depth of the search tree. It does not need to
explore till infinity. As a result, the depth-first search is a special case of depth-limited search. when
the limit l is infinite.

Depth-limited search on a binary tree


In the above figure, the depth-limit is 1. So, only level 0 and 1 get expanded in A->B->C DFS sequence,
starting from the root node A till node B. It is not giving satisfactory result because we could not reach
the goal node I.
Depth-limited search Algorithm
 Set a variable NODE to the initial state, i.e., the root node.
 Set a variable GOAL which contains the value of the goal state.
 Set a variable LIMIT which carries a depth-limit value.
 Loop each node by traversing in DFS manner till the depth-limit value.
 While performing the looping, start removing the elements from the stack in LIFO order.
 If the goal state is found, return goal state. Else terminate the search.
The performance measure of Depth-limited search
 Completeness: Depth-limited search does not guarantee to reach the goal node.
 Optimality: It does not give an optimal solution as it expands the nodes till the depth-limit.
 Space Complexity: The space complexity of the depth-limited search is O(bl).
 Time Complexity: The time complexity of the depth-limited search is O(bl).
Disadvantages of Depth-limited search
 This search strategy is not complete.
 It does not provide an optimal solution.
Note: Depth-limit search terminates with two kinds of failures: the standard failure value indicates “no
solution,” and cut-off value, which indicates “no solution within the depth-limit.”
Iterative deepening depth-first search/Iterative deepening search
This search is a combination of BFS and DFS, as BFS guarantees to reach the goal node and DFS
occupies less memory space. Therefore, iterative deepening search combines these two advantages of
BFS and DFS to reach the goal node. It gradually increases the depth-limit from 0,1,2 and so on and reach
the goal node.
In the above figure, the goal node is H and initial depth-limit =[0-1]. So, it will expand level 0 and 1 and
will terminate with A->B->C sequence. Further, change the depth-limit =[0-3], it will again expand the
nodes from level 0 till level 3 and the search terminate with A->B->D->F->E->H sequence where H is
the desired goal node.
Iterative deepening search Algorithm
 Explore the nodes in DFS order.
 Set a LIMIT variable with a limit value.
 Loop each node up to the limit value and further increase the limit value accordingly.
 Terminate the search when the goal state is found.
The performance measure of Iterative deepening search
 Completeness: Iterative deepening search may or may not reach the goal state.
 Optimality: It does not give an optimal solution always.
 Space Complexity: It has the same space complexity as BFS, i.e., O(bd).
 Time Complexity: It has O(d) time complexity.
Disadvantages of Iterative deepening search
 The drawback of iterative deepening search is that it seems wasteful because it generates states
multiple times.
Note: Generally, iterative deepening search is required when the search space is large, and the depth of
the solution is unknown.
Bidirectional search
The strategy behind the bidirectional search is to run two searches simultaneously–one forward search
from the initial state and other from the backside of the goal–hoping that both searches will meet in
the middle. As soon as the two searches intersect one another, the bidirectional search terminates with the
goal node. This search is implemented by replacing the goal test to check if the two searches intersect.
Because if they do so, it means a solution is found.
The performance measure of Bidirectional search
 Complete: Bidirectional search is complete.
 Optimal: It gives an optimal solution.
 Time and space complexity: Bidirectional search has O(bd/2)
Disadvantage of Bidirectional Search
 It requires a lot of memory space.
Informed Search/Heuristic Search
July 16, 2019
by

An informed search is more efficient than an uninformed search because in informed search, along with
the current state information, some additional information is also present, which make it easy to reach the
goal state.
Below we have discussed different types of informed search:
Best-first Search (Greedy search)
A best-first search is a general approach of informed search. Here, a node is selected for expansion based
on an evaluation function f(n), where f(n) interprets the cost estimate value. The evaluation function
expands that node first, which has the lowest cost. A component of f(n) is h(n) which carries the
additional information required for the search algorithm, i.e.,
h(n)= estimated cost of the cheapest path from the current node n to the goal node.
Note: If the current node n is a goal node, the value of h(n) will be 0.
Best-first search is known as a greedy search because it always tries to explore the node which is nearest
to the goal node and selects that path, which gives a quick solution. Thus, it evaluates nodes with the help
of the heuristic function, i.e., f(n)=h(n).
Best-first search Algorithm
1. Set an OPEN list and a CLOSE list where the OPEN list contains visited but unexpanded nodes
and the CLOSE list contains visited as well as expanded nodes.
2. Initially, traverse the root node and visit its next successor nodes and place them in the OPEN
list in ascending order of their heuristic value.
3. Select the first successor node from the OPEN list with the lowest heuristic value and expand
further.
4. Now, rearrange all the remaining unexpanded nodes in the OPEN list and repeat above two steps.
5. If the goal node is reached, terminate the search, else expand further.

In the above figure, the root node is A, and its next level successor nodes
are B and C with h(B)=2 and h(C)=4. Our task is to explore that node which has the lowest h(n) value.
So, we will select node B and expand it further to node D and E. Again, search out that node which has
the lowest h(n) value and explore it further.
The performance measure of Best-first search Algorithm:
 Completeness: Best-first search is incomplete even in finite state space.
 Optimality: It does not provide an optimal solution.
 Time and Space complexity: It has O(bm) worst time and space complexity, where m is the
maximum depth of the search tree. If the quality of the heuristic function is good, the
complexities could be reduced substantially.
Note: Best first searches combines the advantage of BFS and DFS to find the best solution.
Disadvantages of Best-first search
 BFS does not guarantees to reach the goal state.
 Since the best-first search is a greedy approach, it does not give an optimized solution.
 It may cover a long distance in some cases.
A* Search Algorithm
A* search is the most widely used informed search algorithm where a node n is evaluated by combining
values of the functions g(n)and h(n). The function g(n) is the path cost from the start/initial node to a
node n and h(n) is the estimated cost of the cheapest path from node n to the goal node. Therefore,
we have
f(n)=g(n)+h(n)
where f(n) is the estimated cost of the cheapest solution through n.
So, in order to find the cheapest solution, try to find the lowest values of f(n).
Let’s see the below example to understand better.

In the above example, S is the root node, and G is the goal node. Starting from the root node S and
moving towards its next successive nodes A and B. In order to reach the goal node G, calculate the f(n)
value of node S, A and B using the evaluation equation i.e.
f(n)=g(n)+h(n)
Calculation of f(n) for node S:
f(S)=(distance from node S to S) + h(S)
 0+10=10.
Calculation of f(n) for node A:
f(A)=(distance from node S to A)+h(A)
 2+12=14
Calculation of f(n) for node B:
f(B)=(distance from node S to B)+h(B)
 3+14=17
Therefore, node A has the lowest f(n) value. Hence, node A will be explored to its next level nodes C and
D and again calculate the lowest f(n) value. After calculating, the sequence we get is S->A–>D->G with
f(n)=13(lowest value).
How to make A* search admissible to get an optimized solution?
A* search finds an optimal solution as it has the admissible heuristic function h(n) which believes that the
cost of solving a problem is less than its actual cost. A heuristic function can
either underestimate or overestimate the cost required to reach the goal node. But an admissible
heuristic function never overestimates the cost value required to reach the goal state. Underestimating the
cost value means the cost we assumed in our mind is less than the actual cost. Overestimating the cost
value means the cost we assumed is greater than the actual cost, i.e.,

Here, h(n) is the actual heuristic cost value and h’(n) is the estimated heuristic cost value.
Note: An overestimated cost value may or may not lead to an optimized solution, but an underestimated
cost value always lead to an optimized solution.
Let’s understand with the help of an example:
Consider the below search tree where the starting/initial node is A and goal node is E. We have different
paths to reach the goal node E with their different heuristic costs h(n) and path costs g(n). The actual
heuristic cost is h(n)=18. Let’s suppose two different estimation values:
h1′(n)= 12 which is underestimated cost value
h2′ (n)= 25 which is overestimated cost value

So, when the cost value is overestimated, it will not take any load to search the best optimal path and
acquire the first optimal path. But if the h(n) value is underestimated, it will try and reach the best optimal
value of h(n) which will lead to a good optimal solution.
Note: Underestimation of h(n) leads to a better optimal solution instead of overestimating the value.
The performance measure of A* search
 Completeness: The star(*) in A* search guarantees to reach the goal node.
 Optimality: An underestimated cost will always give an optimal solution.
 Space and time complexity: A* search has O(bd) space and time complexities.
Disadvantage of A* search
 A* mostly runs out of space for a long period.
AO* search Algorithm
AO* search is a specialized graph based on AND/OR operation. It is a problem decomposition strategy
where a problem is decomposed into smaller pieces and solved separately to get a solution required to
reach the desired goal. Although A*search and AO* search, both follow best-first search order, but they
are dissimilar from one another.
Let’s understand AO* working with the help of the below example:

Here, the destination/ goal is to eat some food. We have two ways, either order food from any restaurant
or buy some food ingredients and cook to eat food. Thus, we can apply any of the two ways, the choice
depends on us. It is not guaranteed whether the order will be delivered on time, food will be tasty or not,
etc. But if we will purchase and cook it, we will be more satisfied.
Therefore, the AO* search provides two ways to choose either OR or AND. It is better to
choose AND rather OR to get a good optimal solution.
Heuristic Functions in Artificial Intelligence

Heuristic Functions
As we have already seen that an informed search make use of heuristic functions in order to reach the
goal node in a more prominent way. Therefore, there are several pathways in a search tree to reach the
goal node from the current node. The selection of a good heuristic function matters certainly. A good
heuristic function is determined by its efficiency. More is the information about the problem, more is the
processing time.
Some toy problems, such as 8-puzzle, 8-queen, tic-tac-toe, etc., can be solved more efficiently with the
help of a heuristic function. Let’s see how:
Consider the following 8-puzzle problem where we have a start state and a goal state. Our task is to slide
the tiles of the current/start state and place it in an order followed in the goal state. There can be four
moves either left, right, up, or down. There can be several ways to convert the current/start state to the
goal state, but, we can use a heuristic function h(n) to solve the problem more efficiently.
A heuristic function for the 8-puzzle problem is defined below:
h(n)=Number of tiles out of position.
So, there is total of three tiles out of position i.e., 6,5 and 4. Do not count the empty tile present in the
goal state). i.e. h(n)=3. Now, we require to minimize the value of h(n) =0.
We can construct a state-space tree to minimize the h(n) value to 0, as shown below:

It is seen from the above state space tree that the goal state is minimized from h(n)=3 to h(n)=0. However,
we can create and use several heuristic functions as per the reqirement. It is also clear from the above
example that a heuristic function h(n) can be defined as the information required to solve a given problem
more efficiently. The information can be related to the nature of the state, cost of transforming from
one state to another, goal node characterstics, etc., which is expressed as a heuristic function.
Properties of a Heuristic search Algorithm
Use of heuristic function in a heuristic search algorithm leads to following properties of a heuristic search
algorithm:
 Admissible Condition: An algorithm is said to be admissible, if it returns an optimal solution.
 Completeness: An algorithm is said to be complete, if it terminates with a solution (if the
solution exists).
 Dominance Property: If there are two admissible heuristic
algorithms A1 and A2 having h1 and h2 heuristic functions, then A1 is said to
dominate A2 if h1 is better than h2 for all the values of node n.
 Optimality Property: If an algorithm is complete, admissible, and dominating other
algorithms, it will be the best one and will definitely give an optimal solution.
Local Search Algorithms and Optimization Problem
The informed and uninformed search expands the nodes systematically in two ways:
 keeping different paths in the memory and
 selecting the best suitable path,
Which leads to a solution state required to reach the goal node. But beyond these “classical search
algorithms,” we have some “local search algorithms” where the path cost does not matters, and only
focus on solution-state needed to reach the goal node.
A local search algorithm completes its task by traversing on a single current node rather than multiple
paths and following the neighbors of that node generally.
Although local search algorithms are not systematic, still they have the following two advantages:
 Local search algorithms use a very little or constant amount of memory as they operate only on a
single path.
 Most often, they find a reasonable solution in large or infinite state spaces where the classical or
systematic algorithms do not work.
Does the local search algorithm work for a pure optimized problem?
Yes, the local search algorithm works for pure optimized problems. A pure optimization problem is one
where all the nodes can give a solution. But the target is to find the best state out of all according to
the objective function. Unfortunately, the pure optimization problem fails to find high-quality solutions
to reach the goal state from the current state.
Note: An objective function is a function whose value is either minimized or maximized in different
contexts of the optimization problems. In the case of search algorithms, an objective function can be the
path cost for reaching the goal node, etc.
Working of a Local search algorithm
Let’s understand the working of a local search algorithm with the help of an example:
Consider the below state-space landscape having both:
 Location: It is defined by the state.
 Elevation: It is defined by the value of the objective function or heuristic cost function.
The local search algorithm explores the above landscape by finding the following two points:
 Global Minimum: If the elevation corresponds to the cost, then the task is to find the lowest
valley, which is known as Global Minimum.
 Global Maxima: If the elevation corresponds to an objective function, then it finds the highest
peak which is called as Global Maxima. It is the highest point in the valley.
We will understand the working of these points better in Hill-climbing search.
Below are some different types of local searches:
 Hill-climbing Search
 Simulated Annealing
 Local Beam Search
We will discuss above searches in the next section.
Note: Local search algorithms do not burden to remember all the nodes in the memory; it operates on
complete state-formulation.
Hill Climbing Algorithm
Hill Climbing Algorithm
Hill climbing search is a local search problem. The purpose of the hill climbing search is to climb a hill
and reach the topmost peak/point of that hill. It is based on the heuristic search technique where the
person who is climbing up on the hill estimates the direction which will lead him to the highest peak.

State-space Landscape of Hill climbing algorithm


To understand the concept of hill climbing algorithm, consider the below landscape representing the goal
state/peak and the current state of the climber. The topographical regions shown in the figure can be
defined as:
 Global Maximum: It is the highest point on the hill, which is the goal state.
 Local Maximum: It is the peak higher than all other peaks but lower than the global maximum.
 Flat local maximum: It is the flat area over the hill where it has no uphill or downhill. It is a
saturated point of the hill.
 Shoulder: It is also a flat area where the summit is possible.
 Current state: It is the current position of the person.
Types of Hill climbing search algorithm
There are following types of hill-climbing search:
 Simple hill climbing
 Steepest-ascent hill climbing
 Stochastic hill climbing
 Random-restart hill climbing

Simple hill climbing search


Simple hill climbing is the simplest technique to climb a hill. The task is to reach the highest peak of the
mountain. Here, the movement of the climber depends on his move/steps. If he finds his next step better
than the previous one, he continues to move else remain in the same state. This search focus only on his
previous and next step.
Simple hill climbing Algorithm
1. Create a CURRENT node, NEIGHBOUR node, and a GOAL node.
2. If the CURRENT node=GOAL node, return GOAL and terminate the search.
3. Else CURRENT node<= NEIGHBOUR node, move ahead.
4. Loop until the goal is not reached or a point is not found.
Steepest-ascent hill climbing
Steepest-ascent hill climbing is different from simple hill climbing search. Unlike simple hill climbing
search, It considers all the successive nodes, compares them, and choose the node which is closest to the
solution. Steepest hill climbing search is similar to best-first search because it focuses on each node
instead of one.
Note: Both simple, as well as steepest-ascent hill climbing search, fails when there is no closer node.
Steepest-ascent hill climbing algorithm
1. Create a CURRENT node and a GOAL node.
2. If the CURRENT node=GOAL node, return GOAL and terminate the search.
3. Loop until a better node is not found to reach the solution.
4. If there is any better successor node present, expand it.
5. When the GOAL is attained, return GOAL and terminate.
Stochastic hill climbing
Stochastic hill climbing does not focus on all the nodes. It selects one node at random and decides
whether it should be expanded or search for a better one.
Random-restart hill climbing
Random-restart algorithm is based on try and try strategy. It iteratively searches the node and selects the
best one at each step until the goal is not found. The success depends most commonly on the shape of the
hill. If there are few plateaus, local maxima, and ridges, it becomes easy to reach the destination.
Limitations of Hill climbing algorithm
Hill climbing algorithm is a fast and furious approach. It finds the solution state rapidly because it is quite
easy to improve a bad state. But, there are following limitations of this search:
 Local Maxima: It is that peak of the mountain which is highest than all its neighboring states but
lower than the global maxima. It is not the goal peak because there is another peak higher than it.

 Plateau: It is a flat surface area where no uphill exists. It becomes difficult for the climber to
decide that in which direction he should move to reach the goal point. Sometimes, the person gets
lost in the flat area.
 Ridges: It is a challenging problem where the person finds two or more local maxima of the same
height commonly. It becomes difficult for the person to navigate the right point and stuck to that
point itself.

Simulated Annealing
Simulated annealing is similar to the hill climbing algorithm. It works on the current situation. It picks a
random move instead of picking the best move. If the move leads to the improvement of the current
situation, it is always accepted as a step towards the solution state, else it accepts the move having a
probability less than 1. This search technique was first used in 1980 to solve VLSI layout problems. It
is also applied for factory scheduling and other large optimization tasks.
Local Beam Search
Local beam search is quite different from random-restart search. It keeps track of k states instead of just
one. It selects k randomly generated states, and expand them at each step. If any state is a goal state, the
search stops with success. Else it selects the best k successors from the complete list and repeats the same
process. In random-restart search where each search process runs independently, but in local beam search,
the necessary information is shared between the parallel search processes.
Disadvantages of Local Beam search
 This search can suffer from a lack of diversity among the k states.
 It is an expensive version of hill climbing search.
Note: A variant of Local Beam Search is Stochastic Beam Search which selects k successors at random
rather than choosing the best k successors.

Differences in Artificial Intelligence

Difference between Intelligence and Artificial Intelligence


Intelligence Artificial Intelligence

It is a natural process or quality given to human beings. It is programmed using human intelligence.

It is not hereditary but a copy of human


It is an actual hereditary.
intelligence.

A human brain does not require any electricity to show Artificial intelligence requires electricity to get
his intelligence. an output.

Execution speed is higher than the human


Execution speed of a human brain is less.
brain.

Human intelligence can handle different situations in a It is designed to handle only a few types of
better way. problems.

A human brain is analog. An artificial brain is digital.


Difference between Strong AI and Weak AI
Strong AI Weak AI

A computer machine gets capable of thinking A computer machine gets a ‘thinking’ like feature to
atleast equal to human beings. make it more powerful.

A machine can perform tasks on its own, just like A machine can perform tasks but need human
human beings. intervention.

A computer program adds an algorithm itself to act


Here, tasks to be performed are added manually.
in different situations.

This type of AI allows machines to solve problems This type of AI allows machines to solve problems
in an unlimited domain. in a limited domain.

It is an independent AI which can take the decision It is dependent on humans and can simulate like
on its own. human beings.

Currently, strong AI does not exist in the real world. Weak AI is in its advance phase of working.
There is no proper example of it. Example: Automatic car, APPLE Siri, etc.
Difference between Uninformed Search and Informed Search
Uninformed Search Informed Search

It is a search strategy which carries some


It is a search strategy with no additional information.
additional information with the current state
It only contains the current state information.
information.

It is less efficient to use uninformed search


It is more efficient search technique.
technique.

It may take more time to reach the goal node. It mostly reaches the goal state in limited time.

May or may not give an optimal solution. Mostly provides an optimal solution.

It is also known as Blind Search because it searches It is also known as Heuristic Search as it searches
the goal blindly without having the prior knowledge. the goal with the help of some prior knowledge.

An uninformed search requires more computation. An informed search require less computation.

BFS, DFS, Uniform cost search are types of Best first search, A* search are types of informed
uninformed search. search.
Difference between BFS and DFS
BFS DFS

It extends for Breadth-first search. It extends for Depth-first search.

It searches a node breadthwise, i.e., covering each It searches a node depthwise, i.e., covering one
level one by one. path deeply.

It uses the queue to store data in the memory. It uses the stack to store data in the memory.

BFS is a vertex-based algorithm. DFS is an edge-based algorithm.

The structure of a BFS tree is wide and short. The structure of a DFS tree is narrow and long.

The oldest unexpanded node is its first priority to


The nodes along the edge are explored first.
explore it.

BFS is used to examine bipartite graph, connected DFS is used to examine a two-edge connected
path as well as shortest path present in the graph. graph, acyclic graph, and also the topological order.
Difference between A* search and AO* search
A* search AO* search

A* search is an OR graph algorithm. AO* search is an AND/OR graph algorithm.


It finds more than one solution by combining one or more
It finds only one solution.
branches.

It follows the best-first search


It also follows the best-first search strategy.
strategy.
Adversarial Search in Artificial Intelligence
Adversarial search is a game-playing technique where the agents are surrounded by a competitive
environment. A conflicting goal is given to the agents (multiagent). These agents compete with one
another and try to defeat one another in order to win the game. Such conflicting goals give rise to the
adversarial search. Here, game-playing means discussing those games where human
intelligence and logic factor is used, excluding other factors such as luck factor. Tic-tac-toe, chess,
checkers, etc., are such type of games where no luck factor works, only mind works.
Mathematically, this search is based on the concept of ‘Game Theory.’ According to game theory, a
game is played between two players. To complete the game, one has to win the game and the other
looses automatically.’

Techniques required to get the best optimal solution


There is always a need to choose those algorithms which provide the best optimal solution in a limited
time. So, we use the following techniques which could fulfill our requirements:
 Pruning: A technique which allows ignoring the unwanted portions of a search tree which make
no difference in its final result.
 Heuristic Evaluation Function: It allows to approximate the cost value at each level of the
search tree, before reaching the goal node.
Elements of Game Playing search
To play a game, we use a game tree to know all the possible choices and to pick the best one out. There
are following elements of a game-playing:
 S0: It is the initial state from where a game begins.
 PLAYER (s): It defines which player is having the current turn to make a move in the state.
 ACTIONS (s): It defines the set of legal moves to be used in a state.
 RESULT (s, a): It is a transition model which defines the result of a move.
 TERMINAL-TEST (s): It defines that the game has ended and returns true.
 UTILITY (s,p): It defines the final value with which the game has ended. This function is also
known as Objective function or Payoff function. The price which the winner will get i.e.
 (-1): If the PLAYER loses.
 (+1): If the PLAYER wins.
 (0): If there is a draw between the PLAYERS.
For example, in chess, tic-tac-toe, we have two or three possible outcomes. Either to win, to lose, or to
draw the match with values +1,-1 or 0.
Let’s understand the working of the elements with the help of a game tree designed for tic-tac-toe. Here,
the node represents the game state and edges represent the moves taken by the players.

A game-tree for tic-tac-toe


 INITIAL STATE (S0): The top node in the game-tree represents the initial state in the tree and
shows all the possible choice to pick out one.
 PLAYER (s): There are two players, MAX and MIN. MAX begins the game by picking one
best move and place X in the empty square box.
 ACTIONS (s): Both the players can make moves in the empty boxes chance by chance.
 RESULT (s, a): The moves made by MIN and MAX will decide the outcome of the game.
 TERMINAL-TEST(s): When all the empty boxes will be filled, it will be the terminating state
of the game.
 UTILITY: At the end, we will get to know who wins: MAX or MIN, and accordingly, the price
will be given to them.
Types of algorithms in Adversarial search
In a normal search, we follow a sequence of actions to reach the goal or to finish the game optimally.
But in an adversarial search, the result depends on the players which will decide the result of the game.
It is also obvious that the solution for the goal state will be an optimal solution because the player will try
to win the game with the shortest path and under limited time.
There are following types of adversarial search:
 Minmax Algorithm
 Alpha-beta Pruning.
Note: The types of adversarial search are discussed in the next section.

Minimax Strategy
In artificial intelligence, minimax is a decision-making strategy under game theory, which is used to
minimize the losing chances in a game and to maximize the winning chances. This strategy is also known
as ‘Minmax,’ ’MM,’ or ‘Saddle point.’ Basically, it is a two-player game strategy where if one wins, the
other loose the game. This strategy simulates those games that we play in our day-to-day life. Like, if two
persons are playing chess, the result will be in favor of one player and will unfavor the other one. The
person who will make his best try,efforts as well as cleverness, will surely win.
We can easily understand this strategy via game tree– where the nodes represent the states of the game
and edges represent the moves made by the players in the game. Players will be two namely:
 MIN: Decrease the chances of MAX to win the game.
 MAX: Increases his chances of winning the game.
They both play the game alternatively, i.e., turn by turn and following the above strategy, i.e., if one wins,
the other will definitely lose it. Both players look at one another as competitors and will try to defeat one-
another, giving their best.
In minimax strategy, the result of the game or the utility value is generated by a heuristic function by
propagating from the initial node to the root node. It follows the backtracking technique and backtracks
to find the best choice. MAX will choose that path which will increase its utility value and MIN will
choose the opposite path which could help it to minimize MAX’s utility value.
MINIMAX Algorithm
MINIMAX algorithm is a backtracking algorithm where it backtracks to pick the best move out of several
choices. MINIMAX strategy follows the DFS (Depth-first search) concept. Here, we have two
players MIN and MAX, and the game is played alternatively between them, i.e., when MAX made a
move, then the next turn is of MIN. It means the move made by MAX is fixed and, he cannot change it.
The same concept is followed in DFS strategy, i.e., we follow the same path and cannot change in the
middle. That’s why in MINIMAX algorithm, instead of BFS, we follow DFS.
 Keep on generating the game tree/ search tree till a limit d.
 Compute the move using a heuristic function.
 Propagate the values from the leaf node till the current position following the minimax strategy.
 Make the best move from the choices.
For example, in the above figure, the two players MAX and MIN are there. MAX starts the game by
choosing one path and propagating all the nodes of that path. Now, MAX will backtrack to the initial
node and choose the best path where his utility value will be the maximum. After this,
its MIN chance. MIN will also propagate through a path and again will backtrack, but MIN will choose
the path which could minimize MAX winning chances or the utility value.
So, if the level is minimizing, the node will accept the minimum value from the successor nodes. If the
level is maximizing, the node will accept the maximum value from the successor.
Note: The time complexity of MINIMAX algorithm is O(bd) where b is the branching factor and d is the
depth of the search tree.

Alpha-beta Pruning | Artificial Intelligence


July 29, 2019
by

Alpha-beta pruning is an advance version of MINIMAX algorithm. The drawback of minimax strategy is
that it explores each node in the tree deeply to provide the best path among all the paths. This increases its
time complexity. But as we know, the performance measure is the first consideration for any optimal
algorithm. Therefore, alpha-beta pruning reduces this drawback of minimax strategy by less exploring the
nodes of the search tree.
The method used in alpha-beta pruning is that it cutoff the search by exploring less number of nodes. It
makes the same moves as a minimax algorithm does, but it prunes the unwanted branches using the
pruning technique (discussed in adversarial search). Alpha-beta pruning works on two threshold values,
i.e., α (alpha) and β (beta).
 α: It is the best highest value, a MAX player can have. It is the lower bound, which represents
negative infinity value.
 β: It is the best lowest value, a MIN player can have. It is the upper bound which represents
positive infinity.
So, each MAX node has α-value, which never decreases, and each MIN node has β-value, which never
increases.
Note: Alpha-beta pruning technique can be applied to trees of any depth, and it is possible to prune the
entire subtrees easily.
Working of Alpha-beta Pruning
Consider the below example of a game tree where P and Q are two players. The game will be played
alternatively, i.e., chance by chance. Let, P be the player who will try to win the game by maximizing its
winning chances. Q is the player who will try to minimize P’s winning chances. Here, α will represent
the maximum value of the nodes, which will be the value for P as well. β will represent the minimum
value of the nodes, which will be the value of Q.

 Any one player will start the game. Following the DFS order, the player will choose one path and
will reach to its depth, i.e., where he will find the TERMINAL value.
 If the game is started by player P, he will choose the maximum value in order to increase its
winning chances with maximum utility value.
 If the game is started by player Q, he will choose the minimum value in order to decrease the
winning chances of A with the best possible minimum utility value.
 Both will play the game alternatively.
 The game will be started from the last level of the game tree, and the value will be chosen
accordingly.
 Like in the below figure, the game is started by player Q. He will pick the leftmost value of the
TERMINAL and fix it for beta (β). Now, the next TERMINAL value will be compared with the
β-value. If the value will be smaller than or equal to the β-value, replace it with the current β-
value otherwise no need to replace the value.
 After completing one part, move the achieved β-value to its upper node and fix it for the other
threshold value, i.e., α.
 Now, its P turn, he will pick the best maximum value. P will move to explore the next part only
after comparing the values with the current α-value. If the value is equal or greater than the
current α-value, then only it will be replaced otherwise we will prune the values.
 The steps will be repeated unless the result is not obtained.
 So, number of pruned nodes in the above example are four and MAX wins the game with the
maximum UTILITY value, i.e.,3
The rule which will be followed is: “Explore nodes if necessary otherwise prune the unnecessary
nodes.”
Note: It is obvious that the result will have the same UTILITY value that we may get from the
MINIMAX strategy.

Constraint Satisfaction Problems in Artificial Intelligence


Constraint Satisfaction Problems in Artificial Intelligence
We have seen so many techniques like Local search, Adversarial search to solve different problems. The
objective of every problem-solving technique is one, i.e., to find a solution to reach the goal. Although, in
adversarial search and local search, there were no constraints on the agents while solving the problems
and reaching to its solutions.
In this section, we will discuss another type of problem-solving technique known as Constraint
satisfaction technique. By the name, it is understood that constraint satisfaction means solving a problem
under certain constraints or rules.
Constraint satisfaction is a technique where a problem is solved when its values satisfy certain
constraints or rules of the problem. Such type of technique leads to a deeper understanding of the
problem structure as well as its complexity.
Constraint satisfaction depends on three components, namely:
 X: It is a set of variables.
 D: It is a set of domains where the variables reside. There is a specific domain for each variable.
 C: It is a set of constraints which are followed by the set of variables.
In constraint satisfaction, domains are the spaces where the variables reside, following the problem
specific constraints. These are the three main elements of a constraint satisfaction technique. The
constraint value consists of a pair of {scope, rel}. The scope is a tuple of variables which participate in
the constraint and rel is a relation which includes a list of values which the variables can take to satisfy
the constraints of the problem.
Solving Constraint Satisfaction Problems
The requirements to solve a constraint satisfaction problem (CSP) is:
 A state-space
 The notion of the solution.
A state in state-space is defined by assigning values to some or all variables such as
{X1=v1, X2=v2, and so on…}.
An assignment of values to a variable can be done in three ways:
 Consistent or Legal Assignment: An assignment which does not violate any constraint or rule is
called Consistent or legal assignment.
 Complete Assignment: An assignment where every variable is assigned with a value, and the
solution to the CSP remains consistent. Such assignment is known as Complete assignment.
 Partial Assignment: An assignment which assigns values to some of the variables only. Such
type of assignments are called Partial assignments.
Types of Domains in CSP
There are following two types of domains which are used by the variables :
 Discrete Domain: It is an infinite domain which can have one state for multiple variables. For
example, a start state can be allocated infinite times for each variable.
 Finite Domain: It is a finite domain which can have continuous states describing one domain for
one specific variable. It is also called a continuous domain.
Constraint Types in CSP
With respect to the variables, basically there are following types of constraints:
 Unary Constraints: It is the simplest type of constraints that restricts the value of a single
variable.
 Binary Constraints: It is the constraint type which relates two variables. A value x2 will contain
a value which lies between x1 and x3.
 Global Constraints: It is the constraint type which involves an arbitrary number of variables.
Some special types of solution algorithms are used to solve the following types of constraints:
 Linear Constraints: These type of constraints are commonly used in linear programming where
each variable containing an integer value exists in linear form only.
 Non-linear Constraints: These type of constraints are used in non-linear programming where
each variable (an integer value) exists in a non-linear form.
Note: A special constraint which works in real-world is known as Preference constraint.
Constraint Propagation
In local state-spaces, the choice is only one, i.e., to search for a solution. But in CSP, we have two choices
either:
 We can search for a solution or
 We can perform a special type of inference called constraint propagation.
Constraint propagation is a special type of inference which helps in reducing the legal number of values
for the variables. The idea behind constraint propagation is local consistency.
In local consistency, variables are treated as nodes, and each binary constraint is treated as an arc in the
given problem. There are following local consistencies which are discussed below:
 Node Consistency: A single variable is said to be node consistent if all the values in the
variable’s domain satisfy the unary constraints on the variables.
 Arc Consistency: A variable is arc consistent if every value in its domain satisfies the binary
constraints of the variables.
 Path Consistency: When the evaluation of a set of two variable with respect to a third variable
can be extended over another variable, satisfying all the binary constraints. It is similar to arc
consistency.
 k-consistency: This type of consistency is used to define the notion of stronger forms of
propagation. Here, we examine the k-consistency of the variables.
CSP Problems
Constraint satisfaction includes those problems which contains some constraints while solving the
problem. CSP includes the following problems:
 Graph Coloring: The problem where the constraint is that no adjacent sides can have the same
color.
 Sudoku Playing: The gameplay where the constraint is that no number from 0-9 can be repeated
in the same row or column.

 n-queen problem: In n-queen problem, the constraint is that no queen should be placed either
diagonally, in the same row or column.
Note: The n-queen problem is already discussed in Problem-solving in AI section.
 Crossword: In crossword problem, the constraint is that there should be the correct formation of
the words, and it should be meaningful.
 Latin square Problem: In this game, the task is to search the pattern which is occurring several
times in the game. They may be shuffled but will contain the same digits.

 Cryptarithmetic Problem: This problem has one most important constraint that is, we cannot
assign a different digit to the same character. All digits should contain a unique alphabet.
Note: We will discuss cryptarithmetic in detail in our next section.

Cryptarithmetic Problem in AI
Cryptarithmetic Problem
Cryptarithmetic Problem is a type of constraint satisfaction problem where the game is about digits and
its unique replacement either with alphabets or other symbols. In cryptarithmetic problem, the digits (0-
9) get substituted by some possible alphabets or symbols. The task in cryptarithmetic problem is to
substitute each digit with an alphabet to get the result arithmetically correct.
We can perform all the arithmetic operations on a given cryptarithmetic problem.
The rules or constraints on a cryptarithmetic problem are as follows:
 There should be a unique digit to be replaced with a unique alphabet.
 The result should satisfy the predefined arithmetic rules, i.e., 2+2 =4, nothing else.
 Digits should be from 0-9 only.
 There should be only one carry forward, while performing the addition operation on a problem.
 The problem can be solved from both sides, i.e., lefthand side (L.H.S), or righthand side
(R.H.S)
Let’s understand the cryptarithmetic problem as well its constraints better with the help of an example:
 Given a cryptarithmetic problem, i.e., S E N D + M O R E = M O N E Y

In this example, add both terms S E N D and M O R E to bring M O N E Y as a result.


Follow the below steps to understand the given problem by breaking it into its subparts:
 Starting from the left hand side (L.H.S) , the terms are S and M. Assign a digit which could give a
satisfactory result. Let’s assign S->9 and M->1.

Hence, we get a satisfactory result by adding up the terms and got an assignment for O as O->0 as well.
 Now, move ahead to the next terms E and O to get N as its output.

Adding E and O, which means 5+0=0, which is not possible because according to cryptarithmetic
constraints, we cannot assign the same digit to two letters. So, we need to think more and assign some
other value.

Note: When we will solve further, we will get one carry, so after applying it, the answer will be
satisfied.
 Further, adding the next two terms N and R we get,
But, we have already assigned E->5. Thus, the above result does not satisfy the values
because we are getting a different value for E. So, we need to think more.
Again, after solving the whole problem, we will get a carryover on this term, so our answer will be
satisfied.

where 1 will be carry forward to the above term


Let’s move ahead.
 Again, on adding the last two terms, i.e., the rightmost terms D and E, we get Y as its result.

where 1 will be carry forward to the above term


 Keeping all the constraints in mind, the final resultant is as follows:

 Below is the representation of the assignment of the digits to the alphabets.


More examples of cryptarithmatic problems can be:

Similarly, we can also perform multiplication on the cryptarithmatic problems.


Knowledge Based Agents in AI
Knowledge is the basic element for a human brain to know and understand the things logically. When a
person becomes knowledgeable about something, he is able to do that thing in a better way. In AI, the
agents which copy such an element of human beings are known as knowledge-based agents.
What is Logic?
Logic is the key behind any knowledge. It allows a person to filter the necessary information from the
bulk and draw a conclusion. In artificial intelligence, the representation of knowledge is done via logics.
There are three main components of logic, which are as follows:
 Syntax: It is the sequence of a specific language which should be followed in order to form a
sentence. Syntax is the representation of a language. Every language has its own syntax. For
example, ax2+bx+c is a well-formed syntax of a quadratic equation.
 Semantics: The sentence or the syntax which a logic follows should be meaningful. Semantics
defines the sense of the sentence which relates to the real world.
For example, Indian people celebrate Diwali every year. This sentence represents the true fact about the
country and its people who are Indians. Therefore, the sentence is syntactically as well as semantically
correct.
 Logical Inference: Inference means to infer or draw some conclusions about some fact or a
problem. Logical inference is thinking all the possible reasons which could lead to a proper result.
Inference algorithms are used to perform logical inference.
Types of Knowledge
There are mainly five types of knowledge.

 Meta Knowledge: It is the information/knowledge about knowledge.


 Heuristic Knowledge: It is the knowledge regarding a specific topic.
 Procedural Knowledge: It gives information about achieving something.
 Declarative Knowledge: It is the information which describes a particular object and its
attributes.
 Structural Knowledge: It describes the knowledge between the objects.
Knowledge-based agents
So far we have studied about intelligent agents which acquire knowledge about the world to make better
decisions in the real world. Knowledge-based agent uses some task-specific knowledge to solve a
problem efficiently.
A knowledge-based system comprises of two distinguishable features which are:
 A Knowledge base
 An Inference Engine
Knowledge base: A Knowledge base represents the actual facts which exist in the real world. It is the
central component of a knowledge-based agent. It is a set of sentences which describes the information
related to the world.
Note: Here, a sentence is not an English language sentence, but it is represented in a language known
as Knowledge representation language.
Inference Engine: It is the engine of a knowledge-based system which allows to infer new knowledge in
the system.
Actions of an agent
When there is a need to add/update some new information or sentences in the knowledge-based system,
we require an inference system. Also, to know what information is already known to the agent, we require
the inference system. The technical words used for describing the mechanism of the inference system
are: TELL and ASK. When the agent solves a problem, it calls the agent program each time. The agent
program performs three things:
1. It TELLS the knowledge base what it has perceived from the environment.
2. It ASKS the knowledge base about the actions it should take?
3. It TELLS the action which is chosen, and finally, the agent executes that action.
The details of the knowledge representation language are abstracted under these three functions. These
functions create an interface between the two main components of an intelligent agent, i.e., sensors and
actuators.

The functions are discussed below:


 MAKE-PERCEPT-SENTENCE()
This function returns a sentence which tells the percieved information by the agent at a given time.
 MAKE-ACTION-QUERY()
This function returns a sentence which tells what action the agent must take at the current time.
 MAKE-ACTION-SENTENCE()
This function returns a sentence which tells an action is selected as well as executed.
Let’s understand the working of these functions under the Inference engine with the help of the below
function:
0
1 functionKB-AGENT(percept ) returnsan action
2 persistent: KB, a knowledge base
3 t, a counter, initially 0, indicating time
4 TELL(KB,MAKE-PERCEPT-SENTENCE(percept , t ))
5 action ←ASK(KB,MAKE-ACTION-QUERY(t ))
6 TELL(KB,MAKE-ACTION-SENTENCE(action, t ))
7 t ←t + 1
8 <strong>return</strong> action
9
Levels of a Knowledge-based agent
 Knowledge Level: In this level, the behavior of an agent is decided by specifying the following :
 The agent’s current knowledge it has percieved.
 The goal of an agent.
 Implementation Level: This level is the physical representation of the knowledge level. Here, it
is understood that “how the knowledge-based agent actually implements its stored knowledge.”
For example, Consider an automated air conditioner. The inbuilt knowledge stored in its system is that “
It would adjust its temperature according to the weather.” This represents the knowledge level of the
agent. The actual working and its adjustment define the implementation level of the knowledge-based
agent.
Approaches used to build a Knowledge-based agent
There are following two approaches used to design the behavior of a knowledge-based system:
 Declarative Approach: Feeding the necessary information in an empty knowledge-based system.
Such type of approach is used to design a knowledge-based system. The agent
designer TELLS sentences to the empty system one by one until the system becomes
knowledgeable enough to deal with the environment.
 Procedural Approach: In this approach, knowledge is stored into an empty system in the form
of program code. It is a contrasting approach to the declarative approach. It designs the behavior
of the system via coding.
Note: In the 1970’s and 1980’s, a team debate led to the combination of the above two mentioned
approaches to build a successful knowledge-based agent.
Knowledge Representation in AI
In this section, we will understand how to represent the knowledge in the form which could be understood
by the knowledge-based agents. The knowledge that is stored in the system is related to the world and its
environment. It is stored in the system to prepare these systems to deal with the world and solve complex
problems in a better way.
Ontological Engineering
A machine sounds like an empty box unless it is encoded with some features or information. Therefore, to
make it a valuable machine, it is required to put the necessary knowledge in it. So that it could understand
it and is able to take the right decisions.
There are three factors which are put into the machine, which makes it valuable:
 Knowledge: The information related to the environment is stored in the machine.
 Reasoning: The ability of the machine to understand the stored knowledge.
 Intelligence: The ability of the machine to make decisions on the basis of the stored information.
With the increasing demand for the knowledge representation technique, there was a need for larger and
modular knowledge that could integrate and combine with one another. Ontological engineering is the
engineering of such systems which could represent the complex domains effectively. With the help of
ontological engineering, the representation of the general concepts such as actions, time, physical
objects, performance, meta-data, and beliefs becomes possible on a large-scale.
For special type of representations, we require a special type of ontology known as Special ontology. But
for special ontologies, there is a need to move towards a high-level generality.
There are two following major characteristics which distinguish general ontologies from the special
one:
 General ontologies should be applicable in every type of special-purpose domains with some
domain-specific axioms.
 When there is a sufficiently demanding domain, the areas of knowledge should be unified.
Unfortunately, none of the applications of artificial intelligence make use of the shared/general ontology,
all they use is special ontology.
Properties of a Knowledge Representation system:
There are following properties of a Knowledge Representation system:
 Representational Adequacy: It is the ability of the system to represent all kinds of knowledge
needed in a specific domain.
 Inferential Adequacy: It is the ability of a knowledge representation system to manipulate the
current stored knowledge so that newly gained knowledge could be added.
 Inferential Efficiency: It is the ability of the system to directly add new knowledge in the system
with efficiency
 Acqusistional Efficiency: It is the ability of the system to automatically acquire new knowledge
from the environment. This leads the system to give more productive result as more knowledge
adds up with the current knowledge.
Techniques used for Knowledge Representation
There are following techniques used to represent the stored knowledge in the system:
 Logic: It is the basic method used to represent the knowledge of a machine. The term logic means
to apply intelligence over the stored knowledge.
Logic can be further divided as:
 Propositional Logic: This technique is also known as propositional calculus, statement logic,
or sentential logic. It is used for representing the knowledge about what is true and what is
false.
 First-order Logic: It is also known as Predicate logic or First-order predicate calculus
(FOPL). This technique is used to represent the objects in the form of predicates or quantifiers.
It is different from Propositional logic as it removes the complexity of the sentence represented
by it. In short, FOPL is an advance version of propositional logic.
0
1 Note: We will discuss the above two techniques in Propositional logic and
2 First-order logic sections.
3
 Rule-based System: This is the most commonly used technique in artificial intelligence. In the
rule-based system, we impose rules over the propositional logic and first-order logic techniques.
If-then clause is used for this technique. For example, if there are two variables A and B. Value
of both A and B is True. Consequently, the result of both should also be True and vice-versa. It is
represented as:
If the value of A and B is True, then the result will be True. So, such a technique makes the propositional
as well as FOPL logics bounded in the rules.
 Semantic Networks: The technique is based on storing the knowledge into the system in the
form of a graph. Nodes of a graph represent the objects which exist in the real world, and the
arrow represents the relationship between these objects. Such techniques show the connectivity of
one object with another object. For example, Consider the given knowledge stored in a machine:
Ram has a cycle.
Ram is a boy.
Cycle has a bell.
Ram is 12 years old.
Cycle has two paddles.
Representing the above information in the form of a graph looks like:
 Frames: In this technique, the knowledge is stored via slots and fillers. As we have seen in
DBMS, we store the information of an employee in the database, where:
Similarly, the Slots are the entities and Fillers are its attributes. They are together stored in a frame. So,
whenever there is a requirement, the machine infers the necessary information to take the decision. For
example, Tomy is a dog having one tail.
It can be framed as:

0
1 Tomy((Species (Value = Dog))
2 (Feature (Value = Tail)))
3
 Script: It is an advanced technique over the Frames. Here, the information is stored in the form
of a script. The script is stored in the system containing all the required information. The system
infers the information from that script and solves the problem
Challenges/Issues in Knowledge Representation
 Important Attributes: Some basic attributes were occurring in almost every problem domain.
 Relationship among attributes: Any important relationship which exists among object
attributes.
 Choosing Granularity: How much detailed knowledge is needed to be represented?
 Set of Objects: How to represent the set of objects?
 Finding the right structure: The information is stored in a large amount. The question is how to
access the relevant information out of whole?
The Wumpus World
The Wumpus world is a game playing which provides an environment to the knowledge-based agent to
showcase its stored knowledge. It was developed by Gregory Yob in 1973.
About the game:
 It is a single-player game.
 It is a cave consisting of rooms which are connected with one-another via passways.
 There is a beast or monster in the game named Wumpus, lurking somewhere the cave.
 Wumpus eats everyone who tries to enter the cave.
 The player needs to kill the Wumpus.
 The player has only one arrow to shoot out the monster.
 There are some rooms containing bottomless pits which may trap anyone whoever wanders in
the room.
 The goal of the game is to search for a heap of gold.
PEAS Description of the Wumpus World
 Performance Measure: The player is awarded with the following utilities:
 (+1000): It is for coming out of the cave safely with the gold.
 (-1000): It is for falling into the pit or if eaten by the Wumpus.
 (-1): It is for each action taken by the player.
 (-10): It is for raising the arrow up.
The game ends if the player comes out of the cave safely or dies.
1) Environment: The environment provided in the Wumpus world is as follows:
 It is a 4X4 grid of rooms.
 The player always starts in the square labeled [1,1] and facing towards the right.
 Location of the monster and the gold is choosen randomly in a uniform distribution.
 Remember, the location chosen will never be the starting point.
 Each square room other than the starting one can be a pit with 0.2 probability.
2) Actuators: The player performs the following actions:
 The agent can move forward or TurnLeft by 900 and TurnRight by 900.
 The player dies if he enters a room having a pit or alive monster. It is safe to enter the room if the
Wumpus is dead.
 If the player will try to move forward and bumps into the wall, then the player will not move.
 Using the action Grab, the player can pick up the gold in the same room.
 Using the action Shoot, the player can shoot the monster with the arrow. Either the arrow will
shoot the monster or will hit on the wall.
 The action Climb is used to come out of the cave but only from the square [1,1].
3) Sensors: The player is provided with five sensors, which gives a single bit of information:
 The player will perceive a Stench, if Wumpus is present in the room which is directly adjacent to
the player.
 The player will perceive a Breeze, if in the square is directly adjacent to the pit.
 The player will perceive a Glitter, if in the square gold is present.
 The player will perceive a Bump, when the player walks into the wall.
When the player will shoot out the monster, it will emit a scary Scream which can be heard/perceived
from anywhere in the cave.
Modern technologies use The Wumpus World technique for developing new trending games.
Propositional Logic
It is a branch of logic which is also known as statement logic, sentential logic, zeroth-order logic, and
many more. It works with the propositions and its logical connectivities. It deals with the propositions or
statements whose values are true, false, or maybe unknown.
Syntax and Semantics of Propositional Logic
Syntax and semantics define a way to determine the truth value of the sentence.
Syntax: The statements given in a problem are represented via propositional symbols. Each sentence
consists of a single propositional symbol. The propositional symbol begins with an uppercase letter and
may be followed by some other subscripts or letters. We have two fixed propositional symbols, i.e., True
and False.
To convert simple sentences into complex one, following connectives (a connective is used to
combine two or more sentences) are used:
 not(¬): It is known as the negation of a sentence. A literal can be a positive literal or a negative
literal.
 and(Ʌ): When a sentence is having (Ʌ) as the main connective. It is known as Conjunction, and
its parts are known as Conjuncts. For example, (Y1 V Y2) Ʌ (Y3 V Y4) Ʌ…(Yn V Ym), such type
of sentences are known as Conjunctive sentences.
 or(V): When a sentence is having (V) as the main connective. It is known as Disjunction, and its
parts are known as Disjuncts. For example, (Y1 Ʌ Y2) V (Y3 Ʌ Y4) V …(Yn Ʌ Ym), such type of
sentences are known as Disjunctive sentences.
 implies(=>): When (Y1 V Y2) => Y3 is given, it is known as the Implication of a sentence. It is
like if->then clause, where if this implies then it will happen. Implication is sometimes referred
to as Rules or if-then statement. It can also be denoted as ( ) or ( ).
 if and only if (ó): It represents implication at both sides where the expression is (a1 V a2)⇔a3,.
Such type of connective is called biconditional implication. It returns true if both sides satisfy
one another, else returns false.This can also be denoted as (≡).
Precedence Order of the Connectives
Below table shows the precedence order of the connectives in their decreasing order:
Name Symbol

Parenthesis/ Brackets ()

Negation/not ¬ or ~

Conjuction/and Ʌ

Disjunction/or V

Implication →

Biconditional/ if and only if ó


Semantics: It defines the rules to determine the truth of a sentence with respect to a specific model. A
semantic should be able to compute the truth value of any given sentence.
There are following five rules regarding the semantics of the complex sentences P and Q in a given
model m :
¬P: Its value will be false, iff it is true in the model m.
(P Ʌ Q): Its value is true, iff both P and Q are true in m.
(P v Q): Its value is true, iff either P is true, or Q is true in m.
(P=> Q): Its value is true, iff the value of P is false, and that of Q is true in m.
(P ⇔ Q): The value will be true, iff P and Q value is either true or false in the given model m.
Note: Here, iff means if and only if.
These five connectives can also be understood with the help of the below described truth table:

Examples of Propositional Logic


Example 1: Consider the given statement:
If it is humid, then it is raining.
Solution: Let, P and Q be two propositions.
P=It is humid.
Q=It is raining.
It is represented as (P→Q).
Example 2: It is noon and Ram is sleeping.
Solution: A= It is noon.
B= Ram is sleeping.
It is represented as (A V B).
Example 3: If it is raining, then it is not sunny.
Solution: P= It is raining.
Q= It is sunny.
It is represented as P → ( ~Q)
Example 4: Ram is a man or a boy.
Solution: X= Ram is a man.
Y= Ram is a boy.
It is represented as (X Ʌ Y).
Example 5: I will go to Delhi if and only if it is not humid.
Solution: A= I will go to Delhi.
B= It is humid.
It is represented as (A ⇔ B).
There can be many examples of Propositional logic.
Propositional Theorem Proving
Theorem proving means to apply rules of inference directly to the sentences.
There are following concepts which are used for theorem proving:
 Logical Equivalence: If the value of P and Q is true in the same set of models, then they are said
to be logically equivalence.
Rule Name Rule
Idempotency Law (A Ʌ A) = A(AV A) = A

Commutative Law (A Ʌ B) = (B Ʌ A)(AV B) = (B V A)

De morgan’s Law ~(A Ʌ B) =( ~A V ~B)~(A V B) = (~A Ʌ ~B)

Associative Law AV(B V C) = (A V B) V CA Ʌ(B Ʌ C) = (A ɅB) Ʌ C

Distributive Law A Ʌ(B V C) = (A Ʌ B) V (A Ʌ C)A V (B Ʌ C) = (A V B) Ʌ (A V C)

A → B = ~A → ~B
Contrapositive Law
~A → ~B (Converse of Inverse)

Implication Removal A → B = ~A V B

Biconditional Removal A ⇔ B = (A → B) Ʌ (B → A)

Absorption Law A Ʌ (A V B) ≡ AAV (A Ʌ B) ≡A

Double-negation elimination ~(~A)=A


Table defining the rules used in Propositional logic where A, B, and C represents some arbitrary
sentences.
 Validity: If a sentence is valid in all set of models, then it is a valid sentence. Validity is also
known as tautology, where it is necessary to have true value for each set of model.
 Satisfiability: If a sentence is true atleast for some set of values, it is a satisfiable sentence.
Let’s understand validity and satisfiability with the help of examples:
Example 1:
(P V Q) → (P Ʌ Q)
P Q PV Q PɅQ (P V Q) (P Ʌ Q)

False False False False True

False True True False False

True False True False False

True True True True True


So, from the above truth table, it is clear that the given expression is satisfiable but not valid.
Example 2:
A B A→B (A → B) Ʌ A ((A → B) Ʌ A) → B

False False True False True

False True True False True

True False False False True


True True True True True
((A → B) Ʌ A) → B
So, it is clear from the truth table that the given expression is valid as well as satisfiable.
Note: If the given expression is valid, it is by default satisfiable.
inference Rules in Proposition Logic
Inference rules are those rules which are used to describe certain conclusions. The inferred conclusions
lead to the desired goal state.
In propositional logic, there are various inference rules which can be applied to prove the given
statements and conclude them.
There are following laws/rules used in propositional logic:
 Modus Tollen: Let, P and Q be two propositional symbols:
Rule: Given, the negation of Q as (~Q).
If P→Q, then it will be (~P), i.e., the negation of P.
Example: If Aakash goes to the temple, then Aakash is a religious person. Aakash is not a religious
person. Prove that Aakash doesn’t go to temple.
Solution: Let, P= Aakash goes to temple.
Q= Aakash is religious. Therefore, (~Q)= Aakash is not a religious person.
To prove: ~P→~Q
By using Modus Tollen rule, P→Q, i.e., ~P→~Q (because the value of Q is (~Q)).
Therefore, Aakash doesn’t go to the temple.
 Modus Ponen: Let, P and Q be two propositional symbols:
Rule: If P→Q is given, where P is positive, then Q value will also be positive.
Example: If Sheero is intelligent, then Sheero is smart. Sheero is intelligent. Prove that Sheero is smart.
Solution: Let, A= Sheero is intelligent.
B= Sheero is smart.
To prove: A→B.
By using Modus Ponen rule, A→B where A is positive. Hence, the value of B will be true. Therefore,
Sheero is smart.
 Syllogism: It is a type of logical inference rule which concludes a result by using deducting
reasoning approach.
Rule: If there are three variables say P, Q, and R where
P→Q and Q→R then P→R.
Example: Given a problem statement:
If Ram is the friend of Shyam and Shyam is the friend of Rahul, then Ram is the friend of Rahul.
Solution: Let, P= Ram is the friend of Shyam.
Q= Shyam is the friend of Rahul.
R= Ram is the friend of Rahul.
It can be represented as: If (P→Q) Ʌ (Q→R)= (P→R).
 Disjunctive Syllogism
Rule: If (~P) is given and (P V Q), then the output is Q.
Example: Sita is not beautiful or she is obedient.
Solution: Let, (~P)= Sita is beautiful.
Q= She is obedient.
P= Sita is not beautiful.
It can be represented as (P V Q) which results Sita is obedient.
Note: Logical equivalence rules can also be used as Inference rules in Proposition logic.
We can also apply the inference rules to the logical equivalence rules as well.
 Biconditional Elimination: If Aó B then (A→B) Ʌ (B→A) or
If (A→B) Ʌ (B→A) then A óB. (using one side implication rule).
 Contrapositive: If ¬(A óB) then ¬((A→B) Ʌ (B→A))
We can re-obtain it using De Morgan’s and Modus Ponen rule.
Using inference rules, we can also define a proof problem as follows:
 Initial State: It is the initial knowledge base.
 Actions: It is the set of actions which contains all the inference rules applied over all the
sentences that match the top half of the inference rule.
 Result: When we add the sentence at the bottom of the inference rule, it gives the result of the
applied action.
 Goal: It is the state which contains that sentence we are trying to prove.
Note: It is more efficient to find a proof, as it removes irrelevant prepositions.
Theory of First-order Logic
Theory of First-order Logic
First-order logic is also called Predicate logic and First-order predicate calculus (FOPL). It is a formal
representation of logic in the form of quantifiers. In predicate logic, the input is taken as an entity, and the
output it gives is either true or false.
Syntax and Semantics of FOPL
Syntax: It defines the way of representing the given predicates. As these predicates are represented via
quantifiers, there are different types of quantifiers used:
 Universal Quantifier(For all/every): When the predicate is indicating about all/everything, we
use for all quantifier. It is denoted as “ ∀ “
 Existential Quantifier(For some): When the predicate is indicating about some quantity, we
use for some quantifier. It is denoted as “Ǝ”
 Nested Quantifiers: It is the nesting of the same type of quantifier. One predicate is nested under
the other predicate.
 Atomic Sentences: These sentences are formed via predicate symbols may or may not be
followed by a list of terms.
Example: Parents(Ram, Sita) where Ram and Sita are the parents.
 Complex Sentences: These sentences make use of logical connectives to construct more complex
sentences.
 Equality: We use the equality symbol to express that two terms refer to the same object. For
example, Eleveenth_President(India)= Dr. APJ Abdul Kalam. Here, both LHS is equal to RHS. It
means that both terms refer to the same entity/ person.
Elements and their symbols in Predicate Logic
The elements for which different symbols are defined are:
 Objects: It refers to an entity that exists in the real world. For example, Ram, John, etc. are
referred to as Objects.
 Functions: Any function performed by the object/on the object. For example, LeftLeg, writes,
eats, etc. are some of the functions.
 Relations: The relation of an object with the other object defines its relation. For
example, brother, mother, king, etc. are some types of relations which exist in the real world.
Now, let’s discuss the symbols used to represent these elements. They are as follows:
 Constant Symbols: These symbols are used to represent the objects.
 Predicate Symbols: These symbols are used to represent relations.
 Function Symbols: These symbols are used to represent the functions performed by the object.
Semantics: It defines the sense of the given predicate. It allows to make more logical expression by
devising its semantics. Semantics allow us to understand the sentence meaning.
Let’s understand Predicate logic with the help of below examples:
Example 1: Lipton is a tea.
Solution: Here, the object is Lipton.
It will be represented as Tea(Lipton).
Note: In this example, there is no requirement of quantifiers because the quantity is not specified in the
given predicate. Let’s see more.
Example 2: Every man is mortal.
Solution: Here, the quantifier is the universal identifier, and the object is man.
Let x be the man.
Thus, it will be represented as x: man(x) → mortal(x).
Example 3: All girls are beautiful.
Solution: Here, we are talking about all girls. It means universal quantifier will be used. The object is
girls. Let, y be the girls.
Therefore, it will be represented as girls(y) → beautiful(y).
Example 4: All that glitters is not gold.
Solution: Here, we will represent gold as x.
Therefore, it will be represented as glitters(x) → ¬gold(x).
Example 5: Some boys are obedient.
Solution: Here, boys are objects. The quantifier used will be existential quantifier. Let x be the boys.
Thus, it will be represented as
Ǝx: boys(x) → obedient(x).
Example 6: Some cows are black and some cows are white.
Solution: Let, x be the cows. Therefore, it will be represented as:
Ǝx: cows(x) → black(x) Ʌ white(x).
0
1 <strong>Note:</strong> There can be several examples of Predicate logic.
2
Knowledge Engineering in FOPL
Knowledge engineering is the process where a knowledge engineer investigates a specific domain, learn
the important concepts regarding that domain, and creates the formal representation of the objects and
relations in that domain.
Knowledge Engineering Process
An engineering term is used when we are talking about any project. Therefore, knowledge engineering
over a project involves the below described steps:
 Identify the task: A knowledge engineer should be able to identify the task by asking a few
questions like:
 Do the knowledge base will support?
 What kinds of facts will be available for each specific problem?
The task will identify the knowledge requirement needed to connect the problem instance with the
answers.
 Assemble the relevant knowledge: A knowledge engineer should be an expert in the domain. If
not, he should work with the real experts to extract their knowledge. This concept is known
as Knowledge Acquisition.
Note: Here, we do not represent the knowledge formally. But to understand the scope of the knowledge
base and also to understand the working of the domain.
 Decide on a vocabulary of constants, predicates, and functions: Translating important
domain-level concepts into logical level concepts.
Here, the knowledge engineer asks questions like:
 What are the elements which should be represented as objects?
 What functions should be chosen?
After satisfying all the choices, the vocabulary is decided. It is known as the Ontology of the domain.
Ontology determines the type of things that exists but does not determine their specific properties and
interrelationships.
 Encode general knowledge about the domain: In this step, the knowledge engineer pen down
the axioms for all the chosen vocabulary terms.
Note: Here, misconceptions occur between the vocabulary terms.
 Encode description of the specific problem instance: We write the simple atomic sentences for
the selected vocabulary terms. We encode the chosen problem instances.
 Raise queries to the inference procedure and get answers: It is the testing step. We apply the
inference procedure on those axioms and problem-specific facts which we want to know.
 Debug the knowledge base: It is the last step of the knowledge engineering process where the
knowledge engineer debugs all the errors.
Inference in First-order Logic
Inference in First-order Logic
While defining inference, we mean to define effective procedures for answering questions in FOPL.
FOPL offers the following inference rules:
 Inference rules for quantifiers
 Universal Instantiation (UI): In this, we can infer any sentence by substituting a ground term (a
term without variables) for the variables. In short, when we create the FOPL of the given
statement, we can easily infer any other statement using that FOPL
Notation: Let, SUBST( θ , α ) be the result of the given sentence α , and its substitute is θ.

where v is the variable and g is the ground term.


For example: Every man is mortal.
It is represented as ∀ x: man(x) → mortal(x).
In UI, we can infer different sentences as:
man(John) → mortal(John)
man(Aakash) → mortal(Aakash), etc.
 Existential Instantiation(EI): In EI, the variable is substituted by a single new constant symbol.
Notation: Let, the variable be v which is replaced by a constant symbol k for any sentence α The value
of k is unique as it does not appear for any other sentence in the knowledge base. Such type of constant
symbols are known as Skolem constant. As a result, EI is a special case of Skolemization process.
Note: UI can be applied several times to produce many sentences, whereas EI can be applied once, and
then the existentially quantified sentences can be discarded.
For example: ∃x:steal(x, Money).
We can infer from this: steal(Thief, Money)
 Generalized Modus Ponen: It is a lifted version of Modus Ponen as it uplifts the Modus Ponens
from ground propositions to FOPL. Generalized Modus Ponen is more generalized than Modus
Ponen. It is because, in generailzed, the known facts and the premise of the implication are
matched only upto a substitution, instead of its exact match.
Notation: For atomic sentences like pi.pi’ and q where we have a substitute
θ that SUBST( θ, pi) for each i.

For example: p1’ is Thief(Charlie) p1 is Thief(x)


p2’ is Silent(y) p2 is Silent(y)
θ will be {x/Charlie, y/Charlie} q is evil(x)
SUBST(θ,q ) is evil(Charlie).
 Unification: It is the key component of First-order inference algorithms. Unification is the
process used by the lifted inference rules to find substituents that could give identical but
different logical expressions. It means the meaning of the sentence should not be changed, but it
should be expressed in multiple ways. The UNIFY algorithm in unification takes two sentences
as input and then returns a unifier if one exists:
UNIFY(p,q)= θ where SUBST( θ , p) = SUBST( θ, q).
Let see how UNIFY works with the help of the below example:
Given: Knows(Ram,x). The question is- Whom does Ram knows?
The UNIFY algorithm will search all the related sentences in the knowledge base, which could unify
with Knows(Ram,x).
UNIFY (Knows(Ram, x), Knows(Ram, Shyam))≡{x/Shyam}
UNIFY (Knows{Ram,x}, Knows{y, Aakash})≡{x/Aakash, y/Ram}
UNIFY (Knows{Ram,x}, Knows{x, Raman})≡fails.
The last one failed because we have used the same variable for two persons at the same time.
Unification Algorithm
Earlier, we have studied TELL and ASK functions which are used to inform and interrogate a knowledge
base. These are the primitive functions of STORE and FETCH functions. STORE function is used to
store a sentence s into the knowledge base and FETCH function is used to return all the unifiers with
some sentences.
0
1 function UNIFY(a , b, θ) returns a substitution to make a, b identical
2 inputs: a , a variable, constant, list, or compound expression
3 a, a variable, constant, list, or compound expression
4 θ, the substitution built up earlier (optional, defaults to empty)
5 if θ = failure then return failure
6 else if a = b then return θ
7 else if VARIABLE?(a ) then return UNIFY-VAR(a , b, θ)
8 else if VARIABLE?(b) then return UNIFY-VAR(a, b, θ)
9 else if COMPOUND?(a ) and COMPOUND?(b) then
10 return UNIFY(a.ARGS, b.ARGS, UNIFY(a.OP, b.OP, θ))
11 else if LIST?(a) and LIST?(b) then
12 return UNIFY(a .REST, b.REST, UNIFY(a .FIRST, b.FIRST, θ))
13 else return failure
14 function UNIFY-VAR(var, a , θ) returns a substitution
15 if {var/val} ∈ θthen return UNIFY(val , a , θ)
16 else if {a/val} ∈ θ then return UNIFY(var, val , θ)
17 else if OCCUR-CHECK?(var, a ) then return failure
18 else return add {var/a } to θ
19
Note: In the above example: Knows(Ram, x) → It is an instance of FETCH function.
 Forward Chaining: In forward chaining, we start with the atomic sentences in the knowledge
base and apply Modus Ponen in forward direction. Also adding new sentences until any inference
is not made.
Note: We will understand Forward Chaining in detail in Forward Chaining section.
 Backward Chaining: This algorithm is opposite of forward chaining algorithm. It works in
backward direction. It starts from the goal, chain through the rules to search the known facts and
infer sentences from the given facts in backward direction.
Note: We will understand Backward Chaining in detail in Backward Chaining section.
 Resolution Method: Unification, Backward Chaining as well as Forward Chaining, all are based
on the resolution method. The resolution method is a decision-making rule where a machine
decides what to do and what not to do. It can be understood as:
Firstly, we convert the given statement into FOPL.
Secondly, we infer some related sentences from it.
Then, realizing our goal, we need to prove it.
Here, we make use of the resolution method to decide the best possible FOPL from various.
Note: We will understand resolution method for both Propositional logic and Predicate logic in our next
section.
Resolution Method in AI
Resolution Method in AI
Resolution method is an inference rule which is used in both Propositional as well as First-order Predicate
Logic in different ways. This method is basically used for proving the satisfiability of a sentence. In
resolution method, we use Proof by Refutation technique to prove the given statement.
The key idea for the resolution method is to use the knowledge base and negated goal to obtain null
clause(which indicates contradiction). Resolution method is also called Proof by Refutation. Since the
knowledge base itself is consistent, the contradiction must be introduced by a negated goal. As a result,
we have to conclude that the original goal is true.
Resolution Method in Propositional Logic
In propositional logic, resolution method is the only inference rule which gives a new clause when two or
more clauses are coupled together.
Using propositional resolution, it becomes easy to make a theorem prover sound and complete for all.
The process followed to convert the propositional logic into resolution method contains the below
steps:
 Convert the given axiom into clausal form, i.e., disjunction form.
 Apply and proof the given goal using negation rule.
 Use those literals which are needed to prove.
 Solve the clauses together and achieve the goal.
But, before solving problems using Resolution method, let’s understand two normal forms
Conjunctive Normal Form(CNF)
In propositional logic, the resolution method is applied only to those clauses which are disjunction of
literals. There are following steps used to convert into CNF:
1) Eliminate bi-conditional implication by replacing A ⇔ B with (A → B) Ʌ (B →A)
2) Eliminate implication by replacing A → B with ¬A V B.
3) In CNF, negation(¬) appears only in literals, therefore we move it inwards as:
 ¬ ( ¬A) ≡ A (double-negation elimination
 ¬ (A Ʌ B) ≡ ( ¬A V ¬B) (De Morgan)
 ¬(A V B) ≡ ( ¬A Ʌ ¬B) (De Morgan)
4) Finally, using distributive law on the sentences, and form the CNF as:
(A1 V B1) Ʌ (A2 V B2) Ʌ …. Ʌ (An V Bn).
Note: CNF can also be described as AND of ORS
Disjunctive Normal Form (DNF)
This is a reverse approach of CNF. The process is similar to CNF with the following difference:
(A1 Ʌ B1) V (A2 Ʌ B2) V…V (An Ʌ Bn). In DNF, it is OR of ANDS, a sum of products, or a cluster
concept, whereas, in CNF, it is ANDs of Ors.
Example OF Propositional Resolution
Consider the following Knowledge Base:
1. The humidity is high or the sky is cloudy.
2. If the sky is cloudy, then it will rain.
3. If the humidity is high, then it is hot.
4. It is not hot.
Goal: It will rain.
Use propositional logic and apply resolution method to prove that the goal is derivable from the given
knowledge base.
Solution: Let’s construct propositions of the given sentences one by one:
1. Let, P: Humidity is high.
Q: Sky is cloudy.
It will be represented as P V Q.
2) Q: Sky is cloudy. …from(1)
Let, R: It will rain.
It will be represented as bQ → R.
3) P: Humidity is high. …from(1)
Let, S: It is hot.
It will be represented as P → S.
4) ¬S: It is not hot.
Applying resolution method:
In (2), Q → R will be converted as (¬Q V R)
In (3), P → S will be converted as (¬P V S)
Negation of Goal (¬R): It will not rain.
Finally, apply the rule as shown below:

After applying Proof by Refutation (Contradiction) on the goal, the problem is solved, and it has
terminated with a Null clause ( Ø ). Hence, the goal is achieved. Thus, It is not raining.
Note: We can have many examples of Proposition logic which can be proved with the help of
Propositional resolution method.
Resolution Method in FOPl/Predicate Logic
Resolution method in FOPL is an uplifted version of propositional resolution method.
In FOPL, the process to apply the resolution method is as follows:
 Convert the given axiom into CNF, i.e., a conjunction of clauses. Each clause should be dis-
junction of literals.
 Apply negation on the goal given.
 Use literals which are required and prove it.
 Unlike propositional logic, FOPL literals are complementary if one unifies with the negation of
other literal.
For example: {Bird(F(x)) V Loves(G(x), x)} and {¬Loves(a, b) V ¬Kills(a, b)}
Eliminate the complementary literals Loves(G(x),x) and Loves(a,b)) with θ ={a/G(x), v/x} to give the
following output clause:
{Bird(F(x)) V ¬Kills(G(x),x)}
The rule applied on the following example is called Binary Resolution as it has solved exactly two
literals. But, binary resolution is not complete. An alternative approach is to extend the factoring i.e., to
remove redundant literals to the first order case. Thus, the combination of binary resolution and factoring
is complete.
Conjunctive Normal Form
There are following steps used to convert into CNF:
 Eliminate the implications as:
∀x: A(x) → B(x) with {¬ x: ¬A( ∀x) V B(x)}
 Move negation (¬) inwards as:
¬∀x: A becomes ∃x: ¬A and,
¬∃x: A becomes ∀x: ¬A
It means that the universal quantifier becomes existential quantifier and vice-versa.
 Standardize variables: If two sentences use same variable, it is required to change the name of
one variable. This step is taken so as to remove the confusion when the quantifiers will be
dropped.
For example: { ∀x: A(x) V ∀x: B(x)}
 Skolemize: It is the process of removing existential quantifier through elimination.
 Drop universal quantifiers: If we are on this step, it means all remaining variables must be
universally quantified. Drop the quantifier.
 Distribute V over Ʌ: Here, the nested conjunction and disjunction are flattened.
Example of FOPL resolution
Consider the following knowledge base:
1. Gita likes all kinds of food.
2. Mango and chapati are food.
3. Gita eats almond and is still alive.
4. Anything eaten by anyone and is still alive is food.
Goal: Gita likes almond.
Solution: Convert the given sentences into FOPL as:
Let, x be the light sleeper.
1. ∀x: food(x) → likes(Gita,x)
2. food(Mango),food(chapati)
3. ∀x∀y: eats(x,y) Ʌ ¬ killed(x → food(y)
4. eats(Gita, almonds) Ʌ alive(Gita)
5. ∀x: ¬killed(x) → alive(x)
6. ∀x: alive(x) → ¬killed(x)
Goal: likes(Gita, almond)
Negated goal: ¬likes(Gita, almond)
Now, rewrite in CNF form:
1. ¬food(x) V likes(Gita, x)
2. food(Mango),food(chapati)
3. ¬eats(x,y) V killed(x) V food(y)
4. eats(Gita, almonds), alive(Gita)
5. killed(x) V alive(x)
6. ¬alive(x) V ¬killed(x)
Finally, construct the resolution graph:

Hence, we have achieved the given goal with the help of Proof by Contradiction. Thus, it is proved that
Gita likes almond.
Note: There can be several examples of Resolution method in FOPL
Forward Chaining
Forward Chaining is the process which works on the basis of available data to make certain decisions.
Forward chaining is the process of chaining data in the forward direction. In forward chaining, we start
with the available data and use inference rules to extract data until the goal is not reached. Forward
chaining is the concept of data and decision. From the available data, expand until a decision is not made.

In artificial intelligence, we have two different methods to use forward chaining.


 Forward Chaining in Propositional Logic
 Forward Chaining in Predicate Logic/(FOPL)
We will discuss both one by one
Forward Chaining in Propositional Logic
In propositional logic, forward chaining starts its journey from the given knowledge base. If all the
premises of the implication are known, then its conclusion will be added to the set of known facts. We
use the below forward chaining algorithm to perform the forward chaining.
0
1 function PL-FC-ENTAILS?(KB, q) returns true or false
2 inputs: KB, the knowledge base, a set of propositional definite clauses
3 q, the query, a proposition symbol
4 count ←a table, where count [c] is the number of symbols in c’s premise
5 inferred ←a table,where inferred[s] is initially false for all symbols
6 agenda ←a queue of symbols, initially symbols known to be true in KB
7 while agenda is not empty do
8 p←POP(agenda)
9 if p = q then return true
10 if inferred[p] = false then
11 inferred[p]←true
12 for each clause c in KB where p is in c.PREMISE do
13 decrement count [c]
14 if count [c] = 0 then add c.CONCLUSION to agenda
15 return false
16
Conclusions drawn from the above algorithm:
 Forward Chaining is sound as every inference is necessarily an application of Modus Ponen.
 Forward Chaining is complete as all atomic sentences will be derived from it.
Let’s see an example:
1. If D barks and D eats bone, then D is a dog.
2. If V is cold and V is sweet, then V is ice-cream.
3. If D is a dog, then D is black.
4. If V is ice-cream, then it is Vanilla.
Derive forward chaining using the given known facts to prove Tomy is black.
 Tomy barks.
 Tomy eats bone.
Solution: Given Tomy barks.
From (1), it is clear:
If Tomy barks and Tomy eats bone, then Tomy is a dog.
From (3), it is clear:
If Tomy is a dog, then Tomy is black.
Hence, it is proved that Tomy is black.
Note: There is an advantage of forward chaining that is, we can draw new inference from the given facts.
Forward Chaining in Predicate Logic/FOPL
Forward Chaining in Predicate Logic is different from forward chaining in Propositional Logic. In FOPL,
forward chaining is efficiently implemented on first-order clauses. First-order clauses are the disjunction
of literals of which exactly one is positive.
For example, Crow(x) Ʌ Thrust(x)→Water(x).
Crow(x).
Thrust(x).
Therefore, a definite clause is either atomic or an implication whose predecessor is a conjunction of
positive literals. As a result, it results in a single positive literal.
The forward chaining algorithm used in FOPL is:
0
1 function FOL-FC-ASK(KB,α) returns a substitution or false
2 inputs: KB, the knowledge base, a set of first-order definite clauses
3 α, the query, an atomic sentence
4 local variables: new, the new sentences inferred on each iteration
5 repeat until new is empty
6 new ←{}
7 for each rule in KB do
8 (p1 ∧ . . . ∧ pn ⇒ q)←STANDARDIZE-VARIABLES(rule)
9 for each θ such that SUBST(θ, p1 ∧ . . . ∧ pn) = SUBST(θ, p_
10 1 ∧ . . . ∧ p_
11 n)
12 for some p_
13 1 , . . . , p_
14 n in KB
15 q_←SUBST(θ, q)
16 if q_ does not unify with some sentence already in KB or new then
17 add q_ to new
18 φ←UNIFY(q_,α)
19 if φ is not fail then return φ
20 add new to KB
21 return false
22
Conclusions drawn:
 Forward Chaining in FOPL is sound as each inference is an application of Generalized Modus
Ponen.
 It is complete as it answers each query.
Let’s see an example of Forward Chaining in FOPL
Consider the below axioms:
1. Gita loves all types of clothes.
2. Suits are clothes.
3. Jackets are clothes.
4. Anything any wear and isn’t bad is clothes.
5. Sita wears skirt and is good.
6. Renu wears anything Sita wears.
Apply backward chaining and prove that Gita loves Kurtis.
Solution: Convert the given axioms into FOPL as:
1. x: clothes(x)→loves(Gita, x).
2. Suits(x)→Clothes(x).
3. Jackets(x)→Clothes(x).
4. wears(x,y)Ʌ ¬bad(y)→Clothes(x)
5. wears(Sita,skirt) Ʌ ¬good(Sita)
6. wears(Sita,x)→wears(Renu,x)
To prove: Gita loves Kurtis.
FOPL: loves(Gita, Kurtis).
On applying forward chaining in the below graph:

Thus, it is proved that Gita loves Kurtis.


Forward Chaining
Forward Chaining is the process which works on the basis of available data to make certain decisions.
Forward chaining is the process of chaining data in the forward direction. In forward chaining, we start
with the available data and use inference rules to extract data until the goal is not reached. Forward
chaining is the concept of data and decision. From the available data, expand until a decision is not made.

In artificial intelligence, we have two different methods to use forward chaining.


 Forward Chaining in Propositional Logic
 Forward Chaining in Predicate Logic/(FOPL)
We will discuss both one by one
Forward Chaining in Propositional Logic
In propositional logic, forward chaining starts its journey from the given knowledge base. If all the
premises of the implication are known, then its conclusion will be added to the set of known facts. We
use the below forward chaining algorithm to perform the forward chaining.
0
1 function PL-FC-ENTAILS?(KB, q) returns true or false
2 inputs: KB, the knowledge base, a set of propositional definite clauses
3 q, the query, a proposition symbol
4 count ←a table, where count [c] is the number of symbols in c’s premise
5 inferred ←a table,where inferred[s] is initially false for all symbols
6 agenda ←a queue of symbols, initially symbols known to be true in KB
7 while agenda is not empty do
8 p←POP(agenda)
9 if p = q then return true
10 if inferred[p] = false then
11 inferred[p]←true
12 for each clause c in KB where p is in c.PREMISE do
13 decrement count [c]
14 if count [c] = 0 then add c.CONCLUSION to agenda
15 return false
16
Conclusions drawn from the above algorithm:
 Forward Chaining is sound as every inference is necessarily an application of Modus Ponen.
 Forward Chaining is complete as all atomic sentences will be derived from it.
Let’s see an example:
1. If D barks and D eats bone, then D is a dog.
2. If V is cold and V is sweet, then V is ice-cream.
3. If D is a dog, then D is black.
4. If V is ice-cream, then it is Vanilla.
Derive forward chaining using the given known facts to prove Tomy is black.
 Tomy barks.
 Tomy eats bone.
Solution: Given Tomy barks.
From (1), it is clear:
If Tomy barks and Tomy eats bone, then Tomy is a dog.
From (3), it is clear:
If Tomy is a dog, then Tomy is black.
Hence, it is proved that Tomy is black.
Note: There is an advantage of forward chaining that is, we can draw new inference from the given facts.
Forward Chaining in Predicate Logic/FOPL
Forward Chaining in Predicate Logic is different from forward chaining in Propositional Logic. In FOPL,
forward chaining is efficiently implemented on first-order clauses. First-order clauses are the disjunction
of literals of which exactly one is positive.
For example, Crow(x) Ʌ Thrust(x)→Water(x).
Crow(x).
Thrust(x).
Therefore, a definite clause is either atomic or an implication whose predecessor is a conjunction of
positive literals. As a result, it results in a single positive literal.
The forward chaining algorithm used in FOPL is:
0
1 function FOL-FC-ASK(KB,α) returns a substitution or false
2 inputs: KB, the knowledge base, a set of first-order definite clauses
3 α, the query, an atomic sentence
4 local variables: new, the new sentences inferred on each iteration
5 repeat until new is empty
6 new ←{}
7 for each rule in KB do
8 (p1 ∧ . . . ∧ pn ⇒ q)←STANDARDIZE-VARIABLES(rule)
9 for each θ such that SUBST(θ, p1 ∧ . . . ∧ pn) = SUBST(θ, p_
10 1 ∧ . . . ∧ p_
11 n)
12 for some p_
13 1 , . . . , p_
14 n in KB
15 q_←SUBST(θ, q)
16 if q_ does not unify with some sentence already in KB or new then
17 add q_ to new
18 φ←UNIFY(q_,α)
19 if φ is not fail then return φ
20 add new to KB
21 return false
22
Conclusions drawn:
 Forward Chaining in FOPL is sound as each inference is an application of Generalized Modus
Ponen.
 It is complete as it answers each query.
Let’s see an example of Forward Chaining in FOPL
Consider the below axioms:
1. Gita loves all types of clothes.
2. Suits are clothes.
3. Jackets are clothes.
4. Anything any wear and isn’t bad is clothes.
5. Sita wears skirt and is good.
6. Renu wears anything Sita wears.
Apply backward chaining and prove that Gita loves Kurtis.
Solution: Convert the given axioms into FOPL as:
1. x: clothes(x)→loves(Gita, x).
2. Suits(x)→Clothes(x).
3. Jackets(x)→Clothes(x).
4. wears(x,y)Ʌ ¬bad(y)→Clothes(x)
5. wears(Sita,skirt) Ʌ ¬good(Sita)
6. wears(Sita,x)→wears(Renu,x)
To prove: Gita loves Kurtis.
FOPL: loves(Gita, Kurtis).
On applying forward chaining in the below graph:

Thus, it is proved that Gita loves Kurtis.


lassical Planning
Classical Planning is the planning where an agent takes advantage of the problem structure to construct
complex plans of an action. The agent performs three tasks in classical planning:
 Planning: The agent plans after knowing what is the problem.
 Acting: It decides what action it has to take.
 Learning: The actions taken by the agent make him learn new things.

A language known as PDDL(Planning Domain Definition Language) which is used to represent all
actions into one action schema.
PDLL describes the four basic things needed in a search problem:
 Initial state: It is the representation of each state as the conjunction of the ground and
functionless atoms.
 Actions: It is defined by a set of action schemas which implicitly define
the ACTION() and RESULT() functions.
 Result: It is obtained by the set of actions used by the agent.
 Goal: It is same as a precondition, which is a conjunction of literals (whose value is either
positive or negative).
There are various examples which will make PDLL understandable:
 Air cargo transport
 The spare tire problem
 The blocks world and many more.
Let’s discuss one of them
 Air cargo transport
This problem can be illustrated with the help of the following actions:
 Load: This action is taken to load cargo.
 Unload: This action is taken to unload the cargo when it reaches its destination.
 Fly: This action is taken to fly from one place to another.
Therefore, the Air cargo transport problem is based on loading and unloading the cargo and flying it from
one place to another.
Below is the PDLL description for Air cargo transport:

0 Init (On(C1, SFO) ∧ On(C2, JFK) ∧ On(P1, SFO) ∧ On(P2, JFK)∧ Cargo(C1) ∧ Cargo(C2) ∧ Plane(P1) ∧
1 Plane(P2)
2 ∧ Airport (JFK) ∧ Airport (SFO))
3 Goal (On(C1, JFK) ∧ On(C2, SFO))
4 Action(Load (c, p, a),
5
PRECOND: On(c, a) ∧ On(p, a) ∧ Cargo(c) ∧ Plane(p) ∧ Airport (a)
6
EFFECT: ¬ On(c, a) ∧ In(c, p))
7
Action(Unload(c, p, a),
8
PRECOND: In(c, p) ∧ On(p, a) ∧ Cargo(c) ∧ Plane(p) ∧ Airport (a)
9
10 EFFECT: On(c, a) ∧ ¬In(c, p))
11 Action(Fly(p, from, to),
12 PRECOND: On(p, from) ∧ Plane(p) ∧ Airport (from) ∧ Airport (to)
13 EFFECT: ¬ On(p, from) ∧ On(p, to))

The above described actions, (i.e., load, unload, and fly) affects the following two predicates:
 (c,p): In this, the cargo is inside the plane p.
 (x,a): In this, the object x is at the airport a. Here, object can be the cargo or plane.
It is to be noted that when the plan flies from one place to another, it should carry all cargo inside it. It
becomes difficult with the PDLL to give solution for such a problem. Because PDLL do not have the
universal quantifier. Thus, the following approach is used:
 piece of cargo ceases to beOn anywhere when it is In a plane.
 the cargo only becomesOn the new airport when it is unloaded.
Therefore, the planning for the solution is:
0
1 Load (C1, P1, SFO), Fly(P1, SFO, JFK),Unload(C1, P1, JFK),
2 Load (C2, P2, JFK), Fly(P2, JFK, SFO),Unload(C2, P2, SFO)] .
3
Note: Some problems can be ignored because they does not cause any problem in planning.
 The spare tire problem
The problem is that the agent needs to change the flat tire. The aim is to place a good spare tire over the
car’s axle. There are four actions used to define the spare tire problem:
1. Remove the spare from the trunk.
2. Remove the flat spare from the axle.
3. Putting the spare on the axle.
4. Leave the car unattended overnight. Assuming that the car is parked at an unsafe neighborhood.
The PDLL description for the spare tire problem is:
0
1 Init(Tire1(Flat ) Ʌ Tire1(Spare) Ʌ At(Flat , Axle) Ʌ At(Spare, Trunk ))
2 Goal (At(Spare, Axle))
3 Action(Remove(obj , loc),
4 PRECOND: At(obj , loc)
5 EFFECT: ¬ At(obj , loc) Ʌ At(obj , Ground))
6 Action(PutOn(t , Axle),
7 PRECOND: Tire1(t) Ʌ At(t , Ground) Ʌ¬At(Flat , Axle)
8 EFFECT: ¬ At(t , Ground) Ʌ At(t , Axle))
9 Action(LeaveOvernight ,
10 PRECOND:
11 EFFECT: ¬ At(Spare, Ground) Ʌ¬At(Spare, Axle) Ʌ¬At(Spare, Trunk)
12 Ʌ¬At(Flat, Ground) Ʌ¬At(Flat , Axle) Ʌ¬At(Flat, Trunk))
13
The solution to the problem is:
0
1 [Remove(Flat,Axle),Remove(Spare,Trunk), PutOn(Spare, Axle)].
2
Similarly, we can design PDLL for various problems.
Complexity of the classical planning
In classical planning, there occur following two decision problems:
1. PlanSAT: It is the question asking if there exists any plan that solves a planning problem.
2. Bounded PlanSAT: It is the question asking if there is a solution of length k or less than it.
We found that:
 PlanSAT and Bounded PlanSAT are decidable for classical planning.
 Both decision problems lie in the complexity class PSPACE, which is larger than NP.
Note: PSPACE is the class which refers to those problems that can be solved via deterministic Turing
machine under a polynomial time space.
From the above, it can be concluded that:
1. PlanSAT is P whereas Bounded PlanSAT is NP-complete.
2. Optimal planning is hard with respect to sub-optimal planning.
Advantages of Classical Planning
There are following advantages of Classical planning:
 It has provided the facility to develop accurate domain-independent heuristics.
 The systems are easy to understand and work efficiently.
Artificial Intelligence Tutorial | AI Tutorial
Artificial Intelligence (AI) tutorial is a very trending subject which helps us to make the intelligent
machines. This AI tutorial is developed for beginners as well as professionals.
What is Artificial Intelligence?
The term Artificial Intelligence comprises of two words ‘Artificial’ and ‘Intelligence’, where, Artificial
means ‘copy of something natural’ and ‘Intelligence’ means ‘able to think.’
So, Artificial Intelligence can be defined as a copy of a human brain with thinking ability.
According to John McCarthy, who is known as the father of AI,
“AI is the science and engineering of making intelligent machines, especially computer programs.”
The objective of AI is to explore the ways onto a machine that can reason like a human, think like a
human and act like a human. Its approach is to train a machine (i.e., a computer or a robot) with the
same capabilities as of a human brain. In the future, AI will prove itself as an excellent helping hand.
Need for Artificial Intelligence
Consider a scenario where a human brain may fail to take an intelligent decision and need someone who
can make a wise and intelligent decision for him. In such a situation, we can understand the need for AI.

Therefore, AI has groomed the world with its exploring intelligent power, and the following points will
make us understand the need for AI more effectively:
 AI can be used to make an intelligent decision as compared to human beings.
 AI can be used to analyze data more deeply.
 To maintain security and privacy of data more effectively and efficiently.
 To create expert systems having the capability to explain and give advice to users.
 AI can also be used to speed up the work performance.
How Artificial Intelligence came into existence?
Earlier Greeks used to discuss Artificial Intelligence in rumors or stories. As a result, In the 1940s and
50s, a group of classical philosophers and mathematicians decided to convert the myth of Artificial
Intelligence into reality.
Turing Machine and Turing Test
1936: Alan Turing created a Turing machine which formalized the concept of algorithm and
computation. Turing machine was highly influential in the development of theoretical computer science.
1950: Alan Turing published a seminal paper on “Computing Machinery Intelligence” in which he
described the “Turing Test” to determine whether a machine is intelligent or not.
The term AI was coined
1956: Several scientists attended the Dartmouth Summer Conference at New Hampshire. During the
conference, it was claimed that “every aspect of learning or any other feature of intelligence can be so
precisely described that a machine can be made to simulate it” and finally it was named “A.I.”
First Chatbot
1966: Joseph Weizenbaum, a German-American computer scientist, invented ‘ELIZA’, which is a
computer program that communicates with humans.
AI in the medical field.
1972: Ted Shortliffe developed an expert system named ‘MYCIN’ which is used for the treatment of
illnesses.
Voice of the Computer: NETtalk
1986: Terrence J. Sejnowski and Charles Rosenberg developed an artificial neural network,’ NETtalk.’ It
was able to read words and pronounce them correctly and could apply what it learned for understanding
more new words.
Victory over champions
1997: Deep Blue from IBM became the first computerized chess-playing system to defeat the world
chess champion, Garry Kasparov.
2005: A robot from Stanford University won the DARPA Challenge. It drove autonomously for 131 miles
across an unrehearsed desert trail.
2007: A team from CMU won the DARPA Urban Challenge by autonomously navigating 55 miles in an
urban environment by following all traffic laws.
2011: IBM’s question answering system, Watson, defeated the two greatest Jeopardy Champions, Brad
Rutter and Ken Jennings in a Jeopardy! Quiz exhibition match.
AI Today
Now a days, faster computers and advanced machine learning techniques have been introduced to access
a large amount of data. It has resolved many economical and financial problems. Currently, experts are
working on Deep Learning, Big Data, Machine learning, and several other techniques and taking the
world to a highly advanced level.
Artificial Intelligence: The Superset.
AI provides ways to make machines intelligent. AI uses algorithms and expert systems to make the
artificial brain. ML is the subset of artificial intelligence because ML makes AI algorithms more advance
so that machines may automatically improve through experiences without manual intervention. Thus,
Machine learning is an application/component of Artificial Intelligence.
Components of Artificial Intelligence
 Reasoning, problem-solving: Researchers had developed machines with algorithms that enable
machines to solve puzzles or quiz similar to humans. AI can also deal with uncertain or
incomplete information through advanced algorithms.
 Knowledge Representation: It is the representation of all the knowledge which is stored by an
agent to make an expert system. Knowledge can be a set of objects, relations, concepts, or
properties.
 Planning: Intelligent agents should be able to set goals and make plans to achieve those goals.
They should be able to visualize the future and make predictions about their actions taken for
achieving the goal.
 Learning: It is the study of the computer algorithms which improve automatically through
experiences. This concept is known as Machine Learning.
 Natural Language Processing: This processing enables a machine to read and understand
human language by processing the human language into machine language.
 Perception: An ability of the machine to use input from sensors, microphones, wireless signals,
etc. for understanding different aspects of the world.
Types of Artificial Intelligence
Classification of AI can be done in several ways:
 Weak AI: It is also known as narrow AI, which is designed to perform a specific task. It acts like
it can ‘think’.
 Strong AI: It is also known as artificial general intelligence which has generalized human
cognitive abilities. It is intelligent enough to find a solution.
Arend Hintze, an assistant professor of integrative biology and computer science, classified Artificial
Intelligence into four types:
 Reactive Machines: These machines are designed for small purposes, but it has no memory and
cannot use past experience for future decision. An example of a reactive machine is Deep Blue
from IBM.
 Limited Memory: This system uses past experience for future decisions, for
example, autonomous vehicles.
 Theory of Mind: This is a psychological term which refers to the understanding that “Every
mindset is different, so is the decision.”At present, this type does not exist.
 Self-awareness: In this type, machines have self-awareness ability to understand their current
state and can predict what others feel. Currently, this type of AI does not exist.
Recent Tools and Technologies
 Speech Recognition: It recognizes the human voice and transforms into the format, which can be
understood by different computer applications.
 Natural Language Generation: It is a tool which produces text from the computer data.
 Virtual Agent: The agent serves as an online customer service representative. It behaves
intelligently with the customer and responses well.
 Machine learning: ML provides a platform to develop algorithms and APIs for the improvement
of the machine and to make machines self-supervised.
 Bio-metrics: It is used for identifying access management and access control. It is also used to
identify the person under surveillance.
Applications of Artificial Intelligence
AI in Business
 AI has become a supporting tool for the growth of the business.
 AI helps in determining the consequences of each action for decision making.
 AI can also make decisions on its own and can act in situations not foreseen by the person.
 Machine learning algorithms are integrated with CRM (Customer Relationship Management) to
provide better services to customers.
 Chatbots used by e-companies provide immediate responses to the customers.
AI in Healthcare
 Hospitals use ML algorithms for better and fast diagnosis than humans. IBM’s Watson (a
question-answering system) used to form a hypothesis from the patient’s data.
 AI can assist both the patients and doctors well.
 Autonomous robots help surgeons in surgery.
 It helps doctors for the right treatments of Cancer.
 It provides a way to try and monitor multiple high risks patients by interrogating them.
 It provides a laboratory for examination and representation of medical information.
AI in Education
 It provides a platform for the students to learn and grab things quickly.
 It automates grading systems that help staff to monitor marks easily.
 AI saves much time of students and teachers.
AI for Robotics
With the help of AI, it becomes easy to take care of the aging population and can see a drastic reduction in
the death rate of people.
AI in Autonomous Vehicles
 AI has automated the systems of cars and other vehicles.
 AI has provided sensors to understand the world around them and learn from the environment
AI in Agriculture
 AI showed improvements in gaining yield and increased research and development of growing
crops.
 Crop and soil monitoring has become easy.
 AI has made farming easier for farmers to know when the fruit or vegetable be ready to ripe.
Advantages of Artificial Intelligence
 Chances of the error have approximately become negligible and achieved higher accuracy.
 Intelligent robots have explored the world.
 AI has become a helping hand for humans in laborious work.
 AI also helps in making the best decision.
 AI has made fraud detection on smart card possible.
 Provide in-depth analyses of data.
Disadvantages of Artificial Intelligence
 It can cost lot of money to build, rebuild or repair machines.
 Robots can replace humans and take off their jobs.
 AI can cause unemployment.
 If given in wrong hands, machines may lead to destruction.
 AI will make human dependent on it which lead to rust on their brains.
Artificial Intelligence Topics
Artificial Intelligence Introduction
 Introduction to Artificial Intelligence
 Intelligent Agents
Search Algorithms
 Problem-solving
 Uninformed Search
 Informed Search
 Heuristic Functions
 Local Search Algorithms and Optimization Problems
 Hill Climbing search
 Differences in Artificial Intelligence
 Adversarial Search in Artificial Intelligence
 Minimax Strategy
 Alpha-beta Pruning
 Constraint Satisfaction Problems in Artificial Intelligence
 Cryptarithmetic Problem in Artificial Intelligence
Knowledge, Reasoning and Planning
 Knowledge based agents in AI
 Knowledge Representation in AI
 The Wumpus world
 Propositional Logic
 Inference Rules in Propositional Logic
 Theory of First Order Logic
 Inference in First Order Logic
 Resolution method in AI
 Forward Chaining
 Backward Chaining
 Classical Planning
Uncertain Knowledge and Reasoning
 Quantifying Uncertainty
 Probabilistic Reasoning
 Hidden Markov Models
 Dynamic Bayesian Networks
 Utility Functions in Artificial Intelligence
ntelligent Agents

What is an Agent?
An agent can be viewed as anything that perceives its environment through sensors and acts upon that
environment through actuators.
For example, human being perceives their surroundings through their sensory organs known as sensors
and take actions using their hands, legs, etc., known as actuators.
Diagrammatic Representation of an Agent
Agents interact with the environment through sensors and actuators
Intelligent Agent
An intelligent agent is a goal-directed agent. It perceives its environment through its sensors using the
observations and built-in knowledge, acts upon the environment through its actuators.
Rational Agent
A rational agent is an agent which takes the right action for every perception. By doing so, it maximizes
the performance measure, which makes an agent be the most successful.
Note: There is a slight difference between a rational agent and an intelligent agent.
Omniscient Agent
An omniscient agent is an agent which knows the actual outcome of its action in advance. However, such
agents are impossible in the real world.
Note: Rational agents are different from Omniscient agents because a rational agent tries to get the best
possible outcome with the current perception, which leads to imperfection. A chess AI can be a good
example of a rational agent because, with the current action, it is not possible to foresee every possible
outcome whereas a tic-tac-toe AI is omniscient as it always knows the outcome in advance.
Software Agents
It is a software program which works in a dynamic environment. These agents are also known
as Softbots because all body parts of software agents are software only. For example, video games, flight
simulator, etc.
Behavior of an Agent
Mathematically, an agent behavior can be described by an:
 Agent Function: It is the mapping of a given percept sequence to an action. It is an abstract
mathematical explanation.
 Agent Program: It is the practical and physical implementation of the agent function.
For example, an automatic hand-dryer detects signals (hands) through its sensors. When we bring hands
nearby the dryer, it turns on the heating circuit and blows air. When the signal detection disappears, it
breaks the heating circuit and stops blowing air.
Rationality of an agent
It is expected from an intelligent agent to act in a way that maximizes its performance measure.
Therefore, the rationality of an agent depends on four things:
 The performance measure which defines the criterion of success.
 The agent’s built-in knowledge about the environment.
 The actions that the agent can perform.
 The agent’s percept sequence until now.
For example: score in exams depends on the question paper as well as our knowledge.
Note: Rationality maximizes the expected performance, while perfection maximizes the actual
performance which leads to omniscience.
Task Environment
A task environment is a problem to which a rational agent is designed as a solution. Consequently, in
2003, Russell and Norvig introduced several ways to classify task environments. However, before
classifying the environments, we should be aware of the following terms:
 Performance Measure: It specifies the agent’s sequence of steps taken to achieve its target by
measuring different factors.
 Environment: It specifies the interaction of the agent with different types of environment.
 Actuators: It specifies the way the agent affects the environment by taking expected actions.
 Sensors: It specifies the way the agent gets information from its environment.
These terms acronymically called as PEAS (Performance measure, Environment, Actuators, Sensors). To
understand PEAS terminology in more detail, let’s discuss each element in the following example:
Agent Type Performance Environment Actuators Sensors

Safe, fast, correct Steering, horn, Cameras, GPS,


Taxi Driver Roads, traffic
destination breaks speedometer

PEAS summary for an automated taxi driver


Properties/Classification of Task Environment
Fully Observable vs. Partially Observable:
When an agent’s sensors allow access to complete state of the environment at each point of time, then the
task environment is fully observable, whereas, if the agent does not have complete and relevant
information of the environment, then the task environment is partially observable.
Example: In the Checker Game, the agent observes the environment completely while in Poker Game,
the agent partially observes the environment because it cannot see the cards of the other agent.
Note: Fully Observable task environments are convenient as there is no need to maintain the internal state
to keep track of the world.
Single-agent vs. Multiagent
When a single agent works to achieve a goal, it is known as Single-agent, whereas when two or more
agents work together to achieve a goal, they are known as Multiagents.
Example: Playing a crossword puzzle – single agent
Playing chess –multiagent (requires two agents)
Deterministic vs. Stochastic
If the agent’s current state and action completely determine the next state of the environment, then the
environment is deterministic whereas if the next state cannot be determined from the current state and
action, then the environment is Stochastic.
Example: Image analysis – Deterministic
Taxi driving – Stochastic (cannot determine the traffic behavior)
Note: If the environment is partially observable, it may appear as Stochastic
Episodic vs. Sequential
If the agent’s episodes are divided into atomic episodes and the next episode does not depend on the
previous state actions, then the environment is episodic, whereas, if current actions may affect the future
decision, such environment is sequential.
Example: Part-picking robot – Episodic
Chess playing – Sequential
Static vs. Dynamic
If the environment changes with time, such an environment is dynamic; otherwise, the environment is
static.
Example: Crosswords Puzzles have a static environment while the Physical world has a dynamic
environment.
Discrete vs. Continuous
If an agent has the finite number of actions and states, then the environment is discrete otherwise
continuous.
Example: In Checkers game, there is a finite number of moves – Discrete
A truck can have infinite moves while reaching its destination – Continuous.
Known vs. Unknown
In a known environment, the agents know the outcomes of its actions, but in an unknown environment,
the agent needs to learn from the environment in order to make good decisions.
Example: A tennis player knows the rules and outcomes of its actions while a player needs to learn the
rules of a new video game.
Note: A known environment is partially observable, but an unknown environment is fully observable.
Structure of agents
The goal of artificial intelligence is to design an agent program which implements an agent function i.e.,
mapping from percepts into actions. A program requires some computer devices with physical sensors and
actuators for execution, which is known as architecture.
Therefore, an agent is the combination of the architecture and the program i.e.
agent = architecture + program
Note: The difference between the agent program and agent function is that an agent program takes the
current percept as input, whereas an agent function takes the entire percept history.
Types of Agent Programs
Varying in the level of intelligence and complexity of the task, the following four types of agents are
there:
 Simple reflex agents: It is the simplest agent which acts according to the current percept only,
pays no attention to the rest of the percept history. The agent function of this type relies on
the condition-action rule – “If condition, then action.” It makes correct decisions only if the
environment is fully observable. These agents cannot ignore infinite loop when the environment
is partially observable but can escape from infinite loops if the agents randomize its actions.

Example: iDraw, a drawing robot which converts the typed characters into
writing without storing the past data.
Note: Simple reflex agents do not maintain the internal state and do not depend on the percept theory.
 Model-based agent: These type of agents can handle partially observable environments by
maintaining some internal states. The internal state depends on the percept history, which reflects
at least some of the unobserved aspects of the current state. Therefore, as time passes, the internal
state needs to be updated which requires two types of knowledge or information to be encoded in
an agent program i.e., the evolution of the world on its own and the effects of the agent’s actions.

Example: When a person walks in a lane, he maps the pathway in his mind.
 Goal-based agents: It is not sufficient to have the current state information unless the goal is not
decided. Therefore, a goal-based agent selects a way among multiple possibilities that helps it to
reach its goal.
Note: With the help of searching and planning (subfields of AI), it becomes easy for the Goal-based agent
to reach its destination.

 Utility-based agents: These types of agents are concerned about the performance measure. The
agent selects those actions which maximize the performance measure and devote towards the
goal.
Example: The main goal of chess playing is to ‘check-and-mate’ the king, but the player completes
several small goals previously.
Note: Utility-based agents keep track of its environment, and before reaching its main goal, it completes
several tiny goals that may come in between the path.
 Learning agents: The main task of these agents is to teach the agent machines to operate in an
unknown environment and gain as much knowledge as they can. A learning agent is divided into
four conceptual components:
 Learning element: This element is responsible for making improvements.
 Performance element: It is responsible for selecting external actions according to the
percepts it takes.
 Critic: It provides feedback to the learning agent about how well the agent is doing,
which could maximize the performance measure in the future.
 Problem Generator: It suggests actions which could lead to new and informative
experiences.
Example: Humans learn to speak only after taking birth.
Note: The objective of a Learning agent is to improve the overall performance of the agent.
Working of an agent program’s components
The function of agent components is to answer some basic questions like “What is the world like now?”,
“what do my actions do?” etc.
We can represent the environment inherited by the agent in various ways by distinguishing on an axis of
increasing expressive power and complexity as discussed below:
 Atomic Representation: Here, we cannot divide each state of the world. So, it does not have any
internal structure. Search, and game-playing, Hidden Markov Models, and Markov decision
process all work with the atomic representation.
 Factored Representation: Here, each state is split into a fixed set of attributes or variables
having a value. It allows us to represent uncertainty. Constraint satisfaction, propositional
logic, Bayesian networks, and machine learning algorithms work with the Factored
representation.
Note: Two different factored states can share some variables like current GPS location, but two different
atomic states cannot do so.
 Structured Representation: Here, we can explicitly describe various and varying relationships
between different objects which exist in the world. Relational databases and first-order logic,
first-order probability models, natural language understanding underlie structured
representation.

You might also like