Professional Documents
Culture Documents
Machine
Planning
Learning
Expert
NLP Vision Robotics Systems
• 1.Norvig P. Russells S., Artificial Intelligence - A Modern Approach; First
Edition;
Prentice Hall; ISBN: 0-13-103805-2
2. R Beale and T Jackson, Neural Computing: An Introduction; R Beale and T
Jackson;
Institute of Physics Publishing; ISBN: 0-85-274262-2
3. Publisher: Van Nostrand Reinhold, 1993, Advanced Methods in Neural
Computing,
ISBN 0442004613
4. Publisher: Prentice Hall, 1998, Neural Networks: A comprehensive
foundation,
ISBN 0132733501
5. Publisher: IGI Global, 2008, Artificial Intelligence for Advanced Problem
Solving
Techniques, ISBN 9781599047058
What is Artificial Intelligence ?
• making computers that think?
• the automation of activities we associate with human thinking,
like decision making, learning ... ?
• the art of creating machines that perform functions that
require intelligence when performed by people ?
• the study of mental faculties through the use of computational
models ?
What is Artificial Intelligence ?
• the study of computations that make it possible to
perceive, reason and act ?
• a field of study that seeks to explain and emulate
intelligent behaviour in terms of computational
processes ?
• a branch of computer science that is concerned with the
automation of intelligent behaviour ?
• anything in Computing Science that we don't yet know
how to do properly ? (!)
What is Artificial Intelligence ?
HUMAN RATIONAL
Systems that act like humans:
Turing Test
• “The art of creating machines that perform
functions that require intelligence when
performed by people.” (Kurzweil)
• “The study of how to make computers do
things at which, at the moment, people are
better.” (Rich and Knight)
Systems that act like humans
?
• You enter a room which has a computer
terminal. You have a fixed period of time to type
what you want into the terminal, and study the
replies. At the other end of the line is either a
human being or a computer system.
• If it is a computer system, and at the end of the
period you cannot reliably determine whether it
is a system or a human, then the system is
deemed to be intelligent.
Systems that act like humans
HUMAN RATIONAL
Systems that think like humans:
cognitive modeling
• Humans as observed from ‘inside’
• How do we know how humans think?
– Introspection vs. psychological experiments
• Cognitive Science
• “The exciting new effort to make computers think
… machines with minds in the full and literal
sense” (Haugeland)
• “[The automation of] activities that we associate
with human thinking, activities such as decision-
making, problem solving, learning …” (Bellman)
What is Artificial Intelligence ?
HUMAN RATIONAL
Systems that think ‘rationally’
"laws of thought"
• Humans are not always ‘rational’
• Rational - defined in terms of logic?
• Logic can’t express everything (e.g. uncertainty)
• Logical approach is often not feasible in terms of
computation time (needs ‘guidance’)
• “The study of mental facilities through the use of
computational models” (Charniak and
McDermott)
• “The study of the computations that make it
possible to perceive, reason, and act” (Winston)
What is Artificial Intelligence ?
HUMAN RATIONAL
Systems that act rationally:
“Rational agent”
• Rational behavior: doing the right thing
• The right thing: that which is expected to
maximize goal achievement, given the
available information
• Giving answers to questions is ‘acting’.
• I don't care whether a system:
– replicates human thought processes
– makes the same decisions as humans
– uses purely logical reasoning
Systems that act rationally
• Logic only part of a rational agent, not all of
rationality
– Sometimes logic cannot reason a correct
conclusion
– At that time, some specific (in domain) human
knowledge or information is used
• Thus, it covers more generally different situations of
problems
– Compensate the incorrectly reasoned conclusion
Systems that act rationally
• Study AI as rational agent –
2 advantages:
– It is more general than using logic only
• Because: LOGIC + Domain knowledge
– It allows extension of the approach with more
scientific methodologies
Rational agents
An agent is an entity that perceives and acts
– increased costs
– difficulty with software development - slow and
expensive
– few experienced programmers
– few practical products have reached the market
as yet.
Search
• 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":
– blind
• we move through the space without worrying about
what is coming next, but recognising the answer if we
see it
– informed
• we guess what is ahead, and use that information to
decide where to look next.
• 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.
Knowledge Representation & Reasoning
• The second most important concept in AI
• If we are going to act rationally in our environment, then we must have
some way of describing that environment and drawing inferences from
that representation.
– how do we describe what we know about the world ?
– how do we describe it concisely ?
– how do we describe it so that we can get hold of the right piece of
knowledge when we need it ?
– how do we generate new pieces of knowledge ?
– how do we deal with uncertain knowledge ?
Knowledge
Declarative Procedural
2. Neural Networks
1943 - first AI work by McCulloch & Pitts
1950’s & 60’s - Minsky’s book on “Perceptrons” stops nearly all work on nets
1986 - rediscovery of solutions leads to massive growth in neural nets research
The UK had its own funding freeze in 1973 when the Lighthill report reduced AI work
severely -Lesson: Don’t claim too much for your discipline!!!!
Look for similar stop/go effects in fields like genetic algorithms and evolutionary computing.
This is a very active modern area dating back to the work of Friedberg in 1958.
Symbolic and Sub-symbolic AI
• Symbolic AI is concerned with describing and
manipulating our knowledge of the world as explicit
symbols, where these symbols have clear relationships to
entities in the real world.
• Sub-symbolic AI (e.g. neural-nets) is more concerned with
obtaining the correct response to an input stimulus
without ‘looking inside the box’ to see if parts of the
mechanism can be associated with discrete real world
objects.
AI Applications
• Autonomous Planning
& Scheduling:
– Autonomous rovers.
AI Applications
• Autonomous Planning & Scheduling:
– Telescope scheduling
AI Applications
• Autonomous Planning & Scheduling:
– Analysis of data:
AI Applications
• Medicine:
– Image guided surgery
AI Applications
• Medicine:
– Image analysis and enhancement
AI Applications
• Transportation:
– Autonomous
vehicle control:
AI Applications
• Transportation:
– Pedestrian detection:
AI Applications
Games:
AI Applications
• Games:
AI Applications
• Robotic toys:
AI Applications
Other application areas:
• Bioinformatics:
– Gene expression data analysis
– Prediction of protein structure
• Text classification, document sorting:
– Web pages, e-mails
– Articles in the news
• Video, image classification
• Music composition, picture drawing
• Natural Language Processing .
• Perception.
Homework
Read Pg (1 – 31) From the book
Read Turing’s original paper on AI (Turing, 1950). In the paper, he discusses
several objections to his proposed enterprise and his test for
intelligence. Which objections still carry weight? Are his refutations
valid? Can you think of new objections arising from developments since
he wrote the paper? In the paper, he predicts that, by the year 2000, a
computer will have a 30% chance of passing a five-minute Turing Test
with an unskilled interrogator.What chance do you think a computer
would have today? In another 50 years?
Propositional logic in Artificial intelligence
a) It is Sunday.
b) The Sun rises from West (False proposition)
c) 3+3= 7(False proposition)
d) 5 is a prime number.
Basic facts about propositional logic:
• Propositional logic is also called Boolean logic as it
works on 0 and 1.
• In propositional logic, we use symbolic variables to
represent the logic, and we can use any symbol for a
representing a proposition, such A, B, C, P, Q, R, etc.
• Propositions can be either true or false, but it cannot
be both.
• Propositional logic consists of an object, relations or
function, and logical connectives.
• These connectives are also called logical operators.
• These connectives are also called logical operators.
• The propositions and connectives are the basic
elements of the propositional logic.
• Connectives can be said as a logical operator which
connects two sentences.
• A proposition formula which is always true is
called tautology, and it is also called a valid sentence.
• A proposition formula which is always false is
called Contradiction.
Syntax of propositional logic:
• Example:
• Statement-1: "If I am sleepy then I go to bed" ==> P→ Q
Statement-2: "I am sleepy" ==> P
Conclusion: "I go to bed." ==> Q.
Hence, we can say that, if P→ Q is true and P is true then Q will be true.
• Example:
• Statement-1: Today is Sunday or Monday. ==>P∨Q
Statement-2: Today is not Sunday. ==> ¬P
Conclusion: Today is Monday. ==> Q
Addition:
• The Addition rule is one the common inference rule, and it
states that If P is true, then P∨Q will be true.
• Example:
• Statement: I have a vanilla ice-cream. ==> P
Statement-2: I have Chocolate ice-cream.
Conclusion: I have vanilla or chocolate ice-cream. ==> (P∨Q)
Simplification:
• The simplification rule state that if P∧ Q is true, then Q or
P will also be true. It can be represented as:
Resolution:
• The Resolution rule state that if P∨Q and ¬ P∧R is true, then
Q∨R will also be true. It can be represented as
Wumpus world:
•
First-Order logic:
• First-order logic is another way of knowledge
representation in artificial intelligence. It is an
extension to propositional logic.
• FOL is sufficiently expressive to represent the natural
language statements in a concise way.
• First-order logic is also known as Predicate logic or
First-order predicate logic. First-order logic is a
powerful language that develops information about
the objects in a more easy way and can also express
the relationship between those objects.
First-order logic
• Whereas propositional logic assumes the world
contains facts,
• first-order logic (like natural language) assumes
the world contains
– Functions: father of, best friend, one more than, plus,
…
• Objects: people, houses, numbers, colors,
baseball games, wars, …
• Relations: red, round, prime, brother of, bigger
than, part of, comes between, …
First-order logic
• As a natural language, first-order logic also has
two main parts:
• Syntax
• Semantics
Syntax of FOL: Basic elements
• Constants KingJohn, 2, NUS,...
• Predicates Brother,...
• Functions Sqrt, LeftLegOf,...
• Variables x, y, a, b,...
• Connectives , , , ,
• Equality =
• Quantifiers ,
Atomic sentences:
• Atomic sentences are the most basic
sentences of first-order logic. These sentences
are formed from a predicate symbol followed
by a parenthesis with a sequence of terms.
• We can represent atomic sentences
as Predicate (term1, term2, ......, term n).
• Example: Ravi and Ajay are brothers: =>
Brothers(Ravi, Ajay).
Chinky is a cat: => cat (Chinky).
Atomic sentences
Atomic sentence = predicate (term1,...,termn)
or term1 = term2
•
Truth in first-order logic
• Sentences are true with respect to a model and an interpretation
• Existential quantifiers are the type of quantifiers, which express that the
statement within its scope is true for at least one instance of something.
• It is denoted by the logical operator ∃, which resembles as inverted E. When it is
used with a predicate variable then it is called as an existential quantifier.
• If x is a variable, then existential quantifier will be ∃x or ∃(x). And it will be read as:
• There exists a 'x.'
• For some 'x.'
• For at least one 'x.‘
• It will be read as: There are some x where x is a boy who is intelligent.
• The main connective for universal
quantifier ∀ is implication →.
• The main connective for existential
quantifier ∃ is and ∧.
• In universal quantifier, ∀x∀y is similar to ∀y∀x.
• In Existential quantifier, ∃x∃y is similar to ∃y∃x.
• ∃x∀y is not similar to ∀y∃x.
• Some Examples of FOL using quantifier:
Examples
• 1. All birds fly.
In this question the predicate is "fly(bird)."
And since there are all birds who fly so it will be represented as follows.
∀x bird(x) →fly(x).
• 2. Every man respects his parent.
In this question, the predicate is "respect(x, y)," where x=man, and y= parent.
Since there is every man so will use ∀, and it will be represented as follows:
∀x man(x) → respects (x, parent).
• 3. Some boys play cricket.
In this question, the predicate is "play(x, y)," where x= boys, and y= game. Since there are some boys so we
will use ∃, and it will be represented as:
∃x boys(x) → play(x, cricket).
• 4. Not all students like both Mathematics and Science.
In this question, the predicate is "like(x, y)," where x= student, and y= subject.
Since there are not all students, so we will use ∀ with negation, so following representation for this:
¬∀ (x) [ student(x) → like(x, Mathematics) ∧ like(x, Science)].
• 5. Only one student failed in Mathematics.
In this question, the predicate is "failed(x, y)," where x= student, and y= subject.
Since there is only one student who failed in Mathematics, so we will use following representation for this:
∃(x) [ student(x) → failed (x, Mathematics) ∧∀ (y) [¬(x==y) ∧ student(y) → ¬failed (x,
Mathematics)].
Inference in First-Order Logic
• Inference in First-Order Logic is used to
deduce new facts or sentences from existing
sentences.
Substitution:
• Substitution is a fundamental operation performed on terms
and formulas. It occurs in all inference systems in first-order
logic. The substitution is complex in the presence of
quantifiers in FOL. If we write F[a/x], so it refers to substitute
a constant "a" in place of variable "x".
Equality:
• First-Order logic does not only use predicate
and terms for making atomic sentences but
also uses another way, which is equality in
FOL. For this, we can use equality
symbols which specify that the two terms
refer to the same object.
• Example: Brother (John) = Smith.
• Example: ¬ (x=y) which is equivalent to x ≠y
FOL inference rules for quantifier:
• Universal Generalization
• Universal Instantiation
• Existential Instantiation
• Existential introduction
Universal Generalization:
• Universal generalization is a valid inference rule which states
that if premise P(c) is true for any arbitrary element c in the
universe of discourse, then we can have a conclusion as ∀ x
P(x).
• This rule can be used if we want to show that every element
has a similar property.
• In this rule, x must not appear as a free variable.
• Example: Let's represent, P(c): "A byte contains 8 bits", so
for ∀ x P(x) "All bytes contain 8 bits.", it will also be true.
Universal Instantiation
• Universal instantiation is also called as universal elimination or UI is a valid
inference rule. It can be applied multiple times to add new sentences.
• The new KB is logically equivalent to the previous KB.
• As per UI, we can infer any sentence obtained by substituting a ground
term for the variable.
• The UI rule state that we can infer any sentence P(c) by substituting a
ground term c (a constant within domain x) from ∀ x P(x) for any object
in the universe of discourse.
• Example:1.
• IF "Every person like ice-cream"=> ∀x P(x) so we can infer that
"John likes ice-cream" => P(c)
Example: 2.
• Let's take a famous example,
• "All kings who are greedy are Evil." So let our knowledge base
contains this detail as in the form of FOL:
• ∀x king(x) ∧ greedy (x) → Evil (x),
• So from this information, we can infer any of the following
statements using Universal Instantiation:
• King(John) ∧ Greedy (John) → Evil (John),
• King(Richard) ∧ Greedy (Richard) → Evil (Richard),
• King(Father(John)) ∧ Greedy (Father(John)) → Evil
(Father(John)),
Existential Instantiation:
• Existential instantiation is also called as Existential Elimination,
which is a valid inference rule in first-order logic.
• It can be applied only once to replace the existential sentence.
• The new KB is not logically equivalent to old KB, but it will be
satisfiable if old KB was satisfiable.
• This rule states that one can infer P(c) from the formula given
in the form of ∃x P(x) for a new constant symbol c.
• Example:
• From the given sentence: ∃x Crown(x) ∧ OnHead(x, John),
• So we can infer: Crown(K) ∧ OnHead( K, John), as long as K
does not appear in the knowledge base.
Existential introduction
• An existential introduction is also known as an
existential generalization, which is a valid inference
rule in first-order logic.
• This rule states that if there is some element c in the
universe of discourse which has a property P, then
we can infer that there exists something in the
universe which has the property P.
• Example: Let's say that,
"Priyanka got good marks in English."
"Therefore, someone got good marks in English."
Equality
• term1 = term2 is true under a given interpretation if
and only if term1 and term2 refer to the same object
•
A simple knowledge base
• Knowledge Base
World Model, Agent Perception Model
Facts in Knowledge base (Prepositions)
Px,y is true if there is a pit in [x, y].
Wx,y is true if there is a wumpus in [x, y], dead or alive.
Bx,y is true if the agent perceives a breeze in [x, y].
Sx,y is true if the agent perceives a stench in [x, y]
Rules
A simple inference procedure
• Entailment -Model-checking approach
Forward Chaining and backward
chaining
• Inference engine:
The inference engine is the component of the
intelligent system in artificial intelligence, which
applies logical rules to the knowledge base to infer
new information from known facts. The first inference
engine was part of the expert system. Inference
engine commonly proceeds in two modes, which are:
Forward chaining
Backward chaining
Horn Clause and Definite clause:
• Horn clause and definite clause are the forms of sentences,
which enables knowledge base to use a more restricted and
efficient inference algorithm. Logical inference algorithms use
forward and backward chaining approaches, which require KB in
the form of the first-order definite clause.
• Definite clause: A clause which is a disjunction of literals
with exactly one positive literal is known as a definite clause or
strict horn clause.
• Horn clause: A clause which is a disjunction of literals with at
most one positive literal is known as horn clause. Hence all the
definite clauses are horn clauses.
• Example: (¬ p V ¬ q V k). It has only one positive literal k.
Forward Chaining
• Forward chaining is also known as a forward deduction or
forward reasoning method when using an inference
engine. Forward chaining is a form of reasoning which
start with atomic sentences in the knowledge base and
applies inference rules (Modus Ponens ) in the
forward direction to extract more data until a goal is
reached.
• The Forward-chaining algorithm starts from known facts,
triggers all rules whose premises are satisfied, and add
their conclusion to the known facts. This process repeats
until the problem is solved.
Properties of Forward-Chaining:
• step-1:
• In the first step we will start with the known facts and will choose the
sentences which do not have implications, such as: American(Robert),
Enemy(A, America), Owns(A, T1), and Missile(T1). All these facts will be
represented as below.
• Step-2:
• At the second step, we will see those facts which infer from available facts and with satisfied
premises.
• Rule-(1) does not satisfy premises, so it will not be added in the first iteration.
• Rule-(2) and (3) are already added.
• Rule-(4) satisfy with the substitution {p/T1}, so Sells (Robert, T1, A) is added, which infers
from the conjunction of Rule (2) and (3).
• Rule-(6) is satisfied with the substitution(p/A), so Hostile(A) is added and which infers from
Rule-(7).
Step-3:
• // Generate realWorld.
• generateRealWorld(realWorld);
• // Generate agentWorld
• setFlag(agentWorld, start, CURRENT); // Initialy player is at (0,0)
• // Go to the nearest safe field if any safe field exists in agent world
• int takeSafeAction(int agentWorld[NOCOLS][NOROWS], struct coord field){
• int random,z;
• struct coord neighbors[4]; // Neighbors coordinates
• except_i = 0;
• except_size = 0;
• // First we will see are there any neighbor fields that are SAFE
• for(z=0; z<4; z++){
• if ( (
• ((neighbors[z].y > NOROWS-1) && (z == 0))
• ||
• ((neighbors[z].x > NOCOLS-1) && (z == 1))
• ||
• ((neighbors[z].y < 0) && (z == 2))
• ||
• ((neighbors[z].x < 0) && (z == 3))
• )
• ||
• (testFlag(agentWorld, neighbors[z], VISITED))
• ||
• (testFlag(agentWorld, neighbors[z], SAFE) == 0)
• ){
• if(except_i == 0){
• except_size++;
• if ((exceptSF = (int*)calloc(except_size, sizeof(int))) == NULL) {
• fprintf(stderr, "Error allocating memory.\n");
• exit(EXIT_FAILURE);
• }
• }else if(except_i == except_size){
• except_size++;
• if ((exceptSF_temp = (int*)realloc(exceptSF, except_size * sizeof(int))) == NULL) {
• fprintf(stderr, "Ran out of memory while expanding except array.\n");
• free(exceptSF);
• exit(EXIT_FAILURE);
• }
• exceptSF = exceptSF_temp;
• }
• exceptSF[except_i] = z;
• except_i++;
• }
• }
• if (except_i<4){
• random = randInt(0,3,exceptSF,except_i);
• }
• }