0% found this document useful (0 votes)
38 views112 pages

Unit

The document provides an overview of Artificial Intelligence (AI), including its definitions, types, and historical context. It discusses the goals, advantages, and disadvantages of AI, as well as the foundational principles and components necessary for its development. Additionally, it highlights various applications of AI and emphasizes the importance of ethical considerations in its implementation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views112 pages

Unit

The document provides an overview of Artificial Intelligence (AI), including its definitions, types, and historical context. It discusses the goals, advantages, and disadvantages of AI, as well as the foundational principles and components necessary for its development. Additionally, it highlights various applications of AI and emphasizes the importance of ethical considerations in its implementation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 112

UNIT-I

INTRODUCTION AND INTELLIGENT AGENT

Introduction: What is AI? - The Foundations of Artificial Intelligence - The History of Artificial
Intelligence - The State of the Art - Risks and Benefits of AI; Intelligent Agents: Agents and
Environments – Good Behavior – The Nature of Environments – The Structure of Agents;
Philosophy, Ethics, and Safety of AI: The Limits of AI - Can Machines Really Think? - The Ethics
of AI, The Future of AI: AI Components - AI Architectures.

INTRODUCTION
INTELLIGENCE ARTIFICIAL
INTELLIGENCE
It is a natural process. It is programmed by humans.
It is actually hereditary. It is not hereditary.
Knowledge is required for KB and electricity are required
intelligence. to generate output.
No human is an expert. We Expert systems are made which
may get better solutions from aggregate many person’s
other humans. experience and ideas.

DEFINITION

The study of how to make computers do things at which at the moment, people are better.
“Artificial Intelligence is the ability of a computer to act like a human being”.

 Systems that think like humans


 Systems that act like humans
 Systems that think rationally.
 Systems that act rationally.

(a) Intelligence - Ability to apply knowledge in order to perform better in an environment.


(b) Artificial Intelligence - Study and construction of agent programs that perform well in a given
environment, for a given agent architecture.
(c) Agent - An entity that takes action in response to precepts from an environment.
(d) Rationality - property of a system which does the “right thing” given what it knows.
(e) Logical Reasoning - A process of deriving new sentences from old, such that the new
sentences are necessarily true if the old ones are true.
Figure 1.1 Some definitions of artificial intelligence, organized into four categories
DEFINITION OF ARTIFICIAL INTELLEGENCE

Four Approaches of Artificial Intelligence:


 Acting humanly: The Turing test approach.
 Thinking humanly: The cognitive modelling approach.
 Thinking rationally: The laws of thought approach.
 Acting rationally: The rational agent approach.

In today's world, technology is growing very fast, and we are getting in touch with different new
technologies day by day.

Here, one of the booming technologies of computer science is Artificial Intelligence which is ready to create
a new revolution in the world by making intelligent machines.The Artificial Intelligence is now all around us.
It is currently working with a variety of subfields, ranging from general to specific, such as self-driving cars,
playing chess, proving theorems, playing music, Painting, etc.

AI is one of the fascinating and universal fields of Computer science which has a great scope in future. AI
holds a tendency to cause a machine to work as a human.
Artificial Intelligence is composed of two words Artificial and Intelligence, where Artificial defines "man-
made," and intelligence defines "thinking power", hence AI means "a man-made thinking power."

So, we can define AI as:

"It is a branch of computer science by which we can create intelligent machines which can behave like a
human, think like humans, and able to make decisions."

Artificial Intelligence exists when a machine can have human based skills such as learning, reasoning, and
solving problems

With Artificial Intelligence you do not need to preprogram a machine to do some work, despite that you can
create a machine with programmed algorithms which can work with own intelligence, and that is the
awesomeness of AI.

It is believed that AI is not a new technology, and some people says that as per Greek myth, there were
Mechanical men in early days which can work and behave like humans.

What is AI?

AI stands for Artificial Intelligence, which is a field of study that focuses on creating computer systems that
can performtasks that normally require human intelligence.

Types of artificial intelligence:

 Narrow AI (Weak AI) – Designed for specific tasks (e.g., Siri, Google Assistant, ChatGPT).
 General AI (Strong AI) – Aims to perform any intellectual task a human can (still theoretical).
 Super AI – Hypothetical AI surpassing human intelligence.
Artificial intelligence can be organized in several ways, depending on stages of development or
actions being performed.
For instance, four stages of AI development are commonly recognized.
1. Reactive machines: Limited AI that only reacts to different kinds of stimuli based on
preprogrammed rules. Does not use memory and thus cannot learn with new data. IBM’s Deep Blue
that beat chess champion Garry Kasparov in 1997 was an example of a reactive machine.
2. Limited memory: Most modern AI is considered to be limited memory. It can use memory to
improve over time by being trained with new data, typically through an artificial neural network or
other training model. Deep learning, a subset of machine learning, is considered limited memory
artificial intelligence.
3. Theory of mind: Theory of mind AI does not currently exist, but research is ongoing into its
possibilities. It describes AI that can emulate the human mind and has decision-making capabilities
equal to that of a human, including recognizing and remembering emotions and reacting in social
situations as a human would.
4. Self aware: A step above theory of mind AI, self-aware AI describes a mythical machine that is
aware of its own existence and has the intellectual and emotional capabilities of a human. Like
theory of mind AI, self-aware AI does not currently exist.
A more useful way of broadly categorizing types of artificial intelligence is by what the machine can
do. All of what we currently call artificial intelligence is considered artificial “narrow” intelligence,
in that it can perform only narrow sets of actions based on its programming and training. For
instance, an AI algorithm that is used for object classification won’t be able to perform natural
language processing. Google Search is a form of narrow AI, as is predictive analytics, or virtual
assistants.
Artificial general intelligence (AGI) would be the ability for a machine to “sense, think, and act” just
like a human. AGI does not currently exist. The next level would be artificial superintelligence
(ASI), in which the machine would be able to function in all ways superior to a human.
AI Technologies:
 Machine Learning (ML) – AI learns from data to improve over time.
 Deep Learning – Uses neural networks to process complex patterns.
 Natural Language Processing (NLP) – Enables AI to understand human language (e.g., chatbots).
 Computer Vision – Helps AI interpret and analyze images/videos.
 Robotics – AI-powered robots perform tasks like manufacturing and self-driving.
Applications and use cases for artificial intelligence”
Speech recognition
 Automatically convert spoken speech into written text.
Image recognition
 Identify and categorize various aspects of an image.
Translation
 Translate written or spoken words from one language into another.
Predictive modeling
 Mine data to forecast specific outcomes with high degrees of granularity.
Data analytics
 Find patterns and relationships in data for business intelligence.
Cybersecurity
 Autonomously scan networks for cyber attacks and threats.

Why Artificial Intelligence?

Before Learning about Artificial Intelligence, we should know that what is the importance of AI and
why should we learn it. Following are some main reasons to learn about AI:

o With the help of AI, you can create such software or devices which can solve real-world problems
very easily and with accuracy such as health issues, marketing, traffic issues, etc.
o With the help of AI, you can create your personal virtual Assistant, such as Cortana, Google
Assistant, Siri, etc.
o With the help of AI, you can build such Robots which can work in an environment where survival of
humans can be at risk.
o AI opens a path for other new technologies, new devices, and new Opportunities.

Goals of Artificial Intelligence

Following are the main goals of Artificial Intelligence:

1. Replicate human intelligence


2. Solve Knowledge-intensive tasks
3. An intelligent connection of perception and action
4. Building a machine which can perform tasks that requires human intelligence such as:
o Proving a theorem
o Playing chess
o Plan some surgical operation
o Driving a car in traffic
5. Creating some system which can exhibit intelligent behavior, learn new things by itself,
demonstrate, explain, and can advise to its user.

What Comprises to Artificial Intelligence?

Artificial Intelligence is not just a part of computer science even it's so vast and requires lots of
other factors which can contribute to it. To create the AI first we should know that how
intelligence is composed, so the Intelligence is an intangible part of our brain which is a
combination of Reasoning, learning, problem- solving perception, language understanding,
etc.

To achieve the above factors for a machine or software Artificial Intelligence requires the
following discipline:

oMathematics
oBiology
oPsychology
oSociology
oComputer Science
oNeurons Study
oStatistics
Advantages of Artificial Intelligence

Following are some main advantages of Artificial Intelligence:

o High Accuracy with less errors: AI machines or systems are prone to less errors and high accuracy
as it takes decisions as per pre-experience or information.
o High-Speed: AI systems can be of very high-speed and fast-decision making, because of that AI
systems can beat a chess champion in the Chess game.
o High reliability: AI machines are highly reliable and can perform the same action multiple times
with high accuracy.
o Useful for risky areas: AI machines can be helpful in situations such as defusing a bomb, exploring
the ocean floor, where to employ a human can be risky.
o Digital Assistant: AI can be very useful to provide digital assistant to the users such as AI
technology is currently used by various E-commerce websites to show the products as per customer
requirement.
o Useful as a public utility: AI can be very useful for public utilities such as a self-driving car which
can make our journey safer and hassle-free, facial recognition for security purpose, Natural language
processing to communicate with the human in human-language, etc.

Disadvantages of Artificial Intelligence

Every technology has some disadvantages, and thesame goes for Artificial intelligence. Being so
advantageous technology still, it has some disadvantages which we need to keep in our mind while
creating an AI system. Following are the disadvantages of AI:

o High Cost: The hardware and software requirement of AI is very costly as it requires lots of
maintenance to meet current world requirements.
o Can't think out of the box: Even we are making smarter machines with AI, but still they cannot
work out of the box, as the robot will only do that work for which they are trained, or programmed.
o No feelings and emotions: AI machines can be an outstanding performer, but still it does not have
the feeling so it cannot make any kind of emotional attachment with human, and may sometime be
harmful for users if the proper care is not taken.
o Increase dependency on machines: With the increment of technology, people are getting more
dependent on devices and hence they are losing their mental capabilities.
o No Original Creativity: As humans are so creative and can imagine some new ideas but still AI
machines cannot beat this power of human intelligence and cannot be creative and imaginative.
Prerequisite

Before learning about Artificial Intelligence, you must have the fundamental knowledge of
following so that you can understand the concepts easily:

o Any computer language such as C, C++, Java, Python, etc.(knowledge of Python will be an advantage)
o Knowledge of essential Mathematics such as derivatives, probability theory, etc.

Artificial Intelligence Examples


Specific examples of AI include:
Generative AI Tools
Generative AI tools, sometimes referred to as AI chatbots —
including ChatGPT, Gemini, Claude and Grok — use artificial intelligence to produce written
content in a range of formats, from essays to code and answers to simple questions.
Smart Assista
nts
Personal AI assistants, like Alexa and Siri, use natural language processing to receive instructions
from users to perform a variety of “smart tasks.” They can carry out commands like setting
reminders, searching for online information or turning off your kitchen lights.
Self-Driving Cars
Self-driving cars are a recognizable example of deep learning, since they use deep neural networks
to detect objects around them, determine their distance from other cars, identify traffic signals and
much more.
Wearables
Many wearable sensors and devices used in the healthcare industry apply deep learning to assess
the health condition of patients, including their blood sugar levels, blood pressure and heart rate.
They can also derive patterns from a patient’s prior medical data and use that to anticipate any
future health conditions.
Visual Filters
Filters used on social media platforms like TikTok and Snapchat rely on algorithms to distinguish
between an image’s subject and the background, track facial movements and adjust the image on
the screen based on what the user is doing.

The Foundation of AI: Core Principles and Components


1.Mathematics & Statistics
Mathematics provides the theoretical backbone for AI, while statistics helps in data-driven
decision-making.
 Linear Algebra – Essential for machine learning models (e.g., vectors, matrices, tensors).
 Probability & Statistics – Used in Bayesian networks, uncertainty modeling, and decision-
making.
 Calculus – Supports optimization algorithms and backpropagation in deep learning.
 Graph Theory – Fundamental in search algorithms, neural networks, and knowledge
representation.
2. Computer Science & Algorithms
AI relies on efficient algorithms and computational techniques for problem-solving.
 Search Algorithms – Used in pathfinding, game AI, and decision-making (e.g., A*,
Minimax).
 Sorting & Optimization – Improves the efficiency of AI models.
 Data Structures – Trees, graphs, hash tables, and queues help in knowledge representation
and retrieval.
 Complexity Theory – Determines the feasibility of AI solutions (e.g., NP-hard problems).

3. Machine Learning & Deep Learning


 Supervised Learning – Models learn from labeled data (e.g., classification, regression).
 Unsupervised Learning – AI finds patterns in unlabeled data (e.g., clustering,
dimensionality reduction).
 Reinforcement Learning – Agents learn through trial and error (e.g., AlphaGo, robotics).
 Neural Networks & Deep Learning – Used in image recognition, NLP, and generative
models.

4. Logic & Reasoning


AI must reason and make decisions based on given facts and rules.
 Propositional & Predicate Logic – Used in expert systems and automated reasoning.
 Fuzzy Logic – Helps AI handle uncertainty and approximate reasoning.
 Bayesian Inference – Supports probabilistic reasoning under uncertainty.

5. Cognitive Science & Neuroscience


Understanding human intelligence helps in designing AI models that mimic human
behavior.
 Cognitive Psychology – Studies human perception, memory, and learning to inspire AI
models.
 Neuroscience – Neural networks are inspired by the workings of the human brain.
 Behavioral Science – Used in AI-human interaction and ethical AI design.

6. Natural Language Processing (NLP)


AI interacts with human language through speech and text.
 Syntax & Semantics – Understanding sentence structure and meaning.
 Speech Recognition – Converts spoken words into text (e.g., Alexa, Siri).
 Language Models – GPT-4, BERT, and similar models improve AI-driven communication.

7. Robotics & Control Systems


AI is used in robotics for automation and autonomous decision-making.
 Kinematics & Dynamics – Governs robot movement and interaction.
 Perception & Vision – Enables robots to understand their environment (e.g., computer
vision).
 Autonomous Decision-Making – Used in self-driving cars, drones, and smart assistants.

8. Ethics & Philosophy of AI


AI must be developed with ethical considerations to prevent bias and harm.
 AI Ethics – Focuses on fairness, accountability, and transparency.
 Explainable AI (XAI) – Ensures AI models are interpretable and trustworthy.
 AI and Society – Examines the social and economic impact of AI adoption.

The History of Artificial Intelligence

The idea of “artificial intelligence” goes back thousands of years, to ancient philosophers
considering questions of life and death. In ancient times, inventors made things called
“automatons” which were mechanical and moved independently of human intervention. The word
“automaton” comes from ancient Greek, and means “acting of one’s own will.” One of the earliest
records of an automaton comes from 400 BCE and refers to a mechanical pigeon created by a
friend of the philosopher Plato. Many years later, one of the most famous automatons was created
by Leonardo da Vinci around the year 1495.
So while the idea of a machine being able to function on its own is ancient, for the purposes of
this article, we’re going to focus on the 20th century, when engineers and scientists began to make
strides toward our modern-day AI.
Groundwork for AI:
1900-1950In the early 1900s, there was a lot of media created that centered around the idea of
artificial humans. So much so that scientists of all sorts started asking the question: is it possible to
create an artificial brain? Some creators even made some versions of what we now call “robots”
(and the word was coined in a Czech play in 1921) though most of them were relatively simple.
These were steam-powered for the most part, and some could make facial expressions and even
walk.
Dates of note:
 1921: Czech playwright Karel Čapek released a science fiction play “Rossum’s Universal
Robots” which introduced the idea of “artificial people” which he named robots. This was the first
known use of the word.
 1929: Japanese professor Makoto Nishimura built the first Japanese robot,
named Gakutensoku.
 1949: Computer scientist Edmund Callis Berkley published the book “Giant Brains, or
Machines that Think” which compared the newer models of computers to human brains.
Birth of AI: 1950-1956
This range of time was when the interest in AI really came to a head. Alan Turing published his
work “Computer Machinery and Intelligence” which eventually became The Turing Test, which
experts used to measure computer intelligence. The term “artificial intelligence” was coined and
came into popular use.

Dates of note:
 1950: Alan Turing published “Computer Machinery and Intelligence” which proposed a test
of machine intelligence called The Imitation Game.
 1952: A computer scientist named Arthur Samuel developed a program to play checkers,
which is the first to ever learn the game independently.
 1955: John McCarthy held a workshop at Dartmouth on “artificial intelligence” which is the
first use of the word, and how it came into popular usage.

AI maturation: 1957-1979
The time between when the phrase “artificial intelligence” was created, and the 1980s was a
period of both rapid growth and struggle for AI research. The late 1950s through the 1960s was a
time of creation. From programming languages that are still in use to this day to books and films
that explored the idea of robots, AI became a mainstream idea quickly.
The 1970s showed similar improvements, such as the first anthropomorphic robot being built in
Japan, to the first example of an autonomous vehicle being built by an engineering grad student.
However, it was also a time of struggle for AI research, as the U.S. government showed little
interest in continuing to fund AI research.

Notable dates include:


 1958: John McCarthy created LISP (acronym for List Processing), the first programming
language for AI research, which is still in popular use to this day.
 1959: Arthur Samuel created the term “machine learning” when doing a speech about
teaching machines to play chess better than the humans who programmed them.
 1961: The first industrial robot Unimate started working on an assembly line at General
Motors in New Jersey, tasked with transporting die casings and welding parts on cars (which was
deemed too dangerous for humans).
 1965: Edward Feigenbaum and Joshua Lederberg created the first “expert system” which
was a form of AI programmed to replicate the thinking and decision-making abilities of human
experts.
 1966: Joseph Weizenbaum created the first “chatterbot” (later shortened to chatbot), ELIZA,
a mock psychotherapist, that used natural language processing (NLP) to converse with
humans.1968: Soviet mathematician Alexey Ivakhnenko published “Group Method of Data
Handling” in the journal “Avtomatika,” which proposed a new approach to AI that would later
become what we now know as “Deep Learning.”
 1973: An applied mathematician named James Lighthill gave a report to the British Science
Council, underlining that strides were not as impressive as those that had been promised by
scientists, which led to much-reduced support and funding for AI research from the British
government.
 1979: James L. Adams created The Standford Cart in 1961, which became one of the first
examples of an autonomous vehicle. In ‘79, it successfully navigated a room full of chairs without
human interference.
 1979: The American Association of Artificial Intelligence which is now known as
the Association for the Advancement of Artificial Intelligence (AAAI) was founded.
AI boom: 1980-1987
Most of the 1980s showed a period of rapid growth and interest in AI, now labeled as the “AI
boom.” This came from both breakthroughs in research, and additional government funding to
support the researchers. Deep Learning techniques and the use of Expert System became more
popular, both of which allowed computers to learn from their mistakes and make independent
decisions.

Notable dates in this time period include:


 1980: First conference of the AAAI was held at Stanford.
 1980: The first expert system came into the commercial market, known as XCON (expert
configurer). It was designed to assist in the ordering of computer systems by automatically picking
components based on the customer’s needs.
 1981: The Japanese government allocated $850 million (over $2 billion dollars in today’s
money) to the Fifth Generation Computer project. Their aim was to create computers that could
translate, converse in human language, and express reasoning on a human level.
 1984: The AAAI warns of an incoming “AI Winter” where funding and interest would
decrease, and make research significantly more difficult.
 1985: An autonomous drawing program known as AARON is demonstrated at the AAAI
conference.
 1986: Ernst Dickmann and his team at Bundeswehr University of Munich created and
demonstrated the first driverless car (or robot car). It could drive up to 55 mph on roads that didn’t
have other obstacles or human drivers.
 1987: Commercial launch of Alacrity by Alactrious Inc. Alacrity was the first strategy
managerial advisory system, and used a complex expert system with 3,000+ rules.
AI winter: 1987-1993
As the AAAI warned, an AI Winter came. The term describes a period of low consumer, public,
and private interest in AI which leads to decreased research funding, which, in turn, leads to few
breakthroughs. Both private investors and the government lost interest in AI and halted their
funding due to high cost versus seemingly low return. This AI Winter came about because of some
setbacks in the machine market and expert systems, including the end of the Fifth Generation
project, cutbacks in strategic computing initiatives, and a slowdown in the deployment of expert
systems.
Notable dates include:

 1987: The market for specialized LISP-based hardware collapsed due to cheaper and more
accessible competitors that could run LISP software, including those offered by IBM and Apple.
This caused many specialized LISP companies to fail as the technology was now easily accessible.
 1988: A computer programmer named Rollo Carpenter invented the chatbot Jabberwacky,
which he programmed to provide interesting and entertaining conversation to humans.
AI agents: 1993-2011

Despite the lack of funding during the AI Winter, the early 90s showed some impressive strides
forward in AI research, including the introduction of the first AI system that could beat a reigning
world champion chess player. This era also introduced AI into everyday life via innovations such
as the first Roomba and the first commercially-available speech recognition software on Windows
computers.
The surge in interest was followed by a surge in funding for research, which allowed even more
progress to be made.
Notable dates include:

 1997: Deep Blue (developed by IBM) beat the world chess champion, Gary Kasparov, in a
highly-publicized match, becoming the first program to beat a human chess champion.
 1997: Windows released a speech recognition software (developed by Dragon Systems).
 2000: Professor Cynthia Breazeal developed the first robot that could simulate human
emotions with its face,which included eyes, eyebrows, ears, and a mouth. It was called Kismet.
 2002: The first Roomba was released.
 2003: Nasa landed two rovers onto Mars (Spirit and Opportunity) and they navigated the
surface of the planet without human intervention.
 2006: Companies such as Twitter, Facebook, and Netflix started utilizing AI as a part of
their advertising and user experience (UX) algorithms.
 2010: Microsoft launched the Xbox 360 Kinect, the first gaming hardware designed to track
body movement and translate it into gaming directions.
 2011: An NLP computer programmed to answer questions named Watson (created by IBM)
won Jeopardy against two former champions in a televised game.
 2011: Apple released Siri, the first popular virtual assistant.
Artificial General Intelligence: 2012-present
That brings us to the most recent developments in AI, up to the present day. We’ve seen a surge
in common-use AI tools, such as virtual assistants, search engines, etc. This time period also
popularized Deep Learning and Big Data..
Notable dates include:
 2012: Two researchers from Google (Jeff Dean and Andrew Ng) trained a neural network to
recognize cats by showing it unlabeled images and no background information.
 2015: Elon Musk, Stephen Hawking, and Steve Wozniak (and over 3,000 others) signed an
open letter to the worlds’ government systems banning the development of (and later, use of)
autonomous weapons for purposes of war.
 2016: Hanson Robotics created a humanoid robot named Sophia, who became known as the
first “robot citizen” and was the first robot created with a realistic human appearance and the
ability to see and replicate emotions, as well as to communicate.
 2017: Facebook programmed two AI chatbots to converse and learn how to negotiate, but as
they went back and forth they ended up forgoing English and developing their own language,
completely autonomously.
 2018: A Chinese tech group called Alibaba’s language-processing AI beat human intellect
on a Stanford reading and comprehension test.
 2019: Google’s AlphaStar reached Grandmaster on the video game StarCraft 2,
outperforming all but 0.2% of human players.
 2020: OpenAI started beta testing GPT-3, a model that uses Deep Learning to create code,
poetry, and other such language and writing tasks. While not the first of its kind, it is the first that
creates content almost indistinguishable from those created by humans.
 2021: OpenAI developed DALL-E, which can process and understand images enough to
produce accurate captions, moving AI one step closer to understanding the visual world.

ACTING HUMANLY: THE TURING TEST APPROACH

The Turing Test, proposed by Alan Turing (1950), was designed to provide a satisfactory
operational definition of intelligence. A computer passes the test if a human interrogator, after
posing some written questions, cannot tell whether the written responses come from a person or
from a computer.
 natural language processing to enable it to communicate successfully in English;
 knowledge representation to store what it knows or hears;
 automated reasoning to use the stored information to answer questions and to
draw new conclusions
machine learning to adapt to new circumstances and to detect and extrapolate patterns.
Total Turing Test includes a video signal so that the interrogator can test the subject’s
perceptual abilities, as well as the opportunity for the interrogator to pass physical objects
“through the hatch.” To pass the total Turing Test, the computer will need

computer vision to perceive objects, and robotics to manipulate objects and move about.

Thinking humanly: The cognitive modelling approach

Analyse how a given program thinks like a human, we must have some way of determining
how humans think. The interdisciplinary field of cognitive science brings together computer
models from AI and experimental techniques from psychology to try to construct precise and
testable theories of the workings of the human mind.

Although cognitive science is a fascinating field in itself, we are not going to be discussing it
all that much in this book. We will occasionally comment on similarities or differences
between AI techniques and human cognition. Real cognitive science, however, is necessarily
based on experimental investigation of actual humans or animals, and we assume that the
reader only has access to a computer for experimentation. We will simply note that AI and
cognitive science continue to fertilize each other, especially in the areas of vision, natural
language, and learning.

Thinking rationally: The “laws of thought” approach

The Greek philosopher Aristotle was one of the first to attempt to codify ``right thinking,'' that
is, irrefutable reasoning processes. His famous syllogisms provided patterns for argument
structures that always gave correct conclusions given correct premises.

For example, ``Socrates is a man; all men are mortal; therefore Socrates is mortal.''

These laws of thought were supposed to govern the operation of the mind, and initiated the
field of logic.

Acting rationally: The rational agent approach

Acting rationally means acting so as to achieve one's goals, given one's beliefs. An agent is
just something that perceives and acts.

The right thing: that which is expected to maximize goal achievement, given the available
information

Does not necessary involve thinking.

For Example - blinking reflex- but should be in the service of rational action.

THE STATE OF THE ART:


Artificial Intelligence (AI) is an interdisciplinary field drawing from several core disciplines,
including computer science, economics, psychology, neuroscience, mathematics, linguistics,
philosophy, control theory, and cybernetics. Each of these areas contributes uniquely to the
development and advancement of AI.

1. Computer Science & AI


AI is fundamentally driven by computer science, which provides the algorithms, data
structures, and computational power to build intelligent systems.

Key Developments:
 Deep Learning & Neural Networks – AI models like GPT-4, DALL·E, and AlphaFold rely
on deep learning techniques.
 Quantum Computing & AI – Emerging research on quantum-enhanced machine learning.
 AI & Edge Computing – AI processing on edge devices for real-time decision-making.
Applications:
 Autonomous systems (self-driving cars, drones).
 AI-powered cybersecurity (threat detection & prevention).
 AI-driven software development (Copilot, AlphaCode).
2. Economics & AI
AI is transforming economics through market predictions, automated trading, and economic
modeling.
Key Innovations:
 Algorithmic Trading – AI-driven trading strategies optimize financial markets.
 AI-driven Economic Forecasting – Predicting inflation, GDP growth, and market crashes.
 Game Theory & AI – Used in reinforcement learning for AI decision-making in uncertain
environments.
Applications:
 AI-powered fintech (fraud detection, credit scoring).
 Supply chain optimization with predictive AI.
 AI-driven economic policies and market regulation.

3. Psychology & AI
Understanding human cognition, emotions, and decision-making helps improve AI systems
that interact with people.
Key Innovations:
 Affective Computing (Emotion AI) – AI models that detect and respond to human emotions.
 Cognitive AI – Simulating human-like reasoning in AI (e.g., IBM Watson).
 AI-based Behavioral Analysis – AI-driven analysis of consumer behavior and mental health
patterns.
Applications:
 AI-powered mental health chatbots (Wysa, Woebot).
 Human-AI collaboration in workplaces (AI as a cognitive assistant).
 AI-driven personalized learning (adaptive AI tutors).

4. Neuroscience & AI
AI development is inspired by how the human brain processes information and learns.
Key Innovations:
 Neuromorphic Computing – AI models that mimic brain neurons for energy-efficient
computing.
 Brain-Computer Interfaces (BCI) – AI-powered interfaces that allow direct brain-machine
communication (e.g., Neuralink).
 Memory-Augmented Neural Networks (MANNs) – AI that mimics human memory and
learning processes.
Applications:
 AI-assisted prosthetics and neurorehabilitation.
 Brain-inspired deep learning models for advanced reasoning.
 AI-driven medical diagnosis for neurological disorders.
5. Mathematics & AI
Mathematics underpins AI through statistics, probability, algebra, and optimization
techniques.
Key Innovations:
 Bayesian Inference & Probabilistic AI – AI models that handle uncertainty effectively.
 Graph Neural Networks (GNNs) – Used in social network analysis and molecular research.
 Mathematical Optimization in AI – Improving AI performance using advanced calculus and
linear algebra.
Applications:
 AI in scientific research (protein folding, physics simulations).
 AI-driven logistics and route optimization.
 Improved AI explainability through mathematical models.

6. Linguistics & AI
AI in natural language processing (NLP) helps machines understand, generate, and interact in
human language.
Key Innovations:
 Large Language Models (LLMs) – AI models like GPT-4, LLaMA, and Claude understand
and generate human-like text.
 Speech Recognition & Synthesis – AI-powered text-to-speech (TTS) and automatic speech
recognition (ASR).
 Multilingual AI – AI that understands and translates multiple languages with high accuracy.
Applications:
 AI-driven customer support chatbots.
 Real-time AI translators and transcription services.
 AI-generated content for creative industries (music, writing, and storytelling).
7. Philosophy & AI
Philosophy helps define AI ethics, consciousness, and the nature of intelligence.
Key Innovations:
 Ethical AI (Fairness, Bias Reduction) – Ensuring AI is unbiased and responsible.
 Explainable AI (XAI) – Making AI decisions interpretable for humans.
 AI & Consciousness – Research into whether AI can achieve self-awareness or reasoning
beyond human capability.

Applications:
 AI-driven ethical decision-making in automation.
 AI in law and governance (legal AI for case analysis).
 AI for philosophical research in ethics and morality.
8. Control Theory & AI
Control theory ensures AI systems remain stable, efficient, and adaptive in dynamic
environments.
Key Innovations:
 Reinforcement Learning (RL) – AI that learns optimal actions based on feedback (e.g.,
AlphaGo, OpenAI Five).
 Adaptive AI Systems – AI that adjusts parameters dynamically in real-time.
 AI-powered Control Systems – Used in industrial automation and robotics.
Applications:
 Self-driving cars using AI-based control algorithms.
 AI-driven robotic arms in manufacturing.
 Autonomous drone control systems.

9. Cybernetics & AI
Cybernetics studies how AI systems interact with biological and mechanical systems.
Key Innovations:
 Human-AI Augmentation – AI-powered prosthetics, wearables, and neural implants.
 Biohybrid AI – AI integrated with biological elements for enhanced computing.
 Autonomous Learning Systems – AI that adapts in real-time like living organisms.
Applications:
 AI-powered exoskeletons for mobility assistance.
 Neural AI interfaces for controlling machines with thoughts.
 AI-driven feedback loops in smart environments (smart cities, IoT).

RISKS AND BENEFITS OF AI


 Benefits of AI:
 1. Increased Efficiency & Automation
 AI can perform repetitive and complex tasks faster and more accurately than humans.
✅ Example: AI-powered robotic process automation (RPA) automates business operations,
reducing human workload.
 2. Improved Decision-Making
 AI analyzes vast amounts of data to provide better insights and predictions.
✅ Example: AI-driven healthcare diagnostics detect diseases like cancer earlier and with higher
accuracy.
 3. Enhanced Creativity & Innovation
 Generative AI helps in art, music, writing, and software development.
✅ Example: AI tools like DALL·E, MidJourney, and GitHub Copilot assist in creative and
coding tasks.
 4. Personalized User Experiences
 AI customizes experiences based on user preferences.
✅ Example: Netflix and Spotify recommend personalized movies and music using AI
algorithms.
 5. Scientific & Medical Advancements
 AI accelerates research in genetics, drug discovery, and climate modeling.
✅ Example: AlphaFold (DeepMind) predicts protein structures, revolutionizing drug
development.
 6. Financial & Economic Growth
 AI optimizes stock trading, fraud detection, and risk management.
✅ Example: AI-powered algorithmic trading makes real-time investment decisions in
milliseconds.
 7. Autonomous Systems & Robotics
 AI enables self-driving cars, drones, and robotic automation.
✅ Example: Tesla’s Autopilot & Waymo’s self-driving taxis reduce accidents caused by human
errors.
 8. Accessibility & Assistive Technology
 AI helps people with disabilities through speech recognition and vision assistance.
✅ Example: AI-powered prosthetics and screen readers improve accessibility for visually
impaired users.
 9. Cybersecurity & Fraud Prevention
 AI detects cyber threats and fraudulent activities faster than traditional methods.
✅ Example: AI-driven threat detection systems identify hacking attempts in real-time.
 10. Environmental & Sustainability Solutions
 AI optimizes energy use, waste management, and climate monitoring.
✅ Example: AI-powered smart grids improve energy efficiency in cities.

RISKS OF AI

1. Job Displacement & Economic Disruptions


AI automation may replace human jobs, causing economic inequality.
❌ Example: AI-driven chatbots and robots replace customer service and factory workers.
2. Bias, Discrimination & Ethical Concerns
AI can inherit biases from training data, leading to unfair decisions.
❌ Example: AI-powered hiring systems may discriminate based on gender or race.
3. Security Threats & Cyber Risks
Hackers can use AI for deepfakes, automated cyberattacks, and identity theft.
❌ Example: AI-generated deepfake videos spread misinformation.
4. Privacy Violations & Surveillance
AI-powered facial recognition and data collection raise concerns about surveillance.
❌ Example: Governments using AI for mass surveillance without privacy protections.
5. Dependence on AI & Lack of Human Control
Over-reliance on AI can make systems vulnerable to failure or manipulation.
❌ Example: AI autonomous weapons operating without human oversight.
6. AI Misuse & Malicious Applications
AI can be weaponized for cyberwarfare, misinformation, and autonomous weapons.
❌ Example: AI-generated fake news and propaganda manipulate public opinion.
7. Existential Risks & AGI (Artificial General Intelligence)
Highly advanced AI could surpass human intelligence and become uncontrollable.
❌ Example: Superintelligent AI making decisions beyond human understanding.
8. Unemployment & Economic Inequality
Wealth from AI-driven industries may widen economic gaps.
❌ Example: Large corporations benefit, while low-skill workers struggle to find jobs.
9. AI Hallucinations & Incorrect Information
AI may generate false, misleading, or nonsensical information.
❌ Example: AI chatbots like ChatGPT and Bard sometimes provide inaccurate answers.
10. Lack of Transparency & Explainability
Some AI decisions are complex and difficult to interpret.
❌ Example: AI-driven credit scoring denying loans without explanation.

FUTURE OF ARTIFICIAL INTELLIGENCE


 Transportation: Although it could take a decade or more to perfect them, autonomous cars will
one day ferry us from place to place.
 Manufacturing: AI powered robots work alongside humans to perform a limited range of tasks
like assembly and stacking, and predictive analysis sensors keep equipment running smoothly.
 Healthcare: In the comparatively AI-nascent field of healthcare, diseases are more quickly and
accurately diagnosed, drug discovery is sped up and streamlined, virtual nursing assistants
monitor patients and big data analysis helps to create a more personalized patient experience.
 Education: Textbooks are digitized with the help of AI, early-stage virtual tutors assist human
instructors and facial analysis gauges the emotions of students to help determine who’s
struggling or bored and better tailor the experience to their individual needs.
 Media: Journalism is harnessing AI, too, and will continue to benefit from it. Bloomberg uses
Cyborg technology to help make quick sense of complex financial reports. The Associated Press
employs the natural language abilities of Automated Insights to produce 3,700 earning reports
stories per year — nearly four times more than in the recent past
 Customer Service: Last but hardly least, Google is working on an AI assistant that can place
human-like calls to make appointments at, say, your neighborhood hair salon. In addition to
words, the system understands context and nuance.

Future of Artificial Intelligence:

1. Health Care Industries


India is 17.7% of the worlds’ population that makes it the second-largest country in terms of
China’s population. Health care facilities are not available to all individuals living in the
country. It is because of the lack of good doctors, not having good infrastructure, etc. Still, there
are people who couldn’t reach to doctors/ hospitals. AI has the ability to provide the facility to
detect disease based on symptoms; even if you don’t go to the doctor, AI would read the data
from Fitness band/medical history of an individual to analyze the pattern and suggest proper
medication and even deliver it on one’s fingertips just through cell-phone.
As mentioned earlier Google’s deep mind has already beaten doctors in detecting fatal diseases
like breast cancer. It’s not far away when AI will be detecting common disease as well as
providing proper suggestions for medication. The consequences of this could be: no need for
doctors in the long term result in JOB reduction.
2. AI in Education
The development of a country depends on the quality of education youth is getting. Right now,
we can see there are lots of courses are available on AI. But in the future AI is going to
transform the classical way of education. Now the world doesn’t need skilled labourers for
manufacturing industries, which is mostly replaced by robots and automation. The education
system could be quite effective and can be according to the individual’s personality and ability.
It would give chance brighter students to shine and to imbecile a better way to cop up.

Right Education can enhance the power of individuals/nations; on the other hand, misuse of the
same could lead to devastating results.

3. AI in Finance
Quantification of growth for any country is directly related to its economic and financial
condition. As AI has enormous scope in almost every field, it has great potential to boost
individuals’ economic health and a nation. Nowadays, the AI algorithm is being used in
managing equity funds.

An AI system could take a lot number of parameters while figuring out the best way to manage
funds. It would perform better than a human manager. AI-driven strategies in the field of
finance are going to change the classical way of trading and investing. It could be devastating
for some fund managing firms who cannot afford such facilities and could affect business on a
large scale, as the decision would be quick and abrupt. The competition would be tough and on
edge all the time.

4.AI in Military and Cybersecurity


AI-assisted Military technologies have built autonomous weapon systems, which won’t need
humans at all hence building the safest way to enhance the security of a nation. We could see
robot Military in the near future, which is as intelligent as a soldier/ commando and will be able
to perform some tasks.

AI-assisted strategies would enhance mission effectiveness and will provide the safest way to
execute it. The concerning part with AI-assisted system is that how it performs algorithm is not
quite explainable. The deep neural networks learn faster and continuously keep learning the
main problem here would be explainable AI. It could possess devastating results when it
reaches in the wrong hands or makes wrong decisions on its own.

AGENTS IN ARTIFICIAL INTELLIGENCE

In artificial intelligence, an agent is a computer program or system that is designed to perceive


its environment, make decisions and take actions to achieve a specific goal or set of goals. The
agent operates autonomously, meaning it is not directly controlled by a human operator.
Agents can be classified into different types based on their characteristics, such as whether they
are reactive or proactive, whether they have a fixed or dynamic environment, and whether they
are single or multi-agent systems.
 Reactive agents are those that respond to immediate stimuli from their environment and take
actions based on those stimuli. Proactive agents, on the other hand, take initiative and plan ahead
to achieve their goals. The environment in which an agent operates can also be fixed or dynamic.
Fixed environments have a static set of rules that do not change, while dynamic environments
are constantly changing and require agents to adapt to new situations.
 Multi-agent systems involve multiple agents working together to achieve a common goal. These
agents may have to coordinate their actions and communicate with each other to achieve their
objectives. Agents are used in a variety of applications, including robotics, gaming, and
intelligent systems. They can be implemented using different programming languages and
techniques, including machine learning and natural language processing.
Artificial intelligence is defined as the study of rational agents. A rational agent could be
anything that makes decisions, such as a person, firm, machine, or software. It carries out an
action with the best outcome after considering past and current percepts(agent’s perceptual
inputs at a given instance). An AI system is composed of an agent and its environment. The
agents act in their environment. The environment may contain other agents.
An agent is anything that can be viewed as:
 Perceiving its environment through sensors and
 Acting upon that environment through actuators

AGENTS AND ITS TYPES

Figure 1.3 Agent types

An agent is anything that can be viewed as perceiving its environment through sensors
and acting upon that environment through actuators.

 Human Sensors:
 Eyes, ears, and other organs for sensors.
 Human Actuators:
 Hands, legs, mouth, and other body parts.
 Robotic Sensors:
 Mic, cameras and infrared range finders for sensors
 Robotic Actuators:
 Motors, Display, speakers etc An agent can be:
Human-Agent: A human agent has eyes, ears, and other organs which work for sensors
h and, legs, vocal tract work for actuator
Robotic Agent: A robotic agent can have cameras, infrared range finder, NLP for sensors and
various motors for actuators.
Software Agent: Software agent can have keystrokes, file contents as sensory input and
act on those inputs and display output on the screen.

Hence the world around us is full of agents such as thermostat, cell phone, camera, and
even we are also agents. Before moving forward, we should first know about sensors, effectors,
and actuators.

Sensor: Sensor is a device which detects the change in the environment and sends the
information to other electronic devices. An agent observes its environment through sensors.
Actuators: Actuators are the component of machines that converts energy into
motion. The actuators are only responsible for moving and controlling a system. An actuator can
be an electric motor, gears, rails, etc.

Effectors: Effectors are the devices which affect the environment. Effectors can be legs,
wheels, arms, fingers, wings, fins, and display screen.

Figure 1.4 Effectors

PROPERTIES OF ENVIRONMENT
An environment is everything in the world which surrounds the agent, but it is not a part of an
agent itself. An environment can be described as a situation in which an agent is present.
The environment is where agent lives, operate and provide the agent with something to sense and
act upon it.
Fully observable vs Partially Observable:
If an agent sensor can sense or access the complete state of an environment at each point of time
then it is a fully observable environment, else it is partially observable.
A fully observable environment is easy as there is no need to maintain the internal state to keep
track history of the world.
An agent with no sensors in all environments then such an environment is called as
unobservable.
Example: chess – the board is fully observable, as are opponent’s moves. Driving – what is
around the next bend is not observable and hence partially observable.
1. Deterministic vs Stochastic
 If an agent's current state and selected action can completely determine the next
state of the environment, then such environment is called a deterministic
environment.
 stochastic environment is random in nature and cannot be determined completely
by an agent.
 In a deterministic, fully observable environment, agent does not need to worry
about uncertainty.
2. Episodic vs Sequential
 In an episodic environment, there is a series of one-shot actions, and only the
current percept is required for the action.
 However, in Sequential environment, an agent requires memory of past actions to
determine the next best actions.
3. Single-agent vs Multi-agent
 If only one agent is involved in an environment, and operating by itself then such
an environment is called single agent environment.
 However, if multiple agents are operating in an environment, then such an
environment is called a multi-agent environment.
 The agent design problems in the multi-agent environment are different from
single agent environment.
4. Static vs Dynamic
 If the environment can change itself while an agent is deliberating then such
environment is called a dynamic environment else it is called a static
environment.
 Static environments are easy to deal because an agent does not need to continue
looking at the world while deciding for an action.
 However for dynamic environment, agents need to keep looking at the world at
each action.
 Taxi driving is an example of a dynamic environment whereas Crossword puzzles
are an example of a static environment.
5. Discrete vs Continuous
 If in an environment there are a finite number of precepts and actions that can be
performed within it, then such an environment is called a discrete environment
else it is called continuous environment.
 A chess game comes under discrete environment as there is a finite number of
moves that can be performed.
 A self-driving car is an example of a continuous environment.

6. Known vs Unknown
 Known and unknown are not actually a feature of an environment, but it is an
agent's state of knowledge to perform an action.
 In a known environment, the results for all actions are known to the agent. While
in unknown environment, agent needs to learn how it works in order to perform
an action.
 It is quite possible that a known environment to be partially observable and an
Unknown environment to be fully observable.
7. Accessible vs. Inaccessible
 If an agent can obtain complete and accurate information about the state's
environment, then such an environment is called an Accessible environment else
it is called inaccessible.
 An empty room whose state can be defined by its temperature is an example of an
accessible environment.
 Information about an event on earth is an example of Inaccessible environment.
Task environments, which are essentially the "problems" to which rational agents are the
"solutions."
PEAS: Performance Measure, Environment, Actuators, Sensors
Performance
The output which we get from the agent. All the necessary results that an agent gives after
processing comes under its performance.
Environment
All the surrounding things and conditions of an agent fall in this section. It basically consists of
all the things under which the agents work.
Actuators
The devices, hardware or software through which the agent performs any actions or processes
any information to produce a result are the actuators of the agent.
Sensors
The devices through which the agent observes and perceives its environment are the sensors of
the agent.
Figure 1.5 Examples of agent types and their PEAS descriptions
Rational Agent - A system is rational if it does the “right thing”. Given what it knows.
Characteristic of Rational Agent
 The agent's prior knowledge of the environment.
 The performance measure that defines the criterion of success.
 The actions that the agent can perform.
 The agent's percept sequence to date.
For every possible percept sequence, a rational agent should select an action that is expected to
maximize its performance measure, given the evidence provided by the percept sequence and
whatever built-in knowledge the agent has.
 An omniscient agent knows the actual outcome of its actions and can act accordingly; but
omniscience is impossible in reality.
 Ideal Rational Agent precepts and does things. It has a greater performance measure.
Eg. Crossing road. Here first perception occurs on both sides and then only action. No perception
occurs in Degenerate Agent.
Eg. Clock. It does not view the surroundings. No matter what happens outside. The clock works
based on inbuilt program.
 Ideal Agent describes by ideal mappings. “Specifying which action an agent ought to take in
response to any given percept sequence provides a design for ideal agent”.
 Eg. SQRT function calculation in calculator.
 Doing actions in order to modify future precepts-sometimes called information gathering- is an
important part of rationality.
 A rational agent should be autonomous-it should learn from its own prior knowledge
The Structure of Intelligent Agents
Agent = Architecture + Agent Program
Architecture = the machinery that an agent executes on. (Hardware)
Agent Program = an implementation of an agent function.
(Algorithm, Logic – Software)

CHARACTERISTICS OF INTELLIGENT AGENTS


Situatedness
The agent receives some form of sensory input from its environment, and it performs some action
that changes its environment in some way.
Examples of environments: the physical world and the Internet.
 Autonomy
The agent can act without direct intervention by humans or other agents and that it has control
over its own actions and internal state.
 Adaptivity
The agent is capable of
(1) reacting flexibly to changes in its environment;
(2) taking goal-directed initiative (i.e., is pro-active), when appropriate; and
(3) Learning from its own experience, its environment, and interactions with others.
• Sociability
The agent is capable of interacting in a peer-to-peer manner with other agents or humans.
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

THE SIMPLE REFLEX AGENTS

 The Simple reflex agents are the simplest agents. These agents take decisions on the
basis of the current percepts and ignore the rest of the percept history (past State).

 These agents only succeed in the fully observable environment.

 The Simple reflex agent does not consider any part of percepts history during their
decision and action process.

 The Simple reflex agent works on Condition-action rule, which means it maps the
current state to action. Such as a Room Cleaner agent, it works only if there is dirt in
the room.

 Problems for the simple reflex agent design approach:

o They have very limited intelligence


o They do not have knowledge of non-perceptual parts of the current state
o Mostly too big to generate and to store.
o Not adaptive to changes in the environment.
Condition-Action Rule − It is a rule that maps a state (condition) to an action.
Ex: if car-in-front-is-braking then initiate- braking.

Figure. A simple reflex agent


MODEL BASED REFLEX AGENTS

 The Model-based agent can work in a partially observable environment, and track the
situation.
 A model-based agent has two important factors:
o Model: It is knowledge about "how things happen in the world," so it is called a
Model-based agent.
o Internal State: It is a representation of the current state based on percept history.
 These agents have the model, "which is knowledge of the world" and based on the
model they perform actions.
 Updating the agent state requires information about:
o How the world evolves
o How the agent's action affects the world.

Figure . model-based reflex agent

GOAL BASED AGENTS

o The knowledge of the current state environment is not always sufficient to decide for
an agent to what to do.

o The agent needs to know its goal which describes desirable situations.

o Goal-based agents expand the capabilities of the model-based agent by having the
"goal" information.
o They choose an action, so that they can achieve the goal.

o These agents may have to consider a long sequence of possible actions before
deciding whether the goal is achieved or not. Such considerations of different scenario
are called searching and planning, which makes an agent proactive.

Figure 1.8 A goal-based agent

UTILITY BASED AGENTS


o These agents are similar to the goal-based agent but provide an extra component of
utility measurement (“Level of Happiness”) which makes them different by
providing a measure of success at a given state.

o Utility-based agent act based not only goals but also the best way to achieve the goal.

o The Utility-based agent is useful when there are multiple possible alternatives, and an
agent has to choose in order to perform the best action.

o The utility function maps each state to a real number to check how efficiently each
action achieves the goals.

Figure .utility-based agent


LEARNING AGENTS

o A learning agent in AI is the type of agent which can learn from its past experiences,
or it has learning capabilities.

o It starts to act with basic knowledge and then able to act and adapt automatically
through learning.

o A learning agent has mainly four conceptual components, which are:

a. Learning element: It is responsible for making improvements by learning from


environment

b. Critic: Learning element takes feedback from critic which describes that how
well the agent is doing with respect to a fixed performance standard.

c. Performance element: It is responsible for selecting external action

d. Problem generator: This component is responsible for suggesting actions that


will lead to new and informative experiences.

o Hence, learning agents are able to learn, analyze performance, and look for new ways
to improve the performance.

Figure 1.10 Learning Agents

a. Problem generator: This component is responsible for suggesting actions that


will lead to new and informative experiences.

o Hence, learning agents are able to learn, analyze performance, and look for new ways
to improve the performance.
Figure 1.10 Learning Agents

Learning Agent
Multi-Agent Systems
These agents interact with other agents to achieve a common goal. They may have to coordinate
their actions and communicate with each other to achieve their objective.
A multi-agent system (MAS) is a system composed of multiple interacting agents that are designed
to work together to achieve a common goal. These agents may be autonomous or semi-autonomous
and are capable of perceiving their environment, making decisions, and taking action to achieve the
common objective.
MAS can be used in a variety of applications, including transportation systems, robotics, and social
networks. They can help improve efficiency, reduce costs, and increase flexibility in complex
systems. MAS can be classified into different types based on their characteristics, such as whether
the agents have the same or different goals, whether the agents are cooperative or competitive, and
whether the agents are homogeneous or heterogeneous.
 In a homogeneous MAS, all the agents have the same capabilities, goals, and behaviors.
 In contrast, in a heterogeneous MAS, the agents have different capabilities, goals, and behaviors.
This can make coordination more challenging but can also lead to more flexible and robust systems.
Cooperative MAS involves agents working together to achieve a common goal, while competitive
MAS involves agents working against each other to achieve their own goals. In some cases, MAS
can also involve both cooperative and competitive behavior, where agents must balance their own
interests with the interests of the group.
MAS can be implemented using different techniques, such as game theory, machine learning, and
agent-based modeling. Game theory is used to analyze strategic interactions between agents and
predict their behavior. Machine learning is used to train agents to improve their decision-making
capabilities over time. Agent-based modeling is used to simulate complex systems and study the
interactions between agents.
Overall, multi-agent systems are a powerful tool in artificial intelligence that can help solve complex
problems and improve efficiency in a variety of applications.
Hierarchical Agents
These agents are organized into a hierarchy, with high-level agents overseeing the behavior of
lower-level agents. The high-level agents provide goals and constraints, while the low-level agents
carry out specific tasks. Hierarchical agents are useful in complex environments with many tasks
and sub-tasks.
 Hierarchical agents are agents that are organized into a hierarchy, with high-level agents overseeing
the behavior of lower-level agents. The high-level agents provide goals and constraints, while the
low-level agents carry out specific tasks. This structure allows for more efficient and organized
decision-making in complex environments.
 Hierarchical agents can be implemented in a variety of applications, including robotics,
manufacturing, and transportation systems. They are particularly useful in environments where there
are many tasks and sub-tasks that need to be coordinated and prioritized.
 In a hierarchical agent system, the high-level agents are responsible for setting goals and constraints
for the lower-level agents. These goals and constraints are typically based on the overall objective of
the system. For example, in a manufacturing system, the high-level agents might set production
targets for the lower-level agents based on customer demand.
 The low-level agents are responsible for carrying out specific tasks to achieve the goals set by the
high-level agents. These tasks may be relatively simple or more complex, depending on the specific
application. For example, in a transportation system, low-level agents might be responsible for
managing traffic flow at specific intersections.
 Hierarchical agents can be organized into different levels, depending on the complexity of the
system. In a simple system, there may be only two levels: high-level agents and low-level agents. In
a more complex system, there may be multiple levels, with intermediate-level agents responsible for
coordinating the activities of lower-level agents.
 One advantage of hierarchical agents is that they allow for more efficient use of resources. By
organizing agents into a hierarchy, it is possible to allocate tasks to the agents that are best suited to
carry them out, while avoiding duplication of effort. This can lead to faster, more efficient decision-
making and better overall performance of the system.
Overall, hierarchical agents are a powerful tool in artificial intelligence that can help solve complex
problems and improve efficiency in a variety of applications.
Uses of Agents
Agents are used in a wide range of applications in artificial intelligence, including:
 Robotics: Agents can be used to control robots and automate tasks in manufacturing, transportation,
and other industries.
 Smart homes and buildings: Agents can be used to control heating, lighting, and other systems in
smart homes and buildings, optimizing energy use and improving comfort.
 Transportation systems: Agents can be used to manage traffic flow, optimize routes for autonomous
vehicles, and improve logistics and supply chain management.
 Healthcare: Agents can be used to monitor patients, provide personalized treatment plans, and
optimize healthcare resource allocation.
 Finance: Agents can be used for automated trading, fraud detection, and risk management in the
financial industry.
 Games: Agents can be used to create intelligent opponents in games and simulations, providing a
more challenging and realistic experience for players.
 Natural language processing: Agents can be used for language translation, question answering, and
chatbots that can communicate with users in natural language.
 Cybersecurity: Agents can be used for intrusion detection, malware analysis, and network security.
 Environmental monitoring: Agents can be used to monitor and manage natural resources, track
climate change, and improve environmental sustainability.
 Social media: Agents can be used to analyze social media data, identify trends and patterns, and
provide personalized recommendations to users.
Good Behavior:
An agent should act as a Rational Agent. A rational agent is one that does the right thing that
is the right actions will cause the agent to be most successful in the environment.
Performance measures
A performance measures embodies the criterion for success of an agent‘s behavior. As a general
rule, it is better to design performance measures according to what one actually wants in the
environment, rather than according to how one thinks the agent should behave.
Rationality
What is rational at any given time depends on four things:
The performance measure that defines the criterion of success.
The agent‘s prior knowledge of the environment.
The actions that the agent can perform.
The agent‘s percept sequence to date.
This leads to a definition of a rational agent (ideal rational agent)
“For each possible percept sequence, a rational agent should select an action that is expected to
maximize its performance measure, given the evidence provided by the percept sequence and
whatever built-in knowledge the agent has, that is the task of rational agent is to improve the
performance measure depends on percept sequence”

Omniscience, learning, and autonomy


 An omniscient agent knows the actual outcome of its actions and can act accordingly; but
omniscience is impossible in reality.
 A rational agent not only to gather information, but also to learn as much as possible from what it
perceives. The agent‘s initial configuration could reflect some prior knowledge of the environment,
but as the agent gains experience this may be modified and augmented.
 Successful agents split the task of computing the agent function into three different periods: when
the agent is being designed, some of the computation is done by its designers; when it is deliberating
on its next action, the agent does more computation; and as it learns from experience, it does even
more computation to decide how to modify its behavior.
 A rational agent should be autonomous – it should learn what it can to compensate for partial or
incorrect prior knowledge. Concrete implementation, running on the agent architecture.
The Nature of Environments
An environment is the external system where an agent operates. AI environments can be:
 Fully Observable vs. Partially Observable
o Fully observable: AI has complete knowledge (e.g., chess).
o Partially observable: AI operates with limited information (e.g., poker).
 Deterministic vs. Stochastic
o Deterministic: Actions have predictable outcomes (e.g., solving a math equation).
o Stochastic: Outcomes have randomness (e.g., weather forecasting).
 Episodic vs. Sequential
o Episodic: Each action is independent (e.g., image recognition).
o Sequential: Actions affect future decisions (e.g., playing a game).
 Static vs. Dynamic
o Static: The world does not change while AI is reasoning (e.g., solving a puzzle).
o Dynamic: The world changes as AI operates (e.g., self-driving cars).
 Discrete vs. Continuous
o Discrete: AI chooses from a fixed set of actions (e.g., turn-based games).
o Continuous: AI operates in an infinite space of possibilities (e.g., robotics).

PHILOSOPHY, ETHICS, AND SAFETY OF AI

A fundamental question in AI and philosophy is whether machines can truly think or just
simulate thinking.
Strong AI vs. Weak AI
 Strong AI (Artificial General Intelligence - AGI): Hypothetical AI with human-like reasoning.
 Weak AI (Artificial Narrow Intelligence - ANI): AI specialized for specific tasks (e.g., Siri,
ChatGPT).
Turing Test
Proposed by Alan Turing, it states that an AI is intelligent if it can imitate human conversation so
well that a human cannot distinguish it from another human.
Chinese Room Argument
Proposed by John Searle, it suggests that an AI can simulate intelligence without truly
understanding anything.

2. The Ethics of AI
AI raises several ethical concerns, including:
 Bias & Fairness: AI models may inherit biases from training data, leading to discrimination.
 Privacy & Surveillance: AI can track and monitor individuals without consent.
 Job Displacement: Automation may replace human workers.
 AI in Warfare: AI-powered autonomous weapons pose security risks.
Ethical AI Solutions:
 Developing transparent AI models.
 Implementing regulations like the EU AI Act.
 Using AI for social good, such as medical diagnosis.
3. The Limits of AI
Despite its advancements, AI has several limitations:
1. Lack of Common Sense – AI cannot reason like humans.
2. Bias in Data – AI decisions can be unfair.
3. Computational Costs – Training deep learning models requires significant resources.
4. Security Risks – AI can be manipulated or attacked (e.g., deepfakes).
Limits Of AI:
While AI has made remarkable advancements, it still has several fundamental limitations that
prevent it from achieving human-like intelligence or fully replacing human decision-making. These
limits are influenced by factors such as technology, data, ethics, and our understanding of
intelligence itself.
Artificial intelligence (AI) has several limitations, including:
 Lack of creativity: AI can generate content and ideas, but it can't create original solutions or
innovate beyond its programming.
 Lack of common sense: AI systems are good at specific tasks, but they don't have a deep
understanding of the world.
 Lack of explainability: Some AI models are difficult to understand, making it hard to know how
they reach conclusions. This is known as the "black box" problem.
 Data dependency: AI systems are dependent on the quality and quantity of training data.
 Resource intensiveness: Training AI models requires a lot of computational power and energy.
 Limited transfer learning: AI models are good at the specific tasks they're trained for, but it's hard
to transfer their knowledge to new tasks.
 Vulnerability to adversarial attacks: AI systems can be misled if the input data is intentionally
manipulated.
 Lack of emotional intelligence: AI systems struggle to understand and respond to human
emotions.
 Bias: AI systems can perpetuate biases in decision-making, which can lead to discriminatory
results.
 Contextual understanding: AI systems can struggle with understanding nuance or context, which
can lead to errors in decision-making.
The Ethics of AI
The ethics of artificial intelligence (AI) involves the principles and practices that ensure AI is
developed and used in a responsible and fair way.
Ethical considerations
 Privacy: AI systems can collect a lot of personal information, so it's important to protect it from
unauthorized access and misuse.
 Explainability: AI systems can make life-changing decisions, so it's important to be able to explain
how those decisions were made.
 Fairness: AI systems should be fair and unbiased.
 Transparency: AI systems should be transparent and understandable.
 Beneficence: AI systems should promote well-being and have a positive impact on society.
 Environmental sustainability: AI systems should be designed to be environmentally sustainable.

The Future of AI:


The future of Artificial Intelligence (AI) is one of the most exciting yet uncertain areas of
technological development. AI is already reshaping industries, economies, and societies, but its full
potential has not yet been realized. As AI technologies evolve, they could lead to revolutionary
breakthroughs or present complex challenges. Below are some key themes that will define the future
of AI:
Artificial General Intelligence (AGI)
 Current Status: Most AI systems today are narrow AI or weak AI, meaning they are designed to
perform specific tasks (e.g., image recognition, natural language processing) and lack general
intelligence or autonomy. However, there is an ongoing push toward Artificial General
Intelligence (AGI), which refers to machines that can perform any intellectual task that a human
can do.
 The Goal: AGI would be capable of learning and reasoning across a wide range of domains, just
like a human, making it highly flexible and adaptable.
 Challenges: Achieving AGI involves overcoming significant technical and philosophical hurdles,
including understanding consciousness, general learning mechanisms, and ensuring that AGI
systems align with human values and goals.
Implications of AGI:
 Superintelligence: If AGI evolves into superintelligent AI, it could outperform humans in every
cognitive domain, leading to both incredible opportunities and existential risks.
 Ethical Concerns: Ensuring that AGI aligns with human interests, values, and ethics is a critical
challenge that requires global cooperation.
2. AI in Healthcare
AI’s role in healthcare is poised to grow exponentially, potentially transforming the industry in
several ways:
 Diagnostics: AI can analyze medical images, identify patterns in data, and make diagnoses with
high accuracy, aiding doctors in early detection of diseases such as cancer and heart disease.
 Personalized Medicine: AI can help design personalized treatment plans by analyzing patients'
medical histories and genetic data.
 Drug Discovery: AI can accelerate the development of new medications by simulating molecular
interactions and predicting outcomes, potentially bringing life-saving drugs to market faster.
Challenges:
 Data Privacy: The sensitive nature of medical data raises privacy concerns and the potential misuse
of AI systems in healthcare.
 Regulation: Ensuring AI tools meet regulatory standards for patient safety while remaining
innovative.
3. AI in Autonomous Systems
 Self-Driving Vehicles: AI will continue to play a crucial role in the development of autonomous
vehicles (AVs), such as self-driving cars, drones, and ships. These systems will rely on computer
vision, machine learning, and sensor fusion to navigate the world.
Implications:
 Transportation Efficiency: Autonomous vehicles could reduce traffic accidents, improve fuel
efficiency, and ease congestion. However, it will also raise questions about job displacement for
drivers in industries like trucking and taxi services.
 Safety: Ensuring the safety and reliability of autonomous systems will be critical, as a failure in
these systems could have serious consequences, especially in critical applications like self-driving
cars or drones.
4. AI in Education
AI has the potential to revolutionize education by offering more personalized, adaptable, and
accessible learning experiences.
Key Developments:
 Adaptive Learning: AI-powered systems can analyze students' performance and adapt the content
to their learning pace and style, making education more tailored to individual needs.
 AI Tutors: Virtual assistants and AI tutors can help students with assignments, answer questions,
and provide explanations, creating a 24/7 learning environment.
Challenges:
 Equity: Ensuring equal access to AI-powered educational tools, especially in underserved regions,
will be important to avoid widening the digital divide.
 Teacher-Student Relationship: Balancing the role of AI with the need for human interaction in
the classroom is key for the emotional and social development of students.
5. AI in the Workplace
AI's ability to automate tasks could lead to widespread job displacement, but it could also create
new types of work, especially in the AI development, data science, and robotics fields.
Key Trends:
 Automation of Repetitive Tasks: AI can handle repetitive, time-consuming tasks in industries like
manufacturing, retail, and customer service, freeing up human workers to focus on more creative
or strategic roles.
 Augmentation: Rather than replacing humans entirely, AI can augment human work by enhancing
capabilities, improving decision-making, and optimizing productivity.
Challenges:
 Job Losses: As AI systems take over certain tasks, industries such as transportation, retail, and
manufacturing could experience large-scale job losses.
 Reskilling: There will be a need for substantial efforts to reskill the workforce, ensuring that people
can transition into AI-enhanced roles.
6. AI Ethics and Regulation
As AI becomes increasingly powerful, the ethical implications of its use will grow in significance.
Addressing these issues is vital to ensure that AI is developed and deployed in a way that benefits
society while minimizing harm.
Key Ethical Concerns:
 Bias and Fairness: AI systems must be designed to avoid reinforcing existing biases or
discrimination based on race, gender, or other characteristics. There will be an increasing focus on
fairness in AI systems.
 Accountability: As AI makes more decisions, determining who is responsible for harmful or
unintended consequences will be a major ethical challenge.
 Transparency: Ensuring that AI algorithms are explainable and that their decision-making
processes can be understood by humans is important to build trust and accountability.

Regulatory Frameworks:
 Governments and international bodies are likely to develop regulatory frameworks for AI,
ensuring that its deployment is ethical, transparent, and aligned with public interest.
 AI Governance: Organizations and governments will increasingly develop guidelines and
frameworks for responsible AI development, focusing on ensuring that AI serves humanity without
violating individual rights.
7. AI and Creativity
AI is already being used in fields like art, music, film, and writing, pushing the boundaries of what
we consider "creative."
Key Developments:
 Art Generation: AI systems like DALL·E and DeepArt are capable of generating art that can
sometimes rival human creativity.
 Music Composition: AI has been used to compose original pieces of music by analyzing existing
works and generating new compositions.
 Storytelling and Content Creation: AI tools, like GPT-based models, are capable of generating
texts that range from poetry to full-length novels.
Challenges:
 Authorship and Ownership: As AI creates content, questions arise about who owns the intellectual
property rights of AI-generated works.
 Human Creativity: How much of the creative process should be left to humans, and how much
should be outsourced to machines?
8. Long-Term Risks of AI
As AI continues to evolve, existential risks related to superintelligent AI or AGI have become a
topic of intense debate.
Key Concerns:
 Loss of Control: The potential for superintelligent AI to operate beyond human control could lead
to unintended consequences.
 Alignment Problem: Ensuring that AI’s objectives align with human values and priorities is a key
concern. If an AI's goals are misaligned with humanity's well-being, it could pose a significant
threat.

CAN MACHINES REALLY THINK?


This is one of the most profound and debated questions in the philosophy of Artificial Intelligence
(AI) and cognitive science. It touches on issues of consciousness, intelligence, and what it means to
"think."
Let’s explore this question from several perspectives:
1. Turing's Perspective: The Turing Test
One of the early and most influential ideas about whether machines can think came from Alan
Turing, who proposed the Turing Test in 1950.
The Turing Test:
 Concept: Turing suggested that if a machine can engage in a conversation with a human (via text)
and convince the human that it is also human, then the machine can be considered to "think."
 The test measures a machine's ability to simulate intelligent behavior, not necessarily its true
understanding or consciousness.
 Key Point: According to Turing, a machine's ability to mimic human conversation and behavior is
sufficient to argue that it "thinks" — at least in terms of practical interaction.
However, the Turing Test has been criticized because mimicking intelligence is not the same as
being truly conscious or self-aware.
2. The Chinese Room Argument: A Critique of Strong AI
Proposed by John Searle in 1980, the Chinese Room Argument challenges the idea that a machine
can truly "think" in the same way humans do.
The Thought Experiment:
 Imagine a person who doesn't know Chinese is inside a room. The room has a set of rules for
manipulating Chinese symbols based on input symbols. To an outsider, it appears as though the
person in the room understands Chinese because they are able to correctly respond to written
Chinese questions.
 However, the person inside the room doesn’t understand Chinese at all; they are just following
syntactic rules without any understanding of the meaning (semantics).
 Key Point: Searle argues that computers only process symbols (syntax) and don’t understand their
meaning (semantics). Therefore, even if a machine can pass the Turing Test, it doesn’t mean it really
understands or "thinks" in a human sense.
3. Strong AI vs. Weak AI
The debate around whether machines can think often centers on the distinction between
Strong AI and Weak AI.
Strong AI:
 Refers to machines that not only simulate intelligence but actually possess consciousness and
understand their thoughts and actions.
 Strong AI would involve artificial general intelligence (AGI), which could replicate the broad and
adaptable cognitive abilities of humans. It would be conscious, self-aware, and capable of reasoning
in any domain like a human.

Weak AI:
 Also known as narrow AI, refers to machines designed to perform specific tasks but with no true
understanding of the task. Most AI today is Weak AI.
 Example: A chess-playing AI can perform incredibly well at chess but has no understanding of what
chess is in a broader sense. It doesn’t think about chess in the way a human would.
Key Point:
 Strong AI posits that machines can think like humans, while Weak AI suggests that while machines
can perform tasks intelligently, they don't "think" in the human sense.

AI COMPONENTS:
The Five Branches of AI

Below are the five primary branches or subfields of Artificial Intelligence (AI), each contributing
uniquely to the development and capabilities of intelligent systems.

1. Machine Learning
Machine Learning (ML) stands as a vital subset within AI, focusing on machines’ capacity to learn
autonomously from data and algorithms. ML leverages the foundational elements of AI to make
decisions without explicit programming by humans, enhancing its adaptability and problem-solving
capabilities.

2. Deep Learning
Deep Learning (DL) operates as a subset of machine learning, utilizing artificial neural networks
(ANNs) inspired by the human brain. DL excels at extracting intricate features from data, leading to
superior performance compared to traditional machine learning.
It minimizes human intervention further, although it requires substantial amounts of data. Common
applications include natural language processing improvements in technologies like Amazon Alexa
or Google Home.

3. Natural Language Processing


Natural Language Processing (NLP) is a critical aspect of AI enabling computers to comprehend
spoken words and written text. NLP is pervasive in digital assistants, chatbots, virtual assistants, and
spam detection. It plays a vital role in sentiment analysis, extracting emotions and attitudes related
to a product or service from textual data.
4. Robotics
Robotics integrates AI to create and design autonomous or semi-autonomous robots and machines.
This field often incorporates other AI technologies such as NLP and ML to enhance the capabilities
of robots. AI-based robots are already making significant contributions to various industries,
including healthcare, retail, and manufacturing, performing tasks with precision and efficiency.
5. Fuzzy Logic
Recognizing that the world is not always binary, Fuzzy Logic comes into play in AI to handle
conditions that are not strictly true or false. Fuzzy Logic resolves uncertainties by employing if-then
statements or rules, utilizing linguistic variables and fuzzy rules. An example is an automatic
braking system, where fuzzy logic helps determine the optimal braking force based on imprecise
information, contributing to the effectiveness of AI systems in real-world, less predictable scenarios.

AI ARCHITECTURES
AI architectures refer to the underlying structures and frameworks that define how an AI
system is designed, organized, and operates to perform tasks that typically require human
intelligence. These architectures provide the foundation for the development of AI models and
systems, enabling them to handle tasks like learning, decision-making, pattern recognition, and
problem-solving. Below are some of the key AI architectures:
1. Neural Network Architecture
The Neural Network (NN) Architecture is inspired by the human brain and consists of layers of
interconnected neurons (nodes). It is one of the most common architectures used in AI, especially in
deep learning models.
Key Components of Neural Network Architecture:
 Input Layer: The layer where the raw data (features) is input into the neural network.
 Hidden Layers: Intermediate layers that process information received from the input layer, applying
weights, biases, and activation functions to make decisions.
 Output Layer: The final layer that produces the prediction or output based on the network's
computation.
Popular Neural Network Architectures:
 Feedforward Neural Networks (FNN): The simplest form of a neural network where data flows in
one direction from input to output.
 Convolutional Neural Networks (CNN): Primarily used for image recognition and processing tasks.
CNNs use convolutional layers to detect patterns like edges, shapes, and textures.
 Recurrent Neural Networks (RNN): Used for sequential data, such as time-series data or natural
language. RNNs have feedback loops that allow information to persist over time.
 Deep Neural Networks (DNN): Deep neural networks have multiple hidden layers, enabling them to
learn complex patterns from large datasets.
Applications:
 Image recognition
 Speech processing
 Natural language processing
 Autonomous systems
2. Rule-Based Expert Systems
Expert Systems are AI architectures that use a knowledge base of if-then rules to simulate the
decision-making abilities of human experts in a specific domain. These systems are designed to
solve complex problems by reasoning through the rules and facts stored in the knowledge base.
Components:
 Knowledge Base: A collection of rules, facts, and domain-specific knowledge.
 Inference Engine: The component that applies the rules to the facts in the knowledge base to draw
conclusions or make decisions.
 User Interface: Allows interaction with the expert system, providing input and receiving output.
Applications:
 Medical diagnosis
 Customer service support
 Troubleshooting systems
3. Probabilistic Graphical Models (PGMs)
Probabilistic Graphical Models (PGMs) represent a class of models that combine probability theory
and graph theory to model uncertain information and relationships between variables. PGMs are
particularly useful in scenarios where uncertainty is inherent, such as in decision-making and
reasoning.
Types of PGMs:
 Bayesian Networks: Directed acyclic graphs (DAGs) where nodes represent random variables, and
edges represent conditional dependencies. Bayesian networks are used for reasoning and decision-
making under uncertainty.
 Markov Networks: Undirected graphs used to model dependencies in systems with a large number
of variables, often used for image processing and computer vision tasks.
Applications:
 Risk analysis
 Decision support systems
 Natural language processing
 Image segmentation
4. Reinforcement Learning Architecture
Reinforcement Learning (RL) is a type of machine learning where an agent interacts with an
environment and learns to make decisions through trial and error. It receives rewards or penalties
based on the actions it takes and aims to maximize the cumulative reward over time.
Key Components:
 Agent: The entity that takes actions in the environment to achieve a goal.
 Environment: The world in which the agent operates, which provides feedback based on the agent’s
actions.
 State: A representation of the current situation in the environment.
 Action: A choice made by the agent that affects the state of the environment.
 Reward: Feedback received by the agent to evaluate the success of its actions.
 Policy: A strategy or mapping from states to actions that the agent uses to make decisions.
Applications:
 Game playing (e.g., AlphaGo, Chess)
 Robotics
 Autonomous vehicles
 Financial trading
5. Hybrid AI Architectures
Hybrid AI architectures combine multiple AI paradigms to leverage the strengths of different
approaches. By combining symbolic reasoning with subsymbolic methods (like machine learning or
neural networks), hybrid systems aim to handle complex tasks that require both structured
knowledge and learning from data.
Types of Hybrid AI:
 Neuro-symbolic AI: Combines the pattern recognition abilities of neural networks with the
structured reasoning capabilities of symbolic systems. It integrates deep learning models with logic-
based reasoning to handle tasks like natural language understanding and visual reasoning.
 Cognitive Architectures: These architectures are inspired by the human brain’s cognitive processes
and often combine elements of symbolic AI, machine learning, and cognitive psychology to create
systems that can reason, learn, and adapt. An example is ACT-R (Adaptive Control of Thought—
Rational).
Applications:
 Complex decision-making systems
 Autonomous agents in uncertain environments
 Human-computer interaction
6. Transformer Architectures
Transformers are a type of deep learning architecture that has significantly advanced the field of
natural language processing (NLP). They use self-attention mechanisms to handle sequences of data
more efficiently than previous models, such as RNNs.
Key Components:
 Self-Attention: The ability of the model to focus on different parts of the input sequence when
processing each element, improving the ability to capture long-range dependencies in the data.
 Encoder-Decoder Structure: A common transformer structure, where the encoder processes the input
sequence and the decoder generates the output sequence.
 Positional Encoding: Since transformers don’t have a built-in sense of sequence order (like RNNs),
positional encoding is added to input data to give the model information about the position of each
word in the sequence.
Applications:
 Machine translation (e.g., Google Translate)
 Text generation (e.g., GPT, BERT, T5)
 Speech recognition
 Language understanding tasks
7. Cloud-Based AI Architectures
Cloud-based AI architectures enable the deployment, training, and inference of AI models on cloud
platforms. These architectures provide scalability, flexibility, and accessibility by leveraging cloud
computing resources like compute power, storage, and data management services.
Key Features:
 Distributed Training: AI models, particularly deep learning models, require significant
computational resources. Cloud platforms allow for distributed training of models across multiple
machines, reducing training time and enabling the use of larger datasets.
 Scalable Inference: Cloud services can scale AI inference based on demand, allowing for real-time
processing without the need for on-premise infrastructure.
 Managed AI Services: Cloud providers like AWS, Azure, and Google Cloud offer managed AI
services, enabling users to quickly build and deploy AI models without managing infrastructure.

Applications:
 Cloud-based AI platforms (e.g., AWS SageMaker, Azure AI)
 Real-time data processing
 Machine learning model deployment at scale
8. Edge AI Architectures
Edge AI refers to running AI models directly on edge devices (e.g., smartphones, sensors, IoT
devices) rather than relying on centralized cloud computing. This architecture is designed to process
data locally on the device, enabling faster, more efficient decision-making without the need for
constant connectivity to the cloud.
Key Features:
 Low Latency: Edge AI provides real-time processing, as there is no need to transmit data to the
cloud for processing.
 Data Privacy: Since data is processed locally, edge AI can enhance data privacy and reduce the risk
of sensitive information being exposed.
 Reduced Bandwidth Usage: Edge AI reduces the amount of data that needs to be sent to the cloud,
which can save bandwidth and reduce network congestion.
Applications:
 Smart devices (e.g., smartphones, smart cameras)
 Autonomous vehicles
 Industrial IoT systems
 Healthcare monitoring systems

The architecture of AI typically refers to the structure or framework of how artificial intelligence systems
are built, with different components and layers working together to perform tasks such as learning,
reasoning, decision-making, and problem-solving. Depending on the specific field or domain of AI (like
machine learning, deep learning, reinforcement learning, etc.), the architecture can vary. However, here is
a general breakdown of key architectural components in AI:

1. Input Layer (Data Input)


2.
 Data Collection: This is where the AI system receives data. It could be images, text, sensor
readings, etc. The quality and type of data influence how well the AI can perform.
 Preprocessing: Raw data often needs to be cleaned, normalized, or transformed before it can be
used effectively in models (e.g., scaling features, text tokenization, or noise reduction).

2. Data Representation
 Feature Extraction: The process of identifying and selecting relevant features from raw data. This
is essential for making the AI system more efficient and effective.
 Embeddings: In the case of unstructured data (such as images or text), embedding techniques like
Word2Vec, GloVe (for text), or CNNs (for images) are used to represent complex data in a more
manageable form.

3. Model Layer (Learning Mechanism)


 Model Selection: This is the core of AI, where algorithms (e.g., decision trees, neural networks,
etc.) learn patterns or representations from the data.
 Supervised Learning: The model learns from labeled data (input-output pairs).
 Unsupervised Learning: The model tries to learn the underlying structure from data without
explicit labels (e.g., clustering).
 Reinforcement Learning: The system learns by interacting with an environment, receiving rewards
or penalties to maximize long-term objectives.

4. Processing Layer (Computation)


 Neural Networks (for Deep Learning): Neural networks are used in deep learning, and they consist
of multiple layers such as input, hidden, and output layers.
o Convolutional Neural Networks (CNNs): Common for image recognition tasks.
o Recurrent Neural Networks (RNNs): Useful for sequential data, such as time series or text.
o Transformer Models: Revolutionized NLP tasks and are used in models like GPT (Generative Pre-
trained Transformers) and BERT (Bidirectional Encoder Representations from Transformers).
 Optimization: Algorithms like gradient descent or more advanced optimizers (Adam, SGD) are
used to adjust the parameters of the model to minimize the error or loss.

5. Decision-Making Layer (Inference/Output)


 Inference Engine: Once the model has been trained, it makes predictions or decisions based on
new input data. The inference engine takes the learned model and applies it to real-world
scenarios.
 Action/Output: The output can be a class label, a recommendation, an action, or even a prediction.
For example, in autonomous vehicles, this layer will decide how to steer the vehicle based on
sensor data.

6. Feedback and Adaptation (Learning Loop)


 Model Evaluation: The system is continuously evaluated by comparing its predictions to actual
outcomes. Common evaluation metrics include accuracy, precision, recall, F1 score, etc.
 Reinforcement Learning Feedback: In systems like reinforcement learning, the model learns
continuously from the environment based on feedback, updating its knowledge and improving
over time.
 Model Update/Training: AI systems can be retrained periodically as more data becomes available
to improve performance and adapt to new patterns.

7. Integration and Deployment


 Deployment: Once the AI model is trained and evaluated, it is deployed into real-world
applications (e.g., chatbots, recommendation systems, medical diagnostics).
 Edge Computing: In some cases, AI systems are deployed in edge devices (smartphones, IoT
devices) where the data is processed locally rather than in the cloud, reducing latency.
 Scalability: AI systems need to handle large volumes of data, requiring powerful infrastructure and
cloud-based services for scalability.

8. Human-AI Interaction (User Interface)


 Interface: AI systems often need to interact with humans or other systems. This could involve
visual interfaces (e.g., dashboards), voice interfaces (e.g., chatbots), or even robotic interfaces.
 Explainability & Transparency: As AI systems become more advanced, understanding how
decisions are made becomes critical. Techniques like explainable AI (XAI) are being developed to
make AI systems' decision-making more transparent.

Common AI Architectures

1. Deep Learning Architectures:


o Feedforward Neural Networks (FNNs): Basic architecture for neural networks.
o Convolutional Neural Networks (CNNs): Designed for image and video recognition tasks.
o Recurrent Neural Networks (RNNs): Useful for sequential data like time series, speech, and text.
o Transformers: Attention-based models, especially for NLP, which help overcome some of the
limitations of RNNs and CNNs.

2. Generative Models:
o Generative Adversarial Networks (GANs): Consist of two networks (a generator and a
discriminator) competing against each other to generate realistic synthetic data.
o Variational Autoencoders (VAEs): A type of generative model that uses probabilistic inference to
generate new data similar to the training set.

3.Hybrid Architectures:

o These involve combining different AI models or paradigms, such as combining symbolic AI with
machine learning, or using reinforcement learning with deep learning for complex decision-
making tasks (e.g., AlphaGo).

Tools and Technologies Supporting AI Architecture:


 Frameworks: TensorFlow, PyTorch, Keras, Scikit-learn, etc.
 Cloud Platforms: Google Cloud AI, AWS, Microsoft Azure, etc.
 Processing Power: GPUs, TPUs, distributed computing for training large-scale model
UNIT II
PROBLEM SOLVING
Solving Problems by Searching: Problem Solving Agents – Example Problems – Search
Algorithms – Uninformed Search Strategies – Informed (Heuristic) Search Strategies – Heuristic
Functions; Search in Complex Environments: Local Search Algorithms and Optimization
Problems.

PROBLEM SOLVING APPROACH TO TYPICAL AI PROBLEMS


Problem-solving agents

In Artificial Intelligence, Search techniques are universal problem-solving methods.


Rational agents or Problem-solving agents in AI mostly used these search strategies or
algorithms to solve a specific problem and provide the best result. Problem- solving agents are
the goal-based agents and use atomic representation. In this topic, wewill learn various
problem-solving search algorithms.

Some of the most popularly used problem solving with the help of artificial intelligence are:

1. Chess.
2. Travelling Salesman Problem.
3. Tower of Hanoi Problem.
4. Water-Jug Problem.
5. N-Queen Problem.

Problem Searching

In general, searching refers to as finding information one needs.


Searching is the most commonly used technique of problem solving in artificial
intelligence.
The searching algorithm helps us to search for solution of particular problem.

Problem: Problems are the issues which comes across any system. A solution is needed to
solve that particular problem.
steps : Solve Problem Using Artificial IntelligenceThe process of solving a problem consists of
five steps. These are:
Figure 1.11 Problem Solving in Artificial Intelligence
Defining The Problem: The definition of the problem must be included precisely. It should
contain the possible initial as well as final situations which should result in acceptable solution.

1. Analyzing The Problem: Analyzing the problem and its requirement must be done as
few features can have immense impact on the resulting solution.

2. Identification Of Solutions: This phase generates reasonable amount of solutions to the


given problem in a particular range.

3. Choosing a Solution: From all the identified solutions, the best solution is chosen basis
on the results produced by respective solutions.

4. Implementation: After choosing the best solution, its implementation is done.

Measuring problem-solving performance

We can evaluate an algorithm’s performance in four ways:

Completeness: Is the algorithm guaranteed to find a solution when there is one?


Optimality: Does the strategy find the optimal solution?
Time complexity: How long does it take to find a solution?
Space complexity: How much memory is needed to perform the search?

Search Algorithm Terminologies

Search: Searching is a step by step procedure to solve a search-problem in a given search


space. A search problem can have three main factors:

1. Search Space: Search space represents a set of possible solutions, which a system may have.
2. Start State: It is a state from where agent begins the search.
3. Goal test: It is a function which observe the current state and returns whether the goal state is
achieved or not.

Search tree: A tree representation of search problem is called Search tree. The root of the
search tree is the root node which is corresponding to the initial state.

Actions: It gives the description of all the available actions to the agent.

Transition model: A description of what each action do, can be represented as a


transition model.

Path Cost: It is a function which assigns a numeric cost to each path.

Solution: It is an action sequence which leads from the start node to the goal node. Optimal
Solution: If a solution has the lowest cost among all solution.
Example Problems
A Toy Problem is intended to illustrate or exercise various problem-solving methods.
Areal- world problem is one whose solutions people actually care about.
Toy Problems

Vacuum World
States: The state is determined by both the agent location and the dirt locations. The agent is in one
of the 2 locations, each of which might or might not contain dirt. Thus there are 2*2^2=8 possible
world states.

Initial state: Any state can be designated as the initial state.

Actions: In this simple environment, each state has just three actions: Left, Right, and
Suck. Larger environments might also include Up and Down.

Transition model: The actions have their expected effects, except that moving Left in the
leftmost square, moving Right in the rightmost square, and Sucking in a clean square have no effect.
The complete state space is shown in Figure.

Goal test: This checks whether all the squares are clean.

Path cost: Each step costs 1, so the path cost is the number of steps in the path

Figure 1.12 Vacuum World State Space Graph


8- Puzzle Problem

Figure 1.13 8- Puzzle Problem


States: A state description specifies the location of each of the eight tiles and the blank in one
of the nine squares.
Initial state: Any state can be designated as the initial state. Note that any given goal can
be reached from exactly half of the possible initial states.

The simplest formulation defines the actions as movements of the blank space Left,
Right, Up, or Down. Different subsets of these are possible depending on where the blank is.

Transition model: Given a state and action, this returns the resulting state; for
example, if we apply Left to the start state in Figure 3.4, the resulting state has the 5 and the
blank switched.

Goal test: This checks whether the state matches the goal configuration shown in
Figure. Path cost: Each step costs 1, so the path cost is the number of steps in the path.

Queens Problem

Figure 1.14 Queens Problem


 States: Any arrangement of 0 to 8 queens on the board is a state.

 Initial state: No queens on the board.

 Actions: Add a queen to any empty square.


 Transition model: Returns the board with a queen added to the specified square.

 Goal test: 8 queens are on the board, none attacked.

Consider the given problem. Describe the operator involved in it. Consider the water jug
problem: You are given two jugs, a 4-gallon one and 3-gallon one. Neither has any
measuring marker on it. There is a pump that can be used to fill the jugs with water. How can
you get exactly 2 gallon of water from the 4-gallon jug ?
Explicit Assumptions: A jug can be filled from the pump, water can be poured out of a jug
on to the ground, water can be poured from one jug to another and that there are no other
measuring devices available.
Here the initial state is (0, 0). The goal state is (2, n) for any value of n.
State Space Representation: we will represent a state of the problem as a tuple (x, y)
where x represents the amount of water in the 4-gallon jug and y represents the amount of
water in the 3-gallon jug. Note that 0 ≤ x ≤ 4, and 0 ≤ y ≤ 3.

To solve this we have to make some assumptions not mentioned in the problem. They are:

 We can fill a jug from the pump.


 We can pour water out of a jug to the ground.
 We can pour water from one jug to another.

Sr. Current State Next State Descriptions


1 (x,y) if x < 4 (4,y) Fill the 4 gallon jug
2 (x,y) if x < 3 (x,3) Fill the 3 gallon jug
3 (x,y) if x > 0 (x – d, y) Pour some water out of the 4 gallon jug
4 (x,y) if y > 0 (x, y – d) Pour some water out of the 3 gallon jug
5 (x,y) if y > 0 (0, y) Empty the 4 gallon jug
6 (x,y) if y > 0 (x 0) Empty the 3 gallon jug on the ground
(x,y) if x + y > = 4 Pour water from the 3 gallon jug into
7 (4, y – (4 – x))
and y > 0 the 4 gallon jug until the 4 gallon jug is
full
(x,y) if x + y > = 3 Pour water from the 4 gallon jug into
8 (x – (3 – x), 3)
and x > 0 the 3 gallon jug until the 3 gallon jug is
full
(x,y) if x + y < = 4 Pour all the water from the 3 gallon jug
9 (x + y, 0)
and y > 0 into the 4 gallon jug
(x,y) if x + y < = 3 Pour all the water from the 4 gallon jug
10 (0, x + y)
and x > 0 into the 3 gallon jug
Pour the 2 gallons from 3 gallon jug into
11 (0, 2) (2, 0)
the 4 gallon jug
Empty the 2 gallons in the 4 gallon jug
12 (2, y) (0, y)
on the ground

 There is no measuring device available.


Operators - we must define a set of operators that will take us from one state to another.
Figure 1.15 Solution

Gallons in 4-gel jug(x) Gallons in 3-gel


S.No. Rule Applied
jug (y)
1. 0 0 Initial state
2.. 4 0 1. Fill 4
3 1 3 6. Poor 4 into 3 to fill
4. 1 0 4. Empty 3
5. 0 1 8. Poor all of 4 into 3
6. 4 1 1. Fill 4
7. 2 3 6. Poor 4 into 3

Table 1.2 Solution

 4-gallon one and a 3-gallon Jug

 No measuring mark on the jug.

 There is a pump to fill the jugs with water.

 How can you get exactly 2 gallon of water into the 4-gallon jug?

PROBLEM SOLVING BY SEARCH

An important aspect of intelligence is goal-based problem solving.

The solution of many problems can be described by finding a sequence of actions that lead
to a desirable goal. Each action changes the state and the aim is to find the sequence of
actions and states that lead from the initial (start) state to a final (goal) state.

A well-defined problem can be described by: Initial

state
 Operator or successor function - for any state x returns s(x), the set of states reachable
from x with one action

 State space - all states reachable from initial by any sequence of actions

 Path - sequence through state space

 Path cost - function that assigns a cost to a path. Cost of a path is the sum of costs of
individual actions along the path

 Goal test - test to determine if at goal state

What is Search?

Search is the systematic examination of states to find path from the start/root state to
the goal state.

The set of possible states, together with operators defining their connectivity constitute
the search space.

The output of a search algorithm is a solution, that is, a path from the initial state to a
state that satisfies the goal test.

Problem-solving agents

A Problem solving agent is a goal-based agent. It decide what to do by finding sequence of


actions that lead to desirable states. The agent can adopt a goal and aim at satisfying it.

To illustrate the agent’s behavior, let us take an example where our agent is in the city of
Arad, which is in Romania. The agent has to adopt a goal of getting to Bucharest.

Goal formulation, based on the current situation and the agent’s performance measure, is the
first step in problem solving.

The agent’s task is to find out which sequence of actions will get to a goal state.

Problem formulation is the process of deciding what actions and states to consider given
a goal.
Example: Route finding
problem Referring to figure
On holiday in Romania : currently in Arad. Flight leaves tomorrow from Bucharest
Formulate goal: be in Bucharest
Formulate problem: states: various cities
actions: drive between cities
Find solution:
sequence of cities, e.g., Arad, Sibiu, Fagaras, Bucharest

Problem formulation
A problem is defined by four items:
initial state e.g., “at Arad"
successor function S(x) = set of action-state pairs e.g., S(Arad) = {[Arad -
>Zerind;Zerind],….} goal test, can be
explicit, e.g., x = at Bucharest" implicit, e.g., NoDirt(x)
path cost (additive)
e.g., sum of distances, number of actions executed, etc. c(x; a; y) is the step cost,
assumed to be >= 0
A solution is a sequence of actions leading from the initial state to a goal state.
Goal formulation and problem formulation

EXAMPLE PROBLEMS

The problem solving approach has been applied to a vast array of task environments.
Some best known problems are summarized below. They are distinguished as toy or real-
world problems

A toy problem is intended to illustrate various problem solving methods. It can be


easily used by different researchers to compare the performance of algorithms.

A real world problem is one whose solutions people actually care about.
TOY PROBLEMS

Vacuum World Example

o States: The agent is in one of two locations, each of which might or might not
contain dirt. Thus there are 2 x 22 = 8 possible world states.

o Initial state: Any state can be designated as initial state.

o Successor function: This generates the legal states that results from trying the three
actions (left, right, suck). The complete state space is shown in figure

o Goal Test: This tests whether all the squares are clean.

o Path test: Each step costs one, so that the path cost is the number of steps in the path.
Vacuum World State Space

Figure 2.1 The state space for the vacuum world.


Arcs denote actions: L = Left, R = Right

The 8-puzzle

An 8-puzzle consists of a 3x3 board with eight numbered tiles and a blank space. A
tile adjacent to the balank space can slide into the space. The object is to reach the goal state,
as shown in Figure 2.4

Example: The 8-puzzle

Figure 2.2 A typical instance of 8-puzzle


The problem formulation is as follows:

o States : A state description specifies the location of each of the eight tiles and the
blank in one of the nine squares.
o Initial state : Any state can be designated as the initial state. It can be noted that any
given goal can be reached from exactly half of the possible initial states.
o Successor function : This generates the legal states that result from trying the four
actions(blank moves Left, Right, Up or down).
o Goal Test : This checks whether the state matches the goal configuration shown in
Figure(Other goal configurations are possible)
o Path cost : Each step costs 1,so the path cost is the number of steps in the path.

The 8-puzzle belongs to the family of sliding-block puzzles, which are often used as
test problems for new search algorithms in AI. This general class is known as NP-complete.
The 8-puzzle has 9!/2 = 181,440 reachable states and is easily solved.

The 15 puzzle ( 4 x 4 board ) has around 1.3 trillion states, an the random instances
can be solved optimally in few milli seconds by the best search algorithms.

The 24-puzzle (on a 5 x 5 board) has around 1025 states and random instances are still
quite difficult to solve optimally with current machines and algorithms.

8-Queens problem

The goal of 8-queens problem is to place 8 queens on the chessboard such that no
queen attacks any other.(A queen attacks any piece in the same row, column or diagonal).

Figure 2.3 shows an attempted solution that fails: the queen in the right most column
is attacked by the queen at the top left.

An Incremental formulation involves operators that augments the state description,


starting with an empty state. For 8-queens problem, this means each action adds a queen to
the state. A complete-state formulation starts with all 8 queens on the board and move them
around. In either case the path cost is of no interest because only the final state counts.

Figure 2.3 8-queens problem


The first incremental formulation one might try is the following:

o States: Any arrangement of 0 to 8 queens on board is a state.


o Initial state: No queen on the board.
o Successor function: Add a queen to any empty square.
o Goal Test: 8 queens are on the board, none attacked.

In this formulation, we have 64.63…57 = 3 x 1014 possible sequences to investigate.

A better formulation would prohibit placing a queen in any square that is already
attacked.

o States : Arrangements of n queens ( 0 <= n < = 8 ),one per column in the left
most columns, with no queen attacking another are states.

o Successor function : Add a queen to any square in the left most empty column
such that it is not attacked by any other queen.

This formulation reduces the 8-queen state space from 3 x 1014 to just 2057,and
solutions are easy to find.

For the 100 queens the initial formulation has roughly 10400 states whereas the
improved formulation has about 1052 states. This is a huge reduction, but the improved state
space is still too big for the algorithms to handle.

REAL-WORLD PROBLEMS

ROUTE-FINDING PROBLEM

Route-finding problem is defined in terms of specified locations and transitions along


links between them. Route-finding algorithms are used in a variety of applications, such as
routing in computer networks, military operations planning, and airline travel planning
systems.
AIRLINE TRAVEL PROBLEM

The airline travel problem is specifies as follows:

o States: Each is represented by a location (e.g., an airport) and the current time.
o Initial state: This is specified by the problem.
o Successor function: This returns the states resulting from taking any scheduled flight
(further specified by seat class and location),leaving later than the current time plus
the within-airport transit time, from the current airport to another.

o Goal Test: Are we at the destination by some prespecified time?


o Path cost: This depends upon the monetary cost, waiting time, flight time, customs
and immigration procedures, seat quality, time of date, type of air plane, frequent-
flyer mileage awards, and so on.

TOURING PROBLEMS

Touring problems are closely related to route-finding problems, but with an


important difference. Consider for example, the problem, “Visit every city at least once” as
shown in Romania map.

As with route-finding the actions correspond to trips between adjacent cities. The
state space, however, is quite different.

The initial state would be “In Bucharest; visited{Bucharest}”.

A typical intermediate state would be “In Vaslui;visited {Bucharest, Urziceni,Vaslui}”.

The goal test would check whether the agent is in Bucharest and all 20 cities have been
visited.

THE TRAVELLING SALESPERSON PROBLEM(TSP)

Is a touring problem in which each city must be visited exactly once. The aim is to
find the shortest tour. The problem is known to be NP-hard. Enormous efforts have been
expended to improve the capabilities of TSP algorithms. These algorithms are also used in
tasks such as planning movements of automatic circuit-board drills and of stocking
machines on shop floors.

VLSI layout

A VLSI layout problem requires positioning millions of components and connections


on a chip to minimize area, minimize circuit delays, minimize stray capacitances, and
maximize manufacturing yield. The layout problem is split into two parts: cell layout and
channel routing.
ROBOT navigation

ROBOT navigation is a generalization of the route-finding problem. Rather than a


discrete set of routes, a robot can move in a continuous space with an infinite set of possible
actions and states. For a circular Robot moving on a flat surface, the space is essentially two-
dimensional. When the robot has arms and legs or wheels that also must be controlled, the
search space becomes multi-dimensional. Advanced techniques are required to make the
search space finite.

AUTOMATIC ASSEMBLY SEQUENCING

The example includes assembly of intricate objects such as electric motors. The aim in
assembly problems is to find the order in which to assemble the parts of some objects. If the
wrong order is choosen, there will be no way to add some part later without undoing some
work already done. Another important assembly problem is protein design, in which the goal
is to find a sequence of Amino acids that will be fold into a three-dimensional protein with
theright properties to cure some disease.

INTERNET SEARCHING

In recent years there has been increased demand for software robots that perform
Internet searching, looking for answers to questions, for related information, or for shopping
deals. The searching techniques consider internet as a graph of nodes(pages) connected by
links.

DIFFERENT SEARCH ALGORITHM

Figure 2.4 Different Search Algorithms

UNINFORMED SEARCH STRATGES

Uninformed Search Strategies have no additional information about states beyond


that provided in the problem definition.

Strategies that know whether one non goal state is “more promising” than another are
Called Informed search or heuristic search strategies.

There are five uninformed search strategies as given below.

o Breadth-first search
o Uniform-cost search
o Depth-first search
o Depth-limited search
o Iterative deepening search

BREADTH-FIRST SEARCH

o Breadth-first search is a simple strategy in which the root node is expanded first, then
all successors of the root node are expanded next, then their successors, and so on. In
general, all the nodes are expanded at a given depth in the search tree before any
nodes at the next level are expanded.

o Breath-first-search is implemented by calling TREE-SEARCH with an empty fringe


that is a first-in-first-out (FIFO) queue, assuring that the nodes that are visited first
will be expanded first. In otherwards, calling TREE-SEARCH (problem, FIFO-
QUEUE()) results in breadth-first-search. The FIFO queue puts all newly generated
successors at the end of the queue, which means that Shallow nodes are expanded
before deeper nodes.

Figure 2.5 Breadth-first search on a simple binary tree. At each stage, the node to
be expanded next is indicated by a marker.

Properties of breadth-first-search

Figure 2.6 Breadth-first-search properties

Time complexity for BFS

Assume every state has b successors. The root of the search tree generates b nodes at
the first level, each of which generates b more nodes, for a total of b2 at the second level.
Each of these generates b more nodes, yielding b 3 nodes at the third level, and so on. Now
suppose, that the solution is at depth d. In the worst case, we would expand all but the last
node at level d, generating bd+1 - b nodes at level d+1.

Then
the total number of nodes generated is b + b2 + b3 + …+ bd + ( bd+1 + b) = O(bd+1).

Every node that is generated must remain in memory, because it is either part of the
fringe or is an ancestor of a fringe node. The space compleity is, therefore, the same as the
time complexity

UNIFORM-COST SEARCH

Instead of expanding the shallowest node, uniform-cost search expands the node n
with the lowest path cost. Uniform-cost search does not care about the number of steps a path
has, but only about their total cost.
DEPTH-FIRST-SEARCH

Depth-first-search always expands the deepest node in the current fringe of the search
tree. The progress of the search is illustrated in Figure 1.31. The search proceeds immediately
to the deepest level of the search tree, where the nodes have no successors. As those nodes
are expanded, they are dropped from the fringe, so then the search “backs up” to the next
shallowest node that still has unexplored successors.

Figure 2.7 Depth-first-search on a binary tree. Nodes that have been expanded and have
node scendants in the fringe can be removed from the memory; these are shown in
black. Nodes at depth 3 are assumed to have no successors and M is the only goal node.

This strategy can be implemented by TREE-SEARCH with a last-in-first-out (LIFO)


queue, also known as a stack.

Depth-first-search has very modest memory requirements. It needs to store only a


single path from the root to a leaf node, along with the remaining unexpanded sibling nodes
for each node on the path. Once the node has been expanded, it can be removed from the
memory, as soon as its descendants have been fully explored (Refer Figure 2.7).

For a state space with a branching factor b and maximum depth m, depth-first-search
requires storage of only bm + 1 nodes.

Using the same assumptions as Figure, and assuming that nodes at the same depth as
the goal node have no successors, we find the depth-first-search would require 118 kilobytes
instead of 10 petabytes, a factor of 10 billion times less space.
Drawback of Depth-first-search

The drawback of depth-first-search is that it can make a wrong choice and get stuck
going down very long(or even infinite) path when a different choice would lead to solution
near the root of the search tree. For example, depth-first-search will explore the entire left
subtree even if node C is a goal node.

BACKTRACKING SEARCH

A variant of depth-first search called backtracking search uses less memory and only
one successor is generated at a time rather than all successors.; Only O(m) memory is needed
rather than O(bm)

DEPTH-LIMITED-SEARCH

Figure 2.8 Depth-limited-search

The problem of unbounded trees can be alleviated by supplying depth-first-search


with a pre- determined depth limit l. That is, nodes at depth l are treated as if they have no
successors. This approach is called depth-limited-search. The depth limit solves the infinite
path problem.

Depth limited search will be nonoptimal if we choose l > d. Its time complexity is
l
O(b ) and its space complete is O(bl). Depth-first-search can be viewed as a special case of
depth- limited search with l = oo Sometimes, depth limits can be based on knowledge of the
problem. For, example, on the map of Romania there are 20 cities. Therefore, we know that if
there is a solution, it must be of length 19 at the longest, So l = 10 is a possible choice.
However, it can be shown that any city can be reached from any other city in at most 9 steps.
This number known as the diameter of the state space, gives us a better depth limit.
Depth-limited-search can be implemented as a simple modification to the general tree- search
algorithm or to the recursive depth-first-search algorithm. The pseudocode for recursive depth-
limited-search is shown in Figure.

It can be noted that the above algorithm can terminate with two kinds of failure : the
standard failure value indicates no solution; the cutoffvalue indicates no solution within the
depth limit. Depth-limited search = depth-first search with depth limit l,returns cut off if any
path is cut off by depth limit

function Depth-Limited-Search( problem, limit) returns a solution/fail/cutoff return


Recursive-DLS(Make-Node(Initial-State[problem]), problem, limit) function Recursive-
DLS(node, problem, limit) returns solution/fail/cutoff cutoff-occurred? false
if Goal-Test(problem,State[node]) then return Solution(node)
else if Depth[node] = limit then return cutoff
else for each successor in Expand(node, problem) do result
Recursive-DLS(successor, problem, limit) if result = cutoff then cutoff_occurred?true
else if result not = failure then return result
ifcutoff_occurred? then return cutoff else return failure
Figure 2.9 Recursive implementation of Depth-limited-search

ITERATIVE DEEPENING DEPTH-FIRST SEARCH

Iterative deepening search (or iterative-deepening-depth-first-search) is a general


strategy often used in combination with depth-first-search, that finds the better depth limit. It
does this by gradually increasing the limit – first 0,then 1,then 2, and so on – until a goal is
found. This will occur when the depth limit reaches d, the depth of the shallowest goal node.
The algorithm is shown in Figure.

Iterative deepening combines the benefits of depth-first and breadth-first-search Like


depth-first-search, its memory requirements are modest; O(bd) to be precise.

Like Breadth-first-search, it is complete when the branching factor is finite and


optimal when the path cost is a non decreasing function of the depth of the node.

Figure shows the four iterations of ITERATIVE-DEEPENING_SEARCH on a binary


search tree, where the solution is found on the fourth iteration.
Figure 2.10 The iterative deepening search algorithm, which repeatedly applies
depth-limited- search with increasing limits. It terminates when a solution is found or
if the depth limited search returns failure, meaning that no solution exists.

Figure 2.11 Four iterations of iterative deepening search on a binary tree

Iterative search is not as wasteful as it might seem


Figure 2.12 Iterative search is not as wasteful as it might seem
Properties of iterative deepening search

Figure 2.13 Properties of iterative deepening search


BIDIRECTIONAL SEARCH

The idea behind bidirectional search is to run two simultaneous searches – one
forward from the initial state and the other backward from the goal, stopping when the two
searches meet in the middle

The motivation is that bd/2 + bd/2 much less than, or in the figure, the area of the two
small circles is less than the area of one big circle centered on the start and reaching to the
goal.

Figure 2.14 A schematic view of a bidirectional search that is about to succeed, when
a Branch from the Start node meets a Branch from the goal node.

• Before moving into bidirectional search let’s first understand a few terms.

• Forward Search: Looking in-front of the end from start.

• Backward Search: Looking from end to the start back-wards.

• So Bidirectional Search as the name suggests is a combination of forwarding and


backward search. Basically, if the average branching factor going out of node / fan-
out, if fan-out is less, prefer forward search. Else if the average branching factor is
going into a node/fan in is less (i.e. fan-out is more), prefer backward search.

• We must traverse the tree from the start node and the goal node and wherever they
meet the path from the start node to the goal through the intersection is the optimal
solution. The BS Algorithm is applicable when generating predecessors is easy in
both forward and backward directions and there exist only 1 or fewer goal states.
Figure 2.15 Comparing Uninformed Search Strategies

Figure 2.16 Evaluation of search strategies, b is the branching factor; d is the depth
of the shallowest solution; m is the maximum depth of the search tree; l is the depth
limit. Superscript caveats are as follows: a complete if b is finite; b complete if step
costs >= E for positive E; c optimal if step costs are all identical; d if both directions
use breadth-first search.

Best-first search

Best-first search is an instance of general TREE-SEARCH or GRAPH-SEARCH


algorithm in which a node is selected for expansion based on an evaluation function f(n).
The node with lowest evaluation is selected for expansion, because the evaluation measures
the distance to the goal.
This can be implemented using a priority-queue, a data structure that will maintain the
fringe in ascending order of f-values.
HEURISTIC FUNCTIONS

A heuristic function or simply a heuristic is a function that ranks alternatives in


various search algorithms at each branching step basing on an available information in order
to make a decision which branch is to be followed during a search.
The key component of Best-first search algorithm is a heuristic function, denoted by
h(n): h(n) = estimated cost of the cheapest path from node n to a goal node.

For example, in Romania, one might estimate the cost of the cheapest path from Arad
to Bucharest via a straight-line distance from Arad to Bucharest (Figure 2.19).
HEURISTIC function are the most common form in which additional knowledge is
imparted to the search algorithm.
GREEDY BEST-FIRST SEARCH
Greedy best-first search tries to expand the node that is closest to the goal, on the
grounds that this is likely to a solution quickly.
It evaluates the nodes by using the heuristic function f(n) = h(n).
Taking the example of Route-finding problems in Romania, the goal is to reach
Bucharest starting from the city Arad. We need to know the straight-line distances to
Bucharest from various cities as shown in Figure. For example, the initial state is
In(Arad),and the straight line distance heuristic hSLD (In(Arad)) is found to be 366.

Using the straight-line distance heuristic hSLD, the goal state can be reached faster.

Figure 2.19 Values of hSLD - straight line distances to


Bucharest
Figure 2.20 progress of greedy best-first search

Figure shows the progress of greedy best-first search using hSLD to find a path from Arad to
Bucharest. The first node to be expanded from Arad will be Sibiu, because it is closer to Bucharest
than either Zerind or Timisoara. The next node to be expanded will be Fagaras, because it is closest.
Fagaras in turn generates Bucharest, which is the goal.

Properties of greedy search

o Complete: No–can get stuck in loops, e.g., Iasi !Neamt !Iasi !Neamt !
Complete in finite space with repeated-state checking
o Time: O(bm), but a good heuristic can give dramatic improvement
o Space: O(bm) - keeps all nodes in memory
o Optimal: No

Greedy best-first search is not optimal, and it is incomplete.

The worst-case time and space complexity is O(bm),where m is the maximum


depth of the search space.
A* SEARCH

A* Search is the most widely used form of best-first search. The evaluation function f(n) is
obtained by combining

(1) g(n) = the cost to reach the node, and


(2) h(n) = the cost to get from the node to the goal :
f(n) = g(n) + h(n).

A* Search is both optimal and complete. A* is optimal if h(n) is an admissible heuristic. The
obvious example of admissible heuristic is the straight-line distance hSLD. It cannot be an
overestimate.

A* Search is optimal if h(n) is an admissible heuristic – that is, provided that h(n) never
overestimates the cost to reach the goal.

An obvious example of an admissible heuristic is the straight-line distance hSLD that we used in
getting to Bucharest. The progress of an A* tree search for Bucharest is shown in Figure

The values of ‘g ‘ are computed from the step costs shown in the Romania map(figure).Also the values
of hSLD are given in Figure

Figure 2.21 A* Search


Figure 2.22 Example A* Search

LOCAL SEARCH ALGORITHMS AND OPTIMIZATION PROBLEMS

o In many optimization problems, the path to the goal is irrelevant; the goal state itself
is the solution

o For example, in the 8-queens problem, what matters is the final configuration of
queens, not the order in which they are added.

o In such cases, we can use local search algorithms. They operate using a single
current state (rather than multiple paths) and generally move only to neighbors of
that state.
o The important applications of these class of problems are (a) integrated-circuit design,
(b) Factory-floor layout, (c) job-shop scheduling, (d) automatic programming, (e)
telecommunications network optimization, (f) Vehicle routing, and (g) portfolio
management.
Key advantages of Local Search Algorithms
(1) They use very little memory – usually a constant amount; and
(2) they can often find reasonable solutions in large or infinite(continuous) state spaces
for which systematic algorithms are unsuitable.
OPTIMIZATION PROBLEMS

In addition to finding goals, local search algorithms are useful for solving pure
optimization problems, in which the aim is to find the best state according to an objective
function.
State Space Landscape

To understand local search, it is better explained using state space landscape as


shown in Figure.
A landscape has both “location” (defined by the state) and “elevation” (defined by
the value of the heuristic cost function or objective function).
If elevation corresponds to cost, then the aim is to find the lowest valley – a global
minimum; if elevation corresponds to an objective function, then the aim is to find the
highest peak – a global maximum.
Local search algorithms explore this landscape. A complete local search algorithm
always finds a goal if one exists; an optimal algorithm always finds a global
minimum/maximum.

Figure 2.23 A one dimensional state space landscape in which elevation


corresponds to the objective function. The aim is to find the global
maximum. Hill climbing search modifies the current state to try to improve
it, as shown by the arrow. The various topographic features are defined in
the text
HILL-CLIMBING SEARCH

The hill-climbing search algorithm as shown in figure, is simply a loop that


continually moves in the direction of increasing value – that is, uphill. It terminates when it
reaches a “peak” where no neighbor has a higher value.

function HILL-CLIMBING( problem) return a state that is a local maximum


input: 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
Figure 2.24 The hill-climbing search algorithm (steepest ascent version), which is
the most basic local search technique. At each step the current node is replaced
by the best neighbor; the neighbor with the highest VALUE. If the heuristic cost
estimate h is used, we could find the neighbor with the lowest h.
Hill-climbing is sometimes called greedy local search because it grabs a good
neighbor state without thinking ahead about where to go next. Greedy algorithms often
perform quite well. Problems with hill-climbing

Hill-climbing often gets stuck for the following reasons :

 Local maxima: a local maximum is a peak that is higher than each of its neighboring
states, but lower than the global maximum. Hill-climbing algorithms that reach the
vicinity of a local maximum will be drawn upwards towards the peak, but will then be
stuck with nowhere else to go

 Ridges: A ridge is shown in Figure 2.10. Ridges results in a sequence of local


maximathat is very difficult for greedy algorithms to navigate.

 Plateaux: A plateau is an area of the state space landscape where the evaluation
function is flat. It can be a flat local maximum, from which no uphill exit exists, or a
shoulder, from which it is possible to make progress.

Figure 2.25 Illustration of why ridges cause difficulties for hill-climbing. The grid
of states(dark circles) is superimposed on a ridge rising from left to right,
creating a sequence of local maxima that are not directly connected to each other.
From each local maximum, all the available options point downhill.

Hill-climbing variations

 Stochastic hill-climbing
o Random selection among the uphill moves.
o The selection probability can vary with the steepness of the uphill move.
 First-choice hill-climbing
o cfr. stochastic hill climbing by generating successors randomly until a
better one is found.
 Random-restart hill-climbing
o Tries to avoid getting stuck in local maxima.
SIMULATED ANNEALING SEARCH

A hill-climbing algorithm that never makes “downhill” moves towards states with
lower value (or higher cost) is guaranteed to be incomplete, because it can stuck on a local
maximum. In contrast, a purely random walk –that is, moving to a successor choosen
uniformly at random from the set of successors – is complete, but extremely inefficient.

Simulated annealing is an algorithm that combines hill-climbing with a random walk


in someway that yields both efficiency and completeness.

Figure shows simulated annealing algorithm. It is quite similar to hill climbing.


Instead of picking the best move, however, it picks the random move. If the move improves
the situation, it is always accepted. Otherwise, the algorithm accepts the move with some
probability less than 1. The probability decreases exponentially with the “badness” of the
move – the amount E by which the evaluation is worsened.
Simulated annealing was first used extensively to solve VLSI layout problems in the early
1980s. It has been applied widely to factory scheduling and other large-scale optimization tasks.

Figure 2.26 The simulated annealing search algorithm, a version of


stochastic hill climbing where some downhill moves are allowed.
UNIT III
GAME PLAYING AND CSP
Game Theory – Optimal Decisions in Games - Heuristic Alpha--Beta Tree Search - Monte Carlo Tree
Search - Stochastic Games - Partially Observable Games; Constraint Satisfaction Problems: Defining
Constraint Satisfaction Problems - Constraint Propagation: Inference in CSPs - Backtracking Search for
CSPs - Local Search for CSPs - The Structure of Problems.

Game Theory

In Artificial Intelligence (AI), Game Theory plays a critical role in modeling and analyzing the
interactions between rational agents, where each agent makes decisions to maximize its own utility
while considering the decisions of others. This becomes especially important in multi-agent systems,
where multiple AI agents interact, compete, or cooperate with each other to achieve their respective
goals.

Here’s an overview of how game theory is applied in AI:

1. Multi-Agent Systems (MAS)

In AI, multi-agent systems involve multiple intelligent agents interacting with one another. Game
theory provides a formal framework to understand and design the strategies these agents should
follow to achieve optimal outcomes in a competitive or cooperative environment.

 Cooperative vs. Non-Cooperative Games: In cooperative games, agents can form coalitions and
make binding agreements to work together. In non-cooperative games, agents act independently and
cannot make enforceable agreements.

 Nash Equilibrium: One of the key concepts from game theory, Nash Equilibrium (NE), is widely
used in AI. It helps predict the outcome of strategic interactions between agents where no player
benefits from unilaterally changing their strategy, provided the other players’ strategies remain
unchanged. AI systems can use NE to decide on the optimal strategy in competitive environments.

2. Adversarial Search

In many AI applications, agents are involved in adversarial settings, such as games, where one
agent’s gain is another agent’s loss. Adversarial search is a domain in AI where game theory is
applied to decision-making.

 Minimax Algorithm: This is one of the core concepts in game theory used in AI for two-player zero-
sum games (e.g., chess, checkers, tic-tac-toe). The minimax algorithm assumes that both players are
rational and will make optimal moves. It calculates the best possible move for a player by assuming
the opponent will also play optimally.

 Alpha-Beta Pruning: This is an optimization technique applied to the minimax algorithm. It


eliminates branches of the search tree that don't need to be explored because they will not influence
the final decision. This allows AI agents to compute optimal strategies more efficiently in adversarial
settings.

3. Reinforcement Learning (RL) and Game Theory

Game theory and reinforcement learning (RL) intersect in environments where multiple agents are
learning and interacting over time. In RL, agents learn strategies by interacting with the environment
and receiving rewards or punishments based on their actions.

 Multi-Agent Reinforcement Learning (MARL): In MARL, multiple agents interact within a shared
environment. Game theory is used to model these interactions to understand how agents should
balance cooperation and competition.

o In a zero-sum game, one agent’s gain corresponds to the other’s loss (e.g., in competitive games like
poker). Game theory models this interaction to help agents learn competitive strategies.

o In non-zero-sum games, the agents' payoffs are not strictly inversely related, meaning that
cooperation might lead to a win-win scenario (e.g., collaborative tasks like team-based problem-
solving). In these cases, game theory helps agents learn how to cooperate while still maximizing their
individual payoffs.

 Evolutionary Game Theory (EGT): This is used in AI to model the evolution of strategies in
populations of agents. EGT is particularly useful for studying how cooperative behavior might evolve
in populations where agents repeatedly interact. For example, it can be applied in evolutionary
robotics, where robots (agents) evolve over time to become better at a given task through repeated
interactions and learning.

4. Auction Theory in AI

Game theory is heavily used in designing auction systems, which are key in AI for tasks like
resource allocation, advertising, and pricing. AI agents can participate in auctions, where they bid for
resources based on their strategies, goals, and the behavior of other agents.

 Vickrey Auctions: A type of sealed-bid auction where bidders submit bids without knowing the bids
of others. The highest bidder wins, but they pay the price submitted by the second-highest bidder. AI
agents use game theory to determine their optimal bidding strategies.

 Combinatorial Auctions: In these auctions, agents bid on combinations of items rather than just
individual items. Game theory helps AI agents compute optimal bidding strategies that maximize
their utility, especially when the auction items are interdependent.

5. Mechanism Design

Mechanism design is a subfield of game theory that deals with creating rules or mechanisms to
achieve a desired outcome in a game or system. In AI, mechanism design is used to design systems
where agents interact with each other, such as in online markets, recommendation systems, or
distributed networks.

 Incentive Compatibility: In mechanism design, it is important that agents are motivated to act in a
way that leads to a socially optimal outcome. For example, in an AI-based auction, the mechanism
should ensure that agents have an incentive to bid truthfully.

 Social Choice: This is about designing systems that aggregate individual preferences (like voting
mechanisms or collective decision-making systems) to reach an optimal collective decision. Game
theory helps AI design algorithms that handle these processes fairly and efficiently.

6. Security and Cryptography

In AI, security can be modeled as a game between attackers and defenders. Game theory is used to
design security protocols, where agents (e.g., users, attackers, or defenders) make strategic decisions
regarding encryption, data sharing, and other security measures.

 Defensive Game Theory: AI systems use game theory to design optimal strategies for defense
mechanisms, where attackers try to compromise the system, and defenders attempt to protect it.

 Cryptographic Protocols: Game theory is used to design secure communication protocols, where
agents must consider the actions of adversaries and ensure that their strategies prevent unauthorized
access to sensitive information.

7. Collaborative and Negotiation Systems

In many AI applications, agents need to collaborate or negotiate to achieve their individual or


collective goals. Game theory helps model these interactions and design strategies for negotiation and
cooperation.

 Bargaining Theory: This is used to analyze negotiation scenarios where agents must agree on terms
or resources. AI agents can use bargaining strategies derived from game theory to reach mutually
beneficial agreements.

 Coalition Formation: Game theory is used to model the formation of coalitions where agents
combine their resources or capabilities to achieve a common goal. For example, AI agents might need
to form coalitions in distributed computing tasks to improve efficiency or solve a problem
collaboratively.

Key Challenges in AI and Game Theory

1. Complexity: In real-world AI applications, the number of agents, strategies, and possible outcomes
can be extremely large, leading to computational challenges. Finding optimal strategies in large
games may require significant computational resources or approximation methods.

2. Incomplete Information: In many AI scenarios, agents don’t have complete information about the
environment or other agents, making it difficult to model strategies and predict outcomes accurately.
This is addressed in Bayesian Game Theory, where agents reason about the types and actions of
others using probabilities.

3. Dynamic and Evolving Environments: In dynamic environments, where the state of the game
changes over time or agents evolve, traditional game theory may need to be extended to account for
time-varying payoffs, strategies, and uncertainty.

In Artificial Intelligence (AI), the concept of optimal decisions in games refers to the
strategies that an agent should adopt to maximize its utility or payoff in a given game. The optimal
decision is typically one that takes into account not only the agent’s own actions but also the
possible actions of other agents or players involved in the game.

Optimal decision-making in games can be studied through various frameworks, such as game
theory, adversarial search, and reinforcement learning. These methods help AI agents determine
the best course of action in competitive, cooperative, or mixed environments.

Key Elements in Determining Optimal Decisions in Games

1. Players (Agents): The entities involved in the game, each making decisions to maximize their own
payoff or utility. In AI, players are typically modeled as intelligent agents.

2. Strategies: A strategy defines the set of actions or decisions that an agent can take. A pure strategy
specifies a single action, while a mixed strategy defines a probability distribution over possible
actions.

3. Payoff/Utility Function: The payoff (or utility) is the reward or value an agent gets based on the
combination of strategies chosen by all players. An agent aims to maximize its payoff function
through optimal decision-making.

4. Information: The level of information available to agents about the game environment or the other
agents’ actions. Games with complete information provide all players with the same knowledge
about the game, while games with incomplete information involve some uncertainty.

5. Equilibrium: In many games, the concept of Nash Equilibrium is used to define the optimal
strategy. At Nash Equilibrium, no player can improve their payoff by unilaterally changing their
strategy, assuming all other players' strategies are fixed. The equilibrium can be in pure or mixed
strategies.

1. Adversarial Search (Zero-Sum Games)

In AI, adversarial search is used to model competitive games where one player's gain is another
player's loss, such as chess, checkers, or tic-tac-toe. The goal is for the AI agent to make the
optimal move while assuming that the opponent is also playing optimally.

Minimax Algorithm:

The minimax algorithm is the foundation for decision-making in two-player, zero-sum games. It
assumes that both players are rational and will choose optimal moves. Here's how it works:

 Maximizing Player: The AI tries to maximize its payoff.

 Minimizing Player: The opponent tries to minimize the AI’s payoff.

In the minimax algorithm, the search tree is explored, and each leaf node represents a possible
outcome of the game. The algorithm evaluates the value of each leaf node using a heuristic
function, which estimates how good a game state is for the maximizing player. The algorithm then
propagates these values back up the tree to select the best move at the root node.

 Alpha-Beta Pruning: This is an optimization technique for the minimax algorithm. It eliminates
branches of the game tree that will not be explored, significantly reducing the number of nodes that
need to be evaluated.

Nash Equilibrium in Zero-Sum Games:

In zero-sum games, the optimal strategy for an agent is often one that is Nash Equilibrium, where
no player can improve their outcome by changing their strategy unilaterally. In AI, this is useful for
games like poker, where optimal strategies are computed using game-theoretic approaches (e.g.,
Nash equilibrium strategies in imperfect information games).

2. Cooperative Games (Non-Zero-Sum)

In cooperative games, players can form coalitions and make binding agreements to achieve a
common goal. The payoff is distributed among players based on the agreement. The challenge in
cooperative games is to find an optimal strategy that maximizes the overall utility of the coalition
while ensuring fairness in how the payoffs are divided.

 Shapley Value: The Shapley value is a concept from cooperative game theory that provides a fair
distribution of payoffs among players in a coalition. In AI, it can be used to allocate resources or
rewards in multi-agent systems.

 Pareto Efficiency: A strategy is Pareto optimal if no player can be made better off without making
another player worse off. AI agents may use this concept to find socially optimal decisions in
collaborative environments.

3. Reinforcement Learning (RL) and Optimal Decision-Making

In Reinforcement Learning, agents learn optimal decision-making strategies through trial and
error. The agent interacts with an environment, receiving rewards or punishments based on the
actions it takes, and uses this feedback to adjust its strategy over time.

Markov Decision Processes (MDPs):

An MDP is a mathematical framework used to model decision-making in environments with


uncertainty and time-based dynamics. It consists of:

 States (S): All possible situations the agent can be in.

 Actions (A): The set of possible actions the agent can take.

 Transition Function (T): Defines the probability of transitioning from one state to another given an
action.

 Reward Function (R): Provides feedback (rewards or penalties) based on the state and action taken.

The goal in RL is for the agent to learn an optimal policy (a mapping from states to actions) that
maximizes the expected cumulative reward over time. The agent may use techniques like Q-
learning or Deep Q-Networks (DQN) to learn optimal policies.

 Q-learning: A model-free RL algorithm that estimates the value of an action in a given state. Over
time, the agent updates its Q-values based on the rewards received, converging to an optimal policy.

 Policy Gradient Methods: These are another class of algorithms used in RL, where the agent
directly learns the optimal policy (as opposed to estimating Q-values). This is particularly useful for
continuous action spaces.

4. Evolutionary Game Theory in AI

In Evolutionary Game Theory, the strategies of agents evolve over time through processes like
natural selection. In AI, this can be applied to situations where agents adapt and learn from their
interactions.

 Genetic Algorithms: AI systems may use genetic algorithms to evolve solutions to optimization
problems. Agents in these systems "mate" and produce offspring with mutations based on their
success in the environment.

 Evolutionary Strategies: AI agents can use evolutionary strategies to select optimal decision-
making processes by simulating evolutionary mechanisms like selection, mutation, and
reproduction.

5. Mixed-Strategy Nash Equilibrium

In some games, players might use mixed strategies, where they randomize over their possible
actions instead of choosing one action deterministically. For example, in games like rock-paper-
scissors, players randomize their choices to prevent the opponent from exploiting predictable
patterns.

 In mixed-strategy Nash equilibrium, each player chooses their actions based on specific
probabilities. The optimal strategy in this case is to choose actions in such a way that no player can
improve their expected payoff by changing their strategy.

Applications of Optimal Decision-Making in AI

1. Autonomous Vehicles: In multi-agent environments, autonomous vehicles can use game theory and
optimal decision-making algorithms to navigate safely and efficiently while interacting with other
vehicles and pedestrians.

2. Robotics: Multi-robot systems can use cooperative and competitive game-theoretic strategies to
accomplish tasks like exploration, formation control, or task allocation.

3. Negotiation Systems: In AI-based negotiation platforms (e.g., e-commerce or resource allocation),


agents use game theory to make optimal decisions on bidding, bargaining, or making offers.

4. Economics and Auctions: AI agents use optimal decision-making to participate in auctions, setting
bidding strategies based on the behavior of other participants and maximizing their payoff.

5. Healthcare: AI can use game theory for optimal decision-making in resource allocation, diagnosis,
and treatment planning, particularly when multiple healthcare providers are involved.

ADVERSARIAL SEARCH

Competitive environments, in which the agent’s goals are in conflict, give rise to
adversarial search problems – often known as games.

Games

Mathematical Game Theory, a branch of economics, views any multiagent


environment as a game provided that the impact of each agent on the other is “significant”,
regardless of whether the agents are cooperative or competitive. In, AI, “games” are
deterministic, turn-taking, two-player, zero-sum games of perfect information. This means
deterministic, fully observable environments in which there are two agents whose actions
must alternate and in which the utility values at the end of the game are always equal and
opposite. For example, if one player wins the game of chess(+1),the other player necessarily
loses(-1). It is this opposition between the agents’ utility functions that makes the situation
adversarial.

Formal Definition of Game

We will consider games with two players, whom we will call MAX and MIN. MAX
moves first, and then they take turns moving until the game is over. At the end of the game,
points are awarded to the winning player and penalties are given to the loser. A game can be
formally defined as a search problem with the following components:

o The initial state, which includes the board position and identifies the player to move.
o A successor function, which returns a list of (move, state) pairs, each indicating a
legal move and the resulting state.
o A terminal test, which describes when the game is over. States where the game has
ended are called terminal states.

o A utility function (also called an objective function or payoff function), which give a
numeric value for the terminal states. In chess, the outcome is a win, loss, or draw,
with values+1,-1, or 0. he payoffs in backgammon range from +192 to -192.

Game Tree

The initial state and legal moves for each side define the game tree for the game. Figure 2.18
shows the part of the game tree for tic-tac-toe (noughts and crosses). From the initial state, MAX has

Figure 2.41 A partial search tree. The top node is the initial state, and
MAX move first, placing an X in an empty square.
nine possible moves. Play alternates between MAX’s placing an X and MIN’s placing a 0 until we
reach leaf nodes corresponding to the terminal states such that one player has three in a row or all the
squares are filled. He number on each leaf node indicates the utility value of the terminal state from
the point of view of MAX; high values are assumed to be good for MAX and bad for MIN. It is the
MAX’s job to use the search tree (particularly the utility of terminal states) to determine the best
move.

OPTIMAL DECISIONS IN GAMES

In normal search problem, the optimal solution would be a sequence of move leading
to a goal state – a terminal state that is a win. In a game, on the other hand, MIN has
something to say about it, MAX therefore must find a contingent strategy, which specifies
MAX’s move in the initial state, then MAX’s moves in the states resulting from every
possible response by MIN, then MAX’s moves in the states resulting from every possible
response by MIN those moves, and so on. An optimal strategy leads to outcomes at least as
good as any other strategy when one is playing an infallible opponent

Figure 2.42 Optimal Decisions in Games


.

HEURISTIC ALPHA-BETA PRUNING

In AI, Heuristic Alpha-Beta Pruning is an optimization technique used to improve the efficiency of the
minimax algorithm in adversarial search, which is commonly applied to two-player zero-sum games
like chess, checkers, or tic-tac-toe.

The minimax algorithm explores the entire game tree to make decisions by considering every possible
move that each player can make. The main idea behind minimax is that both players act rationally and
will choose the optimal move in each situation. The algorithm assigns values to the terminal nodes of the
tree based on a heuristic evaluation function and propagates these values up the tree to determine the
optimal move.

However, minimax can be computationally expensive, as it requires evaluating all possible states in the
game tree. This is where alpha-beta pruning comes in to optimize the search and cut down the number
of nodes evaluated. When combined with heuristics, this becomes a highly efficient search method for
decision-making in AI.

How Heuristic Alpha-Beta Tree Search Works

1. Alpha-Beta Pruning:

Alpha-beta pruning is an enhancement of the minimax algorithm that reduces the number of nodes
that need to be evaluated by eliminating branches that will not affect the final decision. This is done
by maintaining two values during the search:
 Alpha (α): The best value that the maximizing player can guarantee at any point along the path. It
represents the best already explored option for the maximizing player.

 Beta (β): The best value that the minimizing player can guarantee at any point along the path. It
represents the best already explored option for the minimizing player.

Pruning Decision:

While performing the search, if at any point, we find that the current branch (subtree) will not lead to
a better outcome than what is already known, we can prune (ignore) that branch. The key pruning
conditions are:

 Prune: If α ≥ β, no further exploration is needed for that branch since the opponent will avoid that
branch anyway.

 Cutoff: If α ≥ β, the branch can be pruned because the current value for the maximizing player (α) is
better than the value the minimizing player could force (β).

2. Heuristic Evaluation Function:

Since it is often impractical to explore every possible game state (especially in large games like
chess), we use a heuristic evaluation function to estimate the desirability of a given game state. The
heuristic function provides an estimate of how good a particular state is for a player, helping guide
the search.

 For example, in chess, a heuristic might assign values based on the material count (the number of
pieces each player has), the control of the board, or the positioning of the pieces.

 The heuristic function doesn't guarantee an optimal solution, but it provides a way to evaluate
intermediate game states more quickly, enabling more efficient pruning in the search tree.

3. Combining Heuristic and Alpha-Beta Pruning:

When combined, alpha-beta pruning and heuristics drastically reduce the number of nodes explored
compared to a brute-force minimax search, making it feasible to perform deeper searches within a
reasonable amount of time.

Here’s the general flow of the Heuristic Alpha-Beta Pruning algorithm:

1. Maximizing Player's Move: The algorithm starts by assuming that the maximizing player is trying
to maximize their payoff (for example, trying to make the best move in a game like chess).

2. Minimizing Player's Move: After considering the maximizing player’s possible moves, the
algorithm then simulates the minimizing player’s move, which aims to minimize the maximizing
player's payoff (for example, trying to block the opponent’s move).

3. Alpha and Beta Values: The algorithm keeps track of the best possible values that both the
maximizing and minimizing players can achieve at each point in the search.

4. Heuristic Evaluation: At the leaf nodes of the game tree (where the game has ended or a cutoff
depth has been reached), the heuristic evaluation function is used to estimate the value of that node.

5. Pruning: If a node’s value is found to be worse than the previously explored paths (based on α and β
values), the branch is pruned.
Example: Alpha-Beta Pruning with Heuristics

Let’s look at a simplified version of alpha-beta pruning with heuristics in a 3-level game tree (where
the search depth is 3):

1. Root Node: Maximizing player

2. Level 1: Minimizing player

3. Level 2: Maximizing player (with leaf nodes evaluated using heuristics)

Here’s how the search unfolds:

1. Start at the root node (Maximizing player).

 Initially, α = -∞, β = ∞.

2. Traverse down to the first minimizing node.

 At this level, the minimizing player will try to minimize the value.

3. Move down to the maximizing player’s level (Level 2), and evaluate the terminal nodes.

 Suppose the heuristic evaluation for each terminal node is computed. For example, let's say the
heuristic values are: 3, 5, 2, and 4.

4. Update α and β values:

 As the search proceeds, the algorithm keeps track of the best possible moves for each player.

 If a move is found that’s worse than the previously explored ones, the algorithm prunes that branch.
For instance, if a minimizing player has a node with a value of 2, but earlier in the search, the
maximizing player had a value of 3 (which is better), then that branch can be pruned.

5. Apply Pruning:

 If the heuristic evaluation of a node suggests that continuing the search won’t lead to a better outcome
for the current player (based on the values of α and β), the algorithm prunes the subtree, saving
computation time.

Efficiency of Alpha-Beta Pruning with Heuristics

The effectiveness of alpha-beta pruning depends on the order in which the game tree is explored.
The earlier you encounter good moves (high-value nodes for the maximizing player or low-value
nodes for the minimizing player), the more branches you can prune, resulting in significant
computational savings.

 Best-case scenario: If the algorithm is able to prune most of the branches, alpha-beta pruning can
reduce the time complexity of the minimax algorithm from O(b^d) (where b is the branching factor
and d is the depth of the tree) to O(b^(d/2)), effectively cutting the search time in half.

 Heuristics improve this even further by guiding the search to the most promising parts of the tree,
further optimizing the pruning process.
MONTE CARLO TREE SEARCH (MCTS) ALGORITHM:

In MCTS, nodes are the building blocks of the search tree. These nodes are formed based on the
outcome of a number of simulations. The process of Monte Carlo Tree Search can be broken down
into four distinct steps, viz., selection, expansion, simulation and backpropagation. Each of these
steps is explained in details below:

 Selection: In this process, the MCTS algorithm traverses the current tree from the root node using
a specific strategy. The strategy uses an evaluation function to optimally select nodes with the
highest estimated value. MCTS uses the Upper Confidence Bound (UCB) formula applied to trees
as the strategy in the selection process to traverse the tree. It balances the exploration-exploitation
trade-off. During tree traversal, a node is selected based on some parameters that return the
maximum value. The parameters are characterized by the formula that is typically used for this
purpose is given below.

 where;
Si = value of a node i
xi = empirical mean of a node i
C = a constant
t = total number of simulations
When traversing a tree during the selection process, the child node that returns the greatest value
from the above equation will be one that will get selected. During traversal, once a child node is
found which is also a leaf node, the MCTS jumps into the expansion step.
 Expansion: In this process, a new child node is added to the tree to that node which was optimally
reached during the selection process.
 Simulation: In this process, a simulation is performed by choosing moves or strategies until a
result or predefined state is achieved.
 Backpropagation: After determining the value of the newly added node, the remaining tree must
be updated. So, the backpropagation process is performed, where it backpropagates from the new
node to the root node. During the process, the number of simulation stored in each node is
incremented. Also, if the new node’s simulation results in a win, then the number of wins is also
incremented.
The above steps can be visually understood by the diagram given below:
These types of algorithms are particularly useful in turn based games where there is no element of
chance in the game mechanics, such as Tic Tac Toe, Connect 4, Checkers, Chess, Go, etc. This
has recently been used by Artificial Intelligence Programs like AlphaGo, to play against the
world’s top Go players. But, its application is not limited to games only. It can be used in any
situation which is described by state-action pairs and simulations used to forecast outcomes.
Pseudo-code for Monte Carlo Tree search:

 Python3

# main function for the Monte Carlo Tree Search


def monte_carlo_tree_search(root):

while resources_left(time, computational power):


leaf = traverse(root)
simulation_result = rollout(leaf)
backpropagate(leaf, simulation_result)

return best_child(root)

# function for node traversal


def traverse(node):
while fully_expanded(node):
node = best_uct(node)

# in case no children are present / node is terminal


return pick_unvisited(node.children) or node

# function for the result of the simulation


def rollout(node):
while non_terminal(node):
node = rollout_policy(node)
return result(node)

# function for randomly selecting a child node


def rollout_policy(node):
return pick_random(node.children)
# function for backpropagation
def backpropagate(node, result):
if is_root(node) return
node.stats = update_stats(node, result)
backpropagate(node.parent)

# function for selecting the best child


# node with highest number of visits
def best_child(node):
pick child with highest number of visits

As we can see, the MCTS algorithm reduces to a very few set of functions which we can use any
choice of games or in any optimizing strategy.

Advantages of Monte Carlo Tree Search:

1. MCTS is a simple algorithm to implement.


2. Monte Carlo Tree Search is a heuristic algorithm. MCTS can operate effectively without any
knowledge in the particular domain, apart from the rules and end conditions, and can find its own
moves and learn from them by playing random playouts.
3. The MCTS can be saved in any intermediate state and that state can be used in future use cases
whenever required.
4. MCTS supports asymmetric expansion of the search tree based on the circumstances in which it is
operating.
Disadvantages of Monte Carlo Tree Search:

1. As the tree growth becomes rapid after a few iterations, it requires a huge amount of memory.
2. There is a bit of a reliability issue with Monte Carlo Tree Search. In certain scenarios, there might
be a single branch or path, that might lead to loss against the opposition when implemented for
those turn-based games. This is mainly due to the vast amount of combinations and each of the
nodes might not be visited enough number of times to understand its result or outcome in the long
run.
3. MCTS algorithm needs a huge number of iterations to be able to effectively decide the most
efficient path. So, there is a bit of a speed issue there.
Issues in Monte Carlo Tree Search:

Here are some common issues associated with MCTS:


1. Exploration-Exploitation Trade-off: MCTS faces the challenge of balancing exploration and
exploitation during the search. It needs to explore different branches of the search tree to gather
information about their potential, while also exploiting promising actions based on existing
knowledge. Achieving the right balance is crucial for the algorithm’s effectiveness and
performance.
2. Sample Efficiency: MCTS can require a large number of simulations or rollouts to obtain accurate
statistics and make informed decisions. This can be computationally expensive, especially in
complex domains with a large search space. Improving the sample efficiency of MCTS is an
ongoing research area.
3. High Variance: The outcomes of individual rollouts in MCTS can be highly variable due to the
random nature of the simulations. This can lead to inconsistent estimations of action values and
introduce noise in the decision-making process. Techniques such as variance reduction and
progressive widening are used to mitigate this issue.
4. Heuristic Design: MCTS relies on heuristics to guide the search and prioritize actions or nodes.
Designing effective and domain-specific heuristics can be challenging, and the quality of the
heuristics directly affects the algorithm’s performance. Developing accurate heuristics that capture
the characteristics of the problem domain is an important aspect of using MCTS.
5. Computation and Memory Requirements: MCTS can be computationally intensive, especially in
games with long horizons or complex dynamics. The algorithm’s performance depends on the
available computational resources, and in resource-constrained environments, it may not be
feasible to run MCTS with a sufficient number of simulations. Additionally, MCTS requires
memory to store and update the search tree, which can become a limitation in memory-constrained
scenarios.
6. Overfitting: In certain cases, MCTS can overfit to specific patterns or biases present in the early
simulations, which can lead to suboptimal decisions. To mitigate this issue, techniques such as
exploration bonuses, progressive unpruning, and rapid action-value estimation have been proposed
to encourage exploration and avoid premature convergence.
7. Domain-specific Challenges: Different domains and problem types can introduce additional
challenges and issues for MCTS. For example, games with hidden or imperfect information, large
branching factors, or continuous action spaces require adaptations and extensions of the basic
MCTS algorithm to handle these complexities effectively.
Monte Carlo Tree Search (MCTS) is a powerful decision-making algorithm widely used in AI,
particularly in domains where the state space is large and the problem is complex, such as in board
games (e.g., Go, chess, and Shogi) and real-time strategy games. Unlike traditional search algorithms
like minimax, which explore the entire search tree, MCTS is based on random simulations to guide
the search and estimate the best moves.
MCTS combines the power of Monte Carlo simulations (which rely on random sampling) with a
tree search framework, making it particularly effective in large and uncertain environments.
Key Concepts of Monte Carlo Tree Search (MCTS)
MCTS builds the search tree iteratively and incrementally by selecting, expanding, simulating, and
backpropagating results. It consists of four main steps:
1. Selection
2. Expansion
3. Simulation
4. Backpropagation
Step-by-Step Explanation of MCTS:
1. Selection
 Starting from the root node (which represents the current state of the game), the algorithm
recursively selects child nodes based on a selection policy until it reaches a leaf node (a node that
hasn't been fully explored or a terminal state).
 The selection process often uses a strategy called Upper Confidence Bound for Trees (UCT),
which balances exploitation (favoring nodes that have already been explored and shown to be
good) and exploration (favoring nodes that haven't been explored much).
The UCT formula is as follows:
UCT(v)=W(v)N(v)+Cln⁡NparentN(v)UCT(v) = \frac{W(v)}{N(v)} + C \sqrt{\frac{\ln N_{\
text{parent}}}{N(v)}}UCT(v)=N(v)W(v)+CN(v)lnNparent
Where:
o W(v)W(v)W(v) is the total reward (or win count) from node vvv.
o N(v)N(v)N(v) is the number of times node vvv has been visited.
o NparentN_{\text{parent}}Nparent is the number of visits to the parent node.
o CCC is a constant that controls the exploration-exploitation balance (typically a value between 0
and 1).

The goal during selection is to choose nodes that either have high win rates (exploitation) or are
still underexplored (exploration).
2. Expansion
 Once a leaf node is reached, if the node is not terminal (i.e., the game isn't over), the algorithm
expands the tree by generating one or more child nodes representing possible future game states.
 For each move, a new node is created, and it represents a potential future state of the game.
3. Simulation
 A simulation (also called playout or rollout) is run from the newly expanded node to simulate the
outcome of the game. The simulation is typically done by choosing actions randomly (or using a
simple heuristic) until a terminal state (win, loss, or draw) is reached.
 The outcome of the simulation provides a reward (e.g., +1 for a win, 0 for a draw, and -1 for a
loss), which will be used for the backpropagation step.
4. Backpropagation
 After a simulation is completed, the result (reward) is backpropagated up the tree. This means
updating the values (e.g., win rates) of the nodes visited during the selection process.
 For each node along the path from the leaf node to the root node, the reward of the simulation is
added to that node's total reward, and the visit count is incremented.
Iterative Process
These four steps are repeated for a large number of iterations, with each iteration selecting,
expanding, simulating, and backpropagating. After enough iterations, the root node will contain an
approximation of the best move based on the simulations. The move corresponding to the child
node with the highest visit count or win rate is then chosen as the optimal move.
Advantages of MCTS
 Scalability: MCTS can handle large, complex state spaces because it doesn't require exploring
every possible move in advance. It focuses computational effort on promising areas of the search
space.
 Adaptability: MCTS works well in both deterministic and non-deterministic environments and
can adapt to changes in the game state.
 No Need for a Heuristic: Unlike traditional methods like minimax, MCTS doesn’t require an
evaluation function to estimate the value of non-terminal states. Instead, it uses random
simulations, making it suitable for games like Go, where a good heuristic is hard to define.
Weaknesses of MCTS
 Computationally Expensive: While MCTS is scalable, it can still be computationally intensive,
especially for games with very large state spaces or where each simulation requires significant
time.
 Longer Planning Horizons: The performance of MCTS improves with more simulations. In real-
time applications, there may be a trade-off between the number of simulations and time available
for decision-making.

Applications of MCTS in AI
1. Go: One of the most famous successes of MCTS was in the game of Go, where it was used by AI
systems such as AlphaGo developed by DeepMind. MCTS provided a way to effectively search
through the enormous state space of Go without requiring a handcrafted evaluation function.
2. Games with Large State Spaces: MCTS is widely used in strategy games, where the branching
factor of the game tree is enormous. Games like chess, Shogi, and Real-Time Strategy (RTS)
games benefit from the ability of MCTS to focus on high-reward regions of the state space.
3. Robotics and Planning: MCTS can be used for planning in robotics and motion planning
problems where the number of possible actions grows exponentially with time or complexity.
4. Real-Time Decision Making: In dynamic, real-time scenarios, MCTS is applied in systems that
need to make decisions on the fly, such as autonomous vehicles, robotic systems, and multi-
agent systems.

Example of MCTS in a Simple Game (Tic-Tac-Toe)


Consider the game of tic-tac-toe. MCTS can be applied as follows:
1. Selection: Start at the current game state (root node) and select the best child node to explore
based on the UCT formula (balancing exploration and exploitation).
2. Expansion: If the selected node is not a terminal state (the game isn’t over), expand the tree by
generating the possible future states of the game (each move of either player).
3. Simulation: Randomly simulate the remaining moves in the game (perhaps by choosing random
valid moves) until the game reaches a terminal state (win, loss, or draw).
4. Backpropagation: Update the values for each node along the path from the expanded node back to
the root, incrementing the visit count and updating the win/loss statistics based on the simulation
result.
After enough iterations, the root node’s child with the highest visit count or best reward can be
selected as the move to make.
STOCHASTIC GAMES IN ARTIFICIAL INTELLIGENCE

Stochastic games in artificial intelligence represent a sophisticated intersection of


game theory, probability, and decision-making, capturing the inherent uncertainty found in real-world
interactions. Unlike deterministic games, where outcomes are predictable based on the actions taken,
stochastic games introduce randomness, allowing AI to navigate unpredictable environments.
Whether through dice rolls or random events, stochastic games enable AI systems to handle
uncertainty while making decisions.

What are Stochastic Games?


A stochastic game is a multi-agent game where players take turns making decisions, influencing the
game’s current state and future states. Unlike deterministic games, randomness is involved in
determining transitions between states, making decision-making more complex.
The essential components of a stochastic game include:
 A set of states (S): Represents the possible configurations of the game.
 A set of actions (A): The decisions available to each player.
 Transition probabilities (P): Random events (e.g., dice rolls) that dictate how the game moves from
one state to another.
 Reward function (R): The payoff that each player receives based on their actions and the current state.
 Discount factor (γ): A value indicating the importance of future rewards, with smaller values placing
more emphasis on short-term outcomes.
Stochastic games are crucial in artificial intelligence for modeling environments where agents
interact and must make decisions under uncertainty, which directly influences both immediate and
long-term results.
Role of Stochastic Games in Artificial Intelligence (AI)
Stochastic games play an essential role in AI for several reasons:
1. Modeling Multi-Agent Systems: Many AI systems involve multiple agents that need to interact,
cooperate, or compete with each other. Stochastic games provide a framework for modeling such
interactions, incorporating both competitive and collaborative elements.
2. Incorporating Uncertainty: Real-world environments are often unpredictable. Stochastic games allow
AI to handle uncertainty by making decisions that consider both known factors (such as opponents’
actions) and unknown factors (such as random events).
3. Sequential Decision-Making: Many AI applications require agents to make decisions over time, with
future states influenced by current actions. Stochastic games are perfect for modeling such
environments, as they require agents to think strategically about future outcomes.
4. Reinforcement Learning: Stochastic games are closely related to reinforcement learning (RL), a
subfield of AI where agents learn optimal strategies through trial and error in dynamic environments.
In fact, one of the key frameworks for RL is based on Markov decision processes (MDPs), which are
essentially single-agent stochastic games. Multi-agent reinforcement learning extends these ideas to
environments where multiple agents interact, each learning their optimal strategies.
Types of Stochastic Games
There are various types of stochastic games, each designed to address specific kinds of multi-agent
interactions:
1. Zero-Sum Stochastic Games: In these games, one player’s gain is exactly equal to the other player’s
loss. This type of game often arises in competitive situations, such as in adversarial AI or security
scenarios. A popular example of this is the Minimax Algorithm used in chess and other competitive
games.
2. General-Sum Stochastic Games: Unlike zero-sum games, the payoffs in general-sum games do not
need to balance out. Agents can either compete or collaborate to achieve their objectives, making
these games suitable for environments where multiple agents may have conflicting or complementary
goals.
3. Markov Games: Markov games are a special case of stochastic games where the state transitions
follow the Markov property—i.e., the future state depends only on the current state and the actions
taken, not on previous states. This simplifies the mathematical complexity and is widely used in AI
research for modeling decision processes in dynamic environments.
Solving Stochastic Games
Solving stochastic games, particularly in AI, involves finding optimal strategies for all agents that
lead to a favorable outcome, often described in terms of equilibrium. One of the most well-known
solution concepts is Nash equilibrium, where no player has an incentive to change their strategy given
the strategies of the others.
However, solving stochastic games is computationally complex, especially as the number of agents or
states increases. Some common approaches include:
1. Dynamic Programming: Techniques such as value iteration and policy iteration are used to compute
optimal policies for each agent in a game. These methods are effective but may not scale well for
large games.
2. Reinforcement Learning: Algorithms like Q-learning and Deep Q-Networks (DQNs) have been
adapted to handle multi-agent stochastic games. These methods allow agents to learn optimal
strategies through experience, often using large-scale neural networks to approximate the value
functions.
3. Approximate Solutions: Given the computational difficulty of solving large stochastic games

exactly, many AI systems rely on approximate methods, such as Monte Carlo


simulations or heuristic-based approaches, to find near-optimal strategies.
Example: Stochastic Game in Backgammon
Many unforeseen external occurrences can place us in unpredictable situations in real life. This
unpredictability is reflected in games that involve random elements, such as dice rolling. These are
known as stochastic games, where decisions are made in the presence of uncertainty. Backgammon,
a classic game that combines both skill and luck, is an excellent example of such a game. In
Backgammon, legal moves are determined by dice rolls at the start of each player’s turn.
Understanding the Game of Backgammon
In Backgammon, the primary objective is to get all of one’s pieces off the board as quickly as
possible. White moves in a clockwise direction toward position 25, while Black moves
counterclockwise toward position 0. If a piece lands on a spot occupied by only one opposing piece,
it can be captured, forcing the opponent’s piece to start over.
For example, imagine White has rolled a 6–5 in the scenario depicted below. White can choose
between four valid moves:
1. (5–10, 5–11)
2. (5–11, 19–24)
3. (5–10, 10–16)
4. (5–11, 11–16)
In the move notation (5–11, 11–16), the first number indicates moving one piece from position 5 to
11, and the second part indicates moving another piece from 11 to 16.

Stochastic Game Tree for Backgammon


In Backgammon, while White knows their own legal moves, they have no idea what dice roll Black
will get, which affects Black’s legal moves. As a result, White cannot build a simple game tree like
those used in deterministic games such as chess or tic-tac-toe. Instead, a game tree in Backgammon
must include chance nodes that represent the outcomes of random events, like dice rolls.
These chance nodes are typically depicted as circles in the game tree. The possible dice rolls are
represented by the branches leading from each chance node, and each branch is labeled with the
corresponding dice roll and its probability.
There are 36 possible combinations of rolling two dice, as each die can result in six possible
outcomes. However, there are only 21 distinct rolls, as a roll of 6–5 is the same as 5–6. The
probability of rolling doubles (e.g., 1–1, 2–2, etc.) is 1/36, while the probability of rolling any other
combination (like 6–5 or 5–6) is 1/18.

Making Decisions in Stochastic Games


After understanding the stochastic game tree, the next step is learning how to make optimal
decisions. The goal is to select a move that places the player in the best possible position. However,
the value of a position in stochastic games isn’t fixed, like in deterministic games, because it
depends on various possible outcomes from chance nodes. Instead, we calculate the expected
value of each position, which is the average value of all potential outcomes weighted by their
probabilities.
To generalize the deterministic minimax approach, we use the expected-minimax algorithm for
games with chance nodes. This algorithm calculates the expected value for each chance node,
considering the weighted sum of all possible outcomes.
Expectiminimax Algorithm
The expectiminimax algorithm is a generalization of the minimax algorithm used for stochastic
games. It takes into account not only the decisions of two competing players (MAX and MIN), but
also the influence of random events (CHANCE).
The algorithm proceeds as follows:
EXPECTIMINIMAX (s)={ UTILITY (s) if TERMINAL-TEST (s)max⁡a EXPECTIMINIMAX
(RESULT⁡(s,a)) if PLAYER (s)=MAX⁡min⁡aEXPECTIMINIMAX⁡(RESULT⁡(s,a)) if PLAYER⁡(s)=MI
N⁡∑rP(r)EXPECTIMINIMAX⁡(RESULT⁡(s,r)) if PLAYER⁡(s)=CHANCE⁡EXPECTIMINIMAX
(s)=⎩⎨⎧ UTILITY (s)maxa EXPECTIMINIMAX (RESULT(s,a))mina
EXPECTIMINIMAX(RESULT(s,a))∑rP(r)EXPECTIMINIMAX(RESULT(s,r)) if TERMINAL-
TEST (s) if PLAYER (s)=MAX if PLAYER(s)=MIN if PLAYER(s)=CHANCE
Where:
 UTILITY(s): The utility or value of state s (i.e., the outcome value of a terminal state).
 MAX: The player trying to maximize their payoff (e.g., White).
 MIN: The player trying to minimize the opponent’s payoff (e.g., Black).
 CHANCE: The chance node, where the outcome is determined by a random event (like rolling dice).
 RESULT(s, r): The state s after taking into account the result of a random event r (e.g., dice roll).
Applications of Stochastic Games in AI
Stochastic games are widely used in AI, especially in environments where decision-making under
uncertainty is critical. Below are some key applications:
1. Autonomous Systems: In robotics and self-driving cars, decisions must be made in uncertain
environments. For example, autonomous vehicles need to account for unpredictable events like
weather changes, other drivers’ actions, or obstacles. Stochastic games allow AI systems to model
such uncertainties and make more informed decisions.
2. Financial Markets: Stochastic games are used in financial models to simulate market conditions
where traders (agents) act based on incomplete information. Random factors such as market volatility
and interest rate changes can be modeled, helping AI optimize trading strategies in dynamic
environments.
3. Healthcare: In healthcare, AI can use stochastic games to model interactions between multiple agents
(e.g., patients, doctors, and insurance companies). Treatment plans and resource allocation often
involve uncertainty due to patient responses and evolving medical conditions, making stochastic
games a valuable tool in decision-making.
4. Security Systems: In cybersecurity, AI systems must defend against random and adversarial attacks.
Stochastic game models help anticipate and mitigate potential threats in uncertain and dynamic
environments.

PARTIALLY OBSERVABLE GAMES IN AI


Partially Observable Games are a class of games in Artificial Intelligence (AI) where agents do
not have access to the complete information about the environment or the game state. This lack of
complete information introduces uncertainty about the true state of the game, making decision-
making more complex.
These games are an extension of traditional game theory and Markov Decision Processes (MDPs)
but include the additional challenge that each player has only partial observations of the state of
the game, rather than full visibility. The partial information typically arises in scenarios where
agents can only observe certain aspects of the environment or game state, often due to sensor
limitations, hidden information, or ambiguity about other players' strategies.

Key Concepts in Partially Observable Games

A partially observable game can be formally defined as an extension of a stochastic game but with a
partially observable state space. The key elements that distinguish it from fully observable games
include:
1. Partially Observable States: Instead of the agents having access to the full state of the game, they
only have access to an observation oio_ioi that provides partial information about the true state. This
observation is typically noisy or incomplete.
2. Belief State: In a partially observable environment, agents maintain a belief state (a probability
distribution) over the possible true states. The belief state represents the agent’s internal estimate of
what the true state could be, based on the information it has gathered through observations and
actions.
3. Hidden Information: This is the information that is not observable by the agents, but could be critical
for making optimal decisions. In many games, opponents' actions or parts of the environment may be
hidden from the agent.
4. Partially Observable Markov Decision Processes (POMDPs): A common formalism for partially
observable games is the POMDP model. POMDPs generalize Markov Decision Processes (MDPs)
by incorporating the partial observability of the environment. In POMDPs, an agent’s observation
provides indirect information about the true state of the system, and it must decide what actions to
take based on this belief state.

A POMDP is represented by the tuple:


⟨S,A,O,P,R,γ⟩\langle S, A, O, P, R, \gamma \rangle⟨S,A,O,P,R,γ⟩
Where:
o S: A finite set of states.
o A: A finite set of actions.
o O: A finite set of observations.
o P: Transition probabilities (the probability of transitioning between states given actions).
o R: Reward function, which assigns rewards to the agent based on the state and action taken.
o γ\gammaγ: A discount factor for future rewards.
In the context of partially observable games, each player may only observe part of the system and
must reason about the hidden components.
Characteristics of Partially Observable Games
1. Imperfect Information: Each player is often missing crucial information that would otherwise
allow for a perfect strategy. This makes planning and decision-making more challenging.
2. Uncertainty and Strategic Interaction: Since players are unable to fully observe the game state or
the strategies of other agents, they must make decisions under uncertainty, often with belief
updates after each observation and action.
3. Hidden Opponent Strategies: Players may not know the actions of their opponents directly, which
makes strategic planning more difficult. They must deduce the opponent’s strategy through their
actions and observations.
4. Belief-based Decision-Making: Players need to maintain a belief about the state of the game and
update it as they observe more information. This belief-based decision-making process can be
computationally expensive, especially in complex environments.
Examples of Partially Observable Games in AI
1. Poker: One of the most common examples of partially observable games is Poker. In Poker,
players can only see their own cards and the community cards, and they must make decisions
based on incomplete information about other players' hands and strategies. This makes Poker a
partially observable game where each player must reason about hidden information.
2. Ghost Recon or Other Strategy Games: Many real-time strategy games, such as those in the Ghost
Recon series, involve partially observable environments where players can see parts of the map but
not the entire battlefield or the exact positions and strategies of the opposing team. In these games,
players must make decisions based on partial information and predictions about the enemy's
hidden movements.
3. Autonomous Vehicles: In scenarios like autonomous driving, vehicles need to make decisions
based on partial observations of the environment (e.g., other vehicles’ movements, road conditions,
pedestrians) while the full environment is not fully observable. The vehicle's sensors can be noisy,
and parts of the environment may be hidden due to obstacles or limitations in sensor range.
4. Multiplayer Online Games (e.g., Multiplayer Games in Strategy and Role-Playing): Many real-
time multiplayer games involve players that do not have full visibility of their opponents' actions or
strategies. In games like Dota 2, League of Legends, or StarCraft, players must plan their strategies
based on partial information and adapt to the changing dynamics of the game.
5. Cooperative Multi-Agent Systems: In settings where agents are cooperating (such as robots
working together to accomplish a task), each agent may only have partial information about the
environment or the actions of other agents. For example, in search and rescue missions, robots may
have partial sensor data, and each robot needs to share its partial observations to form a more
complete understanding of the environment.
Belief State Representation and Updating
In partially observable games, an agent cannot directly observe the true state of the game.
Instead, the agent maintains a belief state, which is a probability distribution over the possible states, reflecting the
agent's uncertainty about the actual state. The belief state is updated using Bayesian updating after each
observation.
Given a previous belief state bbb, an action aaa, and an observation ooo, the belief state b′b'b′ after
taking action aaa and receiving observation ooo is updated as:
b′(s′)=η⋅∑s∈SP(o∣s′)P(s′∣s,a)b(s)b'(s') = \eta \cdot \sum_{s \in S} P(o | s') P(s' | s, a) b(s)b′(s
′)=η⋅s∈S∑P(o∣s′)P(s′∣s,a)b(s)
Where:
 b(s)b(s)b(s): The probability of being in state sss in the belief state.
 P(s′∣s,a)P(s' | s, a)P(s′∣s,a): The transition probability of moving from state sss to state s′s's′ given
action aaa.
 P(o∣s′)P(o | s')P(o∣s′): The observation likelihood, i.e., the probability of receiving observation ooo
given that the true state is s′s's′.
 η\etaη: A normalization constant.
Solving Partially Observable Games
The complexity of solving partially observable games is significantly higher than fully observable
games, as the agent must consider both the uncertainty about the environment and the actions of
other agents.
Approaches for Solving Partially Observable Games:
1. Partially Observable Markov Decision Processes (POMDPs):
o POMDPs provide a framework for solving decision-making problems under partial observability.
Solving POMDPs typically involves computing optimal policies based on belief states.
o Exact solutions for POMDPs can be computationally intractable due to the exponential growth of the
belief space. Therefore, approximate solutions and heuristics are often used.
2. Monte Carlo Tree Search (MCTS):
o MCTS can be extended to partially observable games. In such cases, the tree search is conducted based
on belief states rather than exact game states. This approach is often combined with POMDP solvers to
handle belief state updates during simulations.
3. Reinforcement Learning (RL):
o In scenarios where learning from experience is possible, reinforcement learning algorithms can be used
to update policies based on interactions with the environment. Deep Q-Networks (DQN) and policy
gradient methods have been applied in partially observable environments, such as in multi-agent
settings.
4. Game Theoretic Approaches:
o In multiplayer partially observable games, game-theoretic techniques like Bayesian Games can be used
to model the interactions between agents. Each player maximizes their expected utility, given their
belief about the hidden information.
Challenges and Future Directions
1. Computational Complexity: Solving partially observable games often involves large state and belief
spaces, making exact solutions computationally expensive. Approximate algorithms or simplifying
assumptions are usually necessary.
2. Exploration vs. Exploitation: As agents interact in environments with hidden information, they need to
balance exploration (gathering information) and exploitation (using the knowledge they have to
maximize rewards).
3. Cooperation and Competition: In multi-agent settings, agents may need to cooperate or compete while
dealing with uncertainty. Understanding how to model these interactions under partial observability
remains an open challenge.
4. Deep Learning for POMDPs: Recent advancements in deep reinforcement learning and neural networks
have enabled better approximations for solving POMDPs and partially observable multi-agent games.

CONSTRAINT SATISFACTION PROBLEMS(CSP)

A Constraint Satisfaction Problem(or CSP) is defined by a set of variables,X1,X2,….Xn, and a set of


constraints C1,C2,…,Cm. Each variable Xi has a nonempty domain D,of possible values.

Each constraint Ci involves some subset of variables and specifies the allowable combinations of values for
that subset.

A State of the problem is defined by an assignment of values to some or all of the variables,{Xi = vi,Xj =
vj,…}. An assignment that does not violate any constraints is called a consistent or legal assignment. A
complete assignment is one in which every variable is mentioned, and a solution to a CSP is a complete
assignment that satisfies all the constraints.
Some CSPs also require a solution that maximizes an objective function.
Example for Constraint Satisfaction Problem

Figure shows the map of Australia showing each of its states and territories. We are given
the task of coloring each region either red, green, or blue in such a way that the neighboring regions
have the same color. To formulate this as CSP, we define the variable to be the
regions :WA,NT,Q,NSW,V,SA, andT.

The domain of each variable is the set {red,green,blue}.The constraints require neighboring
regions to have distinct colors; for example, the allowable combinations for WA and NT are the
pairs

{(red,green),(red,blue),(green,red),(green,blue),(blue,red),(blue,green)}.

The constraint can also be represented more succinctly as the inequality WA not = NT,
provided the constraint satisfaction algorithm has some way to evaluate such expressions.) There
are many possible solutions such as

{ WA = red, NT = green, Q = red, NSW = green, V = red,SA = blue,T = red}.

It is helpful to visualize a CSP as a constraint graph, as shown in Figure 2.29. The nodes of
the graph corresponds to variables of the problem and the arcs correspond to constraints.

Figure 2.29 Principle states and territories of Australia. Coloring this map can be
viewed as a constraint satisfaction problem. The goal is to assign colors to each
region so that no neighboring regions have the same color.
CSP can be viewed as a standard search problem as follows:

 Initial state: the empty assignment {},in which all variables are unassigned.
 Successor function: a value can be assigned to any unassigned variable, provided
that it does not conflict with previously assigned variables.
 Goal test: the current assignment is complete.
 Path cost: a constant cost(E.g.,1) for every step.

Every solution must be a complete assignment and therefore appears at depth n if


there are n variables.

Depth first search algorithms are popular for CSPs

VARIETIES OF CSPS
(i) Discrete variables Finite domains

The simplest kind of CSP involves variables that are discrete and have finite
domains. Map coloring problems are of this kind. The 8-queens problem can also be viewed
as finite- domain
CSP, where the variables Q1,Q2,…..Q8 are the positions each queen in columns 1,
….8 and each variable has the domain {1,2,3,4,5,6,7,8}. If the maximum domain size of
any variable in a CSP is d, then the number of possible complete assignments is O(d n) – that
is, exponential in the number of variables. Finite domain CSPs include Boolean CSPs, whose
variables can be either true or false. Infinite domains

Discrete variables can also have infinite domains – for example, the set of integers or
the set of strings. With infinite domains, it is no longer possible to describe constraints by
enumerating all allowed combination of values. Instead a constraint language of algebric
inequalities such as Startjob1 + 5 <= Startjob3.

(ii) CSPs with continuous domains


CSPs with continuous domains are very common in real world. For example in
operation research field, the scheduling of experiments on the Hubble Telescope requires
very precise timing of observations; the start and finish of each observation and manoeuvre
are continuous-valued variables that must obey a variety of astronomical, precedence and
power constraints. The best known category of continuous-domain CSPs is that of linear
programming problems, where the constraints must be linear inequalities forming a convex
region. Linear programming problems can be solved in time polynomial in the number of
variables.

Varieties of constraints

(i) unary constraints involve a single variable.


Example : SA # green
(ii) Binary constraints involve paris of variables.
Example : SA # WA
(iii) Higher order constraints involve 3 or more variables. Example :cryptarithmetic puzzles.

Figure 2.31 cryptarithmetic puzzles.


Figure 2.32 Cryptarithmetic puzzles-Solution

Figure 2.33 Numerical Solution

BACKTRACKING SEARCH FOR CSPS

The term backtracking search is used for depth-first search that chooses values for
one variable at a time and backtracks when a variable has no legal values left to assign. The
algorithm is shown in figure
Figure 2.34 A simple backtracking algorithm for constraint satisfaction problem. The
algorithm is modeled on the recursive depth-first search

Figure 2.34 Part of the search tree generated by simple backtracking for the map-
coloring problem

Figure 2.35 Part of search tree generated by simple backtracking for the map
coloring problem.
FORWARD CHECKING

One way to make better use of constraints during search is called forward checking.
Whenever a variable X is assigned, the forward checking process looks at each unassigned
variable Y that is connected to X by a constraint and deletes from Y ’s domain any value that
is inconsistent with the value chosen for X. Figure 5.6 shows the progress of a map-coloring
search with forward checking.

Figure 2.36 The progress of a map-coloring search with forward checking. WA = red
is assigned first; then forward checking deletes red from the domains of the
neighboring variables NT and SA. After Q = green, green is deleted from the domain
of NT, SA, and NSW. After V = blue, blue, is deleted from the domains of NSW and
SA, leaving SA with no legal values.

CONSTRAINT PROPAGATION

Although forward checking detects many inconsistencies, it does not detect all of them.

Constraint propagation is the general term for propagating the implications of a constraint on one
variable onto other variables.

Arc Consistency

Figure 2.37 Arc Consistency


Figure 2.38 Arc Consistency –CSP

k-Consistency

Local Search for CSPs

The Structure of Problems Problem Structure

Independent Subproblems

Figure 2.39 Independent Subproblems


Tree-Structured CSPs

Figure 2.40 Tree-Structured CSPs

THE STRUCTURE OF PROBLEMS.

What is Problems, Problem Spaces, and Search in AI?

Artificial intelligence (AI) 's initial goal is to build machines capable of carrying out tasks that
usually call for human intelligence. Among the core functions of AI is real-life problem-
solving. Understanding "problems," "problem spaces," and "search" is fundamental to
comprehending how AI systems handle and resolve challenging jobs in the current situation.

Problems in AI
A problem is a particular task or challenge that calls for decision-making or solution-finding.
In artificial intelligence, an issue is simply a task that needs to be completed; these tasks can
be anything from straightforward math problems to intricate decision-making situations.
Artificial intelligence encompasses various jobs and challenges, from basic math operations to
sophisticated ones like picture recognition, natural language processing, gameplay, and
optimization. Every problem has a goal state that must be attained, a defined set of initial
states, and potential actions or moves.

Important Components of Problems in AI


Here, we'll see the important components of Problems in AI:
 Initial State: The state of the issue as it first arises.
 Goal State: The idealized final state that delineates a problem-solving strategy.
 Operators: The collection of maneuvers or actions that can be used to change a state.
 Restrictions: Guidelines or limitations must be adhered to to solve the problem.
Let's an example, in a chess game, the pieces' beginning positions on the board represent the
initial state, a checkmate is the objective state, the permissible moves made by the pieces
represent the operators, and the chess rules represent the constraints.
Problem Spaces in AI
The set of all potential states, actions, and transitions that might arise when trying to solve a
particular problem is known as the problem space. It depicts the whole range of feasible fixes
and routes from the starting point to the desired destination. An abstract representation of
every conceivable state and all possible transitions between them for a particular problem is
called a problem space. It is a conceptual landscape in which all points signify various system
states, and all possible operations or activities are represented by the paths connecting the
points.
Important Components of Problem Spaces in AI
Here, we'll see the important components of Problem Spaces in AI -
 States: Every scenario or configuration that could arise within the issue.
 State Space: The collection of all states that an operator sequence can apply to get
from the starting state.
 Paths: Paths are sets of states that connect the starting state to the destination state
through operators.
In the case of route planning, for instance, the issue space consists of all potential locations on
the map represented as states and all legitimate routes or paths connecting them as actions. For
example, in a maze-solving problem, the problem space consists of the maze itself (state
space), all potential positions within the maze (states), and the paths that travel from the start
to the exit (paths) in the maze.
Search in AI
The practice of searching for a set of steps or movements that will get you to the desired
outcome or a workable solution is known as a search. Within artificial intelligence, search
algorithms are employed to methodically traverse the problem domain and identify routes or
resolutions that fulfill the problem's limitations and goals. Search algorithms are used in AI to
effectively explore issue domains.
Types of Search in AI
Numerous search strategies exist, which can be generically categorized as informed (heuristic)
and uninformed (blind).
1. Uninformed Search
Apart from the problem definition, these algorithms don't know anything else about the states.
Typical ignorant search tactics consist of -
 Breadth-First Search (BFS): Before going on to nodes at the next depth level, the
Breadth-First Search (BFS) method investigates every node at the current depth.
 Depth-First Search (DFS): Investigates a branch as far as it can go before turning
around.
 Cost Search: To find the lowest-cost solution, uniform cost search expands the least-
cost node.
2. Informed Search
These algorithms make use of heuristics or extra information to direct the search more
effectively in the direction of the desired state. Typical knowledgeable search tactics consist of
-
 Greedy Best-First Search: Chooses the node that seems to be closest to the objective
using a heuristic.
 A*: Sums the projected cost from a node with the cost to get there.
Beginning with the original state, the search process investigates potential courses of action to
produce new states. The most promising states to investigate further are then identified by
evaluating these states according to specific criteria (such as cost, utility, or distance to the
goal). Iteratively, the process is carried out until the desired condition is attained or a workable
solution is discovered.
Navigating a Robot Through a Maze
For a 5x5 maze, a robot starts at the top-left corner and aims to reach the bottom-right corner,
avoiding walls and obstacles. Using BFS, the robot explores all possible moves layer by layer,
ensuring the shortest path is found. The process continues until the robot reaches the goal.
Navigating a robot through a maze involves several key components:
1. Initial State: The robot's starting position and orientation in the maze.
2. Goal State: The exit of the maze, defined by specific coordinates.
3. Operators: Possible actions the robot can take, such as moving forward, backward,
turning left, and turning right.
4. Constraints: Walls and obstacles that the robot cannot pass through, which define
valid moves.
5. Problem Space: All possible states the robot can occupy, including all positions and
orientations within the maze.
6. Breadth-First Search (BFS): Explores all neighbors at the current depth before
moving deeper, guaranteeing the shortest path in unweighted mazes.
Navigating a maze requires defining initial and goal states, possible moves, constraints, and
choosing an appropriate search strategy. This systematic approach allows the robot to
efficiently find a path from the start to the exit. Different strategies balance memory use,
speed, and optimality based on the problem's specific requirements.

In Artificial Intelligence (AI), Constraint Satisfaction Problems (CSP) are mathematical


models used to represent problems where the solution needs to satisfy a set of constraints or
conditions. The structure of a CSP is defined by the following components:
1. Variables (V)
 The problem is composed of a set of variables that need to be assigned values. Each
variable typically has a domain of possible values.
 Example: In a Sudoku puzzle, each cell is a variable, and the possible values are the
numbers 1 through 9.
2. Domains (D)
 Each variable has a domain, which is the set of possible values that can be assigned to
that variable.
 Example: In the 8-queens problem, the domain of each variable (representing a
queen's position) could be the set of integers representing the rows of a chessboard.
3. Constraints (C)
 Constraints define the relationships or conditions that must be satisfied between
variables. Constraints can be unary (involving only one variable), binary (involving
two variables), or higher-order (involving more than two variables).
 Example: In the N-queens problem, the constraint is that no two queens can be in the
same row, column, or diagonal.
4. Solutions
 A solution to a CSP is an assignment of values to all variables such that all constraints
are satisfied.
 Example: In a Sudoku puzzle, a solution would be a completed board with numbers
placed in the cells, adhering to the Sudoku constraints.
5. Goal
 The goal is to find a solution that satisfies all the constraints. In some cases, a CSP
might have multiple solutions or just one.
 Example: The goal of a scheduling problem might be to assign times to meetings such
that no two meetings overlap.
Example of a CSP Structure: Map Coloring
 Variables: The countries on the map (e.g., Australia, Brazil, Canada, etc.).
 Domains: Each country can be assigned one of the available colors (e.g., Red, Green,
Blue).
 Constraints: No two adjacent countries can share the same color.
 Solution: Assign a color to each country such that the constraint (no two adjacent
countries share the same color) is satisfied.
CSP Solving Techniques:
 Backtracking: A depth-first search method that tries to assign values to variables and
backtracks when a conflict is found.
 Forward Checking: A technique to reduce the search space by eliminating values
from the domain of other variables that would conflict with an already assigned
variable.
 Constraint Propagation: Techniques like arc-consistency (AC-3) that reduce the
search space by propagating constraints across variables.

You might also like