Artificial Intelligence
Artificial Intelligence
Artificial Intelligence
** 1 INTRODUCTION
A branch of computer science that aims to create or replicate human
intelligence in machines.
Goals
1. Problem-solving
2. Knowledge representation
3. Planning
4. Learning
5. Social Intelligence
Advantages
Reduction in human error
Available 24×7
Helps in repetitive work
Digital assistance
Faster decisions
Rational Decision Maker
Medical applications
Improves Security
Efficient Communication
Disadvantages
Cost overruns
Dearth of talent
Lack of practical products
Lack of standards in software development
Potential for misuse
Highly dependent on machines
Requires Supervision
Artificial Intelligence can be divided mainly into six branches. They are,
Machine learning, neural networks, Deep Learning, Computer Vision,
Natural language processing, Cognitive Computing.
AI works best when it has a good amount of quality data available to it. The algorithm
becomes strong and performs well as the relevant data grows. The AI system fails
badly when enough quality data isn’t fed into it.
5.Issue of responsibility
6. Ethical challenges
One of the major AI problems that are yet be tackled are the ethics and
morality. The way how the developers are technically grooming the AI bots to
perfection where it can flawlessly imitate human conversations, making it
increasingly tough to spot a difference between a machine and a real
customer service rep.
8. Legal Challenges
An AI application with an erroneous algorithm and data governance can
cause legal challenges for the company.
There’s a quite discrepancy between the actual potential of the AI system and
the expectations of this generation.
However, in most of the occasions (particularly in highly specialized roles), AI
cannot substitute the caliber of the human brain and what it brings to the
table.
** 3. AI Technique
1. Heuristics.
2. Support Vector Machines.
3. Artificial Neural Networks.
4. Markov Decision Process.
5. Natural Language Processing.
Heuristics
5 PRODUCTION SYSTEMS
Definition
Components
Global Database: The global database is the central data
structure used by the production system in Artificial Intelligence.
Advantages
Provides excellent tools for structuring AI programs
The system is highly modular because individual rules can be
added, removed or modified independently
Separation of knowledge and Control-Recognises Act Cycle
A natural mapping onto state-space research data or goal-driven
The system uses pattern directed control which is
more flexible than algorithmic control
Provides opportunities for heuristic control of the search
A good way to model the state-driven nature of intelligent
machines
Quite helpful in a real-time environment and applications.
Disadvantages:
It is very difficult to analyze the flow of control within a production
system
It describes the operations that can be performed in a search for a
solution to the problem.
There is an absence of learning due to a rule-based production
system that does not store the result of the problem for future use.
The rules in the production system should not have any type
of conflict resolution as when a new rule is added to the
database it should ensure that it does not have any conflict wit
7. Problem characteristics
Problem Classification
o It is also called greedy local search as it only looks to its good immediate
neighbor state and not beyond that.
o A node of hill climbing algorithm has two components which are state and
value.
o In this algorithm, we don't need to maintain and handle the search tree or
graph as it only keeps a single current state.
1. h(n) <= h*(n)
Here h(n) is heuristic cost, and h*(n) is the estimated cost. Hence heuristic
cost should be less than or equal to the estimated cost.
On each iteration, each node n with the lowest heuristic value is expanded and
generates all its successors and n is placed to the closed list. The algorithm
continues unit a goal state is found.
In the informed search we will discuss two main algorithms which are given below:
o A* Search Algorithm
1. f(n)= g(n).
o Step 2: If the OPEN list is empty, Stop and return failure.
o Step 3: Remove the node n, from the OPEN list which has the lowest value of
h(n), and places it in the CLOSED list.
o Step 5: Check each successor of node n, and find whether any node is a goal
node or not. If any successor node is goal node, then return success and
terminate the search, else proceed to Step 6.
o Step 6: For each successor node, algorithm checks for evaluation function
f(n), and then check if the node has been in either OPEN or CLOSED list. If
the node has not been in both list, then add it to the OPEN list.
o Step 7: Return to Step 2.
Advantages:
o Best first search can switch between BFS and DFS by gaining the advantages
of both the algorithms.
o This algorithm is more efficient than BFS and DFS algorithms.
Disadvantages:
o It can behave as an unguided depth-first search in the worst case scenario.
And-Or graph
PROBLEM REDUCTION:
So far we have considered search strategies for OR graphs through which we want to find a
single path to a goal. Such structure represent the fact that we know how to get from anode
to a goal state if we can discover how to get from that node to a goal state along any one of
the branches leaving it.
AND-OR GRAPHS
The AND-OR GRAPH (or tree) is useful for representing the solution of problems that can
solved by decomposing them into a set of smaller problems, all of which must then be solved.
This decomposition, or reduction, generates arcs that we call AND arcs. One AND arc may
point to any number of successor nodes, all of which must be solved in order for the arc to
point to a solution. Just as in an OR graph, several arcs may emerge from a single node,
indicating a variety of ways in which the original problem might be solved. This is why the
structure is called not simply an AND-graph but rather an AND-OR graph (which also
happens to be an AND-OR tree)
ALGORITHM:
1. Let G be a graph with only starting node INIT.
2. Repeat the followings until INIT is labeled SOLVED or h(INIT) > FUTILITY
a) Select an unexpanded node from the most promising path from INIT (call it
NODE)
b) Generate successors of NODE. If there are none, set h(NODE) = FUTILITY (i.e.,
NODE is unsolvable); otherwise for each SUCCESSOR that is not an ancestor of
NODE do the following:
i. Add SUCCESSSOR to G.
ii. If SUCCESSOR is a terminal node, label it SOLVED and set h(SUCCESSOR) = 0.
iii. If SUCCESSPR is not a terminal node, compute its h
c) Propagate the newly discovered information up the graph by doing the following: let
S be set of SOLVED nodes or nodes whose h values have been changed and need to
have values propagated back to their parents. Initialize S to Node. Until S is empty
repeat the followings:
i. Remove a node from S and call it CURRENT.
ii. Compute the cost of each of the arcs emerging from CURRENT. Assign minimum
cost of its successors as its h.
iii. Mark the best path out of CURRENT by marking the arc that had the minimum
cost in step ii
iv. Mark CURRENT as SOLVED if all of the nodes connected to it through new
labeled arc have been labeled SOLVED
v. If CURRENT has been labeled SOLVED or its cost was just changed, propagate its
new cost back up through the graph. So add all of the ancestors of CURRENT to S.
Means-Ends Analysis in Artificial
Intelligence
o We have studied the strategies which can reason either in forward or
backward, but a mixture of the two directions is appropriate for solving a
complex and large problem. Such a mixed strategy, make it possible that first
to solve the major part of a problem and then go back and solve the small
problems arise during combining the big parts of the problem. Such a
technique is called Means-Ends Analysis.
o The MEA technique was first introduced in 1961 by Allen Newell, and Herbert
A. Simon in their problem-solving computer program, which was named as
General Problem Solver (GPS).
a. First, evaluate the difference between Initial State and final State.
b. Select the various operators which can be applied for each difference.
c. Apply the operator at each difference, which reduces the difference between
the current state and goal state.
Operator Subgoaling
In the MEA process, we detect the differences between the current state and goal
state. Once these differences occur, then we can apply an operator to reduce the
differences. But sometimes it is possible that an operator cannot be applied to the
current state. So we create the subproblem of the current state, in which operator
can be applied, such type of backward chaining in which operators are selected, and
then sub goals are set up to establish the preconditions of the operator is
called Operator Subgoaling.
o Step 2: Else, select the most significant difference and reduce it by doing the
following steps until the success or failure occurs.
c. If
(First-Part <------ MEA (CURRENT, O-START)
And
(LAST-Part <----- MEA (O-Result, GOAL), are successful, then
signal Success and return the result of combining FIRST-PART, O, and
LAST-PART.
The above-discussed algorithm is more suitable for a simple problem and not
adequate for solving complex problems.
Unit 2:-
Next →← Prev
o In this example, there are two players one is called Maximizer and other is
called Minimizer.
o Maximizer will try to get the Maximum possible score, and Minimizer will try
to get the minimum possible score.
o This algorithm applies DFS, so in this game-tree, we have to go all the way
through the leaves to reach the terminal nodes.
o At the terminal node, the terminal values are given so we will compare those
value and backtrack the tree until the initial state occurs. Following are the
main steps involved in solving the two-player game tree:
Next →← Prev
Alpha-Beta Pruning
o Alpha-beta pruning is a modified version of the minimax algorithm. It is an
optimization technique for the minimax algorithm.
1. α>=β
o While backtracking the tree, the node values will be passed to upper nodes
instead of values of alpha and beta.
o We will only pass the alpha, beta values to the child nodes.
o Ideal ordering: The ideal ordering for alpha-beta pruning occurs when lots
of pruning happens in the tree, and best moves occur at the left side of the
tree. We apply DFS hence it first search left of the tree and go deep twice as
minimax algorithm in the same amount of time. Complexity in ideal ordering
is O(bm/2).
o Order the nodes in the tree such that the best nodes are checked first.
o Use domain knowledge while finding the best move. Ex: for Chess, try order:
captures first, then threats, then forward moves, backward moves.
o We can bookkeep the states, as there is a possibility that states may repeat.
https://player.slideplayer.com/13/4173482/data/images/img0.jpg
part of an Uninformed search strategy just like BFS and DFS. We can define IDDFS as
have found certain limitations in BFS and DFS so we have done hybridization of both
incrementing the depth limit by iterating the procedure unless we have found the
searching the element in optimum time and space. The algorithms only guarantee
that the path will be found in exponential time and space. So we found a method
where we can use the amalgamation of space competence of DFS and optimum
solution approach of BFS methods, and there we develop a new method called
iterative deepening using the two of them. The main idea here lies in utilizing the re-
computation of entities of the boundary instead of stocking them up. Every re-
computation is made up of DFS and thus it uses less space. Now let us also consider
We can do this by having aside a DFS which will search up to a limit. It first does
searching to a pre-defined limit depth to depth and then generates a route length1.
This is done by creating routes of length 1 in the DFS way. Next, it makes way for
It even can delete all the preceding calculation all-time at the beginning of the loop
and iterate. Hence at some depth eventually the solution will be found if there is any
2 for d = 0 to infinity:
4 return 1
5 else
6 return 0
among:
While in the case once we try the search method multiple times by increasing the
depth limit each time and in the second case even if we keep on searching multiple
times since no solution exists then it means simply the waste of time. Thus we come
to the conclusion that in the first case failure is found to be failing unnaturally, and in
Data Scienti st Training (76 Courses, 60+ Projects) 76 Online Courses | 60 Hands-on Projects | 632+
Hours | Verifiable Certificate of Completion | Lifetime Access
4.8 (9,040 ratings)
Course Price
₹7999 ₹41999
View Course
Related Courses
Machine Learning Training (17 Courses, 27+ Projects)Cloud Computing Training (18 Courses, 5+ Projects)
node is R where we have to find the depth and the path to reach it. The depth from
the figure is 4. In this example, we consider the tree as a finite tree, while we can
consider the same procedure for the infinite tree as well. We knew that in the
algorithm of IDDFS we first do DFS till a specified depth and then increase the depth
at each loop. This special step forms the part of DLS or Depth Limited Search. Thus
Advantages
IDDFS gives us the hope to find the solution if it exists in the tree.
When the solutions are found at the lower depths say n, then the algorithm proves to
The great advantage of IDDFS is found in-game tree searching where the IDDFS
search operation tries to improve the depth definition, heuristics, and scores of
Another major advantage of the IDDFS algorithm is its quick responsiveness. The
early results indications are a plus point in this algorithm. This followed up with
Space and time complexities are expressed as: O(d) and here d is defined as goal
depth.
Let us consider the run time of IDDFS. Let say b>l where b is branching factor and l is
the depth limit. Then next we search the goal node under the bound k. On the depth
k, we say there may be bknodes that are only generated once. Similarly, the nodes at
the depth limit k-1 is twice and thrice for k-2 depth. Thus the node generated at
depth l is k times.
Disadvantages
The time taken is exponential to reach the goal node.
The main problem with IDDFS is the time and wasted calculations that take place at
each depth.
The situation is not as bad as we may think of especially when the branching factor is
found to be high.
The IDDFS might fail when the BFS fails. When we are to find multiple answers from
the IDDFS, it gives back the success nodes and its path once even if it needs to be
found again after multiple iterations. To stop the depth bound is not increased
further.
Conclusion
Iterative deepening depth-first search is a hybrid algorithm emerging out of BFS and
DFS. IDDFS might not be used directly in many applications of Computer Science, yet
the strategy is used in searching data of infinite space by incrementing the depth
limit by progressing iteratively. This is quite useful and has applications in AI and the
Recommended Articles
This is a guide to Iterative Deepening Depth-First Search. Here we discuss the
example of Iterative Deepening Depth-First Search. You may also have a look at the
2. Features of Magento
3. Search Algorithms in AI
50+ projects
1500+ Hours
Verifiable Certificates
Lifetime Access
Learn More
What to Represent:
Following are the kind of knowledge which needs to be represented in AI systems:
o Object: All the facts about objects in our world domain. E.g., Guitars contains
strings, trumpets are brass instruments.
o Events: Events are the actions which occur in our world.
o Facts: Facts are the truths about the real world and what we represent.
Types of knowledge
Following are the various types of knowledge:
1. Declarative Knowledge:
2. Procedural Knowledge
4. Heuristic knowledge:
5. Structural knowledge:
o It describes relationships between various concepts such as kind of, part of,
and grouping of something.
o It describes the relationship that exists between concepts or objects.
Let's suppose if you met some person who is speaking in a language which you don't
know, then how you will able to act on that. The same thing applies to the intelligent
behavior of the agents.
As we can see in below diagram, there is one decision maker which act by sensing
the environment and using knowledge. But if the knowledge part will not present
then, it cannot display intelligent behavior.
AI knowledge cycle:
An Artificial intelligence system has the following components for displaying
intelligent behavior:
o Perception
o Learning
o Planning
o Execution
The above diagram is showing how an AI system can interact with the real world
and what components help it to show intelligence. AI system has Perception
component by which it retrieves information from its environment. It can be visual,
audio or another form of sensory input. The learning component is responsible for
learning from data captured by Perception comportment. In the complete cycle, the
main components are knowledge representation and Reasoning. These two
components are involved in showing the intelligence in machine-like humans. These
two components are independent with each other but also coupled together. The
planning and execution depend on analysis of Knowledge representation and
reasoning.
Player Weight
Player1 65
Player2 58
Player3 75
2. Inheritable knowledge:
o In the inheritable knowledge approach, all data must be stored into a
hierarchy of classes.
o Every individual frame can represent the collection of attributes and its value.
o Example:
3. Inferential knowledge:
o Inferential knowledge approach represents knowledge in the form of formal
logics.
o This approach can be used to derive more facts.
o It guaranteed correctness.
a. Marcus is a man
man(Marcus)
∀x = man (x) ----------> mortal (x)s
4. Procedural knowledge:
o Procedural knowledge approach uses small programs and codes which
describes how to do specific things, and how to proceed.
o In this approach, one important rule is used which is If-Then rule.
o But it is not necessary that we can represent all cases in this approach.
1. 1. Representational Accuracy:
KR system should have the ability to represent all kind of required knowledge.
2. 2. Inferential Adequacy:
KR system should have ability to manipulate the representational structures
to produce new knowledge corresponding to existing structure.
3. 3. Inferential Efficiency:
The ability to direct the inferential knowledge mechanism into the most
productive directions by storing appropriate guides.
1. Important attributes
There are two attributes shown in the diagram, instance and isa. Since
these attributes support property of inheritance, they are of prime
importance.
i. What are the primitives and at what level should the knowledge be
represented?
Hence, the user can add other facts, such as "Spotted (x, y) → saw (x, y)"
To represent the above statements, PL logic is not sufficient, so we required some more powerfu
First-Order logic:
o First-order logic is another way of knowledge representation in artificial intelligence. It is
o First-order logic is also known as Predicate logic or First-order predicate logic. First-
develops information about the objects in a more easy way and can also express the rela
o First-order logic (like natural language) does not only assume that the world contains fac
assumes the following things in the world:
o Objects: A, B, people, numbers, colors, wars, theories, squares, pits, wumpus, ...
a. Syntax
b. Semantics
Connectives ∧, ∨, ¬, ⇒, ⇔
Equality ==
Quantifier ∀, ∃
Atomic sentences:
o Atomic sentences are the most basic sentences of first-order logic. These sentences are f
by a parenthesis with a sequence of terms.
o We can represent atomic sentences as Predicate (term1, term2, ......, term n).
Complex Sentences:
o Complex sentences are made by combining atomic sentences using connectives.
o Predicate: A predicate can be defined as a relation, which binds two atoms together in a
Consider the statement: "x is an integer.", it consists of two parts, the first part x is the sub
"is an integer," is known as a predicate.
Quantifiers in First-order logic:
o A quantifier is a language element which generates quantification, and quantification spec
universe of discourse.
o These are the symbols that permit to determine or identify the range and scope of the va
are two types of quantifier:
Universal Quantifier:
Universal quantifier is a symbol of logical representation, which specifies that the statement with
every instance of a particular thing.
o For all x
o For each x
o For every x.
Example:
Let a variable x which refers to a cat so all x can be represented in UOD as below:
∀x man(x) → drink (x, coffee).
It will be read as: There are all x where x is a man who drink coffee.
Existential Quantifier:
Existential quantifiers are the type of quantifiers, which express that the statement within its sco
something.
It is denoted by the logical operator ∃, which resembles as inverted E. When it is used with a pre
existential quantifier.
If x is a variable, then existential quantifier will be ∃x or ∃(x). And it will be read as:
Example:
Some boys are intelligent.
It will be read as: There are some x where x is a boy who is intelligent.
Points to remember:
o The main connective for universal quantifier ∀ is implication →.
Properties of Quantifiers:
o In universal quantifier, ∀x∀y is similar to ∀y∀x.
Free Variable: A variable is said to be a free variable in a formula if it occurs outside the scope
Bound Variable: A variable is said to be a bound variable in a formula if it occurs within the sco