Unit I

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

Artificial Intelligence

Unit 1
What is Artificial Intelligence?

“The science and engineering of making intelligent machines,


especially intelligent computer programs”.
by John McCarthy (1956)

Compiled by Dr. Vijay Singh, Graphic Era Deemed to be


2
University, Dehradun
Applications of AI

Compiled by Dr. Vijay Singh, Graphic Era Deemed to be


3
University, Dehradun
Programming Languages for AI

Compiled by Dr. Vijay Singh, Graphic Era Deemed to be


4
University, Dehradun
AI, Machine Learning and Deep Learning

Compiled by Dr. Vijay Singh, Graphic Era Deemed to be


5
University, Dehradun
Simulation of sophisticated and intelligent
behavior in different areas

Simulation of sophisticated and intelligent behavior can be achieved by the


following methods:

• Turing Test
• Agents
• Application area of AI
Turing Test
The test is conducted in an interrogation room run by a judge. The test
subjects, a person and a computer program, are hidden from view. The
judge has a conversation with both parties and attempts to identify
which is the human and which is the computer, based on the quality of
their conversation. Turing concludes that if the judge can't tell the
difference, the computer has succeeded in demonstrating human
intelligence. That is, it can think.
Agents in Artificial Intelligence
Artificial intelligence is defined as the study of rational agents. A rational
agent could be anything that makes decisions, as a person, firm, machine, or
software. It carries out an action with the best outcome after considering
past and current percepts(agent’s perceptual inputs at a given instance). An
AI system is composed of an agent and its environment. The agents act in
their environment. The environment may contain other agents.
• An agent is anything that can be viewed as :
perceiving its environment through sensors and
acting upon that environment through actuators
Types of Agent
Agents can be grouped into five classes based on their degree of
perceived intelligence and capability :
• Simple Reflex Agents

• Model-Based Reflex Agents

• Goal-Based Agents

• Utility-Based Agents

• Learning Agent
Simple reflex agents
Simple reflex agents ignore the rest of the percept history and act only on the basis
of the current percept. Percept history is the history of all that an agent has
perceived to date. The agent function is based on the condition-action rule. A
condition-action rule is a rule that maps a state i.e, condition to an action. If the
condition is true, then the action is taken, else not.
Model-based reflex agents
It works by finding a rule whose condition matches the current
situation. A model-based agent can handle partially observable
environments by the use of a model about the world. The agent has to
keep track of the internal state which is adjusted by each percept and
that depends on the percept history. The current state is stored inside
the agent which maintains some kind of structure describing the part
of the world which cannot be seen.
Goal-based agents
These kinds of agents take decisions based on how far they are
currently from their goal(description of desirable situations). Their
every action is intended to reduce its distance from the goal. This
allows the agent a way to choose among multiple possibilities, selecting
the one which reaches a goal state.
Utility-based agents
The agents which are developed having their end uses as building blocks are called
utility-based agents. When there are multiple possible alternatives, then to decide
which one is best, utility-based agents are used. They choose actions based on
a preference (utility) for each state. Sometimes achieving the desired goal is not
enough. We may look for a quicker, safer, cheaper trip to reach a destination.
Learning Agent :
A learning agent in AI is the type of agent that can learn from its past experiences or it has learning
capabilities. It starts to act with basic knowledge and then is able to act and adapt automatically
through learning.
A learning agent has mainly four conceptual components, which are:

• Learning element: It is responsible for making improvements by learning from the environment

• Critic: The learning element takes feedback from critics which describes how well the agent is
doing with respect to a fixed performance standard.

• Performance element: It is responsible for selecting external action

• Problem Generator: This component is responsible for suggesting actions that will lead to new
and informative experiences.
Application of AI
Problem solving in games
Problems are the issues which comes across any system. A solution is
needed to solve that particular problem.

Solve problem using Artificial Intelligence:


The process of solving a problem consists of five steps.

These are:
• Defining The Problem
• Analyzing The Problem
• Identification Of Solutions
• Choosing a Solution
• Implementation
Problem Solving in Artificial Intelligence
1. Defining The Problem: The definition of the problem must be
included precisely. It should contain the possible initial as well as
final situations which should result in acceptable solution.
2. Analyzing The Problem: Analyzing the problem and its requirement
must be done as few features can have immense impact on the
resulting solution.
3. Identification Of Solutions: This phase generates reasonable
amount of solutions to the given problem in a particular range.
4. Choosing a Solution: From all the identified solutions, the best
solution is chosen basis on the results produced by respective
solutions.
5. Implementation: After choosing the best solution, its
implementation is done.
Automated reasoning
Automated reasoning is the area of computer science that is concerned
with applying reasoning in the form of logic to computing systems. If
given a set of assumptions and a goal, an automated reasoning system
should be able to make logical inferences towards that goal
automatically. Computers that use automated reasoning can be used to
automate and apply logical reasoning to activities such as proving
theorems, checking proofs or designing circuits

Reasoning: is a process of drawing conclusion from facts.


Deductive reasoning:
• Deductive reasoning is deducing new information from logically related known
information. It is the form of valid reasoning, which means the argument's
conclusion must be true when the premises are true.
• Deductive reasoning is a type of propositional logic in AI, and it requires various
rules and facts. It is sometimes referred to as top-down reasoning, and
contradictory to inductive reasoning.
• In deductive reasoning, the truth of the premises guarantees the truth of the
conclusion.
Inductive Reasoning:
• Inductive reasoning is a form of reasoning to arrive at a conclusion
using limited sets of facts by the process of generalization. It starts
with the series of specific facts or data and reaches to a general
statement or conclusion.
• Inductive reasoning is a type of propositional logic, which is also
known as cause-effect reasoning or bottom-up reasoning.
• In inductive reasoning, we use historical data or various premises to
generate a generic rule, for which premises support the conclusion.
• In inductive reasoning, premises provide probable supports to the
conclusion, so the truth of premises does not guarantee the truth of
the conclusion.
Abductive reasoning:

Abductive reasoning is a form of logical reasoning which starts with


single or multiple observations then seeks to find the most likely
explanation or conclusion for the observation.
• Abductive reasoning is an extension of deductive reasoning, but in
abductive reasoning, the premises do not guarantee the conclusion.
• Example:
• Implication: Cricket ground is wet if it is raining
• Axiom: Cricket ground is wet.
• Conclusion It is raining.
Heuristic Search Techniques
• Direct techniques (blind search) are not always possible (they require
too much time or memory).

• Weak techniques can be effective if applied correctly on the right


kinds of tasks.

• Typically require domain specific information.

26
Example: 8 Puzzle

1 2 3 1 2 3
7 8 4 8 4
6 5 7 6 5
27
1 23 GOAL 1 23
8 4 7 84
7 65 6 5

right

1 23 1 23 1 23
7 84 7 84 7 4
6 5 6 5 6 85

Which move is best?

28
8 Puzzle Heuristics
• Blind search techniques used an arbitrary ordering (priority) of
operations.
• Heuristic search techniques make use of domain specific information -
a heuristic.
• What heurisitic(s) can we use to decide which 8-puzzle move is “best”
(worth considering first).

29
8 Puzzle Heuristics
• For now - we just want to establish some ordering to the possible
moves (the values of our heuristic does not matter as long as it ranks
the moves).
• Later - we will worry about the actual values returned by the heuristic
function.

30
A Simple 8-puzzle heuristic
• Number of tiles in the correct position.
• The higher the number the better.
• Easy to compute (fast and takes little memory).
• Probably the simplest possible heuristic.

31
Another approach
• Number of tiles in the incorrect position.
• This can also be considered a lower bound on the number of moves from a
solution!
• The “best” move is the one with the lowest number returned by the heuristic.
• Is this heuristic more than a heuristic (is it always correct?).
• Given any 2 states, does it always order them properly with respect to the minimum
number of moves away from a solution?

32
1 23 GOAL 1 23
8 4 7 84
7 65 6 5

right

1 23 1 23 1 23
7 84 7 84 7 4
6 5 6 5 6 85
h=2 h=4 h=3

33
Another 8-puzzle heuristic
• Count how far away (how many tile movements) each tile is from it’s
correct position.
• Sum up this count over all the tiles.
• This is another estimate on the number of moves away from a
solution.

34
1 23 GOAL 1 23
8 4 7 84
7 65 6 5

right

1 23 1 23 1 23
7 84 7 84 7 4
6 5 6 5 6 85
h=2 h=4 h=4

35
Techniques
• There are a variety of search techniques that rely on the estimate
provided by a heuristic function.
• In all cases - the quality (accuracy) of the heuristic is important in real-
life application of the technique!

36
Generate-and-test
• Very simple strategy - just keep guessing.

do while goal not accomplished


generate a possible solution
test solution to see if it is a goal

• Heuristics may be used to determine the specific rules for solution


generation.

37
Example - Traveling Salesman Problem (TSP)
• Traveler needs to visit n cities.
• Know the distance between each pair of cities.
• Want to know the shortest route that visits all the cities once.
• n=80 will take millions of years to solve exhaustively!

38
TSP Example

A 6 B
1 2
5 3

D 4 C

39
Generate-and-test Example
• TSP - generation of possible
solutions is done in
lexicographical order of cities: A B C D
1. A - B - C - D
2. A - B - D - C
3. A - C - B - D B C D
4. A - C - D - B
...
C D B D C B

D C D B B C
40

You might also like