Sunteți pe pagina 1din 11

P a g e | 1 | Module 1 Source : diginotes.

in
MODULE 1
Artificial Intelligence
Definition:
• AI is the study of how to make computers do the things, which at the moment,
people do better.
The AI problems:
• Some domains of AI
1. Mundane Tasks (Common tasks routine tasks, monotones, tiresome,
exciting etc.)
a. Perception
i. Vision
ii. Speech
b. Natural Language
i. Understanding
ii. Generation
iii. Translation
c. Common Sense Reasoning
i. Robot control formal tasks
2. Formal Tasks
a. Games
i. Chess
ii. Backgammon (ludo)
iii. Checkers-go
b. Mathematics
i. Geometry
ii. Logic
iii. Integral Calculus
iv. Proving properties of programs
3. Expert Tables
a. Engineering
i. Design
ii. Faull finding
iii. Manufacturing planning
b. Scientific Analysis
c. Medical diagnosis
d. Financial Analysis
 What is the underlying assumption?
 The heart of AI lies in the physical symbol system hypothesis (Newells simon).
The physical symbol system is defined as: It consists of a set of entities call
symbols which are the physical patterns which can occur as components of
another type of entity called an Expression (or symbol structure).
Dr. Satyanarayan Reddy K, Dept. of ISE, CITech, Bangalore Source : diginotes.in
P a g e | 2 | Module 1 Source : diginotes.in
 A symbol structure is composed of a number of instances (or token) of
symbols related in some physical way.
 At any instant of time the system will contain a collection of those symbol
structures, system also contains a collection of processes which operate an
expressions to produce other expressions, processes of creation,
modifications, processes of creation, modification, reproduction and
destruction.
 The physical symbol system hypothesis:
 A physical symbol system has the necessary and sufficient means for general
intelligent action.
 What is an AI Technique?
 Intelligence requires knowledge but the knowledge possess some less
desirable properties such as
 It is voluminous
 It is hard to characterize accurately.
 It is constantly changing.
 It differs from data which is organised in some way corresponding to the
way in which it will be used.
 Thus we can define that an AI technique is a method which exploits
knowledge which should be represented in such a way that:
 The knowledge captures generalizations: Each individual situation need not
be represented separately and the situations that share important
properties are grouped together.
 Knowledge can be understood by people who must provide.
 It can be modified easily to correct errors and to reflect the changes in the
world and in our world view.
 It can be used in many situations even if it is not totally accurate or
complete.
 By narrowing down the range of possibilities the sheer bulk of data can be
reduced, for being considered. The AI techniques must be designed
keeping in view the constraints imposed by AI problems.
 How to build a system to solve a particular problem?
1) Define the problem precisely
a) What will be the specification of initial state and final state of acceptable
solution to the problem.
2) Analyse the problems:
a) Appropiate technique be selected for solving problem.
3) Isolate and represent the tasks knowledge which is necessary to solve the
problem.
4) Choose the best problem solving technique and apply it to solve the particular
problem.
Dr. Satyanarayan Reddy K, Dept. of ISE, CITech, Bangalore Source : diginotes.in
P a g e | 3 | Module 1 Source : diginotes.in

 Defining the Problem as a state space search formal description of a


problem:
1) Define the state space which contains all the possible configuration of the
relevant objects.
2) Specify one or more states within that space which describe possible
situation from which the problem solving process manages. These states
are called the Initial states.
3) Specifies one or more states which would be acceptable as solutions to the
problem. These states are called the goal states.
4) Specify a set of rules which describe the action (operators) available. And
for doing this following issues may have to be considered.
a) What unstated assumptions are present in the informal problem
description?
b) How generate the rule should be?
c) How much of the work required to solve the problem should be pre-
computed and represented in the rules.
• The problems can be solved using the rules in combination with an
appropriate control strategy to more through the problem space until
a path from initial state to final state is found.
• The process of search is fundamental to the problem solving process.
 Production Systems:
 A set of rules each consistency of a left side(a pattern) which determines the
applicability of rule and a right side which describes the operation to be
performed if the rule is applied.
 One or more knowledge/databases that contain whatever information is
appropriate for the particular task. Some parts of the database may be
permanent while other parts of it may pertain only to the solution of the current
problem. The info within the databases may be structured in any appropriate
way.
 A control strategy which specifies the order in which the rules will be
compared to the database and a way of resolving the conflicts which arise
when several rules that match at once.
 A rule applier.
 Control Strategies:
 The first requirement of a good control strategy is that it causes motion.
 The second requirement of a good central strategy is that it be systematics.
Ex: One systematic control strategy for the water joining the problem is the
following:
 Construct a dice with the initial state as its root:

Dr. Satyanarayan Reddy K, Dept. of ISE, CITech, Bangalore Source : diginotes.in


P a g e | 4 | Module 1 Source : diginotes.in
 Generate all the off springs of the not by applying each of the applicable to
rule to the initial state as its root.
 The figure below shows how the tree looks at this point.

 Now for each leaf node generate all the successors nodes by applying all
the rules that are appropriate.

 Continue this process until application some rule produces a goal state.
This process is called the breadth first search.

 Algorithm Breadth first search:


1) Create a variable called NODE_LIST and set it to initial state.
2) Until a goal state is found.
a. Remove the first element from NODE_LIST and call it NODE_LIST was
empty quit.
b. For each way that each rule can match the state described in Edo:
i. Apply the rule to generate a new state.
ii. If the new state is a goal state, quit and returned this state.
iii. Otherwise, add the new state to the end of node out.

Dr. Satyanarayan Reddy K, Dept. of ISE, CITech, Bangalore Source : diginotes.in


P a g e | 5 | Module 1 Source : diginotes.in
Chapter 2
 The water jug problem:
 You are given a 4-gallon jug and a 3-gallon jug and a pump which has unlimited water
which can be used to fill the jug. Further water present in the jug can be poured on
the ground. None of the jugs have measuring marks. Then pour exactly 2 gallons of
water in the 4-gallon jug.
 State representation & initial state
 The state of the problem is represented as (x,y) where
x: Amount of water in 4-gallon jug.
y: Amount of water in 3-gallon jug.
Note: 0 ≤ x ≤ 4, 0 ≤ y ≤ 3
Initial state is (0,0)
End state: (2,y) where 0 ≤ y ≤ 3
 The production rules for the water jug problems:
1. (x, y) if (x < 4) → (4, y) fill the 4-gallon jug
2. (x, y) if (y < 3) → (x, 3) fill the 3-gallon jug
3. (x, y) if (x > 0) → (x-d, y) pour some water out of 4-gallon jug
4. (x, y) if (y > 0) → (x, y-d) pour some water out of 3-gallon jug
5. (x, y) if (x > 0) → (0, y) empty the 4-gallon jug onto the ground
6. (x, y) if (y > 0) → (x, 0) empty the 3-gallon jug onto the ground
7. (x, y) if x + y ≥ 4 & y > 0 → (4, y-(4-x)) pour water from 3-gallon jug into the 4-gallon
jug until the 4 gallon jug is full
8. (x, y) if x +y ≥ 3 & x > 0 → (x-(3-y), 3) pour water from 4-gallon jug into the 3-gallon
jug until the 3-gallon jug is full
9. (x, y) if x + y ≤ 4 & y > 0 → (x+y, 0) pour all the water from 3-gallon jug into the 4
gallon jug
10.(x, y) if x + y ≤ 4 & x > 0 → (0, x+y) pour all the water from 4-gallon jug into the 3
gallon jug
11.(0, 2) → (2, 0) pour the 2 gallons from the 3-gallon jug
into the 4-gallon jug
12.(2, y) → (0, y) empty the 2 gallons in the 4-gallon jug on the
Ground
 Solution:
Gallons in 4-gallon jug Gallons in 3-gallon jug Rule Applied
0 0 2
0 3 9
3 0 2
3 3 7
4 2 5 or 12
0 2 9 or 11
2 0
Dr. Satyanarayan Reddy K, Dept. of ISE, CITech, Bangalore Source : diginotes.in
P a g e | 6 | Module 1 Source : diginotes.in
 Breadth first search algorithm tracing
Step 1: NODE_LIST = {(0, 0)}
Step 2: if Goal state Found = NO OR NODE_LIST ≠ ∅
(a) NODE_LIST = { }
E = {(0, 0)}
(b) On state (0, 0) the rules applicable are 1 & 2
i) i.e. (4, 0) (3, 0)
ii) if the new state is a goalstate = NO
iii) NODE_LIST = {(4, 0), (3, 0)}
goto step 2
Step 2 (Iteration 2):
(a) NODE_LIST = {(3, 0)}
E = {(4, 0)}
(b) On state (4, 0) the rules applicable are
i) 2, 3 & 8
i.e. we get the states (4, 3), (0, 0), (1, 3)
ii) if the new state is a goal state = NO
iii) NODE_LIST = {(3, 0), (4, 3), (0, 0), (1, 3)}
goto step 2
Step 2 (Iteration 3)
• Proceeding in this way we can reach the goal state:
 In this the appropriate control strategy is to terminate a path if it reaches dead
end or produces a previous state or the search becomes longer than the
“FUTILITY” limit.
• In such a case backtracking occurs:
 Chronological backtracking: In this case the most recently created state from
which alternative moves are available will be revisited & a new state will be
created.
 Algorithm: Depth-first search
1. If the initial state is a goal state “quit” and return “success”.
2. Otherwise, do the following until SUCCESS or FAILURE is signalled:
a. Generate a successor ‘E’ of the initial state, If there are no more successors
signal failure.
b. Call Depth-First Search with ‘E’ as initial state.
c. If success is returned signal success. Otherwise continue in this loop.

Dr. Satyanarayan Reddy K, Dept. of ISE, CITech, Bangalore Source : diginotes.in


P a g e | 7 | Module 1 Source : diginotes.in
 Advantages of Depth-First Search:
• Depth-first search requires less memory since only the nodes on the current path
are stored. But in breadth-first search all of the tree that has been generated so
far must be stored.
• By chance DFS may find a solution without examining much of the search space at
all. But in BFS, all the parts of the tree must be examined to level ‘n’ before any
node on level ‘n+1’ can be examined. This may lead to finding many acceptable
solutions that exist which is significant.
• Depth-first search can stop when one of the acceptable solution is found.
 Advantages of Breadth-First Search:
• BFS will not get trapped exploring the blind alley. But the DFS may get trapped in
a blind alley by following a single unfruitful path for a very long time, perhaps
forever before the path actually terminates in a state that has no successors.
• If there is a solution to the problem the BFS is guaranteed to find it, further if
there are multiple solutions then a minimal solution (i.e. a solution which requires
a minimum number of steps) will be found, because longer paths are never
explored until all shorter ones have already been examined. But in DFS a long path
maybe explored to find a solution when a shorter path exists in some other.
• The control strategy for water jug will cause motion and it is systematic. It will
always lead to a solution as the problem is very simple. But consider the travelling
salesman problem: “A salesman has a list of cities, each of which he must visit
exactly once. There are direct roads between each pair of cities on the list. Find
the route the salesman should follow for the shortest possible round trip that
both starts and finishes at any one of the cities.”
• A simple motion causing & systematic control structure could solve the problem if
number of cities (n) is small, but the system breaks down as the number of cities
grows.
• Since if there are N=11 cities then 10! = 3628800, which is a very large number.
But what if the number of cities = 25.
• This type of problem lead to a phenomenon called combinational explosion.
• To counter this new control strategy is required; this technique is called the
branch and bound technique.
 Heuristic Search:
 Heuristic search is a technique which improves the efficiency of a search process,
possibly by sacrificing claims of completeness.
Ex: Heuristics is like a tour guide who is good to the extent of that he can point all the
generally interesting directions but he is bad to the extent that he may miss points of
interest to particular individuals.

Dr. Satyanarayan Reddy K, Dept. of ISE, CITech, Bangalore Source : diginotes.in


P a g e | 8 | Module 1 Source : diginotes.in
There are 2 major ways in which domain specific heuristic knowledge can be
incorporated into a rule based search procedures.
1. In the rules themselves.
Ex: In game of chess, the rules might describe not only a set of legal moves but rather
a set of “sensible” moves as determined by the rule writer.(Opponent has made such
a move that player’s queen will be taken unless it is moved.)
But player makes a move that checkmates the opponent’s king in such a way that if
king moves away the opponent’s queen will be taken: rule does not mention this.
2. As a heuristic function which evaluates individual problem states & determines how
desirable they are.
 A heuristic function:
 It is a function which maps from problem state descriptions to measure of desirability
usually represented as numbers.
Note: A well designed heuristic function can play an important part in efficiently guiding
the search process towards a solution.
 A high value of heuristic function indicates a relatively good position, while at other
times a low value indicates an advantageous situation.

 Purpose of heuristic function:


 A heuristic function guides the search process in the most profitable direction; by
suggesting which path to follow first which more than one path is available.
 In general there is a trade-off between the cost of evaluating a heuristic function &
the saving in search time which the function provides.

Dr. Satyanarayan Reddy K, Dept. of ISE, CITech, Bangalore Source : diginotes.in


P a g e | 9 | Module 1 Source : diginotes.in
UNIT-2
 Problem Characteristics
 The criteria for choosing most appropriate method for solving a particular problem
we have to consider the following:-
 Is the problem decomposable into a set of (nearly) independent smaller or easier
sub-problems.
 Can the solution steps be ignored or at least undone, if they prove unwise?
 Is the problems universe predictable?
 Is a good solution to the problem obvious without compression to all other
possible solutions?
 Is the desired solution state of the world or a path to a state.
 Is a large amount of knowledge absolutely required to solve the problem or is
knowledge important only to constrain the search?
 Can a computer which is simply given the problem return the solution or will the
solution of the problem require interaction between the computer & a person.
1. Is the problem Decomposable?
• Consider the problem ∫(x2+3x+sin2x.cos2x)dx
• This problem can be solved by breaking it down into three smaller problems each
of which can then be solved by using a small collection of rules generating the
problem tree by the process of problem decomposition using a simple recursive
integration which works as follows:
o At each step, it checks whether the problem it is working on, is immediately
solvable, if so then the solution is returned directly & if the problem into
smaller problems.
o If the problem is decomposable then such problems are decomposed into
smaller parts 7 the integrator calls itself recursively with small problems as
the parameters
∫(x2+3x+sin2x+cos2x)dx

∫x2dx=x3/3 ∫3xdx ∫sin2.cos2xdx

3x2/2 ∫sin2x.cos2xdx

∫(1-cos2)cos2xdx

∫(cos2x-cos4)dx

∫cos2xdx - ∫cos4xdx

∫(1+cos2x)/2 dx …
1/2∫dx+1/2∫cos2xdx …
1/2x+1/2son2x/2 …
Dr. Satyanarayan Reddy K, Dept. of ISE, CITech, Bangalore Source : diginotes.in
P a g e | 10 | Module 1 Source : diginotes.in
 Now consider the blocks world problem
 Assume that the following operators are available :
1. CLEAR(x) [Block x has nothing on it]
ON(x,Table)[pickup x & put it on the table]
2. CLEAR(x) and CLEAR(y)
ON(x,y)[put x on y]
You can pick up a single block at a time.
Start state Goal state

C A
A B B
ON(C,A) C
ON(B,C)&ON(A,B)
 Applying the technique of problem decomposition to this Blocks world example:
Solution:
CLEAR(A)

Move A to table
CLEAR(A)

ON(A,B)

Put A ON B
ON(A,B)

Solution steps:

ON(B,C)and ON(A,B) C A B
decompose ON(B,C)
ON(B,C) ON(A,B)

Put B ON C B Put B ON C
ON(B,C) C A
ON(A,B)
Put A ON B
A
B
C

 Can the solution steps be Ignored or Undone?


 Consider the 8-puzzle: The 8-puzzle is a square tray in which 8 tiles are placed.
Remaining 9th square is uncovered. Each tile has a number on it. A tile which is
adjacent to the blank space can be slid into that space.

Dr. Satyanarayan Reddy K, Dept. of ISE, CITech, Bangalore Source : diginotes.in


P a g e | 11 | Module 1 Source : diginotes.in
 The game consists of starting position & a specified goal position. The goal is to
transform the starting position into the goal position by sliding the tiles around.

2 8 3 1 2 3
1 6 4 8 4
7 5 7 6 5

Start Goal state

Step 1: slide tile 6 down

2 8 3
1 4
7 6 5

Step 2: slide 8 down

2 3
1 8 4
7 6 5

Step 3: slide tile 2 to right side


2 3
1 8 4
7 6 5

Step 4: slide tile


1 2 3
8 4
7 6 5

Step 6: slide 8 to left


1 2 3
8 4
7 6 5

Goal state

Dr. Satyanarayan Reddy K, Dept. of ISE, CITech, Bangalore Source : diginotes.in

S-ar putea să vă placă și