Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
10 views52 pages

Slides Module3

Module 3 of the Bachelor of Science (Honours) in Data Science and Artificial Intelligence course focuses on understanding problems in artificial intelligence, including problem definition, characteristics, state-space search, and search strategies. It emphasizes the importance of defining problems, exploring problem spaces, and utilizing search algorithms to find solutions. The module also discusses various examples, such as the vacuum world and the 8-puzzle, to illustrate problem-solving techniques in AI.

Uploaded by

jyrfjidjjhstull
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)
10 views52 pages

Slides Module3

Module 3 of the Bachelor of Science (Honours) in Data Science and Artificial Intelligence course focuses on understanding problems in artificial intelligence, including problem definition, characteristics, state-space search, and search strategies. It emphasizes the importance of defining problems, exploring problem spaces, and utilizing search algorithms to find solutions. The module also discusses various examples, such as the vacuum world and the 8-puzzle, to illustrate problem-solving techniques in AI.

Uploaded by

jyrfjidjjhstull
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/ 52

Bachelor of Science (Honours) in Data Science and Artificial Intelligence

DA109: AI Basics

Module 3

Problems in AI
Learning objective of Module 3

➢ Aim to equip learners with a solid understanding of the principles,


techniques, and methodologies used in solving problems using
artificial intelligence.

3
Parts
➢ Problem definition
❑ How to define problems in AI?

➢ Problem characteristics
❑ Categorization and characteristics of problems in AI.

➢ State-space search
❑ Basic idea of problem solving in AI.

➢ Significance of search
❑ Search as a tool for problem solving in AI.

➢ Search strategies
❑ Brief overview of the searching techniques in AI.
4
Part - I
Problem definition

5
Problem definition

➢ A problem is a specific task or challenge that requires finding a solution or making a decision.

➢ In artificial intelligence, problems can vary in complexity and scope, ranging from simple tasks like arithmetic
calculations to complex challenges such as image recognition, natural language processing, game playing,
and optimization.

➢ Each problem has a defined set of initial states, possible actions or moves, and a goal state that needs to be
reached or achieved.

➢ For example, in a game of chess, the problem is to find a sequence of moves that lead to checkmate, while in
route planning, the problem is to find the shortest path between two locations on a map.

6
Problem Space

➢ The problem space is the set of all possible states, actions, and transitions that can be encountered while
attempting to solve a specific problem. It represents the entire landscape of potential solutions and paths from
the initial state to the goal state.

➢ In other words, the problem space defines all the possible configurations or arrangements of elements
involved in the problem and the set of valid moves or actions that can be taken at each state.

➢ Each state in the problem space represents a specific configuration, and each action represents a possible
move or step from one state to another.

➢ For example, in the problem of route planning, the problem space includes all possible locations on the map
as states and all valid roads or paths between them as actions.

7
Search

➢ Search is the process of exploring the problem space to find a sequence of actions or moves that lead to the
goal state or a satisfactory solution.

➢ In AI, search algorithms are used to systematically navigate through the problem space and discover paths or
solutions that satisfy the problem’s constraints and objectives.

➢ The search process involves starting from the initial state and exploring possible actions to generate new
states.

➢ These states are then evaluated based on certain criteria (e.g., distance to the goal, cost, or utility) to
determine the most promising states to explore further.

➢ The process continues iteratively until the goal state is reached or a satisfactory solution is found.
8
Well-defined problems and solutions

➢ The initial state that the agent starts in.

➢ A description of the possible actions available to the agent.

➢ A description of what each action does; the formal name for this is the transition model.

➢ The goal test, which determines whether a given state is a goal state.

➢ A path cost function that assigns a numeric cost to each path.

9
Vacuum world
➢ States:.

➢ Initial state:

➢ Actions:

➢ Transition model:

➢ Goal test:

➢ Path cost:

10
Vacuum world
➢ States: The state is determined by both the agent location and the dirt locations. The agent is in one of two
locations, each of which might or might not contain dirt.

➢ Initial state: Any state can be designated as the initial state.

➢ Actions: In this simple environment, each state has just three actions: Left, Right, and Suck. Larger
environments might also include Up and Down.

➢ Transition model: The actions have their expected effects, except that moving Left in the leftmost square,
moving Right in the rightmost square, and Sucking in a clean square have no effect.

➢ Goal test: This checks whether all the squares are clean.

➢ Path cost: Each step costs 1, so the path cost is the number of steps in the path.

11
8-puzzle
➢ States: A state description specifies the location of each of the eight tiles and the blank in one of the nine
squares.

➢ Initial state: Any state can be designated as the initial state. Note that any given goal can be reached from
exactly half of the possible initial states.

➢ Actions: The simplest formulation defines the actions as movements of the blank space Left, Right, Up, or
Down. Different subsets of these are possible depending on where the blank is.

➢ Transition model: Transition model: Given a state and action, this returns the resulting state; for example, if
we apply Left to the start state in Figure 3.4, the resulting state has the 5 and the blank switched.

➢ Goal test: This checks whether the state matches the goal configuration (Other goal configurations are
possible).

➢ Path cost: Each step costs 1, so the path cost is the number of steps in the path.

12
13
Part - II
Problem characteristics

14
Problem Characteristics

➢ To choose an appropriate method for a particular problem:

❑ Is the problem decomposable?

❑ Can solution steps be ignored or undone?

❑ Is the universe predictable?

❑ Is a good solution absolute or relative?

❑ Is the solution a state or a path?

❑ What is the role of knowledge?

❑ Does the task require human-interaction?

15
Is the problem decomposable?

➢ Can the problem be broken down to smaller problems to be solved independently?

➢ Decomposable problem can be solved:


❑ easily
❑ using the divide-and-conquer technique

➢ Use of decomposing problems:


❑ Each sub-problem is simpler to solve
❑ Each sub-problem can be handed over to a different processor. Thus can be solved in parallel
processing environment.

16
Can solution steps be ignored or undone?

➢ Theorem Proving
❑ Suppose we have proved some lemma in order to prove a theorem and eventually realized that
lemma is no help at all, then ignore it and prove another lemma.

➢ Ignorable!
❑ Can be solved by using simple control strategy.

17
Can solution steps be ignored or 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!
❑ Solved by backtracking so control strategy must be implemented using a stack.

18
Can solution steps be ignored or undone?

➢ Playing chess

❑ Moves cannot be retracted.

➢ Irrecoverable!

❑ Can be solved by planning process.

19
Is the universe predictable?

➢ The 8-Puzzle

❑ Every time we make a move, we know exactly what will happen. Certain outcome!

➢ Playing bridge

❑ We cannot know exactly where all the cards are or what the other players will do on their turns.
Uncertain outcome!

20
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

21
Is a good solution absolute or relative?

➢ Marcus was a man.


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

22
Is a good solution absolute or relative?

➢ Marcus was a man.


➢ Marcus was a Pompeian.
➢ Marcus was born in 40 A.D.
➢ All men are mortal.
➢ All Pompeians died when the volcano erupted in 79 A.D.
➢ No mortal lives longer than 150 years.
➢ It is now 2019 A.D.

Is Marcus alive?

➢ Different reasoning paths lead to the answer. It does not matter which path we follow.

23
Is a good solution absolute or relative?

➢ The Travelling Salesman Problem

❑ We have to try all paths to find the shortest one.

➢ 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.

24
Is the solution a state or a path?

➢ Finding a consistent interpretation

❑ “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.

➢ The Water Jug Problem

❑ The path that leads to the goal must be reported.

25
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.

26
What is the role of knowledge

➢ Two examples:

❑ Chess: Knowledge is required to constrain the search for a solution.


❑ Newspaper story understanding: Lot of knowledge is required even to be able to recognize a solution.

➢ Consider a problem of scanning daily newspapers to decide which are supporting the democrats and
which are supporting the republicans in some election. We need lots of knowledge to answer such
questions as:

❑ The names of the candidates in each party.

❑ The facts that if the major thing you want to see done is have taxes lowered, you are probably
supporting the republicans.
❑ The fact that if the major thing you want to see done is improved education for minority students, you
are probably supporting the democrats.

27
Does the task require human-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.

28
29
Part - III
State-space search

30
State space search

➢ State space is a set of legal positions.

➢ Starting at the initial state.

➢ Using the set of rules to move from one state to another.

➢ Attempting to end up in a goal state.

31
State space search: Playing Chess

➢ Each position can be described by a symbol in a 8-by-8 array.


➢ Initial position is the game opening position.
➢ Goal position is any position in which the opponent does not have a legal move and his or her king is
under attack.
➢ Legal moves can be described by a set of rules:

❑ Left sides are matched against the current state.


❑ Right sides describe the new resulting state.

32
State Space Search: Water Jug Problem

➢ “You are given two jugs, a 4-litre one and a 3-litre one. Neither has any measuring markers on it. There
is a pump that can be used to fill the jugs with water. How can you get exactly 2 liters of water into 4-litre
jug.”

33
State Space Search: Water Jug Problem

➢ State: (x, y) : x represents the Litres of water in 4-Litres jug and y for 3-Litres jug.
x = 0, 1, 2, 3, or 4 y = 0, 1, 2, 3
➢ Start state: (0, 0).
➢ Goal state: (2, n) for any n.
➢ Attempting to end up in a goal state.

34
Production rules for Water Jug Problem

➢ The operators to be used to solve the problem can be described as follows:

Sr No Current state Next State Descritpion


1 (x,y) if x < 4 (4,y) Fill the 4 Litre jug

2 (x,y) if y <3 (x,3) Fill the 3 Litres jug

3 (x,y) if x > 0 (x-d, y) Pour some water out of the 4 Litres jug

4 (x,y) if y > 0 (x, y-d) Pour some water out of the 3-Litres jug

5 (x,y) if x>0 (0, y) Empty the 4 Litres jug

6 (x,y) if y >0 (x,0) Empty the 3 Litres jug on the ground

7 (x,y) if x+y >= 4 (4, y-(4-x)) Pour water from the 3 –Litres jug into the 4
and y >0 –Litres jug until the 4-Litres jug is full

35
Production rules for Water Jug Problem

➢ The operators to be used to solve the problem can be described as follows:

8 (x, y) if x+y >= 3 and (x-(3-y), 3) Pour water from the 4-Litres jug into the
x>0 3-Litres jug until the 3-Litres jug is full

9 (x, y) if x+y <=4 and (x+y, 0) Pour all the water from the 3-Litres jug
y>0 into the 4-Litres jug
10 (x, y) if x+y <= 3 and (0, x+y) Pour all the water from the 4-Litres jug
x>0 into the 3-Litres jug
11 (0,2) (2,0) Pour the 2 Litres from 3-Litres jug into the
4-Litres jug
12 (2,y) (0,y) Empty the 2 Litres in the 4-Litres jug on
the ground

36
State Space Search: Water Jug Problem

1. Current state = (0, 0)


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
(0, 0)
(0, 3)
(3, 0)
(3, 3)
(4, 2)
(0, 2)
(2, 0)

37
State Space Search: Water Jug Problem

➢ The role of the condition in the left side of a rule


restrict the application of the rule
more efficient

1. (x, y) → (4, y)
if x  4
2. (x, y) → (x, 3)
if y  3

38
State Space Search: Water Jug Problem

➢ Special-purpose rules to capture special-case knowledge that can be used at some stage in solving a problem.

11. (0, 2) → (2, 0)

12. (2, y) → (0, y)

39
State Space Search: Water Jug Problem

➢ There are initial and final description of the problem.


➢ There are more than one ways of solving the problem.
➢ One would exercise a choice between various solution paths based on some criteria of goodness or on some
heuristic function.
➢ There are set of rules that describe the actions called production rules.
➢ Left side of the rules is current state and right side describes new state that results from applying the rule.

40
State Space Search: Water Jug Problem

1. Define a state space that contains all the possible configurations of the relevant objects.
2. Specify the initial states.
3. Specify the goal states.
4. Specify a set of rules:
- What are unstated assumptions?
- How general should the rules be?
- How much knowledge for solutions should be in the
rules?

5. Order of application of the rules is called control strategy. Control strategy should cause motion towards a
solution.

41
42
Part - IV
Significance of search

43
Significance of search
➢ Why is search necessary?

❑ No model of the world is complete, consistent, and computable. Any intelligent systems
must encounter surprises.

❑ Solutions cannot be entirely precomputed; Many problems must be solved dynamically,


starting from observed data.

❑ Search provides flexibility to deal with a highly variable environment.

❑ Search can handle local ambiguity in interpretation of perceptual data. Global constraints
can provide unambiguous total interpretation.

44
Significance of search

➢ To achieve goals or to maximize our utility, we need to predict what the result of our actions in the
future will be.

➢ There are many sequences of actions, each with their own utility.

➢ We want to find or search for the best one.

45
46
Part - V
Search strategies

47
Characteristics of good Search Strategies
➢ Requirements of a good search strategy:

❑ It causes motion: Otherwise, it will never lead to a solution. [In water jug problem, if we apply a simple
control strategy of starting each time from the top of rule list and choose the first applicable one, then
we will never move towards solution.]

❑ It is systematic: Otherwise, it may use more steps than necessary. [If we choose another control
strategy, let us say, choose a rule randomly from the applicable rules then definitely it causes motion
and eventually will lead to a solution. But one may arrive to same state several times. This is because
control strategy is not systematic.]

❑ It is efficient: Find a good, but not necessarily the best, answer.

48
Efficient Search Strategies
➢ A search strategy is defined by picking the order of node expansion

➢ Strategies are evaluated along the following dimensions:

❑ Completeness: does it always find a solution if one exists?


❑ Time complexity: How long does it take to find a solution?
❑ Space complexity: How much memory is needed to perform the search?
❑ Optimality: does it always find a least-cost solution?

➢ Time and space complexity are measured in terms of

❑ b: maximum branching factor of the search tree


❑ d: depth of the least-cost solution
❑ m: maximum depth of the state space (may be ∞)

49
Broad Classification of Search Strategies
➢ Uninformed (blind) search : Having no information about the number of steps from the current state to
the goal.
❑ Depth-first
❑ Breadth-first
❑ Uniform-cost search
❑ Iterative deepening
❑ Bi-directional search

➢ Informed (heuristic) search : More efficient than uninformed search.

❑ A* search: Minimizing the total estimated solution cost


❑ Memory-bounded heuristic search

50
51
Summary
➢ The major points to recall are as follows:

❑ Problem definition: States, Initial state, Actions, Transition model, Goal test, Path cost

❑ Problem characteristics: decomposable, ignored or undone, predictable, absolute or relative,


state or a path

❑ State space search: Define a state space, Specify the initial states, specify the goal states,
Specify a set of rules, and Order of application of the rules.

❑ Significance of search: Define a state space, Specify the initial states, specify the goal
states, Specify a set of rules, and Order of application of the rules.

❑ Search strategies: Characteristics, Informed and Uninformed.

52

You might also like