0% found this document useful (0 votes)
112 views105 pages

BCS515B Ai VTU Notes

This document outlines the objectives and outcomes of a course on Artificial Intelligence, focusing on key concepts such as machine learning, neural networks, and ethical implications. It covers various topics including backward chaining, logic programming with Prolog, constraint satisfaction problems, and classical planning techniques. Additionally, it discusses algorithms like GRAPHPLAN and resolution methods for theorem proving in AI.

Uploaded by

harb1nger.bw
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
112 views105 pages

BCS515B Ai VTU Notes

This document outlines the objectives and outcomes of a course on Artificial Intelligence, focusing on key concepts such as machine learning, neural networks, and ethical implications. It covers various topics including backward chaining, logic programming with Prolog, constraint satisfaction problems, and classical planning techniques. Additionally, it discusses algorithms like GRAPHPLAN and resolution methods for theorem proving in AI.

Uploaded by

harb1nger.bw
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 105

ARTIFICIAL INTELLIGENCE

BCS515B

MODULE 5

Manasa Sandeep, Dept. of CSE, DSATM


Manasa Sandeep, Dept. of CSE, DSATM
Course Objectives
Introduce the basic principles and theories underlying artificial intelligence,
Learning Goal (LG) - 1 including machine learning, neural networks, natural language processing, and
robotics.
Apply AI techniques to solve real-world problems, including search algorithms,
Learning Goal (LG) - 2
optimization, and decision-making processes.
Appraise the ethical, legal, and societal implications of AI, including topics
Learning Goal (LG) - 3 such as bias, fairness, accountability, and the impact of AI on the workforce
and privacy.

Course Outcomes
Understand and explain the architecture and components of intelligent agents, including their
CO1
interaction with the AI environment
CO2 Apply problem-solving agents and various search strategies to solve a given problem.
Illustrate logical reasoning and knowledge representation using propositional and first-order
CO3
logic.
CO4 DemonstrateManasa
proficiency in representing knowledge and solving problems using first-order logic.
Sandeep, Dept. of CSE, DSATM

Implement classical planning in the context of artificial intelligence, including its goals,
CO5
constraints, and applications in problem-solving.
Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
BACKWARD CHAINING
• These algorithms work backward from the goal, chaining through
rules to find known facts that support the proof
• Decision driven, Goal driven

Manasa Sandeep, Dept. of CSE, DSATM


A backward-chaining algorithm

Manasa Sandeep, Dept. of CSE, DSATM


• To prove that West is a criminal using First forward-
chaining algorithm, first we should represent these facts as
first-order definite clauses.

Manasa Sandeep, Dept. of CSE, DSATM


The law says that it is a crime for an American to sell
weapons to hostile nations. The country Nono, an enemy of
America, has some missiles, and all of its missiles were sold
to it by ColonelWest, who is an American.

Prove that West is a criminal using Backward chaining

Manasa Sandeep, Dept. of CSE, DSATM


Manasa Sandeep, Dept. of CSE, DSATM
Logic programming

• Prolog(Programming in logic) is the most widely used logic


programming language.
• It is a declarative language designed for developing logic based AI
applications.
• It is used primarily as a rapid prototyping language and for symbol-
manipulation tasks such as writing compilers and parsing natural
language
• Many expert systems have been written in Prolog for legal, medical,
financial, and other domains.

Manasa Sandeep, Dept. of CSE, DSATM


• Prolog statements has facts, rules and queries
• Facts: they describe explicit relationships
Example: Rani is a girl Prema Teaches all subjects
girl(Rani). Teaches(Prema, all subjects).

• Rules: defines implicit relationships.


Example: X is a father of Y if X is a parent of Y and X is
male father(X,Y) :- parent(X,Y) , male(X).
• Queries: Asking questions. Also called goals.
• Example: Is pizza a food? ?- food(pizza).
Manasa Sandeep, Dept. of CSE, DSATM
• Notations used X:- Y ;Z.
• :- → if or implied by X:- Y.
X:- Z.
• , → and (conjunction)
• ; → or (disjunction)
• ?- → Questions
• Every statement ends with dot.

Manasa Sandeep, Dept. of CSE, DSATM


• Prolog programs are sets of definite clauses
• Prolog uses uppercase letters for variables and lowercase
for constants
• Commas separate conjuncts in a clause
• Example : FOL statement A ∧ B ⇒ C is written as
C :- A, B. (clause: head(predicate) :- body )
• criminal(X) :- american(X), weapon(Y), sells(X,Y,Z),
hostile(Z).
• List: [E|L] → a list whose first element is E and whose rest is L.
• The above is an example for rule. If only predicate exists, then it is a
fact.
Manasa Sandeep, Dept. of CSE, DSATM
• append(X,Y,[1,2]): what two lists can be appended to give [1,2]?

• The execution of Prolog programs is done through depth-first


backward chaining, where clauses are tried in the order in which they
are written in the knowledge base.

• The execution of a Prolog program can happen in two modes:


interpreted and compiled

• The mismatch between depth-first search and search trees that include
repeated states and infinite paths
Manasa Sandeep, Dept. of CSE, DSATM
Consider the following logic program that decides if a path exists
between two points on a directed graph

Manasa Sandeep, Dept. of CSE, DSATM


On the other hand, if we put the two clauses in the order

Infinite proof tree generated


when the clauses are in the
“wrong” order.

Manasa Sandeep, Dept. of CSE, DSATM


Constraint Satisfaction Problem (CSP)

• CSP Consists of three components V, D, C


• V is a set of Variables {V1, V2, ….Vn}
• D is a set of Domains {D1, D2,…..Dn}
• C is a set of constraints that specify allowable combination of
values Ci = (scope, rel) where
• Scope= set of variables that participate in constraint
• Rel= relation that define the values that variable can take
• Examples: Graph Coloring Problem, Sudoku, Cryptarithmetic
Problems
Manasa Sandeep, Dept. of CSE, DSATM
Constraint logic programming
• Consider the following example. The predicate triangle(X,Y,Z).
• If the three arguments are numbers that satisfy the triangle
inequality:

If we ask Prolog the query triangle(3,4,5), it succeeds.


On the other hand, if we ask triangle(3,4,Z), no solution
will be found, because the subgoal Z>=0 cannot be handled by
Prolog; we can’t compare an unbound value to 0.

Manasa Sandeep, Dept. of CSE, DSATM


Constraint logic programming

• Constraint logic programming (CLP) allows variables to be


constrained rather than bound.
• A CLP solution is the most specific set of constraints on the query
variables that can be derived from the knowledge base.
• For example, the solution to the triangle(3,4,Z) query is the
constraint 7 >= Z >= 1
• CLP systems incorporate various constraint-solving algorithms for
the constraints allowed in the language

Manasa Sandeep, Dept. of CSE, DSATM


Resolution
• Resolution is a single inference rule
• Resolution is a theorem proving technique that proceeds by building
refutation proofs, i.e, proof by contradiction
• It is used when various statements are given, and we need to prove a
conclusion of those statements
• Steps for Resolution
• Conversion of facts into first-order logic(FOL)
• Convert FOL statements into conjunctive normal form (CNF)
• Negate the statement which needs to be proved (proof by
contradiction)
• Draw a resolution graph (unification )
Manasa Sandeep, Dept. of CSE, DSATM
Resolution
Conjunctive normal form for first-order logic
• First-order resolution requires that sentences be in conjunctive normal
form (CNF)
• CNF is a conjunction of clauses, where each clause is a disjunction of
literals.
• Literals can contain variables, which are assumed to be universally
quantified

Manasa Sandeep, Dept. of CSE, DSATM


Resolution
Conjunctive normal form for first-order logic
• Every sentence of first-order logic can be converted into an
inferentially equivalent CNF sentence.
1. Convert “Everyone who loves all animals is loved by someone”
into CNF
• FOL statement :

• Solution: Step1: Eliminate implications


• Eliminate → , α → β = ~ α V β
• Eliminate → , α → β = (α → β) ∧ (β → α )
Manasa Sandeep, Dept. of CSE, DSATM
Resolution

• Step 2: Move ¬ inwards

Manasa Sandeep, Dept. of CSE, DSATM


Resolution

• Skolemize: Skolemization is the process of removing existential


quantifiers by elimination.

• ∀ x [Animal (F(x)) ∧¬Loves(x, F(x))] ∨ Loves(G(z), x)

• Here F and G are Skolem functions.

Manasa Sandeep, Dept. of CSE, DSATM


`

Manasa Sandeep, Dept. of CSE, DSATM


Prove that John likes Peanuts using
Resolution
`

Manasa Sandeep, Dept. of CSE, DSATM


Step 1: Conversion of facts into first-order logic(FOL)

Manasa Sandeep, Dept. of CSE, DSATM


Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
Anil
Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
CLASSICAL PLANNING

• Planning systems are problem-solving algorithms that


operate on explicit propositional or relational
representations of states and actions.
• These representations make possible the derivation of
effective heuristics and the development of powerful and
flexible algorithms for solving problems.

Manasa Sandeep, Dept. of CSE, DSATM


CLASSICAL PLANNING

Manasa Sandeep, Dept. of CSE, DSATM


Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
Example: The spare tire problem
• Consider the problem of changing a flat tire (Figure 10.2). The goal is to have a
good spare tire properly mounted onto the car’s axle, where the initial state has a
flat tire on the axle and a good spare tire in the trunk. To keep it simple, our
version of the problem is an abstract one, with no sticky lug nuts or other
complications. There are just four actions: removing the spare from the trunk,
removing the flat tire from the axle, putting the spare on the axle, and leaving the
car unattended overnight. We assume that the car is parked in a particularly bad
neighborhood, so that the effect of leaving it overnight is that the tires disappear.
A solution to the problem is [Remove(Flat , Axle), Remove(Spare, Trunk ),
PutOn(Spare, Axle)]. Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
The GRAPHPLAN algorithm

Manasa Sandeep, Dept. of CSE, DSATM


Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
Manasa Sandeep, Dept. of CSE, DSATM
Termination of GRAPHPLAN

Manasa Sandeep, Dept. of CSE, DSATM


• Seminar – 75, 89
• C Sec – 166, 180,

Manasa Sandeep, Dept. of CSE, DSATM

You might also like