Artificial Intelligence Dhanya P.M, Lecturer in DCS, RASET
Artificial Intelligence Dhanya P.M, Lecturer in DCS, RASET
Intelligence is the ability to acquire ,understand and apply knowledge or the ability to
exercise thought and reason.
Knowledge is different from data.A physician uses both knowledge and data.Data is the
patients record like his history,drugs,response to drugs,whereas knowledge is what
physician has learned in medical colleges.
search
AI programs often examine large numbers of possibilities, e.g. moves in a chess game
or inferences by a theorem proving program. Discoveries are continually made about
how to do this more efficiently in various domains.
pattern recognition
When a program makes observations of some kind, it is often programmed to
compare what it sees with a pattern. For example, a vision program may try to match
a pattern of eyes and a nose in a scene in order to find a face. More complex patterns,
e.g. in a natural language text, in a chess position, or in the history of some event are
also studied. These more complex patterns require quite different methods than do the
simple patterns that have been studied the most.
representation
Facts about the world have to be represented in some way. Usually languages of
mathematical logic are used.
inference
From some facts, others can be inferred.. For example, when we hear of a bird, we
man infer that it can fly, but this conclusion can be reversed when we hear that it is a
penguin
common sense knowledge and reasoning
ontology
Ontology is the study of the kinds of things that exist. In AI, the programs and
sentences deal with various kinds of objects, and we study what these kinds are and
what their basic properties are. Emphasis on ontology begins in the 1990s. An
ontology is an explicit specification of a conceptualization. The term is borrowed
from philosophy, where an Ontology is a systematic account of Existence. For AI
systems, what "exists" is that which can be represented. When the knowledge of a
domain is represented in a declarative formalism, the set of objects that can be
represented is called the universe of discourse. This set of objects, and the describable
relationships among them, are reflected in the representational vocabulary with which
a knowledge-based program represents knowledge. Thus, in the context of AI, we can
describe the ontology of a program by defining a set of representational terms. In
such an ontology, definitions associate the names of entities in the universe of
discourse (e.g., classes, relations, functions, or other objects) with human-readable
text describing what the names mean, and formal axioms that constrain the
interpretation and well-formed use of these terms. Formally, an ontology is the
statement of a logical theory
heuristics
A heuristic is a way of trying to discover something or an idea imbedded in a
program. The term is used variously in AI. Heuristic functions are used in some
approaches to search to measure how far a node in a search tree seems to be from a
speech recognition
In the 1990s, computer speech recognition reached a practical level for limited
purposes. Thus United Airlines has replaced its keyboard tree for flight information
by a system using speech recognition of flight numbers and city names. It is quite
convenient. On the the other hand, while it is possible to instruct some computers
using speech, most users have gone back to the keyboard and the mouse as still more
convenient.
understanding natural language
Just getting a sequence of words into a computer is not enough. Parsing sentences is
not enough either. The computer has to be provided with an understanding of the
domain the text is about, and this is presently possible only for very limited domains.
computer vision
The world is composed of three-dimensional objects, but the inputs to the human eye
and computers' TV cameras are two dimensional. Some useful programs can work
solely in two dimensions, but full computer vision requires partial three-dimensional
information that is not just a set of two-dimensional views. At present there are only
limited ways of representing three-dimensional information directly, and they are not
as good as what humans evidently use.
expert systems
A ``knowledge engineer'' interviews experts in a certain domain and tries to embody
their knowledge in a computer program for carrying out some task. How well this
works depends on whether the intellectual mechanisms required for the task are
within the present state of AI. When this turned out not to be so, there were many
disappointing results. One of the first expert systems was MYCIN in 1974, which
AI PROBLEMS
1) TIC-TAC-TOE
TIE
O LOSES
Method: Game is between two persons odd and even.Odd places X and even places
O.A person wins if his letter comes in all vertical ,horizontal and diagonal lines.
2) 8 Puzzle
Here is the shortest solution generated by the 8 puzzle program for the initial state
given above. (The program animates through each game state)
+-----+
|8 3 5|
|4 1 |
|2 7 6|
+-----+
+-----+
|8 3 |
|4 1 5|
|2 7 6|
+-----+
+-----+
|8 3|
|4 1 5|
|2 7 6|
+-----+
+-----+
|8 1 3|
|4 5|
|2 7 6|
+-----+
+-----+
|8 1 3|
| 4 5|
|2 7 6|
+-----+
+-----+
|8 1 3|
|2 4 5|
| 7 6|
+-----+
+-----+
|8 1 3|
|2 4 |
|7 6 5|
+-----+
+-----+
|8 1 3|
|2 4|
|7 6 5|
+-----+
+-----+
| 1 3|
|8 2 4|
|7 6 5|
+-----+
+-----+
|1 3|
|8 2 4|
|7 6 5|
+-----+
+-----+
|1 2 3|
|8 4|
|7 6 5|
+-----+
7 X
6 X
5 X
4 X
3 X
2 X
1 X
0 X
0 1 2 3 4 5 6 7
else {
} //while
}//else
Objective:
• To find all 92 possible ways of placing 8 queens on a chess board such that no
two queens can cancel each other.
• Develop a recursive algorithm for finding the solution to this problem.
To solve the 8 queens problem, start by superimposing the chess board on a on a
cartesian coordinate plane.
For this example, all ten basic operations can be represented in the
language of production rules as follows:
x y Rule
applied
s1 0 0
R2
s2 0 3
R9
s3 3 0
R2
s4 3 3
R7
s5 4 2
R5
s6 0 2
Together the problem and the operators characterize the problem space
associated with the problem:
The problem solving in the water jug example can be represented as the
following tree:
<0, 0>
/ \
R1 R2
<0, 3>
/ |...\
/ |... \
R1 R4... R9
<3, 0>
/ | \
/ | \
R2 R3 R5
<3, 3>
/ |...\...
/ |... \...
R1 R3 R7
<4, 2>
/ |...\...
/ |... \...
R2 R3 R5
<0, 2>
/ | \
/ | \
Problem Characteristics:-
Inorder to choose the most appropriate method for a particular problem,it is necessary to
analyze the problem along several key dimensions .
1)Is the problem decomposable into a set of independent smaller or easier sub problems.
∫ (x2 + 3x +sin2x.cos2x) dx
∫ ∫ ∫
x2dx 3xdx sin2xcos2xdx
X3/3 3 ∫ x dx ∫ (1-cos2x)cos2x dx
The problem can be solved by dividing it in to a no of sub problems and solving it.
1 6 4
7 5
2 3
8 4
In attempting to solve the 8 puzzle,we might make a stupid move by moving tile 5 in to
the empty space .Now we backtrack and undo the first move sliding tile 5 back in
to the first move ,sliding tile 5 back to where it was.Then we can move tile 6.The
control mechanism for the 8 puzzle must keep track of the order in which
operations are performed so that the operations can be undone one at a time.
Consider the 8 puzzle problem.Every time we make a move we know exactly what
is happening.it is possible to plan the entire sequence of moves to avoid having to
undo it.But in case of chess we can’t plan the entire sequence because it depends on
how the other pklayer plays.
Suppose we want to find the answer to the question Is marcus alive? It can be found in 2
ways.
Solution 1
Solution 2
Since we are interested in only answers to the question ,it doesnot matter which path we
follow.
But suppose we consider the traveling sales man problem ,our goal is to find out the
shortest city that visits each city exactly once.Suppose the cities to be visited and
their distances are ordered like this
Dallas Miami
newyork dallas
miami San
francisco
boston
boston
8850 7750
Total :3000+1700+1500+1200+1450=8850
Total: 250+1200+1600+1700+3000=7750
These 2 problems shows the difference between the any path problem and the best path
problem.
Search techniques
Having formulated the problems ,solution for them is found out by a search through the
state space.
Search tree
All the search techniques uses asearch tree that is generated by the initial state and the
successor function.When same state is reached from multiple paths the tree
becomes a graph.
Search node
The root of the search tree is a search node corresponding to the initial state.This is
checked against the goal state.If not then iit is expanded with the successor function
by generating a new set of states.The choice of which state to expand is determined
by the search strategy.
Uninformed search
Means that they have no additional information regarding the states beyond that provided
in the problem definition.All they can do is to generate successors and distinguish a
goal state from a non goal state.it is blind search in which the nodes are explored in
the predefined order.An uninformed search is available with a start state,search
algorithm and a test for the goal state.
1)BFS
2)DFS
6)bidirectional search
Searches are performed by exploring all the nodes at a given depth before proceeding to
the next level.
Algorithm
3.If the first element on the queue is a goal node g return success and stop.
Else remove and expand the first element from the queue and place all the children at
3.return to step 2.
LEVEL 1
B C
LEVEL 3
B C
D E F G
1)If there is a path BFS is guaranteed to find it.Further if there is a multiple solution,then
a minimal solution will be found.
2)Longer paths are never explored until al shorter ones are examined.
A child is generated from the most recently expanded node ,then generating the child’s
children and so on until a goal is found.
3)If the first element on the stack is a goal node g,return success and stop.
Remove and expand first element and place the children at the top of the stack.
4).return to step 2.
Advantages
1)requires only less memory since only the nodes on the current path are made.
2)By chance DFS may find a solution without examining much of the search space at all.
This method expands the node n with the lowest path cost.If all the step cost are
equal,then it is identical to the BFS.
Z 151
75
118 S
T
80
111
L
70
R
M
146
75
D C
120
A
75 QUEUE
118 Z 75
140
T 118
S 140
Z S T
75
140 118
A
75 QUEUE
140 118 T 118
S 140
Z S T O 146
A 150
75
140 118
A O
150 146
A
75
140 118
QUEUE
Z S T
S 140
111 O 146
140 118 A 150
L 229
A O A L A 236
236
150 146 229
Z S T
111
118
QUEUE
O A L O 146
A A 150
236 L 229
146 229 A 236
150
R 220
R
A 280
O A O 291
Eg:-limit l =2
Not explored
Algorithm
1.Set SEARCH-DEPTH=1.
Limit=0
Limit=1
Limit=2
Taking the following map coloring problem as an example, we can explain the constraint
satis faction problem
NT Q
WA
SA
NSW
V
Constraint graph
WA=red WA=red
NT=green NT=blue
WA=red WA=red
NT=green NT=green
Q=red Q=blue
Forward checking
One way to make better use of constraints during search is called forward
checking.whenever a variable is assigned forward checking process looks at each
unassigned variable y that is connected to X by a constraint and deletes from Y’s domain
any value that is inconsistent with the value chosed for X
WA NT Q NSW V SA T
Initial RGB RGB RGB RGB RGB RGB RGB
N
T Q red
W
T
S NS Green
A W
blue
V
T
red
Let the coloring order be {Q,NSW,V,T,SA,WA,NT}.Now when we try SA,we see that
every value violates a constraint .Now instead of backtracking upto T,we backtrack to the
set variables(conflict set) which caused the failure.here the conflict set is{Q,NSW,V}
So we jump over T and try a new value for V.
Tree –decomposition
R G
R G
W G R
NT
A
NT Q
B SA
SA
B
B R
Artificial Intelligence Dhanya P.M, lecturer in DCS, RASET 31
SA Q
R G
R G
W G R
NT
A
NT Q
B SA
SA
B
B R
SA Q
NS
W
G
B G
NS
SA
W
V T
R
6) Bidirectional Search