Professional Documents
Culture Documents
Artificial Intelligence Notes Detailed
Artificial Intelligence Notes Detailed
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.
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.
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
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.
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.
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.
Amazon AI
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.
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.
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.
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 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 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 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.
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.
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.
Speech Recognition
Allows intelligent systems to convert human speech into text or code.
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.
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.
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:
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
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.
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.
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.
Anything you do, it start with a search! AI has solutions to these everyday problems. Lets understand
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
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
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
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
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.
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.
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
1. It does not create redundancy in the data structure thus it does not visit the same node that has been
visited already.
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.
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
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.
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
Before we jump on to finding the algorithm for evaluating the problem and searching for the solution, we
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
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
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
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 —
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
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).
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
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
In the next blog, we will discuss the classical search algorithms,starting with uninformed search algorithms
Time bd bm bd/2 bd bd
Space bd bm bd/2 bd bd
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
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.
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
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.
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.
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.
It is a natural process or quality given to human beings. It is programmed using human intelligence.
A human brain does not require any electricity to show Artificial intelligence requires electricity to get
his intelligence. an output.
Human intelligence can handle different situations in a It is designed to handle only a few types of
better way. problems.
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.
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 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 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.
The structure of a BFS tree is wide and short. The structure of a DFS tree is narrow and long.
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
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 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.
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
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.
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 →
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)
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.
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
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.