Module 1 Lecture NotesAIML
Module 1 Lecture NotesAIML
MODULE – 1
➢ Artificial Intelligence is the study of how to make computers do things which, at the
moment, people do better.
(1.1)The AI Problems
✓ Much of the early work in the field of AI focused on Formal Tasks, such as game playing
& theorem proving.
✓ Another early attempt that the AI focused is on the problem solving, often called
commonsense reasoning. It includes reasoning about physical objects & their
relationships to each other, as well as reasoning about actions & their consequences.
✓ As the research in AI progressed, the techniques for handling larger amounts of world
knowledge were developed, such as Perception (vision & speech), Natural language
understanding, and problem solving in specialized domains such as Medical diagnosis
& chemical analysis.
✓ The ability to use language to communicate a wide variety of ideas is perhaps the most
important thing that separates humans from the animals.
✓ In addition to these mundane tasks i.e ordinary tasks, people can also perform one or
may be more specialized tasks.
✓ Some of the tasks that are the targets of work in AI are listed as follows;
Mundane Tasks
▪ Perception
- Vision
- Speech
▪ Natural language
- Understanding
- Generation
- Translation
▪ Commonsense reasoning
▪ Robot control
Formal Tasks
▪ Games
- Chess
- Backgammon
- Checkers-Go
▪ Mathematics
- Geometry
- Logic
- Integral calculus
- Proving properties of programs
Expert Tasks
▪ Engineering
- Design
- Fault finding
- Manufacturing planning
▪ Scientific analysis
▪ Medical diagnosis
▪ Financial analysis
✓ As a part of the research in AI, in 1976 Newell & Simon has come up with a “Physical
Symbol system hypothesis” & they gave a definition for “physical symbol”.
✓ Later they had come with a hypothesis about the “Physical symbol”.
✓ It was just an assumption & there is no proof or evidence to claim their hypothesis on
“physical symbol” is True. To claim it is True, the only way was to conduct an
experiment.
✓ It also forms the basis of the belief that it is possible to build programs that can perform
intelligent tasks now performed by people.
3) It can easily be modified to correct errors & to reflect changes in the world.
4) It can be used in many great situations even if it is not totally accurate (or) complete.
Example: Tic-Tac-Toe game, Question Answering (In politics program, answers were
constructed by considering both the Input Text and a separate model of beliefs &
actions of various political entities.)
✓ Before we produce some programs to make intelligent things work, we should know
exactly what we are trying to do.
✓ Efforts to build programs that perform tasks the way people do can be divided into two
classes;
Class 1: Programs in this class attempt to solve problems that do not really fit our
definition of an AI task.
They are the problems that a computer could easily solve, although that easy solution
would exploit mechanisms that do not seem to be available to people.
Class 2: Attempt to model human performance are those that do things that follow
more clearly within our definition of AI task.
✓ In any scientific (or) engineering research project, we should be able to know whether
the machine that was built is really intelligent or not.
✓ In 1950, Alan Turing proposed a method for determining whether a machine can think.
His method is now known as “Turing Test”.
✓ One person plays the role of the interrogator, who would be in a separate room from
computer & other person.
✓ The interrogator can ask questions to either the person or the computer, by typing
questions & receiving typed responses.
✓ However, the interrogator knows them only as A & B, and aims to determine which one
is the person & which one is the machine based on the response they get.
✓ The aim of the machine is to fool the interrogator into believing that it is the person.
✓ If the machine succeeds, then we will conclude that the machine can think.
✓ Suppose if we consider the problem statement “Play Chess”, in order to build a program
that could “Play chess”, we would first have to specify the starting position of the chess
board, the rules that define the legal moves, and the board positions that represent a
Win for one side or the other.
✓ If we write the rule for each board positions, then we will have to write a very large
number of them for roughly around 10120 possible board positions.
✓ In order to minimize the problems, we should look for a way to write the rules describing
the legal moves in as general a way as possible.
Rule – 1
Rule – 2
✓ The rule-2 defines the problem of playing chess as a problem of moving around in a
state space, where each state corresponds to a legal position of the board.
✓ This state space representation seems natural for chess because the set of states,
which corresponds to the set of board positions is artificial & well-organized.
1) Define a state space that contains all the possible configurations of the relevant
objects.
2) Specify one or more states within that space that describe possible situations from
which the problem solving may start. These are called as “Initial State”.
3) Specify one or more states that would be acceptable as solutions to the problem.
These states are called “Goal State”.
✓ Helps in structuring AI programs in a way that facilitates in describing & performing the
search process.
i) A set of rules
- each consists of a left-side(pattern) that determines the applicability of the rule.
- a right-side that describes the operation to be performed if the rule is applied.
ii) Knowledge/Database
- will store the information of a particular task.
- Some parts of the database may be permanent, while other parts of it may
pertain only to the solution of the current problem.
✓ 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 & a set of
operators for moving in that space.
✓ The problem can then be solved by searching for a path through the space from an
initial state to a goal state.
❖ To decide which rule to be applied next during the process of searching for a solution to
a problem;
❖ For example:
One systematic control strategy for the water jug problem is as follows;
i) Construct a tree with initial state as its root.
ii) Generate all the offspring of the root by applying each of the applicable rules to the
initial state.
iii) Now for each leaf node, generate all its successors by applying all the rules that are
appropriate.
iv) Continue this process until some rule produces a goal state.
❖ Other systematic control strategies are also available like Depth-First-Search & also we
do a process called backtracking too during this search.
❖ Some heuristics help to guide a search process without sacrificing any claims to
completeness that the process might previously have had.
❖ On an average, heuristics will improve the quality of the paths that are explored.
❖ Using good heuristics, we can hope to get good solutions to hard problems.
❖ There are some good general purpose heuristics that are useful in a wide variety of
problem domains.
❖ In many AI problems, however it is not possible to produce reassuring bounds for two
reasons;
1) For real world problems, it is often hard to measure precisely the value of a particular
solution.
2) It is impossible to define a knowledge can be implemented through mathematical
analysis.
❖ A heuristic function is a function that maps from problem state descriptions to measures
of desirability, usually represented as numbers.
❖ The purpose of a heuristic function is to guide the search process in the most profitable
direction by suggesting which path to follow first when more than one is available.
➢ Heuristic search is a general method applicable for large class of problems and their
specific techniques will be effective for a small class of problems.
Example: 8 Puzzle
Start Goal
1 2 3 1 2 3
4 8 - 4 5 6
7 6 5 7 8 -
DOWN
{(1,2,3), (4,8,5), (7,6,0) }
LEFT
{(1,2,3), (4,8,5), (7,0,6)}
UP
{(1,2,3), (4,0,5), (7,8,6)}
RIGHT
{(1,2,3), (4,5,0), (7,8,6)}
DOWN
{(1,2,3), (4,5,6), (7,8,0)}
After each move, are we able to predict the next state or not ?
4) Is a good solution to the problem obvious without comparison to all other possible
solutions?
i.e We cannot be sure whether the current path is correct without trying other possible
path.
Example: Travelling Salesman Problem(to find the shortest path)
There are several components of this sentence, each of which in isolation may have more
than one interpretation.
Example: in chess, if we follow the rules about legal moves & some simple control
mechanism is good. Additional knowledge will help to speed up the execution of program.
7) Can a computer that is simply given the problem return the solution (or) will the solution
of the problem require interaction between the computer and a person?
Programs need frequent interaction with the Human User? Then, accordingly we need to
program it.
➢ Production systems are a good way to describe the operations that can be performed in
search for a solution to a problem.
➢ A partially commutative production system is a production system with the property that if
the application of a particular sequence of rules transforms state x into state y; then any
permutation of those rules that is allowable also transforms state x into state y.
➢ A commutative production system is a production system that is both monotonic & partially
commutative.
➢ There is no relationship between kinds of problems & kinds of production systems since all
problems can be solved by all kinds of systems.
Monotonic Non-monotonic
a) Partially commutative, monotonic production systems are useful for solving ignorable
problems.
c) Partially commutative, monotonic production systems are good for problems where things
do not change, new things get created.
d) Partially commutative, non-monotonic production systems are useful for problems in which
changes occur but can be reversed & in which, order of operations is not critical.
e) Not-partially commutative production systems are useful for many problems in which
irreversible changes occur.
➢ Every search process can be viewed as a traversal of a tree structure in which each node
represents a problem state & each arc represents a relationship between the states
represented by the nodes it connects.
(i) The direction in which to conduct the search. (Forward Vs Backward reasoning)
→ We can search forward through the state space from the start state to a goal state, (or) we
can search backward from goal.
→Number of missionaries on either side of the river is never less than the number of cannibals
who are on the same side.
→How can everyone get across the river without missionaries risking being eaten.
Department of CSE, AJIET, Mangaluru Page 12
Module – 1 Artificial Intelligence & Machine Learning (18CS71)
3.1) GENERATE-AND-TEST
✓ The generate-and-test strategy is the simplest of all the approaches. It consists of
the following steps:
Algorithm:
1. Generate a possible solution. For some problems, this means generating a
particular point in the problem space. For others, it means generating a path
from a start state.
2. Test to see if this is actually a solution by comparing the chosen point or the
endpoint of the chosen path to the set of acceptable goal states.
3. If a solution has been found, quit. Otherwise return to step 1.
✓ If there exists a solution for one problem then this strategy definitely finds the
solution. Because the complete solution must be generated before they can be
tested.
✓ To implement this generate and test usually, we will use depth-first tree.
✓ This is not an efficient (mechanism) technique when the problem is much harder.
It is acceptable for simple problems.
Example: Water Jug Problem
✓ The key difference between this algorithm and generate-and-test algorithm is the
use of an evaluation function as a way to inject task-specific knowledge into the
control process.
1. Evaluate the initial state. If it is also 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 a complete iteration produces no
change to current state:
a. Let SUCC be a state such that any possible successor of the current state
will be better than SUCC.
b. For each operator that applies to the current state do:
i. Apply the operator and generate a new state.
ii. Evaluate the new state. If it is a goal state, then return it and quit. If not
compare it to SUCC. If it is better, then set SUCC to this state. If it is not
better, leave SUCC alone.
c. IF the SUCC is better than current state, then set current state to SUCC.
✓ Both the basic and steepest-ascent hill climbing may fail to find a solution.
✓ Either algorithm may terminate not by finding a goal state but by getting a state
from which no better states can be generated. This will happen if the program has
reached a local maximum, a plateau or a ridge.
✓ A local maximum is a state that is better than all its neighbors but it not better
than some other states farther away.
✓ At the local maximum, all moves appear to make things worse.
✓ A plateau is a flat area of the search space in which a whole set of neighboring
states has the same value. In this, it is not possible to determine the best direction
in which to move by making local comparisons.
✓ A ridge is a special kind of maximum. It is an area of the search space that is higher
than surrounding areas and that itself has a slope.
✓ There are some ways of dealing with these problems, although these methods are
by no means guaranteed:
▪ Backtrack to some earlier node and try going in a different direction. This is
particularly reasonable if at that node there was another direction that
✓ At each step of the best-first search process, 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 its
successors. If one of them is a solution, then we can quit. Otherwise the
process continues by adding new node to the set of nodes generated so
far.
✓ In DFS, it allows to find a solution without all competing branches having
to be expanded. In BFS, it does not get trapped on dead-end paths.
✓ One way of combining the two methods DFS and BFS is to follow a single
path at a time, but switch paths whenever some competing paths looks
more promising than the current one does.
[3.3.3] Agendas
✓ An agenda is a list of task a system could perform.
✓ Associated with each task, there are usually two things;
i) A list of reasons why the task is being proposed.
ii) A rating representing the overall weight of evidence suggesting that the
task would be useful.
✓ One important question that arises in agenda-driven systems is how to
find the most promising task on each cycle. One way to do this, is
maintain the agenda sorted by rating.
✓ When a new task is created, insert it into the agenda in its proper place.
✓ When a task has its justifications changed, recomputed its rating and
move it to the correct place in the list.
➢ There can be more than one decompositions of the same problem. We have to
decide which is the best way to decompose the problem so that the total solution
(or) cost of the solution is good.
✓ The AND-OR graph (or tree) is useful for representing the solution of
problems that can be solved by decomposing them into a set of smaller
problems, all of which must then be solved.
✓ One AND arc may point to any number of successors nodes all of which must
be solved in order for the arc to point to a solution.
✓ AND node represents a given decomposition, which means that you need to
choose whatever is given.
✓ If we are given a graph in AND-OR, then we should not look only at the
minimum f(n) value at each node. This is explained as below with an example;
✓ In AI, there are many strategies which will try to find out a solution for an AI
problem either Backward or Forward direction.
✓ The Means-End Analysis is a method in which we can find the solution in both
forward as well as backward direction.
✓ We apply a suitable operator at a particular state in order to proceed to the
next state.
✓ The kind of backward chaining in which the operators are selected, then the
sub-goals are set up to establish the preconditions of the operators are called
“Operator Subgoaling”.
✓ If we don’t get a proper solution at the sub-goal, then that means we need to
prioritize either to find solution for the Big problem or Sub problem. During
that time, we use Means-End analysis to switch over from one to another in
finding the solution.
✓ The first AI program that used this Means-End analysis was the General
Problem Solver (GPS).
✓ Just like other problem solving techniques, Means-End analysis relies on a set
of rules that can transform one problem state into another state.
✓ These rules are not represented with complete state descriptions on each
side. Instead they are represented as;
Left Side: describes the conditions that must be met for the rule to be
applicable (Pre-conditions)
Right Side: describes those aspects of the problem that will be changed by
the application of the rule.
3) EXPAND the “diamond” to make it little big as per the expectation at Goal
State.
So, finally we get the Goal state after going through several sub-problem’s
solutions.