ISDT

Download as pdf or txt
Download as pdf or txt
You are on page 1of 157

Amity School of Engineering and Technology

Introduction to AI

1
What is AI ?Amity School of Engineering and Technology
• Artificial Intelligence is the science and engineering of making
intelligent machines.

• Artificial Intelligence is the study of how to make computers


do things which, at the moment, people do better.

• Artificial Intelligence is the branch of computer science that is


concerned with the automation of intelligent behavior.

• Artificial Intelligence is the study and design of intelligent


agents, where an intelligent agent is a system that perceives its
environment and takes actions that maximize its chance
of success.

2
What is AI ?Amity School of Engineering and Technology
• 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.


– Intelligence
– Artificial

• The term artificial is easy to understand. But it’s very difficult


to define intelligence.

3
Amity School of Engineering and Technology
What is Intelligence?
• Intelligence is what we use when we don’t know what to do.
• Intelligence relates to tasks involving higher mental
processes.

Examples: Creativity, Solving problems, Pattern recognition,


Classification, Learning, Induction, Deduction, Building
analogies, Optimization, Language processing, Knowledge
and many more.

4
Amity School of Engineering and Technology
Amity School of Engineering and Technology
Approaches toAmity
AI School of Engineering and Technology
• Hard or Strong AI
• Soft or Weak AI
• Applied AI
• Cognitive AI

7
Hard or StrongAmity
AI School of Engineering and Technology

• Strong AI refers to a machine that


approaches or supersedes human
intelligence.
– if it can do typically human tasks,
– If it can apply a wide range of background
knowledge and
– If it has some degree of self-consciousness
• Strong AI aims to build machines
whose overall intellectual ability is
indistinguishable from that of a human
being. 8
Soft or Weak AI
Amity School of Engineering and Technology

• Weak AI refers to the use of software to study or accomplish


specific problem solving or reasoning tasks that do not
encompass the full range of human cognitive abilities.
Example: a chess program such as Deep Blue

• Weak AI does not achieve self-awareness; it demonstrates


wide range of human level cognitive abilities; it is merely an
intelligent, a specific problem-solver.

9
Applied AI Amity School of Engineering and Technology
• 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.

10
Cognitive AIAmity School of Engineering and Technology
• 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.

11
Cognitive science
Amity School of Engineering and Technology

• Aims to develop, explore and evaluate theories of how the


mind works through the use of computational models.

• The important is not what is done but how it is done; means


intelligent behavior is not enough, the program must operate in
an intelligent manner.

• Example: the chess programs are successful but say little


about the ways humans play chess.

12
CyberneticsAmity School of Engineering and Technology
• Cybernetics” comes from a Greek word meaning “the art of
steering”.
• Cybernetics is about having and taking action to achieve that
goal. Knowing whether you have reached your goal (or at least
are getting closer to it) requires “”, a concept that comes from
cybernetics.
• Cybernetics grew from a desire to understand and build
systems that can achieve goals, whether complex human goals
or just goals like maintaining the temperature of a room under
changing conditions.

13
Goals of AI Amity School of Engineering and Technology
• The definition of AI gives four possible goals to pursue:
1. Systems that think like humans
2. Systems that think rationally
3. Systems that act like humans
4. Systems that act rationally
• Traditionally, all four goals have been followed and the approaches
were:

• Most of AI works falls into category 2 and 4.

14
Systems that think likeAmityhumans
School of Engineering and Technology

• Most of the time it is a black box where we are not


clear about our thought process.
• One has to know functioning of brain and its
mechanism for possessing information.
• It is an area of cognitive science.
– The stimuli are converted into mental representation.
– Cognitive processes manipulate representation to build new
representations that are used to generate actions.

• Neural network is a computing model for processing


information similar to brain.

15
Systems that act likeAmity
humans
School of Engineering and Technology

• The overall behaviour of the system


should be human like.

• It could be achieved by observation.

16
Systems that think rationally
Amity School of Engineering and Technology

• Such systems rely on logic rather than human to


measure correctness.
• For thinking rationally or logically, logic formulas and
theories are used for synthesizing outcomes.
• For example,
– given John is a human and all humans are mortal then one
can conclude logically that John is mortal
• Not all intelligent behavior are mediated by logical
deliberation.

17
Systems that act rationally
Amity School of Engineering and Technology

• Rational behavior means doing right thing.


• Goal is to develop systems that are rational and
sufficient.

18
General AI Goals
Amity School of Engineering and Technology

• Replicate human intelligence

• Solve knowledge intensive tasks

• Make an intelligent connection between perception and action

• Enhance human-human, human-computer and


computer to computer interaction/communication

19
AI Goal Amity School of Engineering and Technology

Engineering based AI Goal


• Develop concepts, theory and practice of building intelligent
machines
• Emphasis is on system building

Science based AI Goal


• Develop concepts, mechanisms and vocabulary to understand
biological intelligent behavior.
• Emphasis is on understanding intelligent behavior.

20
Major components of an AI system
Amity School of Engineering and Technology

Knwoledge Heuristic
Representation Search

AI Program

AI
Programming AI Hardware
languages and
tools

21
Major components of an AI system
Amity School of Engineering and Technology

• The quality of the result depends on how much knowledge the system
possesses. The available knowledge must be represented in a very
efficient way. Hence, knowledge representation is vital component of the
system.
• It is not merely enough that knowledge is represented efficiently. The
inference process should also be equally good for satisfactory results. The
inference process is broadly divided into brute and heuristic search
procedure.
• Today, just like we have specialized languages and programs for data
processing and scientific applications, we encounter specialized languages
and tools for AI programming. AI languages provide the basic functions for
AI programming and tools for the right environment.
• Today, most of the AI programs in India are implemented on Von
Neumann machines only. However dedicated workshops have emerged
for AI programming.

22
Applications areaAmity
ofSchool
AI of Engineering and Technology
• Perception
– Machine vision
– Speech understanding
– Touch ( tactile or haptic) sensation
• Robotics
• Natural Language Processing
– Natural Language Understanding
– Speech Understanding
– Language Generation
– Machine Translation
• Planning
• Expert Systems
• Machine Learning
• Theorem Proving
• Symbolic Mathematics
• Game Playing 24
The Turing Test
Amity School of Engineering and Technology

Turing proposed operational test for intelligent


behavior in 1950.

Human

Human ?
Interrogator
AI system

24
Turing test Amity School of Engineering and Technology
• To conduct Turing test, we need two people and the machine
to be evaluated. One person plays the role of the interrogator,
who is in a separate room from the computer and the other
person.
• The interrogator can ask questions of either the person or the
computer by typing questions and receiving typed responses.
however, the integrator knows only as A and B and aims to
determine which is the person and which is the machine.
• The goal of the machine is to fool the interrogator into
believing that it is the person. If the machine succeeds at this,
then we will conclude that the machine can think. The
machine is allowed to do whatever it can to fool the
interrogator.
35
Information, Knowledge,Amity
Intelligence
School of Engineering and Technology
• Information is a message that contains relevant meaning,
implication, or input for decision and/or action. Information
comes from both current (communication) and historical
(processed data or ‘reconstructed picture’) sources. In
essence, the purpose of information is to aid in making
decisions and/or solving problems or realizing an opportunity.
• Knowledge is the cognition or recognition (know-what),
capacity to act (know-how), and understanding (know-why)
that resides or is contained within the mind or in the brain.
The purpose of knowledge is to better our lives.
• Intelligence (also called intellect) is an umbrella term used to
describe a property of the mind that encompasses many
related abilities, such as the capacities to reason, to plan, to
solve problems, to think abstractly, to comprehend ideas, to
use language, and to learn. 36
Human intelligence Vs. Artificial intelligence
Amity School of Engineering and Technology
Human intelligence Artificial intelligence
Human intelligence revolves around The field of Artificial intelligence focuses
adapting to the environment using a on designing machines that can mimic
combination of several cognitive human behavior.
processes.

Human Intelligence is organically based, Artificial Intelligence is silicon based.

Human intelligence is separated through Computer intelligence is separated into


the five senses. binary code

Human memory...Five access points Artificial intelligence...Just one access


point....
The human mind on the other hand works Artificially Intelligence works along pre-
by asociation, which is not always logical set formulas and ways, it is rather straight
in a technical sense. forward.

37
Intelligent Computing Vs. conventional
Amity Schoolcomputing
of Engineering and Technology

28
Amity School of Engineering and Technology

The AI Problem

29
The AI Problem
Amity School of Engineering and Technology

• Much of the early work in the field focused on


formal tasks, such as game playing and theorem
proving.
• Another early foray into AI focused on the sort of
problem solving that we do every day called as
mundane tasks, such as commonsense
reasoning.
• The problem area where AI is now flourishing
most as a practical discipline are primarily the
domains that require only specialized expertise
without the assistance of commonsense
knowledge, called as expert systems.

30
Formal TasksAmity School of Engineering and Technology
• Games
– Chess
– Backgammon
– Checkers-Go
• Mathematics
– Geometry
– Logic
– Internal calculus
– Proving properties of programs

31
Mundane Tasks
Amity School of Engineering and Technology

• Perception
– Vision
– Speech
• Natural language
– Understanding
– Generation
– Translation
• Commonsense reasoning
• Robot control

32
Expert TasksAmity School of Engineering and Technology
• Engineering
– Design
– Fault finding
– Manufacturing planning
• Scientific analysis
• Medical diagnosis
• Financial analysis

33
Limits of AI Today
Amity School of Engineering and Technology
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.
• 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 with the Hubble Telescope.
• The Learning systems are capable of doing text categorization into
about a 1000 topics
• In Games, AI systems can play at the Grand Master level in chess
(world champion), checkers, etc.

34
What can AI systems NOT do yet?
Amity School of Engineering and Technology

• 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
• Exhibit true autonomy and intelligence

35
Amity School of Engineering and Technology

What is an AI technique

36
What is an AI technique
Amity School of Engineering and Technology

AI technique is a method that exploits knowledge which should be


represented in such a way that –
i. The knowledge captures generalization or we can say that
situations that share important properties and grouped together
rather than to represent separately each individual situation.
ii. It can be understood by people who provide it. In many AI
domains most of the knowledge, a programs has, must ultimately
be provided by people in terms they understand.
iii. It can easily be modified to correct errors and to reflect changes in
the world and in our world view.
iv. It can be used in a great many situations even if it is not totally
accurate or complete.
v. It can be used to help overcome its own sheer bulk by to narrow
the range of possibilities that must usually be considered.

37
Examples of AI
Amity School of Engineering and Technology

1. Tic-Tac toe problems


2. Water jug problem
3. 8-puzzle problem
4. 8-queen problem
5. Chess problem
6. Missionaries and cannibals problem
7. Tower of Hanoi problem
8. Traveling salesman problem
9. Magic square
10. Language understanding problems
11. Monkey and Banana Problem
12. Crypt arithmatic puzzle
13. Block World problem
38
Amity School of Engineering and Technology

Problem solving /Problem


representation

39
Problem solving
Amity School of Engineering and Technology

• Problem solving is a process of generating solutions from


observed data.
• Key element of problem solving
– State: A state is a representation of problem at a given
moment.
– State space: Contains all the possible states for a given
problem.
– Operators: the available actions performed is called
operators.
– Initial state: position from which the problem-solving
process may start.
– Goal state: solution to the problem.

40
General Problem solving
Amity School of Engineering and Technology

• To build a system, to solve a praticular problem, there are


four things:
1. Define the problem precisely (apply the State Space
representation).
2. Analyze the problem.
3. Isolate and represent the task knowledge that is
necessary to solve the problem.
4. Choose the best problem solving technique(s) and
apply it to the particular problem.

41
Problem Characteristics
Amity School of Engineering and Technology

To choose an appropriate method for a particular


problem:
1. Is the problem decomposable?
2. Can solution steps be ignored or undone?
3. Is the universe predictable?
4. Is a good solution absolute or relative?
5. Is the solution a state or a path?
6. What is the role of knowledge?
7. Does the task require human-interaction?

42
1. Is the problem decomposable?
Amity School of Engineering and Technology

• Can the problem be broken down to smaller problems to be


solved independently?

• Decomposable problem can be solved easily.

43
1. Is the problem decomposable?
Amity School of Engineering and Technology

(x2 + 3x + sin2x.cos2x)dx

x2dx 3xdx sin2x.cos2xdx

(1 − cos2x)cos2xdx

cos2xdx −cos4xdx

44
2. Can solution steps beAmity
ignored or
School of Engineering and Technology

undone?
Theorem Proving
A lemma that has been proved can be ignored for next steps.

Ignorable!

45
2. Can solution steps beAmity
ignored or
School of Engineering and Technology

undone?
The 8-Puzzle

2 8 3 1 2 3
1 6 4 8 4
7 5 7 6 5

Moves can be undone and backtracked.

Recoverable!

46
2. Can solution steps beAmity
ignored or
School of Engineering and Technology

undone?
Playing Chess
Moves cannot be retracted.

Irrecoverable!

47
2. Can solution steps beAmity
ignored or
School of Engineering and Technology

undone?
• Ignorable problems can be solved using a simple
control structure that never backtracks.
• Recoverable problems can be solved using backtracking.
• Irrecoverable problems can be solved by recoverable style
methods via planning.

48
Amity School of Engineering and Technology
3. Is the universe predictable?
The 8-Puzzle
Every time we make a move, we know exactly what will
happen.

Certain outcome!

49
Amity School of Engineering and Technology
3. Is the universe predictable?
Playing Bridge
We cannot know exactly where all the cards are or what
the other players will do on their turns.

Uncertain outcome!

50
Amity School of Engineering and Technology
3. Is the universe predictable?
• For certain-outcome problems, planning can used to generate a
sequence of operators that is guaranteed to lead to a solution.
• For uncertain-outcome problems, a sequence of generated
operators can only have a good probability of leading to a
solution.
Plan revision is made as the plan is carried out and the
necessary feedback is provided.

51
Amity School of Engineering and Technology
4. Is a good solution absolute or relative?

1. Marcus was a man.


2. Marcus was a Pompeian.
3. Marcus was born in 40 A.D.
4. All men are mortal.
5. All Pompeians died when the volcano
erupted in 79 A.D.
6. No mortal lives longer than 150 years.
7. It is now 2004 A.D.

52
4. Is a good solution absolute or
Amity School of Engineering and Technology

relative?
1. Marcus was a man.
2. Marcus was a Pompeian.
3. Marcus was born in 40 A.D.
4. All men are mortal.
5. All Pompeians died when the volcano
erupted in 79 A.D.
6. No mortal lives longer than 150 years.
7. It is now 2004 A.D.

Is Marcus alive?
53
4. Is a good solution absolute or
Amity School of Engineering and Technology

relative?
1. Marcus was a man.
2. Marcus was a Pompeian.
3. Marcus was born in 40 A.D.
4. All men are mortal.
5. All Pompeians died when the volcano
erupted in 79 A.D.
6. No mortal lives longer than 150 years.
7. It is now 2004 A.D.

Is Marcus alive?
Different reasoning paths lead to the answer. It does not
matter which path we follow.
54
4. Is a good solution absolute or
Amity School of Engineering and Technology

relative?
The Travelling Salesman Problem
We have to try all paths to find the shortest one.

55
4. Is a good solution absolute or
Amity School of Engineering and Technology

relative?
• Any-path problems can be solved using heuristics that suggest
good paths to explore.

• For best-path problems, much more exhaustive search will be


performed.

56
Amity School of Engineering and Technology
5. Is the solution a state or a path?
Finding a consistent intepretation
“The bank president ate a dish of pasta salad with
the fork”.
– “bank” refers to a financial situation or to a side of a river?
– “dish” or “pasta salad” was eaten?
– Does “pasta salad” contain pasta, as “dog food” does not
contain “dog”?
– Which part of the sentence does “with the fork” modify?
What if “with vegetables” is there?

No record of the processing is necessary.

57
Amity School of Engineering and Technology
5. Is the solution a state or a path?
The Water Jug Problem
The path that leads to the goal must be reported.

58
Amity School of Engineering and Technology
5. Is the solution a state or a path?
• A path-solution problem can be reformulated as a state-
solution problem by describing a state as a partial path to a
solution.

• The question is whether that is natural or not.

59
Amity School of Engineering and Technology
6. What is the role of knowledge
Playing Chess
Knowledge is important only to constrain the search for a
solution.

Reading Newspaper
Knowledge is required even to be able to recognize a solution.

60
7. Does the task require human-
Amity School of Engineering and Technology

interaction?
• Solitary problem, in which there is no intermediate
communication and no demand for an explanation of the
reasoning process.

• Conversational problem, in which intermediate


communication is to provide either additional assistance to the
computer or additional information to the user.

61
State space representation
Amity School of Engineering and Technology
• Before a solution can be found, the prime condition is that the
problem must be very precisely defined. By defining it
properly, one converts the abstract problem into real workable
states that are really understood.
• A set of all possible states for a given problem is known as the
state space of the problem.State space representations are
highly beneficial in AI because they provide all possible states,
operations and goals.
• If the entire state space representations for a problem is given,
it is possible to trace the path from the initial state to the goal
state and identify the sequence of operators necessary for
doing it.
• The major deficiency of this method is that it is not possible to
visualize all states for a given problem. Moreover, the
resources of the computer system are limited to handle huge
state-space representation.
State space representation of coffee
Amity School of Engineering and Technology
making

63
8- puzzle problem
Amity School of Engineering and Technology

• In the 8-puzzle problem we have a 3×3 square


board and 8 numbered tiles. The board has one
blank position.
• Tiles can be slid to adjacent blank positions. We
can alternatively and equivalently look upon this
as the movement of the blank position up, down,
left or right.
• The objective of this puzzle is to move the tiles
starting from an initial position and arrive at a
given goal configuration.

64
Initial and goal state
Amity School of Engineering and Technology

The start state is some


(almost) random
configuration of the tiles
The goal state is as shown
Operators are
Move empty space up
Move empty space down
Move empty space right
Move empty space left

65
State space of the 8 puzzle problem
Amity School of Engineering and Technology

66
Amity School of Engineering and Technology

Water jug problem


Amity School of Engineering and Technology

Water jug problem


Amity School of Engineering and Technology

Water jug problem


8- puzzle problem
Amity School of Engineering and Technology

70
Solution Amity School of Engineering and Technology

71
A Water Jug Problem
Amity School of Engineering and Technology

• You have a 4-
gallon and a 3-
gallon water jug

• You have a pump


with an unlimited
amount of water

• You need to get


exactly 2 gallons
in 4-gallon jug 72
Puzzle-solving as Search
Amity School of Engineering and Technology
• State representation: (x, y)
– x: Contents of four gallon
– y: Contents of three gallon

• Start state: (0, 0)


• Goal state (2, n)
• Operators
– Fill 3-gallon from pump, fill 4-gallon from pump
– Fill 3-gallon from 4-gallon , fill 4-gallon from 3-gallon
– Empty 3-gallon into 4-gallon, empty 4-gallon into 3-
gallon
– Dump 3-gallon down drain, dump 4-gallon down drain
73
State Space Search: Water Jug
Amity School of Engineering and Technology
Problem...
1. (x, y) → (4, y) if x is less than 4, fill the 4 gallon jug
if x  4
2. (x, y) → (x, 3) fill the 3-gallon jug
if y  3
3. (x, y) → (x − d, y) pour some water out of the 4 gallon jug
if x  0
4. (x, y) → (x, y − d) pour some water out of the 3 gallon jug
if y  0
5. (x, y) → (0, y) empty the 4-gallon jug on the ground
if x  0
6. (x, y) → (x, 0) empty the 3-gallon jug on the ground
if y  0

74
Water Jug Problem...
Amity School of Engineering and Technology

7. (x, y) → (4, y − (4 − x)) pour water from the 3- gallon jug into the 4-
gallon jug until the 4-gallon jug is full
if x + y  4, y  0
pour water from the 4- gallon jug into the 3-
8. (x, y) → (x − (3 − y), 3) gallon jug until the 3-gallon jug is full
if x + y  3, x  0
9. (x, y) → (x + y, 0) pour all the water from the 3-gallon jug into
if x + y  4, y  0 the 4-gallon jug

pour all the water from the 4-gallon jug into


10. (x, y) → (0, x + y) the 3-gallon jug
if x + y  3, x  0
pour the 2 gallons from the 3-gallon jug into
11. (0, 2) → (2, 0) the 4-gallon jug

empty the 2 gallons in the 4 gallon jug on the


12. (2, y) → (0, y) ground
75
State Space Search: Water Jug
Amity School of Engineering and Technology

1. Current state = (0, 0)


Problem...
2. Loop until reaching the goal state (2, 0)
- Apply a rule whose left side matches the current state
- Set the new current state to be the resulting state
Gallons in the 4- Gallons in the 3- Rule Applied
Gallon Jug Gallon Jug

0 0 2

0 3 9

3 0 2

3 3 7

4 2 5

0 2 9

2
76
Missionaries and cannibals
Amity School of Engineering and Technology

The missionaries and


cannibals wish to cross a
river
They have a boat that can
hold two people
It is unsafe to have cannibals
outnumber missionaries

77
Missionaries and cannibals
Amity School of Engineering and Technology

MM C M C
M C C M
C C
M

Initial state Goal state

78
States Amity School of Engineering and Technology

• A state can be represented by the number of missionaries


and cannibals on each side of the river
• State(#m, #c, riverbank)
#m → no. of missionaries
#c → no. of cannibals
Bankofriver→ indicates whether the boat in the left bank or
right bank 0→ left bank, 1→right bank
• Initial state (3,3,0)
• Goal state: (0,0,0)

79
OperationsAmity School of Engineering and Technology
• An operation takes us from one state to another
• Here are five possible operations:
– boat takes 1 missionary across river (1m)
– boat takes 1 cannibal across river (1c)
– boat takes 2 missionaries across river (2m)
– boat takes 2 cannibals across river (2c)
– boat takes 1 missionary and 1 cannibal across river (1m1c)

80
The state space
Amity School of Engineering and Technology

3m, 2c etc.

1c etc.
2c 3m, 1c

3m, 3c,
1m
2m, 3c
boat
2m
3m, 2c, etc.
1m, 3c
1m1c 1m boat

2m, 2c
1c 2m, 3c, etc.
boat
1m1c
81
Solution Amity School of Engineering and Technology
1. (3, 3,0) → (0,0,1) Initial state
2. (3, 1,0) → (0,2,1) two cannibal will go
3. (3,2,0) → (0,1,1) one cannibal will return
4. (3,0,0) →(0,3,1) two cannibal will go
5. (3,1,0) →(0,2,1) one cannibal will return
6. (1,1,0) →(2,2,1) two Missionaries will go
7. (2,2,0) →(1,1,1) one cannibal and one Missionaries
will return
8. (0,2,0) →(3,1,1) two Missionaries will go
9. (0,3,0) → (3,0,1) one cannibal will return
10. (0,1,0) →(3,2,1) two cannibal will go
11. (0,2,0) → (3,1,1) one cannibal will return
12. (0,0,0) →(3,3,1) two cannibal will go
82
Farmer river crossingAmity
Problem
School of Engineering and Technology

• A farmer with his wolf, goat and cabbage


come to the edge of a river they all want to
cross the river. There is a boat at the rivers
edge, but only the farmer can row, the boat
can carry two things at a time. if the wolf is
ever left alone with the goat, the wolf will eat
the goat, similar, if the goat is left alone with
the cabbage, the goat will eat the cabbage.

83
Solution
Amity School of Engineering and Technology
• A set of all possible states for a problem is
known as the state space of the problem.
There are 16 sub-states of the man , wolf, goat
and cabbage.
• Some of the 16 states such as GC-MW are
fatal and may never be entered by the system.
MWGC-φ → initial state
φ –MWGC → goal state

84
Sequence of steps for crossing river
Amity School of Engineering and Technology
1. First man crosses the river with goat.
2. Man comes back.
3. Man takes either cabbage (or wolf) with him
to another side.
4. Man comes back with goat to first side.
5. Man takes wolf (or cabbage) with him to
another side.
6. Man comes back.
7. Man takes goat with him to another side.
85
State space representation
Amity School of Engineering and Technology

86
n-queens Amity School of Engineering and Technology

• States: 4 queens in 4 columns (44 = 256 states)


• Actions: move queen in column
• Goal test: no attacks
• Evaluation: h(n) = number of attacks

• Given random initial state, we can solve n-queens for large n


with high probability
Amity School of Engineering and Technology

Search and Control strategies

95
Production system
Amity School of Engineering and Technology

Since search forms the core of many intelligent processes, it is useful to structure AI
programs in a way that facilitates describing and performing the search process.
Production systems provide such structures.
A production system consist of:-
✓ A set of rules, each consisting of a left side (pattern) that determines the applicability
of the rule and a right side describing the operation to be performed.
✓ One or more knowledge/databases that contain whatever information is appropriate
for the particular task.
✓ A control strategy that specifies the order in which the rules will be compared to the
database and a way of resolving the conflicts that arise when several rules match at
once.
✓ A rule applier which is the computational system that
implements the control strategy and applies the rules.
96
Classes of ProductionAmitySystem
School of Engineering and Technology

• Monotonic production system: the application of a rule never


prevents the later application of another rule that could also
have been applied at the time the first rule was selected.

• Non-monotonic production system: Is one in which this is


not true.

• Partially commutative production system: 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.

• Commutative production system: system that is both


monotonic and partially commutative.
90
Control strategies
Amity School of Engineering and Technology
• A control strategy that specifies the order in which the rules will
be applied.
• Control strategies help us to overcome the abnormal situations,
when there are more than one rules or fewer than one rule will
have its left sides match the current state.
• Requirement for control strategy
i. A good control strategy causes motion
ii. A good control strategy is systematic

91
Amity School of Engineering and Technology
Example
(0, 0)

(4, 0) (0, 3)

(4, 3) (0, 0) (1, 3) (4, 3) (0, 0) (3, 0)

92
Search Strategies
Amity School of Engineering and Technology

1. Uninformed search (blind search)(Exhaustive search)(Brute


force)
Having no information about the number of steps from the
current state to the goal.
2. Informed search (heuristic search)
More efficient than uninformed search.

93
Brute Force or Uninformed Search
Amity School of Engineering and Technology
Strategies
❖ These are commonly used search procedure which
explore all the alternatives during the search process.
❖ They do not have any domain specific knowledge.
❖ They need the initial state, the goal state and a set of
legal operators.
❖ The strategy gives the order in which the search space is
searched
❖ The followings are example of uninformed search
– Depth First Search (DFS)
– Breadth First Search (BFS)

94
Search Strategies: Blind Search
Amity School of Engineering and Technology

• Breadth-first search
Expand all the nodes of
one level first.

• Depth-first search
Expand one of the nodes at
the deepest level.

95
Depth First Search
Amity School of Engineering and Technology

• The search begins by expanding the initial node, generate


all successors of the initial node and test them.

• Depth-first search always expands the deepest node in the


current frontier of the search tree.

• Depth-first search uses a LIFO approach.

103
Amity School of Engineering and Technology

97
Amity School of Engineering and Technology

98
Amity School of Engineering and Technology

99
Amity School of Engineering and Technology

100
Amity School of Engineering and Technology

101
Amity School of Engineering and Technology

102
Amity School of Engineering and Technology

103
Amity School of Engineering and Technology

104
Depth-first search
Amity School of Engineering and Technology

105
Amity School of Engineering and Technology

106
Amity School of Engineering and Technology

107
Algorithm for Depth First Search
Amity School of Engineering and Technology

1. If the initial state is a goal state, quit and return success.


2. Otherwise, do the following until success or failure is
signaled:

a) Generate a successor, E, of the initial state. If there are


no more successors, signal failure.

b) Call Depth-First Search with E as the initial state.


c) If success is returned, signal success. Otherwise
continue in this loop.

108
Time and space complexity
Amity School of Engineering and Technology

Time Complexity :
1 + b + b2 + b3 +…+……bd.
Hence Time complexity = O (bd)
Where b-> branching factor
d-> Depth of a tree
Space Complexity :
Hence Space complexity = O (d)

109
Advantages of Depth-First Search
Amity School of Engineering and Technology

i. It requires less memory since only the nodes


of the current path are stored.
ii. By chance, it may find a solution without
examining much of the search space at all.

110
Disadvantages of Depth-First Search
Amity School of Engineering and Technology

i. Determination of the depth until which the


search has to proceed. This depth is called
cut-off depth.
ii. If the cut-off depth is smaller, solution may
not be found.
iii. If cut-off depth is large, time complexity will
be more.
iv. And there is no guarantee to find a minimal
solution, if more than one solution exists.

111
Breadth First Search
Amity School of Engineering and Technology

• Searching processes level by level unlike depth first


search which goes deep into the tree.

• An operator is employed to generate all possible children


of a node.

112
Amity School of Engineering and Technology

113
Amity School of Engineering and Technology

114
Amity School of Engineering and Technology

115
Amity School of Engineering and Technology

116
Breadth-first search
Amity School of Engineering and Technology

•Guaranteed to find shortest solution first


•best-first finds solution a-c-f
•depth-first finds a-b-e-j
Amity School of Engineering and Technology
Amity School of Engineering and Technology
Algorithm of Breadth First Search
Amity School of Engineering and Technology

1. Create a variable called Node-LIST and set it to the initial


state.
2. Until a goal state is found or Node-LIST is empty:
a) Remove the first element from Node-LIST and call it E. if
Node-LIST was empty, quit.
b) For each way that each rule can match the state described
in E do:
i. Apply the rule to generate a new state,
ii. If the new state is a goal state, quit and return this
state.
iii. Otherwise, add the new state to the end of Node-LIST.
Time and space complexity
Amity School of Engineering and Technology

Time Complexity :
1 + b + b2 + b3 +…+……bd.
Hence Time complexity = O (bd)

Space Complexity :
1 + b + b2 + b3 +…+……bd.
Hence Space complexity = O (bd)
Advantages of Breadth-First Search
Amity School of Engineering and Technology

i. Breadth first search will never get trapped


exploring the useless path forever.
ii. If there is a solution, BFS will definitely find it
out.
iii. If there is more than one solution then BFS
can find the minimal one that requires less
number of steps.
Disadvantages of Breadth-First Search
Amity School of Engineering and Technology

i. It requires more memory


ii. Searching process remembers all unwanted
nodes which is of no practical use for the
search.
AmityBFS
School of Engineering and Technology
DFS
It require less memory because only It require more memory because all the
the nodes on the current path are tree that has so far been generated
stored. must be stored.

It is one in which by luck solution can While in BFS all parts of the tree must
be found without examining much of be examined to level n before any
the search space at all. nodes on level n+1 can be examined.
It does not give optimal solution. It gives optimal solution.

DFS may find a long path to a solution BFS guarantees to find a solution if it
in one part of the tree, when a shorter exists. Furthermore if there are
path exists in some other, unexplored multiple solutions, then a minimal
part of the tree. solution will be found.
Time complexity: O(bd ) Time complexity: O(bd )
where b : branching factor, d: depth where b : branching factor, d: depth
Space complexity: O(d) , d: depth Space complexity: O(bd )
where b : branching factor, d: depth
131
Amity School of Engineering and Technology

Building An Expert Systems


Amity School of Engineering and Technology

The process of Building An Expert Systems

•Determining the characteristics of the problem

•Knowledge engineer and domain expert work in coherence to define the problem

•The knowledge engineer translates the knowledge into a computer-


understandable language. He designs an inference engine, a reasoning structure,
which can use knowledge when needed.

•Knowledge Expert also determines how to integrate the use of uncertain


knowledge in the reasoning process and what type of explanation would be useful.
Amity School of Engineering and Technology

Interview the experts

1.Experts in a field are interviewed and their knowledge is collected.

2 Knowledge base is created (component 1) All of the knowledge collected from the experts is
organised and stored in the knowledge base.

The knowledge base is searched by the inference engine (see point 3)

3 Inference Engine is created (component 2) This allows the knowledge base to be searched by the
user.

The inference engine poses questions to the user and then analyses the answers by running a set of
rules that have been programmed into the engine.
Amity School of Engineering and Technology
Examples of questions that a medical diagnosis expert system might pose to a user:

Do you have a runny nose? YES/NO Do you have a sore throat? YES/NO

Examples of rules that allow the inference engine to come up with an answer or a conclusion to a
problem:
IF the patient has a runny nose AND a sore throat THEN the diagnosis is a cold IF the animal has
4 legs AND a tail AND barks THEN the species is a dog.

4 User Interface is created (component 3) This allows the user to communicate with the expert
system. The user interface gives the user the ability to answer questions posed by the system.
Common ways of doing this are:
Text boxes Check boxes / Option buttons Submit buttons

5 Testing Finally the expert system is tested to make sure that the correct answers to problems or
questions are being generated.
Amity School of Engineering and Technology

Thank You
Amity School of Engineering and Technology

Intelligent Agents
Amity School of Engineering and Technology

Agent in AI
• Agent perceives environment through sensors and act upon
that environment through actuators.
• An Agent runs in the cycle of perceiving, thinking,
and acting.
– Human Agent: eyes, ears, and other organs, o/p leg movement
– Robotic agent: cameras, infrared range finder, NLP for sensors
– Software agent: keystrokes, file contents as sensory input
Amity School of Engineering and Technology

Sensor:
• Sensor is a device which detects the change in the
environment and sends the information to other electronic
devices. An agent observes its environment through sensors.
Amity School of Engineering and Technology

Actuators
• Actuators are the component of machines that converts
energy into motion. The actuators are only responsible for
moving and controlling a system.
• An actuator can be an electric motor, gears, rails, etc
Amity School of Engineering and Technology

Effectors:
• Effectors are the devices which affect the environment.
Effectors can be legs, wheels, arms, fingers, wings, fins, and
display screen
Amity School of Engineering and Technology

Agent
Amity School of Engineering and Technology

Conclusion
• Agent perceives environment through sensors and act upon
that environment through actuators
• Agents can solve or provide solution to a given problem
Rules of AIAmity School of Engineering and Technology

• Rule 1: An AI agent must have the ability to perceive the


environment.
• Rule 2: The observation must be used to make decisions.
• Rule 3: Decision should result in an action.
• Rule 4: The action taken by an AI agent must be a rational
action
Amity School of Engineering and Technology

More about agents


• which has clear preference,
• models uncertainty,
• acts in a way to maximize its performance measure
• perform the right things.
• use for game theory and decision theory for various real-world
scenarios.
• For best possible action, agent gets the positive reward and for
each wrong action, an agent gets a negative reward.
Amity School of Engineering and Technology

Agents and problem solving


• Agents can solve or provide solution to a given problem
• They can be goal based agents i.e they have to reach a goal
following a path and rules.
Amity School of Engineering and Technology

Problem solving
• Defining the objective i.e goal state
Goal
formulation • Limiting the objective

• Actions and states based on current state and goal


Problem
formulation • Converting the problem into formal statement,

• Look for sequence of actions, take problem as input and return a


search solution

• Look for a solution that provides optimal solution


solution

• Applying the solution to get the desired output


execution
Amity School of Engineering and Technology

Problem formulation
• a problem-solving is a part of artificial intelligence which
encompasses
• a number of techniques such as algorithms.
• heuristics to solve a problem.
Amity School of Engineering and Technology

Steps performed by Problem-solving agent


• Goal Formulation: one goal/ multiple goals
• Problem Formulation: what actions should be taken to achieve
the formulated goal.
• Initial State: starting state or initial step of the agent towards its
goal.
• Transition Model: It describes what each action does
• Goal Test: It determines if the given state is a goal state
• Path cost: numeric cost to each path that follows the goal.
Amity School of Engineering and Technology

State space
• Initial state, actions, and transition model together define
the state-space of the problem implicitly.
• State-space of a problem is a set of all states which can be
reached from the initial state followed by any sequence of
actions.
• The state-space forms a directed map or graph where nodes are
the states, links between the nodes are actions, and the path is a
sequence of states connected by the sequence of actions.
Amity School of Engineering and Technology

Example Problems: toy problems


• 8 Puzzle Problem:
Amity School of Engineering and Technology
Amity School of Engineering and Technology

The problem formulation for 8 puzzle


• States: It describes the location of each numbered tiles and the blank tile.
• Initial State: We can start from any state as the initial state.
• Actions: Here, actions of the blank space is defined, i.e., either left, right, up
or down
• Transition Model: It returns the resulting state as per the given state and
actions.
• Goal test: It identifies whether we have reached the correct goal-state.
• Path cost: The path cost is the number of steps in the path where the cost of
each step is
Amity School of Engineering and Technology

Design thinking in AI
• Successful AI implementations
• Figure out why, where, and how they can apply AI to
specific business problems.
• Probe deeper into the problem statement and its possible
solutions.
• Accelerate their AI adoption process
• Reduce the resistance to change.
Amity School of Engineering and Technology

Design thinking in AI
• Machine • Semenatic
learning web

Human
thinking
like

optimal acting

• airplanes • Dancing
• autopilot bots
Amity School of Engineering and Technology

Design thinking process/ non linear process


Amity School of Engineering and Technology
How to Develop an Empathic Approach in Design
Amity School of Engineering and Technology

Thinking

• innate quality in all people.


• engaging and observing the people
• People is audience, you intend to help
• Abandon Your Ego
• Adopt Humility
• be a Good Listener
• Hone Your Observation skills
• Care
Amity School of Engineering and Technology
Amity School of Engineering and Technology
Amity School of Engineering and Technology

ideate

• Brainstorm potential solution


• Select and develop your own sollution
Amity School of Engineering and Technology

prototype
• Design a prototype to test all or part of your solution
Amity School of Engineering and Technology

testing
• Understand the impediments
• What works?
• Role play
• Iterate quickly
Amity School of Engineering and Technology

Conclusion
• It helps keep a human element at the centre of the process
• It takes the guesswork out of what your client’s needs are
• It allows you to prioritize solutions
• It generates revolutionary ideas by creating a “yes, and…”
mentality during brainstorming
• It helps teams learn quickly by allowing the team to fail faster
and build out ideas more effectively
• It’s flexible, allowing you to move forward and backward
through the process to prototype and iterate faster

You might also like