Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Problem Solving:
Strong AI aims to build machines that can truly reason and
solve problems. These machines should be self aware and their
overall intellectual ability needs to be indistinguishable from
that of a human being. Excessive optimism in the 1950s and
1960s concerning strong AI has given way to an appreciation of
the extreme difficulty of the problem. Strong AI maintains that
suitably programmed machines are capable of cognitive mental
states.
Weak AI: deals with the creation of some form of computerbased artificial intelligence that cannot truly reason and solve
problems, but can act as if it were intelligent. Weak AI holds that
suitably programmed machines can simulate human cognition.
Applied AI: Aims to produce commercially viable "smart"
systems such as, for example, a security system that is able to
recognize the faces of people who are permitted to enter a
particular building. Applied AI has already enjoyed considerable
success.
Cognitive AI: computers are used to test theories about how the
human mind works--for example, theories about how we
recognize faces and other objects, or about how we solve
abstract problems.
Best First Search: Best First search, which is a way of
combining the advantages of both depth-first and breadth-firstsearch into a single method.
One way of combining the two is to follow a single path
at a time, but switch paths whenever some competing path looks
more promising than the current one does.
Page 3
Page 4
Step4
Step5
A
D
B
AO* algorithm:
1. Place the starting node s on open
2. Using the search tree constructed thus far, compute the
most promising solution tree To.
3. Select a node n that is both on open and a part of To.
Remove n from open and place it on closed.
4. If n is a terminal goal node, label n as solved. If the
solution of n results in any of ns ancestors being solved,
label all the ancestors as solved. If the start node s is
solved, exit with success where To is the solution tree.
Remove from open all nodes with a solved ancestor.
5. If n is not a solvable node (operators cannot be applied),
label n as unsolvable. If the start node is labeled as
unsolvable, exist with failure. If any of ns ancestors
become unsolvable because n is, label them unsolvable as
Page 8
Page 11
Mini-max search: The mini-max search procedure is a depthlimited search procedure. The idea is to start at the current
position and use the plausible-move generator to generate the set
of possible successor positions. Now we can apply the static
evaluation function to those positions and simply choose the
best one.
The starting position is exactly as good for us as the position
generated by the best move we can make next. Here we assume
that the static evaluation function returns large values to indicate
good situations for us, so our goal is to maximize the value of
the static evaluation function of the next board position.
An example of this operation is shown in fig1. It assumes a
static evaluation function that returns values ranging from -10 to
10, with 10 indicating a win for us, -10 a win for the opponent,
and 0 an even match. Since our goal is to maximize the value of
the heuristic function, we choose to move to B. backing Bs
value up to A, we can conclude that As value is 8, since we
know we can move to a position with a value of 8.
A
B(8)
C
Page 12
(8)
(3)
(-2)
E
(9)
(-6) (0)
(0)
I
JJJJ F
Heuristic function
A heuristic function, or simply a heuristic, is a function that
ranks alternatives in various search algorithms at each branching
step based on the available information (heuristically) in order to
make a decision about which branch to follow during a search.
Shortest paths
For example, for shortest path problems, a heuristic is a
function, h(n) defined on the nodes of a search tree, which
serves as an estimate of the cost of the cheapest path from that
node to the goal node. Heuristics are used by informed search
algorithms such as Greedy best-first search and A* to choose the
best node to explore. Greedy best-first search will choose the
node that has the lowest value for the heuristic function. A*
search will expand nodes that have the lowest value for g(n) +
h(n), where g(n) is the (exact) cost of the path from the initial
state to the current node. If h(n) is admissiblethat is, if h(n)
Page 14
Page 15
If H(n) is consistent then the value of H(n) for each node along a
path to goal node are non decreasing.
Page 22
Page 24
Constraint programming
Constraint programming is the use of constraints as a
programming language to encode and solve problems. This is
often done by embedding constraints into a programming
language, which is called the host language. Constraint
programming originated from a formalization of equalities of
terms in Prolog II, leading to a general framework for
embedding constraints into a logic programming language. The
most common host languages are Prolog, C++, and Java, but
other languages have been used as well.
Constraint logic programming
A constraint logic program is a logic program that contains
constraints in the bodies of clauses. As an example, the clause
A(X):-X>0,B(X) is a clause containing the constraint X>0 in the
body. Constraints can also be present in the goal. The constraints
in the goal and in the clauses used to prove the goal are
accumulated into a set called constraint store. This set contains
the constraints the interpreter has assumed satisfiable in order to
proceed in the evaluation. As a result, if this set is detected un
satisfiable, the interpreter backtracks. Equations of terms, as
used in logic programming, are considered a particular form of
Page 25
Page 26
as many ply from the current position as it can search in the time
available. Except for the case of "pathological" game trees [1]
(which seem to be quite rare in practice), increasing the search
depth (i.e., the number of ply searched) generally improves the
chance of picking the best move.
Two-person games can also be represented as and-or trees. For
the first player to win a game there must exist a winning move
for all moves of the second player. This is represented in the
and-or tree by using disjunction to represent the first player's
alternative moves and using conjunction to represent all of the
second player's moves.
Solving Game Trees
second player can follow that will guarantee either a win or tie.
The algorithm can be described recursively as follows.
1. Color the final ply of the game tree so that all wins for
player 1 are colored one way, all wins for player 2 are
colored another way, and all ties are colored a third
way.
2. Look at the next ply up. If there exists a node colored
opposite as the current player, color this node for that
player as well. If all immediately lower nodes are
colored for the same player, color this node for the
same player as well. Otherwise, color this node a tie.
3. Repeat for each ply, moving upwards, until all nodes
are colored. The color of the root node will determine
the nature of the game.
The diagram shows a game tree for an arbitrary game, colored
using the above algorithm.
It is usually possible to solve a game (in this technical sense of
"solve") using only a subset of the game tree, since in many
games a move need not be analyzed if there is another move that
is better for the same player (for example alpha-beta pruning can
be used in many deterministic games).
Any sub tree that can be used to solve the game is known as a
decision tree, and the sizes of decision trees of various shapes
are used as measures of game complexity.
Page 31
Page 32
Unit-2
Knowledge Representation
Introduction to Knowledge Representation (KR)
We argue that the notion can best be understood in terms of
five distinct roles it plays, each crucial to the task at hand:
A knowledge representation (KR) is most fundamentally a
surrogate, a substitute for the thing itself, used to enable
an entity to determine consequences by thinking rather
than acting, i.e., by reasoning about the world rather than
taking action in it
It is a set of ontological commitments, i.e., an answer to
the question: In what terms should I think about the
world?
It is a fragmentary theory of intelligent reasoning,
expressed in terms of three components: (i) the
representations fundamental conception of intelligent
Page 33
about objects
True or false
In predicate logic each atom
is a predicate
propositional
Page 35
apples
and relations:
likes(john, apples)
Functions transform
objects:
of variables
X. likes(X,
Page 36
For all X
if (X is a rose)
then there exists Y
order
also objects
having zero at 17
Condition A might be
THIS.YEAR.SALES>LAST.YEAR.SALES
Because the list of goals determines which rules are selected and
used, this method is called goal-driven, in contrast to data-driven
forward-chaining inference. The backward chaining approach is
often employed by expert systems.
Page 41
CD primitive action
1. ATRANS
2. PTRANS
(e.g. go)
3. PROPEL
(e.g. throw)
4. MOVE
the animal
5. GRASP
hold)
Page 42
Explanation
transfer of abstract relationship(e,g, give)
transfer of physical location of an object
application of physical force of an object
movement of a body part of an animal by
grasping of an object by an actor (e.g.
6. INGEST
Taking of an object by an animal to the
inside of that a
animal (e.g. Drink.eat)
7. EXPEL
Expulsion of an object from inside the body
by an animal to the world (e.g. spit)
8. MTRANS
Transfer of mental information between
animals or within an animal (e.g. tell)
9. MBUILD
Construction of a new information from an
old information (e.g. decide).
10. SPEAK
3. LOCs: Locations
Every action takes place at some locations and serves as
source and destination.
4. Ts: Times
An action can take place at a particular location at a given
specified time. The time can be represented on an absolute scale
or relative scale.
5. AAs: Action aiders
These serve as modifiers of actions, the actor PROPEL has a
speed factor associated with it which is an action aider.
6. PAs: Picture Aides
Page 43
Page 44
Page 45
Semantic Nets: The main idea behind semantic nets is that the
meaning of a concept comes from the ways in which it is
connected to other concepts. In a semantic net, information is
represented as a set of nodes connected to each other by a set of
labeled arcs, which represent relationship among the nodes. A
fragment of a typical semantic net is shown in fig.
Mammal
Isa
Person
Has-port
Nose
Instance
UniformColor
Blue
team
Pee-wee-Reese
Brooklyn- Dodgers
Could be rewritten as
Instance (Marcus, Man)
Thereby making it easy to represent in a semantic net.
3. Partitioned semantic Nets. Suppose we want to represent
simple quantified expression in semantic nets. One way to do
this is to partition the semantic net into a hierarchical set of
spaces, each of which corresponds to the scope of one or more
variables. To see how this works, consider first the simple net
shown in fig. this net corresponds to the statement.
The dog bit the mail carrier.
The nodes Dogs, Bite, and Mail-Carrier represents the classes of
dogs, biting, and mail carriers, respectively, while the nodes d,b,
and m represent a particular dog, a particular biting, and a
particular mail carrier. This fact can be easily be represented by
a single net with no portioning.
But now suppose that we want to represent the fact
Every dog has bitten a mail carrier.
Or, in logic:
X: dog(x)
y: Mail-carrier(y) bite(x, y)
Dogs
Mailcarrier
Bite
Isa
Isa
isa
Assailant
victim
Person
Isa:
Mammal
Cardinality:
6,000,000,000
*handed:
Right
Adult-Male
Isa:
person
Cardinality
2,000,000,000
*height:
5-10
ML-Baseball-Player
Isa:
adult-male
Cardinality:
624
*height:
6-1
*bats:
equal to handed
*batting-average: .252
*team:
*uniform-color:
Fielder
Isa:
ML-baseball-player
Cardinality:
376
*batting-average: .262
Page 50
Pee-Wee-Reese
Instance:
fielder
Height:
5-10
Bats:
right
Batting-average: .309
Team:
Brooklyn-Dodgers
Uniform-color:
Blue
ML-Baseball-Team
Isa:
Team
Cardinality:
26
*team-size:
24
*manager:
Brooklyn-dodgers
Instance:
ML-Baseball-Team
Team-size:
24
Manager:
Leo-Durocher
Players:
(Pee-Wee-Reese)
are interpreted must follow the rules given below, and they are
called wffs (well-formed formulas) of the first order predicate
logic.
Rules for constructing Wffs
A predicate name followed by a list of variables such as P(x, y),
where P is a predicate name, and x and y are variables, is called
an atomic formula.
Wffs are constructed using the following rules:
1. True and False are wffs.
2. Each propositional constant (i.e. specific proposition), and
each propositional variable (i.e. a variable representing
propositions) are wffs.
3. Each atomic formula (i.e. a specific predicate with
variables) is a wff.
4. If A, B, and C are wffs, then so are A, (A B), (A B), (A
B), and (A B).
5. If x is a variable (representing objects of the universe of
discourse), and A is a wff, then so are x A and x A .
6. For example, "The capital of Virginia is Richmond." is a
specific proposition. Hence it is a wff by Rule 2.
Let B be a predicate name representing "being blue" and let
x be a variable. Then B(x) is an atomic formula meaning "x
is blue". Thus it is a wff by Rule 3. above. By applying
Page 52
Unit-3
Handling Uncertainty and learning
Fuzzy Logic: In the techniques we have not modified the
mathematical underpinnings provided by set theory and logic.
We have instead augmented those ideas with additional
constructs provided by probability theory. We take a different
approach and briefly consider what happens if we make
fundamental changes to our idea of set membership and
corresponding changes to our definitions of logical operations.
The motivation for fuzzy sets is provided by the need
to represent such propositions as:
John is very tall.
Mary is slightly ill.
Sue and Linda are close friends.
Exceptions to the rule are nearly impossible.
Most Frenchmen are not very tall.
While traditional set theory defines set membership as a
Boolean predicate, fuzzy set theory allows us to represent set
membership as a possibility distribution.
Page 54
{A, B, C,}
{A, B, D}
{A, C, D}
{B, C, D}
{A, B} {A, C,} {B, C,} {B, D} {A, C,} {C, D} {B, D} {C, D}
{A}
{B}
{C}
{D}
{O}
Fig Lattice of subsets of the universe U.
Page 57
Bayes Theorem: An important goal for many problemsolving systems is to collect evidence as the system goes along
and to modify its behavior on the basis of evidence. To model
this behavior, we need a statistical theory of evidence. Bayesian
statistics is such a theory. The fundamental notion of. Bayesian
statistics is that of conditional probability;
P (H/ E)
231
Page 58
Environment
Examples
Or Teacher
Feedback u
Learner
Component
Page 63
Knowledge
Base
Critic
performance
Evaluator
Response
Performance
Component
Tasks
Fig. Learning Model
Page 64
Feedback
Learning
Algorithms
Training
Scenario
Page 65
resultant
Representation
scheme
Overview
In order to solve a given problem of supervised learning, one has
to perform the following steps:
1. Determine the type of training examples. Before doing
anything else, the engineer should decide what kind of data
is to be used as an example. For instance, this might be a
single handwritten character, an entire handwritten word, or
an entire line of handwriting.
2. Gather a training set. The training set needs to be
representative of the real-world use of the function. Thus, a
set of input objects is gathered and corresponding outputs
are also gathered, either from human experts or from
measurements.
3. Determine the input feature representation of the learned
function. The accuracy of the learned function depends
strongly on how the input object is represented. Typically,
the input object is transformed into a feature vector, which
contains a number of features that are descriptive of the
object. The number of features should not be too large,
because of the curse of dimensionality; but should contain
enough information to accurately predict the output.
4. Determine the structure of the learned function and
corresponding learning algorithm. For example, the
engineer may choose to use support vector machines or
decision trees.
Page 67
Has-scales?
has-feathers? flies?
lives in water?
lays eggs?
Dog
Cat
Bat
Page 71
Whale
Canary
Robin
Ostrich
Snake
Lizard
Alligator 0
Page 74
creativeness in all positions, and Spas sky for his ability to play
all types of positions and create attacks in calm positions .
Page 78
Page 83
Disadvantages:
1. Dependency-directed backtracking incurs a significant time
and space overhead as it requires the maintenance of
dependency records and an additional no-good database.
Thus the effort required to maintain the dependencies may
be more than the problem-solving effort solved.
Page 84
Fuzzy function:
Membership function is the one of the fuzzy function which is
used to develop the fuzzy set value. The fuzzy logic is depends
upon membership function
Unit-4
Natural Language processing and planning
Backward chaining: Backward chaining (or backward
reasoning) is an inference method used in automated theorem
Page 85
green, Then Fritz is yellow) match the goal (to determine Fritz's
color). It is not yet known that Fritz is a frog, so both the
antecedents (If Fritz is a frog, If Fritz is a canary) are added to
the goal list. The rule base is again searched and this time the
first two rules are selected, because their consequents (Then X
is a frog, Then X is a canary) match the new goals that were just
added to the list. The antecedent (If Fritz croaks and eats flies) is
known to be true and therefore it can be concluded that Fritz is a
frog, and not a canary. The goal of determining Fritz's color is
now achieved (Fritz is green if he is a frog, and yellow if he is a
canary, but he is a frog since he croaks and eats flies; therefore,
Fritz is green).
Note that the goals always match the affirmed versions of the
consequents of implications (and not the negated versions as in
modus tollens) and even then, their antecedents are then
considered as the new goals (and not the conclusions as in
affirming the consequent) which ultimately must match known
facts (usually defined as consequents whose antecedents are
always true); thus, the inference rule which is used is modus
ponens.
Because the list of goals determines which rules are selected and
used, this method is called goal-driven, in contrast to data-driven
forward-chaining inference. The backward chaining approach is
often employed by systems. Programming languages such as
Prolog, Knowledge Machine and Eclipse support backward
chaining within their inference engines.
Page 88
Page 91
x: HOLDING (x)]
ARMEMPTY
x: ONTABLE(x)
y: ON(x,y)
PICKUP(X)
P: CLEAR(X) ^ONTABLE(X) ^ARMEMPTY
D: ONTABLE(X) ^ARMEMPTY
A: HOLDING(X)
PUTDOWN(X)
P: HOLDING(X)
D: HOLDING(X)
A: ONTABLE(X) ^ARMEMPTY
Start: ON (B, A) ^
goal: ON (C, A) ^
ON TABLE (A) ^
ON (B, D) ^
ONTABLE(C) ^
ONTABLE (A) ^
Page 97
ONTABLE (D) ^
ONTABLE (D)
ARMEMPTY
ON (C, A)
ON (B, D)
ON (B, D)
ON (C, A)
[1]
[2]
end
function solution?(plan)
if causal-links-establishing-all-preconditions-of-all-steps(plan)
and all-threats-resolved(plan)
and all-temporal-ordering-constraints-consistent(plan)
and all-variable-bindings-consistent(plan)
then return true;
else return false;
end
function select-subgoal(plan)
pick a plan step S-need from steps(plan) with a precondition c
that has not been achieved;
return (S-need, c);
end
procedure choose-operator(plan, operators, S-need, c)
// solve "open precondition" of some step
choose a step S-add by either
Step Addition: adding a new step from operators that
has c in its Add-list
or Simple Establishment: picking an existing step in Steps(plan)
that has c in its Add-list;
if no such step then return fail;
add causal link "S-add --->c S-need" to Links(plan);
add temporal ordering constraint "S-add < S-need" to Orderings(plan);
if S-add is a newly added step then
begin
add S-add to Steps(plan);
add "Start < S-add" and "S-add < Finish" to Orderings(plan);
end
end
Page 101
procedure resolve-threats(plan)
foreach S-threat that threatens link "Si --->c Sj" in Links(plan)
begin // "declobber" threat
choose either
Demotion: add "S-threat < Si" to Orderings(plan)
or Promotion: add "Sj < S-threat" to Orderings(plan);
if not(consistent(plan)) then return fail;
end
end
Unit-5
Expert System and AI languages
Page 102
Development engine
Knowledge
Base
Inference engine
User interface
User
Pro
ble
m
Do
mai
n
E&F
Page 106
EXPERT SYSTEM
USER
Explanation
Module
Inference engine
Input
I/O interface
Case history
file
Output
Editor
Knowledge
base
Working
memory
Learning
Module
MOTIVATED (student)
WORKHARD (student)
EXCELL (student)
SUCCED (student)
Page 110
Page 111
Page 113
Blackboard
Page 114
Knowledge sources
Control information
Fig. Components of blackboard systems.
which is passed on to other nodes or is used to produce some
output response.
Neural networks were originally inspired as being
models of the human nervous system. They are generally
simplified models to be sure.
Domain
D
Expert
Knowledge
engineer
System
Editor
Knowledge
Base
Page 117
Examples
Here follow some example programs written in Prolog.
Hello world
An example of a query:
?- write('Hello world!'), nl.
Hello world!
true.
?Compiler optimization
Page 122
Practical use
MYCIN was never actually used in practice. This wasn't because
of any weakness in its performance. As mentioned, in tests it
outperformed members of the Stanford medical school faculty.
Some observers raised ethical and legal issues related to the use
of computers in medicine if a program gives the wrong
diagnosis or recommends the wrong therapy, who should be held
responsible? However, the greatest problem, and the reason that
MYCIN was not used in routine practice, was the state of
technologies for system integration, especially at the time it was
developed. MYCIN was a stand-alone system that required a
user to enter all relevant information about a patient by typing in
response to questions that MYCIN would pose. The program ran
on a large time-shared system, available over the early Internet
(Arpanet), before personal computers were developed. In the
modern era, such a system would be integrated with medical
record systems, would extract answers to questions from patient
databases, and would be much less dependent on physician entry
of information. In the 1970s, a session with MYCIN could easily
consume 30 minutes or morean unrealistic time commitment
for a busy clinician.
A difficulty that rose to prominence during the development of
MYCIN and subsequent complex expert systems has been the
extraction of the necessary knowledge for the inference engine
Page 128
to use from the human expert in the relevant fields into the rule
base (the so-called knowledge engineering).
Page 129