0% found this document useful (0 votes)
22 views36 pages

AI Unit 1

Uploaded by

Siddarth Sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views36 pages

AI Unit 1

Uploaded by

Siddarth Sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 36

Machine Learning

Machine learning allows computers to automatically learn from previous data. For building
mathematical models and making predictions based on historical data or information,
machine learning employs a variety of algorithms. It is currently being used for a variety of
tasks, including speech recognition, email filtering, auto-tagging on facebook, a
recommender system, and image recognition.

We are surrounded by humans who can learn everything from their experiences with their learning
capability, and we have computers or machines which work on our instructions.

A subset of artificial intelligence known as machine learning focuses primarily on the creation of algorithms
that enable a computer to independently learn from data and previous experiences. Arthur Samuel first
used the term "machine learning" in 1959.

Without being explicitly programmed, machine learning enables a machine to automatically learn from
data, improve performance from experiences, and predict things.

Machine learning algorithms create a mathematical model that, without being explicitly programmed, aids
in making predictions or decisions with the assistance of sample historical data, or training data.

Block diagram

Features of Machine Learning:


o Machine learning uses data to detect various patterns in a given dataset.
o It can learn from past data and improve automatically.
o It is a data-driven technology.
o Machine learning is much similar to data mining as it also deals with the huge amount of the data.

Classification of Machine Learning


1. Supervised learning
2. Unsupervised learning
3. Reinforcement learning

1
1) Supervised Learning

In supervised learning, sample labeled data are provided to the machine learning system for training, and
the system then predicts the output based on the training data.

The system uses labeled data to build a model that understands the datasets and learns about each one.
After the training and processing are done, we test the model with sample data to see if it can accurately
predict the output.

The mapping of the input data to the output data is the objective of supervised learning. The managed
learning depends on oversight, and it is equivalent to when an understudy learns things in the
management of the educator. Spam filtering is an example of supervised learning.

Supervised learning can be grouped further in two categories of algorithms:

o Classification
o Regression

2) Unsupervised Learning

Unsupervised learning is a learning method in which a machine learns without any supervision.

The training is provided to the machine with the set of data that has not been labeled, classified, or
categorized, and the algorithm needs to act on that data without any supervision. The goal of unsupervised
learning is to restructure the input data into new features or a group of objects with similar patterns.

In unsupervised learning, we don't have a predetermined result. The machine tries to find useful insights
from the huge amount of data. It can be further classifieds into two categories of algorithms:

o Clustering
o Association

3) Reinforcement Learning

Reinforcement learning is a feedback-based learning method, in which a learning agent gets a reward for
each right action and gets a penalty for each wrong action. The agent learns automatically with these
feedbacks and improves its performance. In reinforcement learning, the agent interacts with the
environment and explores it. The goal of an agent is to get the most reward points, and hence, it improves
its performance.

The robotic dog, which automatically learns the movement of his arms, is an example of Reinforcement
learning.

Deep learning
Deep learning is a subset of artificial intelligence (AI) that focuses on algorithms modeled
after the human brain, known as neural networks. These algorithms are designed to
automatically learn from large amounts of data, enabling them to perform complex tasks such
as image recognition, natural language processing, and even playing games at a superhuman
level.

2
Key Concepts in Deep Learning:

1. Neural Networks:
o The foundation of deep learning, neural networks consist of layers of
interconnected nodes (neurons). Each connection has a weight that adjusts as
the network learns from data.
o Feedforward Networks: The simplest type, where data moves in one
direction from input to output.
2. Deep Neural Networks (DNNs):
o Composed of many layers (hence "deep"), these networks can capture
complex patterns in data.
o Convolutional Neural Networks (CNNs): Typically used for image
processing, they are designed to automatically and adaptively learn spatial
hierarchies of features from input images.
o Recurrent Neural Networks (RNNs): Ideal for sequential data like time
series or natural language, RNNs have loops that allow information to persist.
3. Training Process:
o Data: Large datasets are needed to train deep learning models.
o Forward Propagation: Data passes through the network layers to generate
predictions.
o Loss Function: Measures how far off the predictions are from the actual
results.
o Backpropagation: Adjusts the weights of the network based on the error
calculated by the loss function, refining the model’s predictions.
4. Optimization:
o Gradient Descent: A method used to minimize the loss function by iteratively
adjusting the weights.
o Learning Rate: A hyperparameter that controls the step size during gradient
descent.
5. Activation Functions:
o Determine whether a neuron should be activated or not. Common functions
include ReLU (Rectified Linear Unit), Sigmoid, and Tanh.
6. Applications:
o Computer Vision: Image and video recognition, object detection, and image
generation.
o Natural Language Processing (NLP): Translation, sentiment analysis, and
text generation.
o Healthcare: Medical image analysis, drug discovery, and personalized
treatment plans.
o Autonomous Systems: Self-driving cars, drones, and robotics.

Advantages:
 High Accuracy: Capable of achieving state-of-the-art performance in many domains.
 Feature Engineering: Automatically learns features from raw data, reducing the need
for manual intervention.

3
Difference between Machine Learning and Deep Learning

Machine Learning Deep Learning

Uses artificial neural network


Apply statistical algorithms to learn the
architecture to learn the hidden
hidden patterns and relationships in the
patterns and relationships in the
dataset.
dataset.

Requires the larger volume of


Can work on the smaller amount of
dataset compared to machine
dataset
learning

Better for complex task like image


Better for the low-label task. processing, natural language
processing, etc.

Takes less time to train the model. Takes more time to train the model.

A model is created by relevant features


Relevant features are automatically
which are manually extracted from
extracted from images. It is an end-
images to detect an object in the
to-end learning process.
image.

More complex, it works like the black


Less complex and easy to interpret the
box interpretations of the result are
result.
not easy.

It can work on the CPU or requires less


It requires a high-performance
computing power as compared to deep
computer with GPU.
learning.

4
State space search
When defining a problem as a state space search, it involves two key aspects: (1) the
formalization of the problem into a state space, and (2) the control strategies employed to
search through this state space effectively.

1. Defining the Problem as a State Space Search

State Space Representation

 State: A snapshot of the system at a given point in time, representing a possible


configuration of the problem.
 Initial State: The state where the search begins.
 Goal State: The state(s) representing the solution to the problem.
 State Space: The set of all possible states reachable from the initial state by applying
a sequence of operators.
 Operators: Functions or actions that transition the system from one state to another.
 Transition Model: Describes how operators change the state, effectively defining the
rules for moving between states.

Example: Pathfinding

 State: A specific location in a grid or map.


 Initial State: The starting point.
 Goal State: The destination.
 State Space: All possible locations that can be reached from the initial location.
 Operators: Movements such as up, down, left, right.
 Transition Model: Rules like moving from one grid cell to an adjacent one.

2. Control Strategies

Control strategies determine how the search process is managed, including the order in which
states are explored and how paths to potential solutions are evaluated. Control strategies can
be broadly classified into uninformed (blind) and informed (heuristic) strategies.

Uninformed (Blind) Search Strategies

These strategies do not have additional information about states beyond the problem
definition. They explore the state space without guidance, often leading to exhaustive
searches.

 Breadth-First Search (BFS):


o Explores all nodes at the present depth level before moving on to nodes at the
next depth level.
o Strategy: Uses a queue (FIFO) to explore states level by level.
o Pros: Guarantees finding the shortest path (in terms of the number of steps) to
the goal.
o Cons: Memory-intensive, especially with large state spaces.
 Depth-First Search (DFS):

5
o Explores as far down a branch as possible before backtracking.
o Strategy: Uses a stack (LIFO) to explore states, diving deep into each branch.
o Pros: Less memory-intensive than BFS.
o Cons: Can get stuck in deep, irrelevant branches; might not find the shortest
path.
 Uniform-Cost Search (UCS):
o Expands the least costly node first, ensuring the cheapest solution is found.
o Strategy: Uses a priority queue ordered by path cost.
o Pros: Guarantees the least costly path.
o Cons: Similar to BFS in memory use and may explore unnecessary paths.

Informed (Heuristic) Search Strategies

These strategies use heuristics or additional knowledge to guide the search, making them
more efficient by focusing on promising areas of the state space.

 Greedy Best-First Search:


o Expands the node that appears to be closest to the goal, according to a
heuristic function.
o Strategy: Uses a priority queue ordered by estimated cost to reach the goal
(heuristic).
o Pros: Often faster than uninformed methods.
o Cons: Does not guarantee the shortest or least costly path.
 A*:
o Combines UCS and Greedy Best-First Search by considering both the cost to
reach a node and the estimated cost to reach the goal from that node.
o Strategy: Uses a priority queue ordered by the sum of the path cost and the
heuristic estimate.
o Pros: Guarantees finding the optimal solution if the heuristic is admissible
(never overestimates).
o Cons: Can be memory-intensive like BFS but more focused.
 Iterative Deepening A* (IDA*):
o Combines the memory efficiency of DFS with the optimality of A*.
o Strategy: Repeatedly applies depth-first search with increasing cost limits.
o Pros: Uses less memory while still ensuring optimality.
o Cons: May involve redundant computations.

Selecting a Control Strategy

 Problem Size: For smaller state spaces, BFS or DFS might be sufficient. For larger
state spaces, UCS or A* might be more appropriate.
 Path Optimality: If the shortest or least costly path is required, UCS or A* are better
choices.
 Memory Constraints: DFS and IDA* are more memory-efficient but may require
more time.
 Heuristics: If good heuristics are available, informed strategies like A* can
significantly reduce the search effort.

6
What is a Production System in AI?

Production System in AI
In artificial intelligence (AI), a production system refers to a type of rule-
based system that is designed to provide a structured approach to
problem solving and decision-making. This framework is particularly
influential in the realm of expert systems, where it simulates human
decision-making processes using a set of predefined rules and facts.
Let’s consider an example of Expert System for Medical Diagnosis.
Scenario: A patient comes to a healthcare facility with the following
symptoms: fever, severe headache, sensitivity to light, and stiff
neck.
Mediacal diagnosis operates in the following manner:
1. Input: A healthcare professional inputs the symptoms into
MediDiagnose.
2. Processing:
 MediDiagnose reviews its knowledge base for rules that match the
given symptoms.
 It identifies several potential conditions but recognizes a strong
match for meningitis based on the combination of symptoms.
3. Output:
 The system suggests that meningitis could be a possible diagnosis
and recommends further tests to confirm, such as a lumbar
puncture.
 It also provides a list of other less likely conditions based on the
symptoms for comprehensive differential diagnosis.
MediDiagnose uses its rule-based system to quickly filter through vast
amounts of medical data to provide preliminary diagnoses. This assists
doctors in focusing their investigative efforts more efficiently and
potentially speeds up the process of reaching an accurate diagnosis.
Key Components of a Production System in AI
The key components of production system includes:
1. Knowledge Base: This is the core repository where all the rules and
facts are stored. In AI, the knowledge base is critical as it contains the
domain-specific information and the if-then rules that dictate how
decisions are made or actions are taken.
2. Inference Engine: The inference engine is the mechanism that applies
the rules to the known facts to derive new facts or to make decisions. It
scans the rules and decides which ones are applicable based on the
current facts in the working memory. It can operate in two modes:

7
 Forward Chaining (Data-driven): This method starts with the
available data and uses the inference rules to extract more data
until a goal is reached.
 Backward Chaining (Goal-driven): This approach starts with a list
of goals and works backwards to determine what data is required to
achieve those goals.
3. Working Memory: Sometimes referred to as the fact list, working
memory holds the dynamic information that changes as the system
operates. It represents the current state of knowledge, including facts
that are initially known and those that are deduced throughout the
operation of the system.
4. Control Mechanism: This governs the order in which rules are applied
by the inference engine and manages the flow of the process. It
ensures that the system responds appropriately to changes in the
working memory and applies rules effectively to reach conclusions or
solutions.
Types of Production Systems
Production systems in AI can be categorized based on how they handle
and process knowledge. This categorization includes Rule-Based
Systems, Procedural Systems, and Declarative Systems, each
possessing unique characteristics and applications.
1. Rule-Based Systems
1. Explanation of Rule-Based Reasoning
 Rule-based systems operate by applying a set of pre-defined rules
to the given data to deduce new information or make decisions.
These rules are generally in the form of conditional statements (if-
then statements) that link conditions with actions or outcomes.
2. Examples of Rule-Based Systems in AI
 Diagnostic Systems: Like medical diagnosis systems that infer
diseases from symptoms.
 Fraud Detection Systems: Used in banking and insurance, these
systems analyze transaction patterns to identify potentially
fraudulent activities.
2. Procedural Systems
1. Description of Procedural Knowledge
 Procedural systems utilize knowledge that describes how to perform
specific tasks. This knowledge is procedural in nature, meaning it
focuses on the steps or procedures required to achieve certain
goals or results.
2. Applications of Procedural Systems
 Manufacturing Control Systems: Automate production processes
by detailing step-by-step procedures to assemble parts or manage
supply chains.

8
 Interactive Voice Response (IVR) Systems: Guide users through
a series of steps to resolve issues or provide information, commonly
used in customer service.
3. Declarative Systems
1. Understanding Declarative Knowledge
 Declarative systems are based on facts and information about what
something is, rather than how to do something. These systems
store knowledge that can be queried to make decisions or solve
problems.
2. Instances of Declarative Systems in AI
 Knowledge Bases in AI Assistants: Power virtual assistants like
Siri or Alexa, which retrieve information based on user queries.
 Configuration Systems: Used in product customization, where the
system decides on product specifications based on user
preferences and declarative rules about product options.
Each type of production system offers different strengths and is suitable
for various applications, from straightforward rule-based decision-making
to complex systems requiring intricate procedural or declarative
reasoning.
How Production Systems Function?
The operation of a production system in AI follows a cyclic pattern:
 Match: The inference engine checks which rules are triggered based
on the current facts in the working memory.
 Select: From the triggered rules, the system (often through the control
mechanism) selects one based on a set of criteria, such as specificity,
recency, or priority.
 Execute: The selected rule is executed, which typically modifies the
facts in the working memory, either by adding new facts, changing
existing ones, or removing some.
Applications of Production Systems in AI
Production systems are used across various domains where decision-
making can be encapsulated into clear, logical rules:
 Expert Systems: For diagnosing medical conditions, offering financial
advice, or making environmental assessments.
 Automated Planning: Used in logistics to optimize routes and
schedules based on current data and objectives.
 Game AI: Manages non-player character behavior and decision-
making in complex game environments.
.

9
Goal Stack Planning for
Blocks World Problem
Implementing Goal Stack Planning for the given configuration
of Blocks World Problem

Blocks World Problem — Initial State and Goal State for this article

In this medium article, we will take look at the Blocks World


Problem and implement Goal Stack Planning to solve the same.

What is Blocks World Problem?

This is how the problem goes — There is a table on which some


blocks are placed. Some blocks may or may not be stacked on other
blocks. We have a robot arm to pick up or put down the blocks. The
robot arm can move only one block at a time, and no other block
should be stacked on top of the block which is to be moved by the
robot arm.

10
Our aim is to change the configuration of the blocks from the Initial
State to the Goal State, both of which have been specified in the
diagram above.

What is Goal Stack Planning?

Goal Stack Planning is one of the earliest methods in artificial


intelligence in which we work backwards from the goal state to
the initial state.

We start at the goal state and we try fulfilling the preconditions


required to achieve the initial state. These preconditions in turn
have their own set of preconditions, which are required to be
satisfied first. We keep solving these “goals” and “sub-goals” until we
finally arrive at the Initial State. We make use of a stack to hold
these goals that need to be fulfilled as well the actions that
we need to perform for the same.

Apart from the “Initial State” and the “Goal State”, we maintain
a “World State” configuration as well. Goal Stack uses this world
state to work its way from Goal State to Initial State. World State on
the other hand starts off as the Initial State and ends up being
transformed into the Goal state.

At the end of this algorithm we are left with an empty stack and a set
of actions which helps us navigate from the Initial State to the World
State.

Representing the configurations as a list of “predicates”

11
Predicates can be thought of as a statement which helps us convey
the information about a configuration in Blocks World.

Given below are the list of predicates as well as their intended


meaning

1. ON(A,B) : Block A is on B

2. ONTABLE(A) : A is on table

3. CLEAR(A) : Nothing is on top of A

4. HOLDING(A) : Arm is holding A.

5. ARMEMPTY : Arm is holding nothing

Using these predicates, we represent the Initial State and the Goal
State in our example like this:

Initial State — ON(B,A) ∧ ONTABLE(A) ∧ ONTABLE(C) ∧


ONTABLE(D) ∧ CLEAR(B) ∧ CLEAR(C) ∧ CLEAR(D) ∧
ARMEMPTY

Initial State

12
Goal State — ON(C,A) ∧ ON(B,D) ∧ ONTABLE(A) ∧ ONTABLE(D)
∧ CLEAR(B) ∧ CLEAR(C) ∧ ARMEMPTY

Goal State

Thus a configuration can be thought of as a list of predicates


describing the current scenario.

“Operations” performed by the robot arm

The Robot Arm can perform 4 operations:

1. STACK(X,Y) : Stacking Block X on Block Y

2. UNSTACK(X,Y) : Picking up Block X which is on top of Block Y

3. PICKUP(X) : Picking up Block X which is on top of the table

4. PUTDOWN(X) : Put Block X on the table

All the four operations have certain preconditions which need to be


satisfied to perform the same. These preconditions are represented
in the form of predicates.

13
The visual representation of our steps variable looks like this.

14
Water Jug Problem in AI
Defining water jug problem in AI
The Water jug Issue is an exemplary riddle in man-made reasoning including two
containers, one with a limit of 'x' Liters and the other 'y' Liters, and a water source.
The objective is to quantify a particular 'z' Liter of water utilizing these containers,
with no volume markings. It's a trial of critical thinking and state space search, where
the underlying state is the two containers unfilled and the objective is to arrive at a
state where one container holds 'z' Liters. Different tasks like filling, exhausting, and
pouring between containers are utilized to track down an effective arrangement of
moves toward accomplish the ideal water estimation.

Water Jug Problem in Artificial Intelligence


Classic Version:
o In its classic form, this problem involves two containers, each with a replacement
limit.
o The goal is to use these containers to measure specific amounts of water while
meeting standards and requirements.
o Guide explaining an example water bottle problem: a 3 Liter bottle and a 5 Liter
bottle. The task is to measure 4 Liters of water.

Sample Problem Situation:


o Imagine a situation where you have a 3-liter bottle and a 5-liter bottle and you want
to measure 4 liters of water.
o Think about the situation by imagining two bottles and a tank to fill.
o The idea is to determine the sequence of operations that will reach an estimate of 4
Liters.

Knowing the AI reservoir statistics in this balance can provide critical thinking
understanding of the problem and become a way for members to engage in critical
thinking.

Requirements and Objectives:

Condition 1: Containers(jug) are limited.

Condition 2: Filling can be done by pouring water between containers or from a


water source.

15
objective: The goal is to fill some water, usually by combining and moving water
between properly measured containers.

State Space and Activity Space:


In cognitive critical thinking, we work in both spatial (each conceptual form) and
functional (each conceivable activity) spaces.

In the water container problem, it is within the state space that all requirements for
water levels are included.

In the activity area there are actions the user can perform, such as filling the
cauldron, emptying it, starting from one container, and pouring water into the next
container.

Initial State, Goal State, and Actions:


The first state is where you start. In the example scenario, it means that both
containers are empty. The target state is the space to be reached when the ideal
water level is reached (e.g. 4 Liters. Actions are operations on containers, such as
covering them as possible actions., or pour water in the middle.)

Brute-Force Approach
Example:
o The most powerful way is to thoroughly research all possible solutions to the water
tank problem.
o This method is obvious, but may not be effective in difficult situations.

Basic Model and Brute-Force Arrangement:

Think of a situation where you need to calculate 4 Liters of water using a 3Liter
container and a 5 Liter container. Walk members through the preparation of the
Beast Force step by step and show them what to do. Begin with the two jugs vacant
(0, 0).

a. Fill the 3 liter container (3, 0).


b. Pour water from a 3 liter container into a 5 liter container (0, 3).
c. Fill the 3 liter container (3, 3).
d. Pour water from a 3 liter container into a 5 liter container until it is full (1, 5).
e. Empty the 5 liter container (1, 0).

16
f. Pour the excess water from the 3 liter container into the 5 liter container (0, 1).
g. Fill the 3 liter container (3, 1).
h. Pour water from the 3 liter container into the 5 liter container until it is full (0, 4)..

This example shows how a dynamic approach can be used to handle the water bottle
problem in artificial intelligence by efficiently testing several successive steps until a
target level is reached. In any case, it is important to emphasize that this strategy
may not work in larger and more surprising situations.

Water Jug Example Using Search Algorithms in AI


An Introduction to Search Algorithms

The search algorithm is a key element of cognitive analysis.

Two common search algorithms used in the water transportation problem are
scalability scan (BFS) and depth-first search (DFS).

o BFS examines each step before continuing to the next step. At a higher level.
o DFS examines each branch before going back.

17
Step-by-Step Demonstration with BFS
To solve the water jug problem, we must proceed with the BFS (Breadth First Search)
method. This model has a bottle of 3 liters and another of 5 liters and calculates to 4
liters of water. We use BFS to follow best practices.

1. Let's start with the first state: (0, 0)


o At the beginning, both containers are empty.
2. Apply the possible actions to the current state: (0, 0)
o Fill the 3 liter container: (3, 0)
o Fill the 5 liter container: (0, 5)
3. Expanding to a higher level:
o There are currently two new states to explore: (3, 0) and (0, 5).
4. Expand:
o Pour from a 3 liter container to a 5 liter container: (0, 3)
o Fill the 3 liter container: ( 3 , 3)\ n
o From (0, 5) you can:
o Pour from a 5 liter container to a 3 liter container: (3, 2).
5. explore Further:
o Advance the land to higher levels.
o You can reach (3, 0) from (0, 3).
o You can reach (0, 3) from (3, 3) or (3, 5)
6. Objective State Accomplished:
o In our search, we've arrived at the objective state (0, 4).
7. Backtrack to Track down the Arrangement:
o To find the arrangement way, we backtrack from the objective state to the
underlying state:

(0, 4) - > (3, 1) - > (0, 1) - > (1, 0) - > (1, 5) - > (3, 4) - > (0, 4).

This presentation describes the idea of Breadth-First Search to explore space in order
to find the best answer to the water container problem. This ensures that we analyze
all possible actions and find the easiest path to the goal state. BFS guarantees
optimal performance, but may not be the most effective solution in larger problem
areas.

18
Brief Notice of Heuristic search Calculations
Both breadth-first search and depth-first search work well for the water container
problem, but the breadth-first approach may not produce the best decisions for
other complex situations. In these situations, heuristic exploratory statistics such as
A* are important.

o Search criteria: A* is a learning search statistic that uses heuristics to target


motivational factors. It combines the advantages of BFS and DFS to ensure
optimization and efficiency.
o Heuristics: A heuristic is a spatial evaluation of how close a state is to its goal. In the
water container problem, the simplest heuristic is the absolute separation between
the current state and the goal state.
o Optimization: Heuristic research calculations such as A* can be adapted to more
complex evolution problems. For example, in resource allocation, A* can effectively
combine resources to achieve a goal while minimizing cost.
o Efficiency: By tightly controlling search, A* can reduce the amount of governance
required for problem areas larger and more diverse.

The Monkey and Banana Problem.


Problem Statement
Suppose the problem is as given below −

 A hungry monkey is in a room, and he is near the door.


 The monkey is on the floor.
 Bananas have been hung from the center of the ceiling of the room.
 There is a block (or chair) present in the room near the window.
 The monkey wants the banana, but cannot reach it.

19
So how can the monkey get the bananas?
So if the monkey is clever enough, he can come to the block, drag the
block to the center, climb on it, and get the banana. Below are few
observations in this case −

 Monkey can reach the block, if both of them are at the same level.
From the above image, we can see that both the monkey and the
block are on the floor.
 If the block position is not at the center, then monkey can drag it to
the center.
 If monkey and the block both are on the floor, and block is at the
center, then the monkey can climb up on the block. So the vertical
position of the monkey will be changed.
 When the monkey is on the block, and block is at the center, then
the monkey can get the bananas.

Now, let us see how we can solve this using Prolog. We will create some
predicates as follows −

We have some predicates that will move from one state to another state,
by performing action.

 When the block is at the middle, and monkey is on top of the block,
and monkey does not have the banana (i.e. has not state), then
using the grasp action, it will change from has not state to have state.

20
 From the floor, it can move to the top of the block (i.e. on top state),
by performing the action climb.
 The push or drag operation moves the block from one place to
another.
 Monkey can move from one place to another
using walk or move clauses.

Another predicate will be canget(). Here we pass a state, so this will


perform move predicate from one state to another using different actions,
then perform canget() on state 2. When we have reached to the state
‘has>’, this indicates ‘has banana’. We will stop the execution.

The missionaries and cannibals problem, and the closely related jealous
husbands problem, are classic river-crossing logic puzzles.[1] The missionaries and
cannibals problem is a well-known toy problem in artificial intelligence, where it was
used by Saul Amarel as an example of problem representation. [2][3]

The problem
[edit]
In the missionaries and cannibals problem, three missionaries and three cannibals
must cross a river using a boat which can carry at most two people, under the
constraint that, for both banks, if there are missionaries present on the bank, they
cannot be outnumbered by cannibals (if they were, the cannibals would eat the
missionaries). The boat cannot cross the river by itself with no people on board. And,
in some variations, one of the cannibals has only one arm and cannot row. [1]

In the jealous husbands problem, the missionaries and cannibals become three
married couples, with the constraint that no woman can be in the presence of
another man unless her husband is also present. Under this constraint, there cannot
be both women and men present on a bank with women outnumbering men, since if
there were, these women would be without their husbands. Therefore, upon
changing men to missionaries and women to cannibals, any solution to the jealous
husbands problem will also become a solution to the missionaries and cannibals
problem.[1]

21
Solving .
Solution
[edit]
The earliest solution known to the jealous husbands problem, using 11 one-way
trips, is as follows. The married couples are represented as α (male)
and a (female), β and b, and γ and c.[4], p. 291.

22
Timeline solutions to both jealous husbands, and
missionaries and cannibals problems, with the vertical axis denoting time, blue denoting
husbands or missionaries, red denoting wives or cannibals, yellow denoting the boat, and
lines of the same type denoting married couples (in the jealous husbands problem).
The solid red line optionally denotes the cannibal unable to row.
In the right figure, if a wife or cannibal staying on the boat counts as being by herself
(circled), a shorter solution is possible.

Trip number Starting bank Travel Ending bank

(start) αa βb γc

1 βb γc αa →

2 βb γc ←α a

3 αβγ bc → a

4 αβγ ←a bc

5 Αa βγ → bc

6 Αa ← βb γc

23
7 ab αβ → γc

8 ab ←c αβγ

9 B ac→ αβγ

10 B ←β αa γc

11 βb → αa γc

(finish) αa βb γc

This is a shortest solution to the problem, but is not the only shortest solution. [4], p. 291.

If however, only one man can get out of the boat at a time and husbands must be on
the shore to count as with his wife as opposed to just being in the boat at the shore:
move 5 to 6 is impossible, for as soon as γ has stepped out b on the shore won't be
with her husband, despite him being just in the boat.

As mentioned previously, this solution to the jealous husbands problem will become
a solution to the missionaries and cannibals problem upon replacing men by
missionaries and women by cannibals. In this case we may neglect the individual
identities of the missionaries and cannibals. The solution just given is still shortest,
and is one of four shortest solutions.[5]

If a woman in the boat at the shore (but not on the shore) counts as being by herself
(i.e. not in the presence of any men on the shore), then this puzzle can be solved in
9 one-way trips:

Trip number Starting bank Travel Ending bank

(start) αa βb γc

1 βb γc αa →

2 βb γc ←a α

3 β γc ab → α

4 β γc ←b αa

24
5 Γc βb → αa

6 Γc ←b αa β

7 Γ bc → αa β

8 Γ ←c αa βb

9 γc → αa βb

(finish) αa βb γc

Variations
[edit]
An obvious generalization is to vary the number of jealous couples (or missionaries
and cannibals), the capacity of the boat, or both. If the boat holds 2 people, then 2
couples require 5 trips; with 4 or more couples, the problem has no solution. [6] If the
boat can hold 3 people, then up to 5 couples can cross; if the boat can hold 4
people, any number of couples can cross. [4], p. 300. A simple graph-theory approach to
analyzing and solving these generalizations was given by Fraley, Cooke, and Detrick
in 1966.[7]

If an island is added in the middle of the river, then any number of couples can cross
using a two-person boat. If crossings from bank to bank are not allowed, then 8n−6
one-way trips are required to ferry n couples across the river;[1], p. 76 if they are allowed,
then 4n+1 trips are required if n exceeds 4, although a minimal solution requires only
16 trips if n equals 4.[1], p. 79. If the jealous couples are replaced by missionaries and
cannibals, the number of trips required does not change if crossings from bank to
bank are not allowed; if they are however the number of trips decreases to 4n−1,
assuming that n is at least 3.

AI Comprised:

25
Combination of :-

1. Reasoning
2. Learning
3. Problem solving
4. Language understanding

Applications of AI
Artificial Intelligence has various applications in today's society. It is becoming
essential for today's time because it can solve complex problems with an efficient
way in multiple industries, such as Healthcare, entertainment, finance, education,
etc. AI is making our daily life more comfortable and fast.

1. AI in Astronomy

o Automated Celestial Object Identification: AI systems can automatically


identify and classify celestial objects in astronomical images, aiding
in discovering new stars, galaxies, and other cosmic phenomena. In
simple words, AI can spot and sort out things in space by looking at
pictures. It's like having a cosmic detective that finds new stars,
galaxies, and other mysterious objects without human help.
o Exoplanet Hunting: AI helps astronomers find planets outside our solar
system by looking at lots of data. It can notice tiny changes in the
light from stars, which tell us there might be planets around them, such
as those caused by exoplanet transits.
o Analyzing Space Information: AI plays a crucial role in the study of
space. It assists scientists by carefully examining vast amounts of
complex data gathered from space observations. This helps astronomers
uncover sophisticated patterns, unusual phenomena, and connections that
might be otherwise very difficult to notice. Essentially, AI acts as a
dedicated assistant, sifting through the cosmic data haystack to find
the valuable needles of knowledge.
o Watching Space Events in Real-time: AI-powered tools can keep a constant
eye on the night sky, looking out for sudden happenings like exploding
stars (supernovae) or bursts of powerful gamma rays. This allows
scientists to quickly study these events in more detail when they occur.
o Making Telescopes Smarter: AI is like a brain for telescopes. It helps
them work better by changing their settings on the fly. For example, if
the weather gets cloudy or if scientists want to study something
specific in space, AI can adjust the telescope to get the best results.
It's like having a telescope that can think and adapt to the situation.

2. AI in Healthcare

o Helping Doctors See Inside the Body Better: AI is like a super helper
for doctors when they look at pictures of the inside of a patient's
body, like X-rays or MRIs. It uses smart algorithms to find things like
problems, tumors, or broken bones very accurately. This means doctors

26
can figure out what's going on faster and more accurately, which is
great for patients and for better diagnosis.
o Detecting Health Problems Early: AI acts as a health detective. It looks
at your health information to find out if you might get certain diseases
in the future. When it sees a high risk, doctors can step in early to
help you stay healthy. This is really important for conditions like
diabetes and heart problems because catching them at this time means
better treatment and less trouble for the patient.
o Developing Medications Quickly and Cost-Effectively: AI acts like a
super scientist in the lab. It uses certain algorithms to predict how
different chemicals can fight diseases. This helps us make new medicines
much quicker and at a low cost. So people can get the treatments they
need sooner, and it doesn't cost as much money to manufacture them.
o Personalized Treatment Plans: AI looks at your health information, like
your genes, what happened to you before, and how you've responded to
treatments. Then, it makes a special plan just for you. This means your
treatment works better and doesn't give you as many problems. It's like
having a personalized health coach, which helps in avoiding
complications caused by improperly prescribed medicine.
o Managing Hospital Functions and Resources: AI acts like a manager for
hospitals. It helps with things like when patients come in, where to put
resources like doctors and supplies, and how to make sure everything
runs well. It can even guess how many patients might come in ahead of
time, so hospitals use their staff and resources in the best way
possible.

3. AI in Gaming

o Smart Game Characters: AI is like the brains behind game characters that
aren't controlled by players. They make these characters, called NPCs,
act more like real people or clever enemies. They can learn from what
players do and change their behavior, which makes games more exciting
and lifelike. Imagine playing a game where the bad guys learn and adapt
to your moves - that's what AI does.
o Creating Game Worlds with AI: AI can make parts of video games all on
its own. It can create levels, maps, and places to explore without
people having to make them by hand. This means games can have bigger and
more interesting worlds because AI does a lot of the work, kind of like
a game world builder. It helps game developers, too.
o Making Games Look and Feel Real: AI helps to make games look and act
more like the real world. They create graphics that look just like the
things we see, and they make how things move in games feel realistic,
like in real life. They even guess what players might do next so the
game looks smooth and natural.

4. AI in Finance

o Identifying and Prevention of Fraud: AI keeps an eye on bank


transactions all the time. They act like super detectives who can spot
strange things happening with money, like someone using a credit card in
a weird way. When they see something fishy, they raise the alarm and
help the bank stop bad people from stealing money. This happens really
fast, without needing people to check every transaction.
o Automated Trading: AI helps a skilled trader who works automatically. It
uses various algorithms to swiftly buy and sell stocks while analyzing
all the market information. This boosts trading strategies, making
investments more efficient and profitable.
o Risk Control: AI helps in examining lots of data to check how risky
something is, like giving out loans or making investments. It looks at
things like whether someone can pay back a loan or how safe an
investment is. This helps banks and investment firms make smarter

27
choices so they don't lose money and can help others save and grow their
money.

5. AI in Data Security

o Anamoly Detection: AI works as a digital detective. It looks at big


piles of data and watches for anything strange or out of the ordinary,
like someone sneaking into a digital vault or trying to steal secrets.
When it sees something fishy, it raises the alarm, helping to keep
important data safe from cyber-attacks.
o Predicting Threats: AI looks at past troubles and keeps an eye on new
dangers that are popping up. By doing this, it can predict what bad
things might happen in the future, like a security breach or a
cyberattack. This way, companies can get ready in advance to protect
their important data, sort of like putting up a strong fortress before
any attack happens.
o Automated Safety Response: AI acts like a digital guardian that can
respond when there's trouble. If it sees something bad happening, like a
cyberattack, it can automatically take action. It might isolate the part
that's under attack. This way, it keeps your important stuff safe in the
digital world.

6. AI in Social Media

o Smart Suggestions: AI helps as a guide on social media. It watches what


you like and what you do, and then it suggests things you might enjoy,
like posts, videos, or ads. It acts as someone who knows your tastes and
shows you stuff you're really into, making your social media experience
more enjoyable and personalized.
o Virtual Assistants and Chatbots: AI chatbots and virtual assistants act
as digital helpers on social media. They're quick to respond and can
talk to you just like a real person. They answer your questions, share
information, and even help with problems. It's like having an assistant
available 24/7, making your social media experience smoother and more
helpful.
o Sentiment Analysis: AI can figure out how people feel on social media.
It looks at what they say in comments and posts and decides if it's a
happy, sad, or neutral kind of message. This helps companies understand
what people think so they can react in the right way. It's like having a
mood gauge for the internet so businesses can make their customers
happier.
o Trend Analysis: AI keeps track of all the chats and what's popular right
now. This helps companies and regular folks understand what everyone's
thinking and talking about. It acts as a social media news reporter that
keeps customers in the loop about what's hot and what people are buzzing
about.

7. AI in Travel & Transport

o Optimization of Route: AI plays a crucial role in optimizing travel


routes, be it for parcel deliveries, public transportation, or personal
trips. It efficiently calculates the swiftest and most economical paths
from one point to another point, resulting in reduced travel time,
minimized fuel consumption, and cost savings. Essentially, it serves as
a pocket-sized travel advisor, enhancing the speed and budget-
friendliness of your journeys.
o Smart Security Screening: AI helps in keeping traveling safely. It uses
special skills to scan bags and people quickly. It can spot things that
might be dangerous and make security checks faster and smoother. This

28
means you can fly knowing that the airport is working hard to keep you
safe without making your travel a hassle.
o Chatbots for Travel Support: AI chatbots are like digital travel
helpers. These chatbots are capable of aiding you in various tasks such
as reserving tickets, suggesting interesting destinations to explore,
and providing responses to your inquiries, much like an affable travel
consultant. This elevates the convenience and pleasure of your travel
adventures, as you can access assistance whenever it's required, even
during late-night hours.
o AI Prevents Breakdowns: AI works like a fortune teller for machines like
cars, planes, and roads. It predicts when they might get sick and need
fixing. This way, we can fix them before they break down and cause
problems. It keeps everything running smoothly, making travel safer and
saving a lot of time and money.

8. AI in Automotive Industry

o Self-Driving Cars: AI is like the brain of self-driving cars. It looks


at what's happening around the car using various sensors and decides
what the car should do, like turning or stopping. It's like having a
super-smart driver that doesn't need a person. This makes cars drive on
their own, making travel more convenient and safer because there's no
need for a human to steer.
o Advanced Driver Assistance Systems (ADAS): AI adds extra smarts to your
car to keep you safe. It possesses the capability to autonomously adjust
your vehicle's speed while on the highway, assist in maintaining your
lane, and swiftly engage the brakes when detecting potential hazards.
These intelligent functionalities function akin to a co-pilot, ensuring
your safety by preventing accidents and ensuring your safe arrival at
your intended destination.
o Streamlining Production Processes: AI watches over machines, checks if
they're healthy, and makes sure they don't break. It also helps with
ordering materials and makes sure everything is made just right. This
makes things faster, cheaper, and better quality, like having a super
factory manager.
o Voice Recognition: AI-driven voice recognition systems allow drivers to
control various functions in their vehicles, such as navigation, music,
and communication, using natural language.

9. AI in Robotics:

o Self-Moving Robots: AI makes robots really smart at moving around on


their own. It's like giving them a built-in GPS and a clever brain. They
can figure out where to go and how to get there without bumping into
things or needing a person to show them the way. This helps them do
tasks like delivering packages or exploring places on their own, making
them super independent.
o Object Recognition and Manipulation: AI gives robots sharp eyes and
clever hands. It helps them see objects clearly and then pick them up
and move them just right. This is super useful, especially in places
like warehouses, where they can do things like sorting and packing items
accurately.
o Collaboration of Humans and Robots: AI makes it possible for robots to
be great team players with people. They can work alongside humans,
helping out and learning from them. If a person does something, the
robot can understand and follow their lead. This makes workplaces safer
and more efficient, like having a trusty robot colleague who understands
and supports you.

29
10. AI in Entertainment

o Recommendation of Content: AI looks at what customers have liked before,


such as movies or music, and suggests new things that they might enjoy.
It's like having a personal entertainment guide, making their experience
more enjoyable by offering just what they like.
o AI as a Creative Assistant: AI acts as a creative sidekick for artists
and creators. It can make music, art, and videos or help improve what
they create. It's like having a helper that speeds up the creative
process, making it easier to bring new ideas to life. This way, artists
can focus more on their vision, and AI handles the technical bits.
o Live Event and Performance Enhancements: AI makes live events and
performances even cooler. It can translate what people are saying in
real time, add cool effects that blend with what's happening, and even
predict what the audience will like. This makes shows and events more
exciting and enjoyable for everyone there. It's like having a magic
touch that brings performances to life in new and amazing ways.

11. AI in Agriculture

o Crop Observation and Control: AI, with the help of various sensors, acts
as a guardian for crops on the farm. It keeps an eye on them, making
sure they're healthy and growing well. It tells farmers when it's the
best time to plant, water, and harvest the most crops. It's like having
a farm expert who ensures the fields are super productive so farmers can
get the most out of their hard work.
o Smart Farming for Efficiency: AI makes farming super efficient. It helps
farmers use just the right amount of things like fertilizer and
pesticides, not too much and not too little. This means there's less
waste, and the crops grow better. It's like having a precise chef in the
field, making sure everything is just perfect for the plants to thrive
and produce lots of food.
o Automated Farming: AI controls a number of machines like tractors and
drones. These machines can plant seeds, remove weeds, and spray stuff on
crops all by themselves. They do it super well and exactly as needed,
like having expert farmers who never get tired and work perfectly,
making farming easier and more efficient.
o Monitoring Livestock: AI uses special sensors and smart data analysis to
make sure they're healthy and happy. If anything is wrong, it alerts the
farmer. This way, the animals are well taken care of, and the farm can
run smoothly. It's like having a watchful friend for the animals, making
sure they're okay and the farm works better.

12. AI in E-commerce

o Personalized Product Suggestions: AI looks at what you've looked at and


bought before and suggests things you might really like. It's like
having a personal shopper who knows your style, making your online
shopping more fun and helping you discover new things you might want to
buy. Plus, it's great for the store because it helps them sell more, and
as a customer, it saves your time.
o Managing Inventory: AI takes care of a store's shelves. It predicts how
much of each product people will buy and automatically orders more when
needed. In this manner, there exists an optimal balance of products,
preventing excessive stock that ties up funds while also ensuring an
adequate supply to prevent customers from leaving without making a
purchase.
o Dynamic Pricing: Artificial intelligence dynamically adjusts pricing
according to demand, market competition, and inventory levels, ensuring
customers receive optimal value while enhancing the store's
profitability.

30
13. AI in education:

o Education Content Creation: AI acts as a teaching assistant for


educators. It helps them make things like quizzes, lesson plans, and
study materials. This makes teaching easier and better because educators
have more time for students, and the materials are top-notch. It's like
having a super-efficient helper who does the paperwork, leaving teachers
more time to inspire students.
o Virtual Learning Assistants: AI is there to answer questions, explain
things, and offer help whenever students need it, day or night. This
makes learning easier and more fun because students have someone to turn
to whenever they're stuck. It also takes some pressure off teachers
because AI can handle common questions, leaving more time for
personalized teaching.
o Automated Assessment and Instant Feedback: AI acts like a super-speedy
homework checker. It looks at your assignments and tests and gives you
grades and feedback right away. This aids in gauging your progress and
pinpointing areas for potential enhancement. Furthermore, it alleviates
some of your teacher's grading responsibilities, allowing them to
dedicate more time to teaching rather than paper evaluation.
o Customized Learning Routes: AI figures out what you're good at and where
you might need extra help. Then, it gives you the right stuff to learn
and the best way to learn it. This makes learning easier and more fun.

Types of Artificial Intelligence:


Artificial Intelligence can be divided in various types, there are mainly two types of main categorization which
are based on capabilities and based on functionally of AI. Following is flow diagram which explain the types of AI.

AI type-1: Based on Capabilities

1. Weak AI or Narrow AI:

o Narrow AI is a type of AI which is able to perform a dedicated task with intelligence.The most
common and currently available AI is Narrow AI in the world of Artificial Intelligence.
o Narrow AI cannot perform beyond its field or limitations, as it is only trained for one specific
task. Hence it is also termed as weak AI. Narrow AI can fail in unpredictable ways if it goes
beyond its limits.
o Apple Siriis a good example of Narrow AI, but it operates with a limited pre-defined range of
functions.
o IBM's Watson supercomputer also comes under Narrow AI, as it uses an Expert system approach
combined with Machine learning and natural language processing.

31
o Some Examples of Narrow AI are playing chess, purchasing suggestions on e-commerce site, self-
driving cars, speech recognition, and image recognition.

2. General AI:

o General AI is a type of intelligence which could perform any intellectual task with efficiency
like a human.
o The idea behind the general AI to make such a system which could be smarter and think like a human
by its own.
o Currently, there is no such system exist which could come under general AI and can perform any
task as perfect as a human.
o The worldwide researchers are now focused on developing machines with General AI.
o As systems with general AI are still under research, and it will take lots of efforts and time to
develop such systems.

3. Super AI:

o Super AI is a level of Intelligence of Systems at which machines could surpass human intelligence,
and can perform any task better than human with cognitive properties. It is an outcome of general
AI.
o Some key characteristics of strong AI include capability include the ability to think, to
reason,solve the puzzle, make judgments, plan, learn, and communicate by its own.
o Super AI is still a hypothetical concept of Artificial Intelligence. Development of such systems
in real is still world changing task.

Artificial Intelligence type-2: Based on functionality

1. Reactive Machines

o Purely reactive machines are the most basic types of Artificial Intelligence.
o Such AI systems do not store memories or past experiences for future actions.
o These machines only focus on current scenarios and react on it as per possible best action.
o IBM's Deep Blue system is an example of reactive machines.
o Google's AlphaGo is also an example of reactive machines.

2. Limited Memory

o Limited memory machines can store past experiences or some data for a short period of time.
o These machines can use stored data for a limited time period only.
o Self-driving cars are one of the best examples of Limited Memory systems. These cars can store
recent speed of nearby cars, the distance of other cars, speed limit, and other information to
navigate the road.

3. Theory of Mind

o Theory of Mind AI should understand the human emotions, people, beliefs, and be able to interact
socially like humans.

32
o This type of AI machines are still not developed, but researchers are making lots of efforts and
improvement for developing such AI machines.

4. Self-Awareness

o Self-awareness AI is the future of Artificial Intelligence. These machines will be super


intelligent, and will have their own consciousness, sentiments, and self-awareness.
o These machines will be smarter than human mind.
o Self-Awareness AI does not exist in reality still and it is a hypothetical concept.

Types of AI Agents
Agents can be grouped into five classes based on their degree of perceived intelligence and capability. All these
agents can improve their performance and generate better action over the time. These are given below:

o Simple Reflex Agent


o Model-based reflex agent
o Goal-based agents
o Utility-based agent
o Learning agent

1. Simple Reflex agent:

o 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.
o These agents only succeed in the fully observable environment.
o The Simple reflex agent does not consider any part of percepts history during their decision and
action process.
o 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.
o 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.

33
2. Model-based reflex agent

o The Model-based agent can work in a partially observable environment, and track the situation.
o 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.
o These agents have the model, "which is knowledge of the world" and based on the model they perform
actions.
o Updating the agent state requires information about:
o How the world evolves
o How the agent's action affects the world.

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

34
4. Utility-based agents

o These agents are similar to the goal-based agent but provide an extra component of utility
measurement 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.

ADVERTISEMENT

35
5. 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:
o Learning element: It is responsible for making improvements by learning from environment
o Critic: Learning element takes feedback from critic which describes that how well the
agent is doing with respect to a fixed performance standard.
o Performance element: It is responsible for selecting external action
o 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.

36

You might also like