50% found this document useful (2 votes)
1K views

AI Notes

The document discusses artificial intelligence and expert systems. It defines AI, describes intelligent behavior such as perception, reasoning, learning, problem solving and more. It also discusses achievements in AI like machine translation and autonomous vehicles. Finally, it covers applications of AI like game playing, speech recognition, expert systems and more.

Uploaded by

Salini Suresh
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
50% found this document useful (2 votes)
1K views

AI Notes

The document discusses artificial intelligence and expert systems. It defines AI, describes intelligent behavior such as perception, reasoning, learning, problem solving and more. It also discusses achievements in AI like machine translation and autonomous vehicles. Finally, it covers applications of AI like game playing, speech recognition, expert systems and more.

Uploaded by

Salini Suresh
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 121

Unit 01: Artificial Intelligence and Expert system

What is Artificial Intelligence?

Definition:
Artificial Intelligence is the branch of computer science concerned with
the study of how to make computer do things which, at the moment people
do better.
Artificial Intelligence is concerned with the design of intelligence in
an artificial device.
The term was coined by McCarthy in 1956.
There are two ideas in the definition.
1. Intelligence
2. Artificial device
What is intelligence?
Accordingly there are two possibilities:
– A system with intelligence is expected to behave as intelligently as a
human
– A system with intelligence is expected to behave in the best possible
manner.
Intelligent behavior
This discussion brings us back to the question of what constitutes intelligent
behavior. Some of these tasks and applications are:
i. Perception involving image recognition and computer vision
ii. Reasoning
iii. Learning
iv. Understanding language involving natural language processing, speech
processing
v. Solving problems
vi. Robotics
Today’s AI systems have been able to achieve limited success in some of
these tasks.
• In Computer vision, the systems are capable of face recognition
• In Robotics, we have been able to make vehicles that are
mostly autonomous.

Page 1
• In Natural language processing, we have systems that are capable of
simple machine translation.
• Today’s Expert systems can carry out medical diagnosis in a narrow
domain
• Speech understanding systems are capable of recognizing several
thousand words continuous speech
• Planning and scheduling systems had been employed in
scheduling experiments .
Achievements of Artificial Intelligence:
1. ALVINN:
Autonomous Land Vehicle In a Neural Network
The system drove a car from the East Coast of USA to the west coast, a total
of about 2850 miles. Out of this about 50 miles were driven by a human,
and the rest solely by the system.
2. Deep Blue
In 1997, the Deep Blue chess program created by IBM, beat the
current world chess champion, Gary Kasparov.
3. Machine translation
A system capable of translations between people speaking different
languages
4. Autonomous agents
In space exploration, robotic space probes autonomously monitor
their surroundings, make decisions and act to achieve their goals.
NASA's Mars rovers successfully completed their primary three-month
missions in April, 2004.
5. Internet agents
The explosive growth of the internet has also led to growing interest
in internet agents to
monitor users' tasks, seek needed information, and to learn
which information is most useful.
What can AI systems NOT do yet?
• Understand natural language robustly (e.g., read and understand articles
in a newspaper)
• Surf the web
• Interpret an arbitrary visual scene
• Learn a natural language
• Construct plans in dynamic real-time domains

Page 2
• Exhibit true autonomy and intelligence
We will now look at a few famous AI system that has been developed over
the years.

****Application of Artificial Intelligence


a) Game Playing
b) Speech Recognition
c) Understanding natural language
d) Expert System
e) Robotics
f) Computer Vision
g) E-Commerce
h) Theorem proving
a) Game playing
Game playing is a search problem Defined by
– - Initial state
– Successor function
– Goal test
– Path cost / utility / payoff function
b) Theorem Proving:
Theorem proving has the property that people who do them well are considered
to be displaying intelligence.
There are two basics methods of theory proving.
Start with the given axioms, use the rules of inference and prove the theorem.
Prove that the negation of the result cannot be TRUE.
c) Natural Language Processing:
The goal of natural language processing is to enable people and computer to
communicate in a “natural “(human) language, such as a English, rather than in
a computer language.
Natural language generation, which strives to have computers produce ordinary
English language so that people can understand computers more easily.
d) Vision and Speech Processing.
The goal of speech processing research is to allow computers to understand
human speech so that they can hear our voices and recognize the words we are
speaking. The goal of computer vision research is to give computers this same
powerful facility for understanding their surroundings. Currently, one of the
primary uses of computer vision is in the area of robotics

Page 3
e) Robotics
A robot is an electro-mechanical device that can be programmed to perform
manual tasks. The Robotic Industries Association formally defines a robot as “a
reprogrammable multi-functional manipulator designed to move material,
parts, tools or specialized devices through variable programmed motions for
the performance of a variety of tasks.”
f) Expert System

An expert system is a computer program designed to act as an expert in a


particular domain (area of expertise). Also known as a knowledge-based system,
an expert system typically includes a sizable knowledge base, consisting of facts
about the domain and heuristics (rules) for applying those facts.

* History of Artificial Intelligence:


logic, which
Aristotle (384-322 BC) developed an informal system of syllogistic
is the basis of the first formal deductive reasoning system.
animalsEarly th
in the 17 century, Descartes proposed that bodies of
are nothing more than complex machines.
Pascal in 1642 made the first mechanical digital calculating machine.
representing th
In the 19 century, George Boole developed a binary algebra
(some) "laws of thought."
mechanical
Charles Babbage & Ada Byron worked on programmable
calculating machines.
 In the late 19th century and early 20th century, mathematical
philosophers like Gottlob Frege, Bertram Russell, Alfred North Whitehead,
and Kurt

Page 4
Gödel built on Boole's initial logic concepts to develop
mathematical representations of logic problems.

 In the late 19th century and early 20th century, mathematical


philosophers like Gottlob Frege, Bertram Russell, Alfred North
Whitehead, and Kurt Gödel built on Boole's initial logic concepts to
develop mathematical representations of logic problems.
In 1950 Turing wrote an article on “Computing Machinery and Intelligence”
 In 1956 a famous conference took place in Dartmouth. The
conference brought together the founding fathers of artificial intelligence
for the first time. In this meeting the term “Artificial Intelligence” was
adopted.
Computers
In 1963, Edward A. Feigenbaum & Julian Feldman published
and Thought, the first collection of articles about artificial
intelligence.
procedure,
In 1965, J. Allen Robinson invented a mechanical proof
the Resolution Method,
knowledge-based
The years from 1969 to 1979 marked the early development of
systems
In the 1980s, Lisp Machines developed and marketed.
 Around 1985, neural networks return to popularity
theoreticIn methods
1988, there was a resurgence of probabilistic and decision-

The 1990's saw major advances in all areas of AI including the following:
• machine learning, data mining
• intelligent tutoring,
• case-based reasoning,
• multi-agent planning, scheduling,
• uncertain reasoning,
• natural language understanding and translation,
• vision, virtual reality, games, and other topics.

Representation in Artificial Intelligence:


A representation is a stylized version of the world. Depending on how it is to be
used a representation can be quite simple or very complex. Suppose we were
building a program to identify objects visually as they came down an assembly
line so that they can be shunted in various directions. Let us concentrate on the
output sent by this program.

Page 5
What is an agent? Explain agents with example?

An agent is something that perceives and acts. An agent acts in an


environment .An agent perceives its environment through sensors.
The complete set of inputs at a given time is called a percept. The current
percept, or a sequence of percepts can influence the actions of an agent. The agent
can change the environment through actuators or effectors. An operation
involving an effector is called an action. Actions can be grouped into action
sequences. The agent can have goals which it tries to achieve.
Thus, an agent can be looked upon as a system that implements a mapping from
percept sequences to actions.
Examples of Agents :
An agent is something that acts in an environment - it does something. Agents
include thermostats, airplanes, robots, humans, companies, and countries. We are
interested in what an agent does; that is, how it acts. We judge an agent by its
actions.
1.Humans can be looked upon as agents. They have eyes, ears, skin, taste buds, etc.
for sensors; and hands, fingers, legs, mouth for effectors.
2.Robots are agents. Robots may have camera, sonar, infrared, bumper, etc. for
sensors. They can have grippers, wheels, lights, speakers, etc. for actuators.

PROBLEM SOLVING
The steps that are required to build a system to solve a particular problem are:

1. Problem Definition that must include precise specifications of what the


initial situation will be as well as what final situations constitute
acceptable solutions to the problem.
2. Problem Analysis, this can have immense impact on the appropriateness
of varies possible techniques for solving the problem.
3. Selection of the best technique(s) for solving the particular problem.

***Define the problem as A state Space Search:-

Consider the problem of “Playing Chess” . to build a program that could play
chess, we have to specify the starting position of the chess board, the rules that
define legal moves. And the board position that represent a win. The goal of
the winning the game, if possible, must be made explicit.

Page 6
The starting position can be described by an 8 X 8 array square in which
each element square (x,y),
(x varying from 1to 8 & y varying from1 to 8) describes the board position of an
appropriate chess coin, the goal is any board position in which the opponent
does not have a legal move and his or her “king” is under attack. The legal
moves provide the way of getting from initial state of final state.

The legal moves can be described as a set of rules consisting of two parts: A left
side that gives the current position and the right side that describes the change to
be made to the board position. An example is shown in the following figure.

Current Position Changing Board Position

While pawn at square ( file e , rank 2) Move pawn from


AND Square ( file e , rank 2) to
Square ( file e , rank 3) is empty Square (file e, rank 4).
AND
Square ( file e , rank 4) is empty
Changing Board Position

The current position of a coin on the board is its STATE and the set of all
possible STATES is STATE SPACE. One or more states where the problem
terminates is FINAL STATE or GOAL STATE . The state space representation
forms the basis of most of the AI methods.
It allows for a formal definition of the problem as the need to convert some
given situation into some desired situation using a set of permissible operations.
It permits the problem to be solved with the help of known techniques and
control strategies to move through the problem space until goal state is found.

***State Space Search Notations :


Let us begin by introducing certain terms. An initial state is the description of the
starting configuration of the agent .An action or an operator takes the agent
from one state to another state which is called a successor state. A state can have
a number of successor states.

A plan is a sequence of actions. The cost of a plan is referred to as the path cost.
The path cost is a positive number, and a common path cost may be the sum of
the costs of the steps in the path.

Page 7
Example for state space problem is water jug problem.

****Explain Water Jug Problem

Statement: - We are given 2 jugs, a 4 liter one and a 3- liter one. Neither have any
measuring markers on it. There is a pump that can be used to fill the jugs with
water. How can we get exactly 2 liters of water in to the 4-liter jug?

Solution:-

The state space for this problem can be defined as

‘i’ represents the number of liters of water in the 4-liter jug and ‘j’ represents the
number of liters of water in the 3-liter jug. The initial state is ( 0,0) that is no
water on each jug. The goal state is to get ( 2,n) for any value of ‘n’.
• The state space for this problem can be described as the set of ordered pairs
of integers (x,y) such that x = 0, 1,2, 3 or 4 and y = 0,1,2 or 3; x represents
the number of gallons of water in the 4-gallon jug and y represents the
quantity of water in 3-gallon jug
• The start state is (0,0)
• The goal state is (2,n)

(2 litre water in 4 litre jug, n means any quantity of water in 3 litre jug, since
problem doesnot specify how many litres of water in 3 litre jug.)

{ ( i ,j ) i = 0,1,2,3,4 j = 0,1,2,3}

To solve this we have to make some assumptions not mentioned in the problem.
They are
1. We can fill a jug from the pump.

2. We can pour water out of a jug to the ground.

3. We can pour water from one jug to another.

4. There is no measuring device available.

Page 8
The various operators (Production Rules) that are available to solve this
problem may be stated as given in the following figure.

Page 9
What is Production system?

In order to solve a problem:

• We must first reduce it to one for which a precise statement can be given.
This can be done by defining the problem’s state space (start and goal states)
and a set of operators for moving that space.
• The problem can then be solved by searching for a path through the
space from an initial state to a goal state.
• The process of solving the problem can usefully be modeled as a
production system.

• How to decide which rule to apply next during the process of searching for
a solution to a problem?
• The two requirements of good control strategy are that
– it should cause motion.
Page 10
– It should be systematic
Search in AI:
Another crucial general technique required when writing AI programs is search.
Often there is no direct way to find a solution to some problem. However, you do
know how to generate possibilities. For example, in solving a puzzle you might
know all the possible moves, but not the sequence that would lead to a solution.
When working out how to get somewhere you might know all the
roads/buses/trains, just not the best route to get you to your destination quickly.
Developing good ways to search through these possibilities for a good solution is
therefore vital. Brute force techniques, where you generate and try out every
possible solution may work, but are often very inefficient, as there are just too
many possibilities to try. Heuristic techniques are often better, where you only try
the options, which you think (based on your current best guess) are most likely to
lead to a good solution.

Page 11
****Search techniques in AI:

Search is the fundamental technique of AI.

Possible answers, decisions or courses of action are structured into an


abstract space, which we then search.

Search is either "blind" or “uninformed":

1.Blind search:we move through the space without worrying about what is
coming next, but recognising the answer if we see it

2.Informed search:we guess what is ahead, and use that information to


decide where to look next.

Page 12
We may want to search for the first answer that satisfies our goal, or we may want
to keep searching until we find the best answer.

Different search strategies or types:

***What is Breadth First Search?

Breadth first search is also like depth first search. Here searching progresses level
by level. Unlike depth first search, which goes deep into the tree. An operator
employed to generate all possible children of a node. Breadth first search being
the brute force search generates all the nodes for identifying the goal.

Algorithm for Breadth first search:

Page 13
Example for Breadth first search:

Page 14
Page 15
***Depth First Search:

The searching process in AI can be broadly classified into two major types. Viz.
Brute Force Search and Heuristics Search. Brute Force Search do not have any
domain specific knowledge. All they need is initial state, the final. state and a set
of legal operators. Depth-First Search is one the important technique of Brute
Force Search.

In Depth-First Search, search begins by expanding the initial node, i.e., by using
an operator, generate all successors of the initial node and test them.
Page 16
Algorithm for Depth first search:

Example for Depth first search:

Page 17
***What is Heuristic Search?
• A Heuristic is a technique that improves the efficiency of a search process,
possibly by sacrificing claims of completeness.
• Heuristics are like tour guides
• They are good to the extent that they point in generally
interesting directions;
• They are bad to the extent that they may miss points of interest to
particular individuals.
• On the average they improve the quality of the paths that are explored.
• Using Heuristics, we can hope to get good (though possibly nonoptimal )
solutions to hard problems such as a TSP in non exponential time.
• There are good general purpose heuristics that are useful in a wide variety
of problem domains.
Page 18
• Special purpose heuristics exploit domain specific knowledge

Explain Nearest Neighbor Heuristic


• It works by selecting locally superior alternative at each step.

• Applying to TSP:

1. Arbitrarily select a starting city


2. To select the next city, look at all cities not yet visited and select the
one closest to the current city. Go to next step.
3. Repeat step 2 until all cities have been visited.
– This procedure executes in time proportional to N2
– It is possible to prove an upper bound on the error it incurs. This provides
reassurance that one is not paying too high a price in accuracy for speed.

Heuristic Function

• This is a function that maps from problem state descriptions to measures


of desirability, usually represented as numbers.

– Which aspects of the problem state are considered,

– how those aspects are evaluated, and

– the weights given to individual aspects are chosen in such a way that

• The value of the heuristic function at a given node in the search process
gives as good an estimate as possible of whether that node is on the
desired path to a solution.

Well designed heuristic functions can play an important part in efficiently guiding
a search process toward a solution.

In heuristic search or informed search, heuristics are used to identify the


most promising search path.

Example Simple Heuristic functions

• Chess: The material advantage of our side over opponent.


• TSP: the sum of distances so far
• Tic-Tac-Toe: 1 for each row in which we could win and in we already have
one piece plus 2 for each such row in we have two
pieces Example of Heuristic Function
Page 19
Example1:

A heuristic function at a node n is an estimate of the optimum cost from the


current node to a goal. It is denoted by h(n).

h(n) = estimated cost of the cheapest path from node n to a goal node

Example 1: We want a path from Bengaluru to Delhi

Heuristic for Delhi may be straight-line distance between Bengaluru and Delhi

h(Bengaluru) = euclideanDistance(Bengaluru, Delhi)

**GENERATE AND TEST

This is the simplest search strategy. It consists of the following steps;

1. Generating a possible solution for some problems; this means


generating a particular point in the problem space. For others it may be
generating a path from a start state.

Page 20
Test to see if this is actually a solution by comparing the chosen point at the end
point of the chosen path to the set of acceptable goal states.

3. If a solution has been found, quit otherwise return to step 1.

The generate - and - Test algorithm is a depth first search procedure because
complete possible solutions are generated before test. This can be implemented
states are likely to appear often in a tree; it can be implemented on a search
graph rather than a tree.

***Hill Climbing

A variant of generate and test in which feedback from the test procedure is used to
help the generator decide which direction to move in the search space.

Hill climbing often used when a good heuristic function is available for
evaluating states but

Other useful knowledge is available.

Eg. Suppose you are in an unfamiliar city without a map and you want to
get down. You simply aim for the tall buildings.

Here the heuristic function is the distance between the current location and
the location of the tall buildings and the desirable states are those in which
this distance is minimized.

Simple hill climbing

Algorithm: simple hill climbing

1. Evaluate the initial state, if it is a goal state, then return it and


quit. Otherwise, continue with the initial state as the current state.
2. Loop until a solution is found or until there are no new operator left to see
applied in the current state.
Select an operator that has not yet been applied to the current state and apply it
to produce a new state.
b). Evaluate the new state
i) If it is a goal state, then return it and quit
ii) If it is not a goal state but it is better than the current state, then make it
the current state
iii) If it is not better than the current state, then continue it the loop.

Page 21
***What is Best first search?

Best first search combines the advantages of both depth first search and breadth
first search.

One way to combine the two is to follow a single path at a time, but switch path
whenever some competing path looks more promising than the current one.

At each step, we select the most promising of the nodes we have generated so far.
This is done by applying an appropriate heuristic function to each of them. We
then expand the chosen node by using the rules to generate it successors.

If one them is a solution, we can quit if not, all those new nodes are added to
the set of nodes generated so far.

Again the most promising node is selected and the process continues.

Page 22
Graphs of these types are called or graphs because each of its branches
represents an alternative problem solving path.

A is an initial node, which is expand to B,C and D. A heuristic function, say cost of
reaching the goal , is applied to each of these nodes, since D is most promising, it
is expanded next, producing two successor nodes E and F. Heuristic function is
applied to them.

Now out of the four remaining ( B,C and F) B looks more promising and hence it
is expand generating nodes G and H . Again when evaluated E appears to be the
next stop J has to be expanded giving rise to nodes I and J. In the next step J has
to be expanded, since it is more promising this process continues until a solution
is found.

To implement the procedure, we use the following two lists of nodes.

1. Open – nodes that have been generated and had the heuristic
function applied to them but which have not yet been examined.

2. Closed – nodes that have been examined.

3. We need a heuristic function that estimates the merits of each node we


generate. Let this function be f’ .

Page 23
4. It is convenient to define this function as a sum of two components g and h’
ie f’ = g + h’

5. g – is the cost of getting from the initial node to the current node.

6. h’ – estimate of the additional cost of getting from the current node to the
goal state.
7. f – Estimate of the cost of getting from the initial state to a goal state.

Algorithm for Best first search:

****Explain A* ALGORITHM

A Star algorithm:Basic Definition

A Star algorithm is a best first graph search algorithm that finds a least cost
path from a given initial node to one goal node.

Keywords used:

Functions used in the algorithm:

Evaluation Function f(n):At any node n,it estimates the sum of the cost of the
minimal cost path from start node s to node n plus the cost of a minimal cost path
from node n to a goal node.

f(n)=g(n)+h(n)
Page 24
Where g(n)=cost of the path in the search tree from s to n;

h(n)=cost of the path in the search tree from n to a goal node;

Function f*(n):At any node n,it is the actual cost of an optimal path m node s
to node n plus the cost of an optimal path from node n to a goal node.

f*(n)=g*(n)+h*(n)

Where g*(n)=cost of the optimal path in the search tree from s to n;

h*(n)=cost of the optimal path in the search tree from n to a goal node;

h*(n):It is the cost of the minimal cost path from n to a goal node and any path
from node n to a goal node that acheives h*(n)is an optimal path from n to a goal.
h is an estimate of h*.

h(n) is calculated on the heuristic information from the problem domain.

A* Algorithm
Step1: Create a single node comprising at root node

Step2: If the first member is goal node then go to step5

Step3: If it is not then remove it from the queue load it to the list of visited nodes,

Consider its child nodes if any and evaluate them with evaluation
the function.
f(n)=g(n)+h(n) and add it to the queue and reorder the states o the basi of
n s
heuristic merit.

Step4: if queue is empty then go to step6 else go to step2

Step5: Print success and stop

Step6: Print unsuccessful and stop

Page 25
****PROBLEM REDUCTION - AND - OR graphs - AO * Algorithm

When a problem can be divided into a set of sub problems, where each sub
problem can be solved separately and a combination of these will be a solution,
AND-OR graphs or AND - OR trees are used for representing the solution.

The decomposition of the problem or problem reduction generates AND arcs. One
AND are may point to any number of successor nodes. All these must be solved so
that the arc will rise to many arcs, indicating several possible solutions. Hence the
graph is known as AND - OR instead of AND. Figure shows an AND - OR graph.

An algorithm
to find a solution in an AND - OR graph must handle AND area appropriately. A*
algorithm can not search AND - OR graphs efficiently. This can be understand
from the give figure.

In figure (a) the top node A has been expanded producing two area one leading to
B and leading to C-D . the numbers at each node represent the value of f ' at that
node (cost of getting to the goal state from current state). For simplicity, it is
assumed that every operation(i.e. applying a rule) has unit cost, i.e., each are with
single successor will have a cost of 1 and each of its components.

Page 26
With the available information till now , it appears that C is the most promising
node to expand since its f ' = 3 , the lowest but going through B would be better
since to use C we must also use D' and the cost would be 9(3+4+1+1). Through
B it would be 6(5+1).

Thus the choice of the next node to expand depends not only n a value but also
on whether that node is part of the current best path form the initial mode. Figure
(b) makes this clearer.

In figure the node G appears to be the most promising node, with the least f '
value. But G is not on the current best path, since to use G we must use GH with a
cost of 9 and again this demands that arcs be used (with a cost of 27). The path
from A through B, E-F is better with a total cost of (17+1=18). Thus we can see
that to search an AND-OR graph, the following three things must be done.

1. traverse the graph starting at the initial node and following the current best
path, and accumulate the set of nodes that are on the path and have not yet
been expanded.

2. Pick one of these unexpanded nodes and expand it. Add its
successors to the graph and computer f ' (cost of the remaining
distance) for each of them.

3. Change the f ' estimate of the newly expanded node to reflect the new
information produced by its successors. Propagate this change backward
through the graph. Decide which of the current best path.

The propagation of revised cost estimation backward is in the tree is not


necessary in A* algorithm. This is because in AO* algorithm expanded nodes are
re-examined so that the current best path can be selected. The working of AO*
algorithm is illustrated in figure as follows:

Page 27
Referring the figure. The initial node is expanded and D is Marked initially as
promising node. D is expanded producing an AND arc E-F. f ' value of D is
updated to 10. Going backwards we can see that the AND arc B-C is better . it is
now marked as current best path. B and C have to be expanded next.

This process continues until a solution is found or all paths have led to dead ends,
indicating that there is no solution. An A* algorithm the path from one node to the
other is always that of the lowest cost and it is independent of the paths through
other nodes.

The algorithm for performing a heuristic search of an AND - OR graph is given


below. Unlike A* algorithm which used two lists OPEN and CLOSED, the AO*
algorithm uses a single structure G. G represents the part of the search graph
generated so far.

Each node in G points down to its immediate successors and up to its immediate
predecessors, and also has with it the value of h' cost of a path from itself to a set
of solution nodes. The cost of getting from the start nodes to the current node "g"
is not stored as in the A* algorithm.

This is because it is not possible to compute a single such value since there may
be many paths to the same state. In AO* algorithm serves as the estimate of
goodness of a node. Also a there should value called FUTILITY is used.

The estimated cost of a solution is greater than FUTILITY then the search
is abandoned as too expensive to be practical.

For representing above graphs AO* algorithm is as follows


Page 28
**** AO* ALGORITHM:

1.Initialise the graph to start node

2. Traverse the graph following the current path accumulating nodes that have
not yet been expanded or solved

3.Pick any of these nodes and expand it and if it has no successors call this value
FUTILITY otherwise calculate only f' for each of the successors.

4.If f' is 0 then mark the node as SOLVED

5.Change the value of f' for the newly created node to reflect its successors by back
propagation.

6.Wherever possible use the most promising routes and if a node is marked as
SOLVED then mark the parent node as SOLVED.

7.If starting node is SOLVED or value greater than FUTILITY, stop, else repeat
from 2.

***MEANS - ENDS ANALYSIS:-

Most of the search strategies either reason forward or backward however, often a
mixture of the two directions is appropriate. Such mixed strategy would make it
possible to solve the major parts of problem first and solve the smaller problems
that arise when combining them together. Such a technique is called "Means - Ends
Analysis".

The means -ends analysis process centers around finding the difference between
current state and goal state. The problem space of means - ends analysis has an
initial state and one or more goal state, a set of operate with a set of preconditions
their application and difference functions that computes the difference between two
state a(i) and s(j). A problem is solved using means - ends analysis by

1. Computing the current state s1 to a goal state s2 and computing their


difference D12.

2. Satisfy the preconditions for some recommended operator op is selected,


then to reduce the difference D12.

Page 29
3. The operator OP is applied if possible. If not the current state is solved a goal is
created and means- ends analysis is applied recursively to reduce the sub goal.

4. If the sub goal is solved state is restored and work resumed on the
original problem.

( the first AI program to use means - ends analysis was the GPS General problem
solver)

Example:

Assume the robot in this domain was given the problem of moving a desk with
two things on it from one room to another.

The difference between the start state and the goal state would be the location of
the desk.

To reduce this difference, either push or carry could be chosen.

Push Carry Walk Pickup Putdown Place

Move * *
object

Move *
robot

Clear *
object

Get *
object
on
object

Get * *
arm
empty

Page 30
Be *
holding
object

Operator Preconditions Results

PUSH (obj, loc) at(robot,obj) at(obj, loc)

&large (obj) & at (robot, loc)

&clear (obj) &

arm empty

CARRY (obj, loc) at(robot, obj) &Small at(obj, loc) &at(robot,


(obj) loc)

WALK(loc) none At(robot, loc)

PICKUP(obj) At(robot, obj) Holding(obj)

PUTDOWN(obj) Holding(obj) Not holding (obj)

PLACE(obj1, obj2) At(robot,obj2) & holding on(obj1, obj2)


(obj1)

Page 31
Min-Max Algorithm:

Page 32
****Mini-Max with Alpha-Beta cut off

Page 33
Alpha-Beta pruning example

********End********

Page 34
Chapter 2: Knowledge and Knowledge Representation
Definition: Knowledge can be defined as the body of facts and principles
accumulated by human kind or the act, fact or state of knowing. Also knowledge is
having a familiarity with language, concepts procedures, rules, ideas, abstractions,
places, customs, beliefs, facts and associations coupled with an ability to use these
notions effectively in modeling different aspects of the world.

Intelligence requires the possession of and access to knowledge. AI Technology


is a method that exploits knowledge.

***Properties of knowledge:
 Knowledge requires data
 Knowledge is voluminous
 It is hard to characterize accurately
 It is constantly changing
 It is differ from data by being organized in a way that corresponds to
the ways it will be used.
Certain constraints that should be kept in mind while designing AI technique to
solve any AI problem.
 Knowledge captures generalizations. i.e. Situations that share
important properties are grouped together.
 Knowledge can be understood by people who must provide it
although in most of the cases data can be acquired
automatically.
 It can be easily modified to correct errors and to reflect
changes in the world.
 It can be used in a great many situations even if it is not
totally accurate or complete.
 It can be used to help overcome its own sheer bulk by
helping to narrow the range of possibilities that must usually
be considered.

Page 35
***Types of knowledge:
1. Procedural Knowledge is a compiled knowledge related to the performance
of some task. E.g. the steps used to solve an algebraic equation are expressed
as procedural knowledge.
2. Declarative Knowledge is a passives about knowledge expressed as
statements of fact about the world. E.g. personnel data in explicit pieces of
independent knowledge.
3. Heuristic Knowledge A special type of knowledge used by humans to solve
complex problems. Heuristics are the strategies, tricks or rules of thumb
used to simplify the solution of problems. Heuristics are usually acquired
with much experience. E.g. A fault in a television set located by an
experienced technician without doing numerous voltage checks.
At this junction we must distinguish knowledge and other concepts such as belief
and hypotheses.
Belief: Belief can be defined as essentially any meaning and coherent expression
that can be represented. A belief may be true or false.
Hypothesis: Hypothesis can be defined as justified belief that is not known to be
true. Through hypothesis is a belief which is backed up with some supporting
evidence, but it may still be false. Finally, we define knowledge as true justified
belief.
Two other terms which we shall occasionally use are epistemology and Meta
knowledge.
Epistemology is the study of the nature of knowledge.
Meta knowledge is knowledge about knowledge, i.e. knowledge about what we
know.
Importance of knowledge: AI has given new meaning for knowledge. It is
possible to “Package” specialized knowledge and sell it with a system that can use
it to reason and draw conclusions. Also the system, which is untiring and being a
reliable advisor that gives high level professional advice in specialized areas, such
as
Manufacturing techniques
Sound financial strategies
Ways to improve one’s health
Marketing strategies
Optimal farming plans, etc,

Page 36
Knowledge-Based System: Knowledge- based systems depend on a rich base of
knowledge to perform difficult task where as general purpose problem solves use a
limited number of laws or axioms, which are too weak to be effective in solving
problems of any complexity.
Edward feigenbaum emphasized the fact that the real power of an expert system
comes from the knowledge it possesses. E.g. MYCIN, an expert system developed
to diagnose in factious blood diseases.
Components of knowledge – based system

I/O unit Inference-control Knowledge Base


unit
Knowledge – based systems get their power from the expert knowledge that has
been coded into facts, rules, heuristics and procedures. The knowledge is stored in
a knowledge base separate from the control and inferencing programs. This greatly
simplifies the construction and maintenance of knowledge-based systems.
***Representation of knowledge
Representation of knowledge has become one of top research priorities in AI.
Knowledge can be represented in different forms as mental images in one’s
thoughts, as spoken or written words in some language, as graphical or other
pictures, as character strings or collection of magnetic spots stored in a computer.
Different levels of knowledge Representation
Mental Images

Written Text

Character Strings

Binary Numbers

Magnetic spots
Various Knowledge Representation Schemes
 PL (Propositional Logic)
 FOPL (First Order Predicate Logic)
 Frames
 Associative Networks
 Model Logics
 Object Oriented Methods etc.
Page 37
Knowledge may vague, contradictory or incomplete. Yet we would still like to be
able to reason and make decisions. Humans do remarkably well with fuzzy,
incomplete knowledge. We would also like our AI programs to demonstrate this
versatile.
Mapping between facts and representation Facts
Internal Representation (Understanding the English) Reasoning Program
(English Generation) English Representation

Acquisition of Knowledge: One of the greatest bottlenecks in building


knowledge-rich system is the acquisition and validation of the knowledge.
Knowledge may be acquired from various sources such as experts, textbooks,
reports, technical articles; knowledge must be accurate, presented at the right level
for encoding, complete, free of inconsistencies and so on. The acquisition problem
has also stimulated much research in machine learning system that is to permit
systems to learn new knowledge automatically without the aid of humans and
continually improve the quality of knowledge they possess.

Knowledge Organization: The organization of knowledge in memory is key to


efficient processing. Knowledge-based systems may require tens of thousands of
facts and rules to perform their intended tasks. Quick access of knowledge is
achievement by having index and keywords to point knowledge groups.

Knowledge Manipulation: Decisions and actions in knowledge based systems


come from manipulation of the knowledge in specified ways. Typically, some form
of input (from a user keyboard or sensors) will initiate a search for a goal or
decision. This requires that known facts in the knowledge-base be located,
composed (matched) and possibly altered in some way. The manipulations are the
computational equivalent of reasoning. This requires a form of inference or
deduction using the knowledge and inferring rules. All forms of reasoning requires
a certain amount of computation time in AI systems, so it is important to have
techniques that limit the amount of search and matching required to complete a
task.

Page 38
Formalized Symbolic Logics

Standard Logic Symbols

Symbol Meaning

→ Implication

↔ Double Implication/Equivalence/If and only if

or Negation

˅ OR

˄ or & AND / Conjunction

˅ For all

ᴲ there exists

Logic is a formal method for reasoning, which has a sound theoretical foundation.
This is especially important in our attempts to mechanize or automate the
reasoning process in that inferences should be correct and logically sound. The
Structure of PL or FOPL must be flexible enough to permit the accurate
representation of natural language reasonably well. Many concepts which can be
verbalized can be translated into symbolic representation which closely
approximates the meaning of these concepts. These symbolic structures can then be
manipulated in programs to deduce various facts to carry out a form of automated
reasoning.

In FOPL, statements from a natural language like English are translated into
symbolic structures comprises predicates functions, variables, constants, quantifies
and logical connections. The symbols from the basic building blocks for the
knowledge and their combination into valid structures are accomplished using the
syntax (rules of combination) for FOPL. Once structures have been created to
represent basic facts or procedure or other types of knowledge inference rules may
then be applied to compare, combine and transform these “assumed” structured
into new “deduced” structures. This is how automated reasoning or inference is
performed.

Page 39
Some simple facts in propositional logic

It is raining

RAINING

It is sunny

SUNNY

It is windy

WINDY

If it is raining then it is not sunny.

RAININ → SUNN

We can conclude from the fact that it is raining the fact that is not sunny.

But we want to represent the obvious fact stated by the classical sentence.

Gandhi is a Man.

We could write the above statement as GANDHIMAN --------- PL

If we also wanted to represent

Einstein is a Man.

We will have to write something such as EISTEINMAN -------- PL

Which would be a totally separate assertion and we would not be able to draw any
conclusion about similarities between Gandhi and Einstein.

It would be much better to represent these facts as

MAN (GANDHI) - FOPL

MAN (EINSTEIN) - FOPL

Syntax and semantics of propositional logic

Valid statements or sentences in PL are determined governs to the rules of


propositional syntax. This syntax governs the combination of basic building blocks
such as propositions and logical connectives. Propositions are elementary atomic
sentences. We shall use wff (well formed formulae) in place of sentences.
Page 40
Simple Propositions:

It is raining.

Snow is white.

Compound Propositions (with logical connectives):

It is raining and the wind is blowing.

If you study hard you will be rewarded.

The sum of 10 and 20 is not 50.

We will use capital letters sometimes followed by digits to stand for propositions.
T and F are special symbols having the values true and false respectively.

E.g. To represent the compound sentence.

“It is raining and the wind is blowing.”

We could write (R ˄ B)

Where R and B stand for the propositions.

“It is raining ” and “ the wind is blowing ” respectively.

If we write

R ˅ B we mean

“It is raining or the wind is blowing or both” i,e., V indicates inclusive disjunction.
Syntax

The syntax of PL is defined recursively as follows:

T and F are formulae.

If P and Q are formulae, then the following are also formulae

Negation (~P)

And (P & Q)

Or (P V Q)

Implication (P Q)
Page 41
Equivalent (P ↔Q)

All formulae are generated from a finite number of the above operations:

An example of a compound formula is


 
((P & (~ Q V R) (Q S))

The procedure given to the connectives from highest to lowest is ~, &, V, and

Semantics
The semantics or meaning of a sentence is just the value true or false; that is, it is
an assignment of a truth value to the sentence. An interpretation a sentence or
group of semantics is an assignment of truth value to each proportional symbol.

Consider a statement

(P & ~Q)

Clearly there are four distinct interpretations for this sentence

I1 assigns true to P and true to Q.

I2 assigns true to P and false to Q.

I3 assigns false to P and true to Q.

I4 assigns false to P and false to Q.

Where I1, I2, I3 and I4 are interpretations.

Once an interpretation has been given to a statement, its truth value can be

determined. This is done by application of semantic rules to larger and layer parts

of the statement until a single truth value is determined.

Page 42
The semantic rules are summarized in the following table where “t” and “t’”

denote any true statements, “f ” and “f ‘ ”denote any false statements and “a” is

any statement.

Rule Number True Statements False Statements

1 T F

2 f t

3 t & t’ f&a

4 t˅a a&f

5 a˅t f ˅ f’

6 a→t t→f

7 f→a t→f

8 t→t’ f→t

9 f→f’

Interpretation I assigns true to P, false to Q and false to R in the statement.



((P & ~Q) R) ˅ Q
Rule 2: gives ~Q as true

Rule 3: gives (P & ~Q) as true

Page 43

Rule 6: gives (P & ~Q) R as false
Rule 5: gives the statement value as false

Properties of Statements:

Satisfiable: A statement is satisfiable if there is no interpretation for which it is


true.

Contradiction: A sentence is contradictory if there is no interpretation for which


it is true.

Valid: A sentence is valid if it is true for every interpretation. Valid sentences are
also called tautologies.

Equivalence: Two sentences are equivalent if they have the same truth value under
every interpretation.

Logical Consequences:

A sentence is a logical consequence of another if it is satisfied by all interpretation


which satisfies the first.

A valid statement is satisfiable and a contradictory statement is invalid but the


converse is not necessarily true.

E.g. P is satisfiable but not valid since an interpretation that assigns false to P
assigns false to the sentence P.

P˅ P is valid since every interpretation results in a value of true for(P ˅ P).

P & P is a contradiction since every interpretation results in a value of false for (P


& P).

P and ( P) are equivalent since each has the same truth values under every
interpretation.

P is a logical consequence of (P & Q) since any interpretation for which (P& Q ) is


true, P is also true.

The notion of logical consequence provides us with a means to perform valid


inference in PL.

Page 44
There are two theorems which give criteria for a statement to be a logical
consequence of a set of statements.

Theorem-1: The sentence s is a logical consequence of S1,…….,Sn if and only if


s1 & s2 & s3 & s4 &……………..& sn → s is valid.

Theorem-2: The sentence s is a logical consequence of s1, s2, s3,……………, sn.


If and only if s1 & s2 & s3 &…………………& sn & s is inconsistent.

Some equivalence laws:

Law Sample statement (Expressions)

Idem potency P ˅ P = P, P ˄ P = P

Associativity (P ˅ Q) ˅ R = P ˅ (Q ˅ R)

(P˄ Q) ˄ R = P ˄ (Q ˄ R)

Commutativity (P ˅ Q) = (Q ˅ P)

(P˄ Q) = (Q ˄ P)

P↔Q = Q↔P

Distributivity P ˄ (Q ˅ R) = (P ˄ Q)˅(P ˄ R)

P ˅ (Q ˄ R) = (P ˅ Q)˄(P ˅ R)

De Morgan’s (P ˅ Q) = P ˄ Q

(P ˄Q) = P˅ Q

Conditional elimination P→Q = P˅Q

Page 45
Bi conditional elimination P↔Q = ( P→ Q) ˄ (Q → P)

Truth Table for equivalent sentences

P Q P ( P˅Q) (P → Q) (Q→P) (P→Q)&(Q→P)

True True False True True True True

True False False False False True False

False True True True True False False

False False True True True True True

****Predicate Logic:
Predicate – contents of statements.

The logic based upon the analysis of predicates in any statement is called predicate
logic.

FOPL – First order predicate logic

Introduction:

FOPL was developed to extend the expressiveness of PL. It is a generalization of


the PL that permits reasoning about world objects as relational entities as well as
classes or sub classes of objects. This generalization comes from the introduction

Page 46
of predicates in place of propositions, the use of functions and the use of variables
together with quantifiers.

The syntax for FOPL like PL is determined by the allowable symbols and rules of
combinations. The semantics of FOPL are determined by interpretations assigned
to predicates rather than propositions. This means that an interpretation must also
assign values to other terms including constants, variables and functions.

Syntax of FOPL:

The symbols and rules of combination permitted in FOPL are defined as follows.

Connections , ˄,˅,→,↔

Quantifiers ᴲ (Existential Quantification)

˅ (For all) (Universal Quantification)

Constants: Fixed value terms that belong to a given domain, denoted by numbers,
words, E.g. Flight- 102, ak – 47, etc;

Variables: Terms that can assume different values over a given domain, denoted
by words.

Functions: Function symbols denotes relations defined on a domain D. They map


n elements (n >= 0) to a single element of the domain. Symbols f, g, h and words
such as father- of, age- of represent functions.

E.g. f (t1, t2,……..,tn ) where t, are terms (constants, variables or functions )


defined over some domain, n>=0.

A o-ary function is a constant.

Predicates: Predicate symbols denote relations or functions mapping from the


elements of a domain D to the values true or false. Capital letters and capitalized
words such as P, Q, R, EQUAL, GOOD, MARRIED are used to represent
predicates. Like functions predicates may have n(n>=0) terms as arguments,
written as P(t1,t2,t3,t4,………..,tn).

A O - ary predicate is a proposition that is a constant predicate.

In addition we use {,}, (,),[,].


Page 47
Example:

Represent the following statements in symbolic form:

E1: All employees earning Rs. 1, 00,000 or more per year pay taxes.

E2: Some employees are sick today.

E3: No employee earns more than the president.

Abbreviations for above statements:

E(x) for x is an employee.

P(x) for x is a president.

i(x) for the income of x.

GE (uv) for u is greater than equals to V.

S(x) for x is sick today.

T(x) for x pays taxes.

Using above abbreviations we can represent E1,E2 and E3 as.

E1’ : ˅(for all)x((E(x) & E (i(x), 100000))→T(x)

E2’ : ᴲ ((E(y) →S(y))

E3’ : ˅(for all)xy((E(x) & P((y)) → E(i(x), i(y))

E1’, E2’, E3’ are known as well-formed formulae or wffs (woofs).

Valid Examples:

MECHANIC (Arun)

ᴲ xyz : ((Father (x,y)) ˄ (FATHER (y,z))→ RANDFATHER (x,z)

Example for invalid statements:

˅(for all) P P(x) → Q(x)

In FOPL, universal quantification is not permitted to the predicate P(x)

MAN( Kunal)

Page 48
Constant should not have predicate arguments.

Predicate Logic:

Predicate - contents of statements

The Logic based upon the analysis of predicates in any statement is called
predicate logic.

Semantics of FOPL: When considering specific wffs, domain D must be


remembered. D is the set of all elements or objects from which fixed assignments
are made to constants and from which the domain and range of functions are
defined. The arguments of predicates must be terms (Constants, variables or
functions). Therefore, the domain of each n-place predicate is also defined over D.

E.g. Our Domain - All entities that make up the MCA Dept. in PESIT.

Constants - Lecturers (N P, SK , DU, CMH ……)

Staff (Sriram, Raghavendra, Shankar) books, labs, office…

Functions - lab – capacity(x)

Dept-grade average(y)

Advisor of (z)

Predicates - HOD(x)

-----------------

-------------------

Interpretation is given to wff only when values are assigned to each term and to
each predicate symbol. If the truth values of two different wffs are same under
every interpretation they are said to be equivalent. A predicate (or wff) that has no
variable is called a ground atom.

Predicates that have variable arguments will be determined to true only if they are
true for the appropriate values of the variables.

E.g. P(x) in ˅(for all) x:P(x) is true only if it is true for every value of x in the
domain D.
Page 49
P(x) in ᴲx: P(x) is true only if it true for at least one value of x in the domain D.

e.g. E: ˅(for all) x((A(a,x) ˅ B(f(x))) ˄ C(x)) →D(x) .

Here A, B, C, D are predicates

a is a constant

x is a variable.

Here E is quantified with the universal quantifier ˅(for all) x. It will evaluate to
true only if it evaluates to true for all x in the domain D.

D= {1,2}

a=2 , f(1) =2, f(2)= 1

A(2,1)= true , A(2,2) = false

B(1) = true, B(2) = false

C(1) = true, C(2) = false

D(1) = false, D(2) = true

Interpretation I for x=1 from D.

If x=1,

A(2,1) – true B(2) - false

(A(2,1) ˅ B(2)) – true

C(1) – true

Outer parenthesis evaluates to true

D(1) – false

Therefore, E – false i.e. , the statement E is false.

Interpretation I for x=2 from D will also evaluate the statement E to false.

Page 50
Representation of simple facts as a set of wffs in predicate Logic:

1. Marcus was a man.


MAN (Marcus)
2. Marcus was a Pompeian
POMPEIAN (Marcus)
3. All Pompeians were Romans
˅ (for all) x: POMPEIAN (x) → ROMAN(x)
4. Caesar was a Ruler.

5. All Romans were either Loyal to caesar hated him.

˅ (for all)x: Roman (x, Caesar)˅ Hate(x, caesar)

Or
˅ (for all)x: Roman (x)→[(Loyalto(x, Caesar )˅ Hate(x,
caesar)) ˄ (Loyal to (x, Caesar )˄Hate (x,Caesar)

6. Everyone is Loyal to someone

˅ (for all) x: ᴲy : Loyal to (x, y)


ᴲy: ˅ (for all) x: Loyal to (x,y)/there exists someone to whom
everyone is loyal to)

7. People only try to assassinate rules they are not loyal to

˅ (for all)x: ˅(for all)y: Person (x)˄Ruler(y)˄Try to


Assassinate (x,y) → Loyal to(x,y)

8. Marcus tried to Assassinate Caesar Try to Assassinate Caesar


Try to assassinate (Marcus, Caesar)

From 7 and 8

Was Marcus Loyal to Caesar?

Loyal to (Marcus, Caesar)

Page 51
Statements in Symbolic form:

Something is good ᴲ(x) ( (x))

Everything is good ˅ (for all) (x) (G(x)) Nothing is good


˅ (for all)(x) ( G(x)) Something is not good ᴲ(x) ( G(x))
Note: Symbols or can be used for negation

All true –none false

(˅ (for all) x(P(x)) ↔ (ᴲ x) ( P(x))

All false – None true

(˅ (for all) x ( P(x)) ↔ (ᴲ x) ( P(x))

Not all true – At least one false

(˅ (for all) x (P(x)) ↔ (ᴲ x) ( P(x))

Not all false – At least one true

(˅ (for all) x ( P(x)) ↔ (ᴲ x) ( P(x))

Rules for quantification:

To negate a statement covered by one quantifier, change the quantifier from


universal to existential or from existential to universal and negate the statement
which it quantifies.

Statement Its negation

(˅(for all) x) (P(x)) (ᴲx)( P(x))

(ᴲ(x)) (P(x)) (˅(for all) x) ( P(x))

Consider the following four statements:

1. All Monkeys has a tail.


2. No Monkeys have tails.
3. Some Monkeys have tails.
4. Some Monkeys have no tails.

Page 52
If the universe for the statement “All Monkeys have tails ” consists only of
Monkeys then this statement is merely.

(˅(for all) x)(P(x)), where P(x): x has a tail.

However, if the universe consists of objects some of which are not monkeys, a
further refinement is necessary.

Let M(x): x is a Monkey.

P(x) : x has a tail.

“All Monkeys have tails” makes no statement about objects in the universe, which
are Monkeys? If the object is a monkey then it has or does not have a tail, the
statement is false, otherwise it is true.

The statement (1) can be rephrased as follows:

“For all x, if x is a Monkey, then x has a tail” and it can be written as ((˅(for all)
x) [M(x) →P(x)].

The statement (2) means “for all x if x is a Monkey, then x has no tail” and it can
be written as (˅ (for all) x)[M(x) → P(x)]

The statement (3) means “there is an x such that x is a Monkey and x has a tail”
and can be written as (ᴲx) [M(x) ˄ P(x)]

The statement (4) means “there is an x such that x is a Monkey” and can be written
as (ᴲx) [M(x) ˄ P(x)]

Statement Symbolic Form

All Monkeys have tails (˅ (for all) x) [M(x) → P(x)]

No monkey has a tail (˅(for all) x)[M(x)→ P(x)]

Some Monkeys has a tail (ᴲx)[M(x) ˄ P(x)]

Some Monkeys have no tails (ᴲx) [M(x) ˄ P(x)]

Page 53
****Write the following sentences in symbolic form:

a. Some people who trust others one rewarded.


b. If anyone is good then Jhon is good.
c. He is ambitious or no one is ambitious.
d. Someone is teasing.
e. It is not true that all roads lead to Rome.

Solution:

Let P(x) : x is a person.

T(x) : x trusts others.

R(x) : x is rewarded.

G(x) : x is good.

A(x) : x is ambitious.

Q(x) : x is teasing.

S(x) : x is a road.

L(x) : x leads to Rome.

Then

a. Some People who trust others one rewarded.


Can be rephrased as
“There is one x such that x is a person, x trusts others and x is
rewarded.” Symbolic form: (ᴲx) [P(x) ˄ T(x) ˄ R(x)]
b. If anyone is good, then Jhon is good, then Jhon is good can be worded as.
“If there is one x such that x is a person and x is good, then Jhon is good”.
Symbolic form: (ᴲx) [(P(x) ˄ (x))] → (John).
c. ‘He’ represents a particular person. Let that person be y. so, that statement is
‘ ’ is ambitious or for all x, if x is a person then x is not ambitious.

Symbolic Form: (˅ (for all) x): (ᴲy): A(y) ˅ [P(x) → A(x)]

d. ‘Some one is teasing’ can be written as “Then is one x such that x is a person
and x is teasing”.
Symbolic form: (ᴲx) [P(x) ˄ Q(x)]

Page 54
e. The statement can be written as (˅ (for all) x)[s(x) → L(x)] or (ᴲ(x))[s(x)
˄ L(x)]

Associative Networks

In a huge Knowledge Base (KB), storage of voluminous and complicated


information, comprehension, use and maintenance of the knowledge can
become difficult. In such cases some form of knowledge structuring and
organization becomes a necessity. Real world problem domains typically
involve a number and variety of different objects interacting with each other in
different ways. The object themselves may require extensive characterizations,
and their interaction relationships with each other objects may be very complex.

Network representations provide a means of structuring the knowledge. In a


network, pieces of knowledge are clustered together into coherent semantic
groups. Network representations give a pictorial presentation of object, their
attributes and the relationships that exist between them and other entities.

Association networks are depicted as directed graphs with labeled nodes and
arcs or arrows. The language used in constructing a network is based on
selected domain primitives for objects and relations as well as some general
primitives.

Here, a class of objects known as bird is depicted. The class has some
properties and a specific member of the class named tweety is shown. The color
of tweety is seemed to be yellow. Associative networks were introduced by quilt
ion in the year 1968 to model the semantics of English sentences and words.

Quillian’s model of semantic networks has a certain intuitive appeal in that


related information is clustered and bound together through a relation links the
knowledge required for the performance of some task is typically contained
within a narrow domain or semantic vicinity of the task. This type of
Page 55
organization in some way resembles the way knowledge is stored and retrieved
in humans. The graphical portrayal of knowledge can also be somewhat more
expensive than other representation schemes. They have been used in variety of
systems such as natural language understanding, information retrieval deductive
databases, learning systems, computer vision and speech generation systems.

Syntax and Semantics of Associative Networks:

There is neither generally accepted syntax nor semantics for associative


networks. Most network systems are based on PL or FOPL with extensions. The
syntax for any system is determined by the object and relation primitives
chosen and by any special rules used to connect nodes. Basically the language
of associative networks is formed from letters of the alphabet both upper and
lower case, relational symbols, set membership and subset symbols, decimal
digits, square and oval nodes, directed arcs of arbitrary length. The word
symbols used are those which represent object constants and n-ary relation
constants. Nodes are commonly used for objects or nouns, arcs for relations.
The direction of an arc is usually taken from the first to subsequent arguments
as they appear in a relational statement.

Thus, OWNS (anand, house) would be written as

A number of arc relations have become common among users. They include as
ISA, MEMBER-OF, SUBSET-OF, AKO (a-kind of), HAS-PARTS,
INSTANCE-OF, AGENT, and ATTRIBUTES, SHARED-LIKE and so forth.
Less common arcs have also been used to express modality relations (time,
manner, and mood), linguistics case relations (theme, source, and goal), logical
connectives, quantifiers, set relations, attributes and quantification (ordinal,
count).

The ISA link is most often used to represent the fact that an object is of a certain
type. The ISA predictive has been used to exhibit the following types of
structures:

Page 56
***GENERIC- GENERIC RELATIONSHIPS

Subset- Superset (fighting ships- battleships)

Generalization- Specialization (restaurant – fast foods)

AKO (an elephant is a kind of mammal)

Conceptual containment (a triangle is a polygon)

GENERIC- INDIVIDUAL RELATIONSHIPS

Set membership (Clyde is a camel)

Prediction (Predicate application to individual as in BROWN (camel))

Conceptual containment (King and the king of England)

Abstraction (The “eagle” in “the eagle is an endangered species”)

Associative network structures permit the implementation of property


inheritance, a form of influence. Nodes which are member or subsets of other
nodes may inherit properties from their higher level ancestor nodes.

The semantics of associative networks are sometimes defined along the some
lines as that of traditional logics. In fact, some network system definitions
provide a means of mapping to and from PL or FOPL expressions. For these
systems, the semantics are based on interpretations. Thus, an interpretation
satisfies a portion of network if and only if all are relations hold in the given
portion.

Syntactic inference in networks can also be defined using parallels to traditional


logics such as unification, changing, modus ponens and even resolution.

Conceptual Graphs

Conceptual graphs the primitive building blocks for associative networks,


which may become de facts standard in the future. A conceptual graph is a
graphical portrayal of a mental perception which consists of basic or primitive
concepts and the relationships that exists between the concepts. A single
conceptual graph is roughly equivalent sentence where the words are depicted
as concepts and relationships.

E.g. “Joe is having soup with a spoon”


Page 57
In the above diagram, concepts are enclosed in boxes and relations between the
concepts are enclosed in ovals. The direction of the arrow corresponds to the
order of the arguments in the relation they connect. Concept symbols refer to
entities, actions, properties or events in the world. A concept may be individual
or generic. Individual or generic. Individual concepts have a type field followed
by a referent field. [PERSON: Joe] Referents, like joe and food

****Truth Maintenance System (TMS)

A truth maintenance system (TMS) is a means of providing the ability to do


dependency – directed back tracking and thus to support non-monotonic
reasoning.

A TMS allows assertions to be connected via a network of dependencies.

Justification-based Truth Maintenance System (JTMS) we refer it as TMS only.

A truth maintenance system maintains consistency in knowledge representation of


a knowledge base.

The following of TMS are to

. Provide justification for conclusions

. Recognize inconsistencies

. Support default reasoning

Provide justification for conclusions

When a problem solving system gives an answer to a user’s query, an explanation


of the answer is required

. Recognize inconsistencies

The inference engine(IE) may tell the TMS may some sentences are contradictory.

Then TMS may find that all those sentences are believed true, and reports to the
IE which can eliminate the inconsistencies by determining the assumptions used
and changing them appropriately.

Eg. A statement that either x,y or z is guilty together with other statements that x is
not guilty, y is not guilty, and z is not guilty form a contradiction.

Page 58
Support default reasoning

In the absence of any firm knowledge, in many situations we want to reason


form default assumptions.

Statistical reasoning

In the logical based approaches described, we have assumed that every thing
is either believed false or believed true.

However, it is often useful to represent the fact that we believe such that
something is probably true, or true with probability.

This is useful for dealing with problems where there is randomness and
unpredictability(such as in games of choice) and also for dealing with problems
where we could, if we had sufficient information, work out exactly what is true.

To do all this in a practical way require techniques for probabilistic reasoning.

Probability

The basic approach statistical methods adopt to deal with uncertainty is via
the axioms of probability:

Probabilities are (real) numbers in the range 0 to 1.

A probability of P(A) = 0 indicates total uncertainty in A, P(A) = 1 total certainty


and values in between some degree of (un)certainty.

Probabilities can be calculated in a number of ways.

Probability = (number of desired outcomes) / (total number of outcomes)

So given a pack of playing cards the probability of being dealt an ace from a full
normal deck is 4 (the number of aces) / 52 (number of cards in deck) which is 1/13.

Probability and Baye’s theorem

In many problem solving systems we collect evidence as the system proceeds and
modify the behavior on the basis of the evidence. To model this behavior we need
a statistical theory and Bayesian theory is one.

The fundamental notation of Bayesian statistics is that of conditional probability:

P(Hi\E)=P(E\Hi)P(Hi)™
Page 59
--------------- P(E\Hn)P(Hn) [for n=1 to k]

Let P(Hi/E) = the probability that hypothesis Hi is true given evidence E

P(E\Hi) = the probability we observe evidence E given hypothesis Hi is true

P(Hi)= the priori probability that hypothesis Hi is true in the absence of


any specific evidence.

K = the number of possible hypothesis

****FUZZY LOGIC

In fuzzy logic, we consider what happens if we make fundamental changes to


our idea of set membership and corresponding changes to our definitions of
logical operations.

While traditional set-theory defines set membership as a Boolean predicate.

fuzzy set theory allows us to represent set membership as a possibility


distribution such as tall-very for the set of tall people and the set of very
tall people.

This contrasts with the standard Boolean definition for tall people where one is
either tall or not and there must be a specific height that defines the boundary. The
same is true for very tall. In fuzzy logic, one’s tallness increases with one’s height
until the value 1 is reached. So it is a distribution.

Once set membership has been redefined in this way, it is possible to define a
reasoning system based on techniques for combining distributions.

The motivation for fuzzy sets is provided by the need to represent


propositions such as:

John is very tall

Mary is slightly tall

Most Frenchmen are not very tall

Sue and linda are close friends

Page 60
***Structured Representation of Knowledge

Representing knowledge using logical formalism, like predicate logic, has


several advantages. They can be combined with powerful inference mechanisms
like resolution, which makes reasoning with facts easy.

But using logical formalism complex structures of the world, objects and their
relationships, events, sequences of events etc. can not be described easily.

A good system for the representation of structured knowledge in a


particular domain should posses the following four properties:

(i) Representational Adequacy:- The ability to represent all kinds of


knowledge that are needed in that domain.

(ii) Inferential Adequacy :- The ability to manipulate the


represented structure and infer new structures.

(iii) Inferential Efficiency:- The ability to incorporate additional


information into the knowledge structure that will aid the inference
mechanisms.

(iv) Acquisitional Efficiency :- The ability to acquire new


information easily, either by direct insertion or by program
control.

The techniques that have been developed in AI systems to accomplish


these objectives fall under two categories:

1. Declarative Methods:- In these knowledge is represented as static


collection of facts which are manipulated by general procedures. Here the
facts need to be stored only one and they can be used in any number of
ways. Facts can be easily added to declarative systems without changing
the general procedures.

2. Procedural Method:- In these knowledge is represented as procedures.


Default reasoning and probabilistic reasoning are examples of procedural
methods. In these, heuristic knowledge of “How to do things efficiently
“can be easily represented.

In practice most of the knowledge representation employ a combination of


both. Most of the knowledge representation structures have been developed to
handle programs that handle natural language input. One of the reasons that
knowledge structures are so important is that they provide a way to represent
information about commonly occurring patterns of things.
Page 61
such descriptions are some times called schema. One definition of schema is
“Schema refers to an active organization of the past reactions, or of past
experience, which must always be supposed to be operating in any well
adapted organic response”.

By using schemas, people as well as programs can exploit the fact that the real
world is not random. There are several types of schemas that have proved useful
in AI programs. They include

(i) Frames:- Used to describe a collection of attributes that a given


object possesses (eg: description of a chair).

(ii) Scripts:- Used to describe common sequence of events


(eg:- a restaurant scene).

(iii) Stereotypes :- Used to described characteristics of people.

(iv) Rule models:- Used to describe common features shared among


a set of rules in a production system.

Frames and scripts are used very extensively in a variety of AI programs. Before
selecting any specific knowledge representation structure, the following issues
have to be considered.

(i)The basis properties of objects , if any, which are common to


every problem domain must be
identified and handled appropriately.

ii) The entire knowledge should be represented as a good set of primitives.

(iii) Mechanisms must be devised to access relevant parts in a


large knowledge base.

All these structures share a common notion that complex entities can be describe
as a collection of attributes and associated values (hence they are often called “slot-
and –filter structures”) ie., these structures have the form of ordered triples

OBJECTS x ATTRIBUTES x VALUE

Information can be retrieved from the knowledge base by an associative


search with VALUE.

Page 62
****Conceptual Dependency (CD)

This representation is used in natural language processing in order to represent


them earning of the sentences in such a way that inference we can be made
from the sentences.

It is independent of the language in which the sentences were originally stated.


CD representations of a sentence is built out of primitives , which are not words
belonging to the language but are conceptual , these primitives are combined to
form the meaning s of the words. As an example consider the event represented by
the sentence.

In the above

Representation the symbols have the following meaning:

Arrows indicate direction of dependency

Double arrow indicates two may link between actor and the action

P indicates past tense

ATRANS is one of the primitive acts used by the theory . it indicates transfer of
possession

0 indicates the object case relation

R indicates the recipient case relation

Conceptual dependency provides a structure in which knowledge can be


represented and also a set of building blocks from which representations can
be built. A typical set of primitive actions are

ATRANS - Transfer of an abstract relationship(Eg: give)


PTRANS - Transfer of the physical location of an object(Eg: go)
PROPEL - Application of physical force to an object (Eg: push)

Page 63
MOVE - Movement of a body part by its owner (eg : kick)
GRASP - Grasping of an object by an actor(Eg: throw)
INGEST - Ingesting of an object by an animal (Eg: eat)
EXPEL - Expulsion of something from the body of an animal (cry)
MTRANS - Transfer of mental information(Eg: tell)
MBUILD - Building new information out of old(Eg: decide)
SPEAK - Production of sounds(Eg: say)
ATTEND - Focusing of sense organ toward a stimulus (Eg: listen)

A second set of building block is the set of allowable dependencies among


the conceptualization describe in a sentence.

Page 64
Unit III-PLANNING

What is planning?

The planning problem in Artificial Intelligence is about the decision making


performed by intelligent creatures like robots, humans, or computer programs when
trying to achieve some goal. It involves choosing a sequence of actions that will
transform the state of the world, step by step, so that it will satisfy the goal.

What does planning involve?

• Planning problems are hard problems:


• They are certainly non-trivial[important].
• Solutions involve many aspects that we have studied so far:
• Search and problem solving strategies.
• Knowledge Representation schemes.
• Problem decomposition -- breaking problem into smaller pieces and
trying to solve these first.

We have seen that it is possible to solve a problem by considering the


appropriate form of knowledge representation and using algorithms to solve
parts of the problem and also to use searching methods.

Page 65
***Blocks World Planning Examples

What is the Blocks World? -- The world consists of:

A flat surface such as a tabletop

An adequate set of identical blocks which are identified by letters.

The blocks can be stacked one on one to form towers of apparently


unlimited height.

The stacking is achieved using a robot arm which has fundamental operations and
states which can be assessed using logic and combined using logical operations.

The robot can hold one block at a time and only one block can be moved at a time.

We shall use the four actions:

UNSTACK(A,B)
pick up clear block A from block B;
STACK(A,B)
place block A using the arm onto clear block B;
PICKUP(A)
lift clear block A with the empty arm;
PUTDOWN(A)
place the held block A onto a free space on the table.

Page 66
and the five predicates:
ON(A,B)
block A is on block B.
ONTABLE(A)
block A is on the table.
CLEAR(A)
block A has nothing on it.
HOLDING(A)
the arm holds block A.
ARMEMPTY
the arm holds nothing
Using logic but not logical notation we can say that
 If the arm is holding a block it is not empty
 If block A is on the table it is not on any other block
 If block A is on block B,block B is not clear.

Why Use the Blocks world as an example?


 The blocks world is chosen because:
 it is sufficiently simple and well behaved.
 easily understood
 yet still provides a good sample environment to study planning:
 problems can be broken into nearly distinct subproblems

 we can show how partial solutions need to be combined to form a realistic


complete solution.

Planning System Components


Simple problem solving tasks basically involve the following tasks:
 Choose the best rule based upon heuristics.
 Apply this rule to create a new state.
 Detect when a solution is found.

 Detect dead ends so that they can be


avoided. More complex problem solvers often
add a fifth task:
 Detect when a nearly solved state occurs and use special methods to make it a
solved state.
 Now let us look at what AI techniques are generally used in each of the
above tasks. We will then look a t specific methods of implementation.

Page 67
i. Choice of best rule

ii. Rule application

iii. Detecting Progress

i.Choice of best rule

Methods used involve

 finding
then
the differences between the current states and the goal states and

 choosing the rules that reduce these differences most effectively.


 Means end analysis good example of this.

 the first thing to do is to fill up the car with fuel.


 If we do not have a car then we need to acquire one.
 The largest difference must be tackled first.

ii.Rule application
 Previously rules could be applied without any difficulty as complete
systems were specified and rules enabled the system to progress from one
state to the next.
 Now we must be able to handle rules which only cover parts of systems.
 A number of approaches to this task have been used.

STRIPS:

STRIPS proposed another approach:


Basically each operator has three lists of predicates associated with it:
 a list of things that become TRUE called ADD.
 a list of things that become FALSE called DELETE.

 aapplied.
set of prerequisites that must be true before the operator can be

 Anything not in these lists is assumed to be unaffected by the operation.

 This method initial implementation of STRIPS -- has been extended to


include other forms of reasoning/planning (e.g. Nonmonotonic methods,
Goal Stack Planning and even Nonlinear planning -- see later)

Page 68
 Consider the following example in the Blocks World and the fundamental
operations:

STACK

 Requires the arm to be holding a block A and the other block B to be clear.
Afterwards the block A is on block B and the arm is empty and these are
true ADD; The arm is not holding a block and block B is not clear;
predicates that are false DELETE;

UNSTACK

 Requires that the block A is on block B; that the arm is empty and that block
A is clear. Afterwards block B is clear and the arm is holding block A ADD;
The arm is not empty and the block A is not on block B DELETE;

 We have now greatly reduced the information that needs to be held. If a new
attribute is introduced we do not need to add new axioms for existing
operators. Unlike in Green's method we remove the state indicator and use a
database of predicates to indicate the current state
 Thus if the last state was:
 ONTABLE(B) ON(A,B) CLEAR(A)

 after the unstack operation the new state is

 ONTABLE(B) CLEAR(B) HOLDING(A) CLEAR(A)

Detecting Progress

The final solution can be detected if we can devise a predicate that is true when
the solution is found and is false otherwise. Requires a great deal of thought and
requires a proof.

Detecting false trails is also necessary:

E.g. A* search -- if insufficient progress is made then this trail is aborted in


favour of a more hopeful one.

 Sometimes it is clear that solving a problem one way has reduced the
problem to parts that are harder than the original state.

Page 69
 By moving back from the goal state to the initial state it is possible to detect
conflicts and any trail or path that involves a conflict can be pruned out.

 Reducing the number of possible paths means that there are more resources
available for those left.

Supposing that the computer teacher is ill at a school there are two possible
alternatives transfer a teacher from mathematics who knows computing or
bring another one in.

Possible Problems:

If the math’s teacher is the only teacher of maths the problem is not solved.

If there is no money left the second solution could be impossible.

*****Goal Stack Planning

Basic Idea to handle interactive compound goals uses goal stacks, Here the
stack contains :

goals, operators ADD, DELETE and PREREQUISITE lists a database


maintaining the current situation for each operator used.

Consider the following where wish to proceed from the start to goal state.

We can describe the start state:

ON(B, A) ONTABLE(A) ONTABLE(C) ONTABLE(D) ARMEMPTY


and goal state:

ON(C, A) ON(B,D) ONTABLE(A) ONTABLE(D)

Initially the goal stack is the goal state.

Page 70
We then split the problem into four subproblems

Two are solved as they already are true in the initial state -- ONTABLE(A),
ONTABLE(D).

With the other two -- there are two ways to proceed:

1. ON(C,A)
2.
3. ON(B,D)
4.
5. ON(C,A) ON(B,D)
6.
7. ONTABLE(A)
8. ONTABLE(D)
9.
10.
11. ON(B,D)
12.
13. ON(C,A)
14. ON(C,A) ON(B,D)
15.
16. ONTABLE(A)
17. ONTABLE(D)
18.
19.
The method is to
Investigate the first node on the stack ie the top goal.

If a sequence of operators is found that satisfies this goal it is removed


and the next goal is attempted.

This continues until the goal state is empty.

The new goal stack becomes;

CLEAR(D)

HOLDING(B)

Page 71
CLEAR(D) HOLDING(B)

STACK (B, D)

ONTABLE(C) CLEAR(C) ARMEMPTY

PICKUP(C)

At this point the top goal is true and the next and thus the combined
goal leading to the application of STACK (B,D), which means that the
world model becomes

ONTABLE(A) ONTABLE(C) ONTABLE(D) ON(B,D) ARMEMPTY

This means that we can perform PICKUP(C) and then STACK (C,A)

Now coming to the goal ON(B,D) we realise that this has already been
achieved and checking the final goal we derive the following plan

1. UNSTACK(B,A)
2. STACK (B,D)
3. PICKUP(C)
4. STACK (C,A)
This method produces a plan using good Artificial Intelligence techniques such as
heuristics to find matching goals and the A* algorithm to detect unpromising paths
which can be discarded.

Page 72
*****Sussman Anomaly

Above method may fail to give a good solution. Consider:

The start state is given by:

ON(C, A) ONTABLE(A) ONTABLE(B) ARMEMPTY

The goal by:

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

This immediately leads to two approaches as given below

1. ON(A,B)
2. ON(B,C)
3.
4. ON(A,B) ON(B,C)
5.
6.
7. ON(B,C)
8. ON(A,B)
9.
10. ON(A,B) ON(B,C)
11.
12.
Choosing path 1 and trying to get block A on block B leads to the goal stack:
13. ON(C,A)
14. CLEAR(C)
15.
16. ARMEMPTY

Page 73
17.
18. ON(C,A) CLEAR(C) ARMEMPTY
19.
20. UNSTACK(C,A)
21.
22. ARMEMPTY
23.

CLEAR(A) ARMEMPTY

PICKUP(A)

CLEAR(B) HOLDING(A)

STACK(A,B)

ON(B,C)

ON(A,B) ON(B,C)
This achieves block A on block B which was produced by putting block C on
the table.
The sequence of operators is

1. UNSTACK(C,A)
2. PUTDOWN(C)
3. PICKUP(A)
4. STACK (A,B)
Working on the next goal of ON(B,C) requires block B to be cleared so that it can
be stacked on block C. Unfortunately we need to unstack block A which we just
did. Thus the list of operators becomes
1. UNSTACK(C,A)
2. PUTDOWN(C)
3. PICKUP(A)
4. STACK (A,B)
5. UNSTACK(A,B)
6. PUTDOWN(A)
7. PICKUP(B)
Page 74
8. STACK (B,C)

To get to the state that block A is not on block B two extra operations are needed:

1. PICKUP(A)

STACK(A,B)

Analyzing this sequence we observe that

Steps 4 and 5 are opposites and therefore cancel each other out,

Steps 3 and 6 are opposites and therefore cancel each other out as
well. So a more efficient scheme is:

1. UNSTACK(C,A)
2. PUTDOWN(C)
3. PICKUP(B)
4. STACK (B,C)
5. PICKUP(A)
6. STACK(A,B)

Page 75
Nonlinear Planning Using Constraint Posting

Let us reconsider the SUSSMAN ANOMALY

Problems such as this one require subproblems to be worked on simultaneously.

Thus a nonlinear plan using heuristics such as:

 Try to achieve ON(A,B) clearing block A putting block C on the


table.
 Achieve ON(B,C) by stacking block B on block C.
 Complete ON(A,B) by stacking block A on block B.

 suggesting operators,
 trying to order them, and

 produce bindings between variables in the operators and actual blocks.


The initial plan consists of no steps and by studying the goal state ideas for
the possible steps are generated.
There is no order or detail at this stage.
Gradually more detail is introduced and constraints about the order of subsets
of the steps are introduced until a completely ordered sequence is created.

In this problem means-end analysis suggests two steps with end conditions
ON(A,B) and ON(B,C) which indicates the operator STACK giving the layout
shown below where the operator is preceded by its preconditions and followed by
its post conditions:
CLEAR(B)

CLEAR(C)

*HOLDING(A) *HOLDING(B)

__________________ __________________

STACK(A,B) STACK(B,C)

Page 76
__________________ __________________

ARMEMPTY ARMEMPTY

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

~CLEAR(B) ~ CLEAR(C)

~ HOLDING(A) ~HOLDING(B)
NOTE:
 There is no order at this stage.
 Unachieved preconditions are starred (*).

 Both of the HOLDING preconditions are unachieved since the arm holds
nothing in the initial state.
 Delete postconditions are marked by (~ ).
Many planning methods have introduced heuristics to achieve goals
or preconditions.

****Hierarchical Planning
In order to solve hard problem, a problem solver may have to generate long
plans. In order to do that efficiently, it is important to be able to eliminate some
of the details of the problem until a solution that addresses the main issue is
found. Then an attempt can be made to fill in the appropriate details.

Early attempt to do this involved the use of macro operators, in which large
operators were built from smaller ones. But in this approach no details
were eliminated from the actual descriptions of the operators.

A better approach was developed in the ABSTRIPS system, which actually


planned in a hierarchy of abstraction spaces, in each of which preconditions at
a lower level of abstraction were ignored.
As an example suppose you want to visit a friend in Europe but you have a
limited amount of cash to spend. It makes sense to check air fares first, since
finding an affordable flight will be the most efficient part of the task.
You should not worry about getting out of your driveway, planning a route to the
airport, or parking your car ..

Page 77
The ABSTRIPS approach to problem solving is as follows: First solve the problem
completely, considering only preconditions whose criticality value is the highest
possible.

Because this process explores entire plans at one level of detail before it looks at
the lower level details of any one of them, it has been called length-first search.

***Perception
We perceive our environment through many channels: sight, sound, touch, smell,
taste. Many animals processes these same perceptual capabilities , and others
also able to monitor entirely different channels.

Robots, too, can process visual and auditory information, and they can also
equipped with more exotic sensors. Such as laser rangefinders, speedometers
and radar.

Two extremely important sensory channels for human are vision and spoken
language. It is through these two faculties that we gather almost all of the
knowledge that drives our problem-solving behaviors.

Vision: Accurate machine vision opens up a new realm of computer applications.


These applications include mobile robot navigation, complex manufacturing
tasks analysis of satellite images, and medical image processing.

The question is that how we can transform raw camera images into
useful information about the world.
A Video Camera provides a computer with an image represented as a two-
dimensional grid of intensity levels. Each grid element, or pixel, may store a
single bit of information (that is , black/white) or many bits(perhaps a real-valued
intensity measure and color information).
A visual image is composed of thousands of pixels. What kinds of things might
we want to do with such an image? Here are four operations, in order of
increasing complexity:
1. Signal Processing:- Enhancing the image, either for human consumption
or as input to another program.

Page 78
2. Measurement Analysis:- For images containing a single object,
determining the two-dimensional extent of the object depicted.
3 Pattern Recognition:- For single – object images, classifying the object
into a category drawn from a finite set of possibilities.

4. image Understanding :- For images containing many objects, locating


the object in the image, classifying them, and building a three-
dimensional model of the scene.
There are algorithms that perform the first two operations. The third operation,
pattern recognition varies in its difficulty. It is possible to classify two-dimensional
(2-D) objects, such as machine parts coming down a conveyor belt, but classifying
3-D objects is harder because of the large number of possible orientations for each
object.

Image understanding is the most difficult visual task, and it has been the
subject of the most study in AI. While some aspects of image understanding reduce
to measurement analysis and pattern recognition, the entire problem remains
unsolved , because of difficulties that include the following:

1. An image is two-dimensional; while the world is three-dimensional


some information is necessarily lost when an image is created.

2. One image may contain several objects, and some objects may partially
occlude others.

3. The value of a single pixel is affected by many different phenomena,


including the color of the object, the source of the light , the angle and
distance of the camera, the pollution in the air, etc. it is hard to disentangle
these effects.

As a result, 2-D images are highly ambiguous. Given a single image, we could
construct any number of 3-D worlds that would give rise to the image . it is
impossible to decide what 3-D solid it should portray. In order to determine the most
likely interpretation of a scene , we have to apply several types of knowledge.

****Robot Architecture

Page 79
Now let us turn what happen when we put it all together-perception, cognition,
and action.
There are many decisions involved in designing an architecture that integrates
all these capabilities, among them:
 What range of tasks is supported by the architecture?
 What type of environment(e.g. indoor, outdoor, space) is supported?
 How are complex behaviors turned into sequence of low-level action?
 Is control centralized or distributed
 How are numeric and symbolic representations merged
 How does the architecture represent the state of the world?
 How quickly can the architecture react to changes in the environment?
 How does the architecture decide to plan and when to act?

1.The input to an AI program is symbolic in form (example : a typed English


sentence), whereas the input to a robot is typically an analog signal ,such as a
two dimensional video image or a speech wave form.
2. Robots require special hardware for perceiving and affecting the
world, while AI programs require only general-purpose computers.

3. Robot sensors are inaccurate, and their effectors are limited in precision.

4. many robots must react in real time. A robot fighter plane, for example,
cannot afford to search optimally or o stop monitoring the world during a
LISP garbage collection.

Page 80
5. the real world is unpredictable, dynamic, and uncertain. A root cannot
hope to maintain a correct and complete description of the world. This
means that a robot must consider the trade-off between devising and
executing plans. This trade-off has several aspects.

For one thing a robot may not possess enough information about the world for it
to do any useful planning. In that case, it must first engage in information
gathering activity . furthermore, once it begins executing a plan, the robot must
continually the results of its actions. If the results are unexpected, then re-planning
may be necessary.

6. Because robots must operate in the real world, searching and back tracking
can be costly.
Recent years have seen efforts to integrate research in robotics and AI. The old
idea of simply sensors and effectors to existing AI programs has given way to a
serious rethinking of basic AI algorithms in light of the problems involved in
dealing with the physical world.

Research in robotics is likewise affected by AI techniques , since reasoning about


goals and plans is essential for mapping perceptions onto appropriate actions.

*****Waltz Algorithm.

CONSTRAINT SATISFACTION – WALTZ ALGORIHTM

Many perceptual tasks appear to be highly complex. ttis is because the number of
interpretations that can be assigned to individual components of an input is large
and the number of combinations of those components also appears to be enormous.
But a clear analysis well reveal that many do the combinations cannot actually
occur. These natural constraints can be exploited in the understanding process to
reduce the complexity from unmanageable to manageable.

There are two important steps in the use of constraints in problem solving:

1. Analyze the problem domain to determine the actual constraints.

2. Solve the problem by applying a constraint satisfaction algorithm.

Consider for example a three dimensional line drawing . The analysis process is to
determine the object described by the lines. The geometric relationships between

Page 81
different types of line junctions helped to determine the object

types.

Three Dimentioal Polyhedral junction types.

In waltz’s algorithm, labels are assigned to lines of various types-say concave


edges are produced by two adjacent toching surfaces which duce a concave (less
than 180 Degrees) depth change .

Conversely, convex edges produce a convexly viewed depth (greater than 180
degrees), and a boundary edge outlines a surface that obstracts other objects.

To label a concave edge, a mints sign is used. Convex edges one labeled with a
plus sign, and a right or left arrow is used to label the boundary edges. By
restricting vertices to be the intersection of three object faces, it is possible to
reduce the number of basic vertex types to only four : the L, the T , the Fork and
the Arrow.

The L types Fork Types T types

Page 82
Valid junction labels for three-dimensional shapes.

When a three-dimensional object is viewed from all possible positions, the four
junction types, together with the valid edge labels, give rise to eighteen different
permissible junction configurations as shown in figure.

Geometric constraints, together with a consistent labeling scheme, can simplify the
object identification process. A set of labeling rules which facilitates this process
can be developed for different classes of objects. The following rules will apply for
many polyhedral objects.

1. The arrow should be directed to mark boundaries by traversing the object in


a clockwise direction.

2. Unbroken lines should have the same label assigned at both ends.

3. When a fork is labeled with a+ edge, it must have all three edges label as +, and

4. Arrow junctions which have a


label on the shaft.

These rules can be applied to a polygonal object as given in figure

example of object labeling.

Starting with any edge having an object face on its right, the external boundary is

_ consistent with the ot

her labeling rules.


Page 83
To see how waltz constraint satisfaction algorithm works, consider the image dr

awing of a pyramid as given in figure3 At the right side of the pyramid are all po

ssible labelings for the four u\junctions A, b, C and

D.

Using these labels as mutual constraints on connected junctions, permissible labels


for the whole pyramid can be determined. The constraint satisfaction procedure
works as follows.

Starting at an arbitrary junction, say A, a record of all permissible labels is made

for that junction. An adjacent junction is then chosen, say , B and labels which are

inconsistent with the line AB are then eliminated from the p

ermissible A and B lists. In this case, the line joining B can only be a +, - or an up

arrow

A labelings can be eliminated and the remainin

g are

Page 84
Choosing junction c next, we find that t

he BC constraints are

satisfied by all of the B and C lableings, so on reduction

is possible with this step. On the otherhand, the line AC must be labled as – or as
an up-

left-
eliminated to reduce the remainder to the following.

This new restriction on a now permit the elimination of one B leabeling to


maintain consistency. Thus, the permissible B leabelings remaining are now

This reduction in turn, places a new restriction on BC, permitting the elimination
of one C label, since BC must now be labeled as a + only. This leaves the
remaining C labels as show in side diagram.

4. Moving now to junction d, we see that of the six possible D leadings, only
three satisfy the BD constraint of a up or a down arrow. Therefore, the
remaining

Page 85
permissible leabelings.

continuing with the above procedure, we see that further label eliminations are not
possible since all constraints have been satisfied. This process is completed by
finding the different combinations of unique labeling that can be assigned to the
figure. An enumerations of the remaining label shows that it is possible to find only
three different labeling.

***Texture:
Texture is one of the most important attributes used in image analysis and pattern
recognition. It provides surface characteristics for the analysis of many types of
images including natural scenes, remotely sensed data, and biomedical
modalities and plays an important role in the human visual system for
recognition and interpretation.
• Although there is no formal definition for texture, intuitively this
descriptor provides measures of properties such as smoothness, coarseness,
and regularity.
• Texture is one of the most important image characteristics to be found
almost anywhere in nature. It can be used to segment images into distinct
object or regions. The classification and recognition of different surfaces is
often based on texture properties.

Different types of textures.


1. Natural textures
2. Artificial textures
3. Regular textures
4. Computer vision is the science and technology of machines that see.
5. Concerned with the theory for building artificial systems that
obtain information from images.
6. The image data can take many forms, such as a video sequence, depth
images, views from multiple cameras, or multi-dimensional data from
a medical scanner

***Computer Vision:

Page 86
• Computer vision is the science and technology of machines that see.
• Concerned with the theory for building artificial systems that
obtain information from images.
• The image data can take many forms, such as a video sequence, depth
images, views from multiple cameras, or multi-dimensional data from
a medical scanner.

Page 87
Unit IV-LEARNING

Learning is the improvement of performance with experience over time.

Learning element is the portion of a learning AI system that decides how to modify
the performance element and implements those modifications.
We all learn new knowledge through different methods, depending on the type of
material to be learned, the amount of relevant knowledge we already possess,
and the environment in which the learning takes place.
***There are five methods of learning. They are,
1. Memorization (rote learning)
2. Direct instruction (by being told)
3. Analogy
4. Induction
5. Deduction

Learning by memorizations is the simplest from of learning. It requires the least


amount of inference and is accomplished by simply copying the knowledge in
the same form that it will be used directly into the knowledge base. Example:-
Memorizing multiplication tables, formulate , etc.

Direct instruction is a complex form of learning. This type of learning requires


more inference than role learning since the knowledge must be transformed into an
operational form before

learning when a teacher presents a number of facts directly to us in a


well organized manner.
Analogical learning is the process of learning a new concept or solution through
the use of similar known concepts or solutions. We use this type of learning when
solving problems on an exam where previously learned examples serve as a
guide or when make frequent use of analogical learning.

This form of learning requires still more inferring than either of the
previous forms. Since difficult transformations must be made between the
known and unknown situations.

Page 88
Learning by induction is also one that is used frequently by humans. it is a
powerful form of learning like analogical learning which also require s more
inferring than the first two methods. This learning requires the use of inductive
inference, a form of invalid but useful inference.

We use inductive learning of instances of examples of the concept. For example


we learn the
Concepts of color or sweet taste after experiencing the sensations associated
with several examples of colored objects or sweet foods.

Deductive learning is accomplished through a sequence of deductive


inference steps using known facts. From the known facts, new facts or
relationships are logically derived. Deductive learning usually requires more
inference than the other methods.

Matching and Learning.

MATCHING:So far, we have seen the process of using search to solve problems as
the application of appropriate rules to individual problem states to generate new
states to which the rules can then be applied, and so forth, until a solution is found.

Clever search involves choosing from among the rules that can be applied at a
particular point, the ones that are most likely to lead to a solution. We need to
extract from the entire collection of rules, those that can be applied at a given
point. To do so requires some kind of matching between the current state and the
preconditions of the rules.

How should this be done?


One way to select applicable rules is to do a simple search through all the rules
comparing one’s preconditions to the current state and extracting all the ones that
match. This requires indexing of all the rules. But there are two problems with
these simple solutions:

A. It requires the use of a large number of rules. Scanning through all of


them would be hopelessly inefficient.
B. It is not always immediately obvious whether a rule’s preconditions are
satisfied by a particular state.

Page 89
Sometimes , instead of searching through the rules, we can use the current state
as an index into the rules and select the matching ones immediately. In spite of
limitations, indexing in some form is very important in the efficient operation of
rules based systems.

A more complex matching is required when the preconditions of rule specify


required properties that are not stated explicitly in the description of the
current state. In this case, a separate set of rules must be used to describe how
some properties can be inferred from others.

An even more complex matching process is required if rules should be applied


and if their pre condition approximately match the current situation. This is often
the case in situations involving physical descriptions of the world.

****Expert systems

There is a class of computer programs, known as expert systems, that aim to


mimic human reasoning. The methods and techniques used to build these
programs are the outcome of efforts in a field of computer science known as
Artificial Intelligence (AI).

Expert systems have been built to diagnose disease (Pathfinder is an expert


system that assists surgical pathologists with the diagnosis of lymph-node
diseases, aid in the design chemical syntheses (Example), prospect for mineral
deposits (PROSPECTOR), translate natural languages, and solve complex
mathematical problems(MACSYMA).

Features
An expert system is a computer program, with a set of rules encapsulating
knowledge about a particular problem domain (i.e., medicine, chemistry,
finance, flight, et cetera). These rules prescribe actions to take when certain
conditions hold, and define the effect of the action on deductions or data.

The expert system, seemingly, uses reasoning capabilities to reach conclusions or to


perform analytical tasks. Expert systems that record the knowledge needed to

Page 90
solve a problem as a collection of rules stored in a knowledge-base are called
rule-based systems.

Utility of Expert Systems(case study)

One of the early applications, MYCIN, was created to help physicians


diagnose and treat bacterial infections. Expert systems have been used to
analyze geophysical data in our search for petroleum and metal deposits (e.g.,
PROSPECTOR). They are used by the investments, banking, and
telecommunications industries.

They are essential in robotics, natural language processing, theorem proving, and
the intelligent retrieval of information from databases. They are used in many
other human accomplishments which might be considered more practical.

Rule-based systems have been used to monitor and control traffic, to aid in
the development of flight systems, and by the federal government to prepare
budgets.

Advantages of Rule-Based Systems

A rule-based, expert system maintains a separation between its Knowledge-base


and that part of the system that executes rules, often referred to as the expert
system shell.

The expert system shell can be applied to many different problem domains with
little or no change. It also means that adding or modifying rules to an expert
system can effect changes in program behavior without affecting the
controlling component, the system shell.

Changes to the Knowledge-base can be made easily by subject matter experts


without programmer intervention, thereby reducing the cost of software
maintenance and helping to ensure that changes are made in the way they
were intended.

Page 91
Rules are added to the knowledge-base by subject matter experts using text or
graphical editors that are integral to the system shell. The simple process by
which rules are added to the knowledge-base is depicted in Figure 1.

Finally, the expert system never forgets, can store and retrieve more knowledge
than any single human being can remember, and makes no errors, provided the
rules created by the subject matter experts accurately model the problem at hand.

****Expert System Architecture

An expert system is, typically, composed of two major components, the


Knowledge-base and the Expert System Shell. The Knowledge-base is a
collection of rules encoded as metadata in a file system, or more often in
a relational database.

The Expert System Shell is a problem-independent component housing


facilities for creating, editing, and executing rules. A software architecture for
an expert system is illustrated in Figure 2.

Page 92
The shell
portion includes software modules whose purpose it is to,

 Process
modules;
requests for service from system users and application layer

 Support
experts;
the creation and modification of business rules by subject matter

 Translate business rules, created by a subject matter experts, into machine-


readable forms;
 Execute business rules; and

 Provide low-level support to expert system components (e.g., retrieve


metadata from and save metadata to knowledge base, build Abstract Syntax
Trees during rule translation of business rules, etc.).
Client Interface

 The Client Interface processes requests for service from system-users


and from application layer components. Client Interface logic routes
these requests to an appropriate shell program unit.

 For example, when a subject matter expert wishes to create or edit a rule,
they use the Client Interface to dispatch the Knowledge-base Editor. Other
service requests might schedule a rule, or a group of rules, for execution
by the Rule Engine.

Knowledge Base Editor

 The Knowledge-base Editor is a simple text editor, a graphical editor, or


some hybrid of these two types. It provides facilities that enable a
subject matter expert to compose and add rules to the Knowledge-base.

Page 93
Rule Translator

 Rules, as they are composed by subject matter experts, are not directly
executable. They must first be converted from their human-readable form
into a form that can be interpreted by the Rule Engine. Converting rules
from one form to another is a function performed by the Rule Translator.

 Once created, AST (Abstract Syntax Tree, an Abstract data


type)representations are converted into rule metadata and stored in the
Knowledge-base. Rule metadata is simply a compact representation
of ASTs. The role of the Rule Translator in the rule editing process.

Rule Engine

 The Rule Engine (often referred to as an inference engine in AI literature) is


responsible for executing Knowledge-base rules. It retrieves rules from the
Knowledge-base, converts them to ASTs, and then provides them to its rule
interpreter for execution.

 The Rule Engine interpreter traverses the AST, executing actions specified in
the rule along the way.

Rule Object Classes

The shell component, Rule Object Classes, is a container for object classes
supporting,
 Rule editing; AST construction;
 Conversion of ASTs to rule metadata;
 Conversion of rule metadata to ASTs; and
 Knowledge-base operations (query, update, insert, delete).

Page 94
***Inductive learning:

Inductive learning is an inherently conjectural process because any knowledge


created by generalization from specific facts cannot be proven true; it can only
be proven false. Hence, inductive inference is falsity preserving, not truth
preserving.
• To generalize beyond the specific training examples, we need
constraints or biases on what f is best. That is, learning can be
viewed as searching the Hypothesis Space H of possible f functions.
• A bias allows us to choose one f over another one
• A completely unbiased inductive algorithm could only memorize the
training examples and could not say anything more about other unseen
examples.
• Two types of biases are commonly used in machine learning:
Restricted Hypothesis Space Bias Allow only certain types of f functions, not
arbitrary ones
Preference Bias Define a metric for comparing fs so as to determine
whether one is better than another .

Inductive Learning Framework


• Raw input data from sensors are preprocessed to obtain a feature vector, x,
that adequately describes all of the relevant features for classifying
examples.
• Each x is a list of (attribute, value) pairs. For example,
x = (Person = Sue, Eye-Color = Brown, Age = Young, Sex = Female)
The number of attributes (also called features) is fixed (positive, finite).
Each attribute has a fixed, finite number of possible values.
Each example can be interpreted as a point in an n-dimensional feature
space, where n is the number of attributes.

***Artificial neural network


An artificial neural network is a network of simple processing nodes, which
is roughly modeled on the human brain.
The human brain is a massively parallel computation device, which achieves
its power through the enormous connectivity between its neurons.
Each neuron is a very simple device that can either fire or not fire, but by
combining billions of these neurons together, the brain is able to achieve levels of
complexity as yet unattainable by machines.
The word artificial is often used to describe neural networks to differentiate them
from the biological neural networks that make up the human brain, we shall simply
Page 95
refer to them as neural networks because it should be clear from the context
which type of network we are referring to.
Neural networks consist of a number of nodes, each of which can be thought of
as representing a neuron. Typically, these neurons are arranged into layers, and
the neurons from one layer are connected to the neurons in the two layers on
either side of it.
Typically, the network is arranged such that one layer is the input layer, which
receives inputs that are to be classified. These inputs cause some of the neurons in
the input layer to fire, and these neurons in turn pass signals to the neurons to
which they are connected, some of which also fire, and so on.
In this way, a complex pattern of firings is arranged throughout the network, with
the final result being that some neurons in the final output layer fire. The
connections between neurons are weighted, and by modifying these weights, the
neural network can be arranged to perform extremely complex classification
tasks such as handwriting analysis and face recognition.
Neural networks have a number of advantages over other learning methods.
Many of these advantages derive from features of the human brain. For example,
neural networks are extremely robust, both to errors in any training data and to
damage that may be caused to the network itself.

Perceptron:
This consists of a single neuron with multiple inputs and a single output. It has
restricted information processing capability. The information processing is done
through a transfer function which is either linear or non-linear.
Multi-layered Perceptron (MLP):
It has a layered architecture consisting of input, hidden and output layers. Each
layer consists of a number of perceptrons. The output of each layer is transmitted
to the input of nodes in other layers through weighted links. Usually, this
transmission is done only to nodes of the next layer, leading to what are known
as feed forward networks. MLPs were proposed to extend the limited information
processing capabilities of simple percptrons, and are highly versatile in terms of
their approximation ability. Training or weight adaptation is done in MLPs using
supervised backpropagation learning.

Recurrent Neural Networks: RNN topology involves backward links from


output to the input and hidden layers. The notion of time is encoded in the RNN

Page 96
information processing scheme. They are thus used in applications like
speech processing where inputs are time sequences data.
Self-Organizing Maps: SOMs or Kohonen networks have a grid topology, wit
unequal grid weights. The topology of the grid provides a low dimensional
visualization of the data distribution. These are thus used in applications which
typically involve organization and human browsing of a large volume of data.
Learning is performed using a winner take all strategy in a unsupervised mode.
Applications of Neural Networks
Neural networks have broad applicability to real world business problems. They
have already been successfully applied in many industries.
Since neural networks are best at identifying patterns or trends in data, they
are well suited for prediction or forecasting needs including:
• sales forecasting
• industrial process control
• customer research
• data validation
• risk management
• target marketing
Because of their adaptive and non-linear nature they have also been used in a
number of control system application domains like,
• process control in chemical plants
• unmanned vehicles
• robotics
• consumer electronics
Neural networks are also used a number of other applications which are too hard
to model using classical techniques. These include, computer vision, path planning
and user modeling.

Page 97
Page 98
Page 99
Page 100
Unit-V
Natural Language Processing (NLP):
What is Natural Language Processing (NLP)
• The process of computer analysis of input provided in a human
language (natural language), and conversion of this input into a useful
form of representation.
• The field of NLP is primarily concerned with getting computers to perform
useful and interesting tasks with human languages.
• The field of NLP is secondarily concerned with helping us come to a better
understanding of human language.

Forms of Natural Language


The input/output of a NLP system can be:
written text
speech
We will mostly concerned with written text (not speech).
To process written text, we need:
lexical, syntactic, semantic knowledge about the
language discourse information, real world knowledge
To process spoken language, we need everything required to process written
text, plus the challenges of speech recognition and speech synthesis.
Components of NLP
Natural Language Understanding
Mapping the given input in the natural language into a useful representation.
Different level of analysis required:
morphological analysis,
syntactic analysis,
semantic analysis,
discourse analysis, …
Natural Language Generation
Producing output in the natural language from some internal representation.
Different level of synthesis required:
deep planning (what to say),
syntactic generation
NL Understanding is much harder than NL Generation. But, still both
of them are hard.
Why NL Understanding is hard?

Page 101
Natural language is extremely rich in form and structure, and very
ambiguous. How to represent meaning,
Which structures map to which meaning structures.
One input can mean many different things. Ambiguity can be at different levels.
Lexical (word level) ambiguity -- different meanings of words
Syntactic ambiguity -- different ways to parse the sentence
Interpreting partial information -- how to interpret pronouns
Contextual information -- context of the sentence may affect the meaning of that
sentence.
Many input can mean the same thing.
Interaction among components of the input is not clear.

NLP Terminology
Phonology – concerns how words are related to the sounds that realize them.
Morphology – concerns how words are constructed from more basic meaning
units called morphemes. A morpheme is the primitive unit of meaning in a
language.
Syntax – concerns how can be put together to form correct sentences and
determines what structural role each word plays in the sentence and what phrases
are subparts of other phrases.
Semantics – concerns what words mean and how these meaning combine in
sentences to form sentence meaning. The study of context-independent
meaning.
Pragmatics – concerns how sentences are used in different situations and how
use affects the interpretation of the sentence.
Discourse – concerns how the immediately preceding sentences affect the
interpretation of the next sentence. For example, interpreting pronouns and
interpreting the temporal aspects of the information.
World Knowledge – includes general knowledge about the world. What each
language user must know about the other’s beliefs and goals.

Natural Language Understanding:

Page 102
Natural Language Generation:

Page 103
Page 104
Page 105
Page 106
Page 107
Page 108
The black cat crossed the road.

Page 109
Page 110
Page 111
Page 112
Page 113
Page 114
Page 115
Page 116
Page 117

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy