0% found this document useful (0 votes)
71 views

Artificial Intelligence AI Notes Chapter3

The document defines a state space search problem and provides examples. It discusses representing a problem as a state space with initial states, goal states, and operators that change states. The water jug problem is presented as an example state space search problem that is solved using a set of production rules and a control strategy to systematically move through the problem space from an initial to goal state.

Uploaded by

Shivani Rana
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)
71 views

Artificial Intelligence AI Notes Chapter3

The document defines a state space search problem and provides examples. It discusses representing a problem as a state space with initial states, goal states, and operators that change states. The water jug problem is presented as an example state space search problem that is solved using a set of production rules and a control strategy to systematically move through the problem space from an initial to goal state.

Uploaded by

Shivani Rana
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/ 18

➡ DEFINING PROBLEM AS A STATE SPACE SEARCH

To solve the problem of playing a game, we require the rules of the game and targets for
winning as well as representing positions in the game. The opening position can be
defined as the initial state and a winning position as a goal state. Moves from initial state
to other states leading to the goal state follow legally. However, the rules are far too
abundant in most games— especially in chess, where they exceed the number of
particles in the universe. Thus, the rules cannot be supplied accurately and computer
programs cannot handle easily. The storage also presents another problem but searching
can be achieved by hashing.

The number of rules that are used must be minimized and the set can be created by
expressing each rule in a form as possible. The representation of games leads to a state
space representation and it is common for well-organized games with some structure.
This representation allows for the formal definition of a problem that needs the movement
from a set of initial positions to target positions. It means that the solution involves using
known techniques and a systematic search. This is quite a common method in Artificial
Intelligence.

➡ State Space Search


A state space represents a problem in terms of states and operators that change states.
A state space consists of:

• A representation of the states the system can be in. For example, in a board game, the
board represents the current state of the game.

• A set of operators that can change one state into another state. In a board game, the
operators are the legal moves from any given state. Often the operators are
represented as programs that change a state representation to represent the new
state.

• An initial state.

• A set of final states; some of these may be desirable, others undesirable.

• This set is often represented implicitly by a program that detects terminal states.

Examples: Water jug problem, tic-tac-toe problem

Water Jug Problem:

In this problem, we use two jugs called four and three; four holds a maximum of four
gallons of water and three a maximum of three gallons of water. How can we get two
gallons of water in the four jug?

Ans- A=4L and B=3L Fill up B all the way up to its brim. Now we have 3L in B and no
water in A

1. Decant the contents of B into A. We now have 3L of water in A while B is


empty.

2. Fill up B again. We now have 3L in both the containers.

3. Decant the contents of B into A until A is full. Container A already has 3L


in it. Since, its maximum capacity was 4L, it can still accommodate 1 L
of water. Container B has 3L and when you useit to fill up A, only 1L is
transferred before A fills up. Leaving 2L of water in B.

The state space is a set of prearranged pairs giving the number of gallons of water in the
pair of jugs at any time, i.e., (four, three) where four = 0, 1, 2, 3 or 4 and three = 0, 1, 2 or
3.

The start state is (0, 0) and the goal state is (2, n) where n may be any but it is limited to
three holding from 0 to 3 gallons of water or empty. Three and four shows the name and
numerical number shows the amount of water in jugs for solving the water jug problem.
The major production rules for solving this problem are shown below:

Initial condition
1. (four, three) if four < 4

2. (four, three) if three< 3

3. (four, three) If four > 0

4. (four, three) if three > 0

5. (four, three) if four + three<4

6. (four, three) if four + three<3

7. (0, three) If three > 0 8. (four, 0) if four > 0 9. (0, 2)

10. (2, 0)

11. (four, three) if four < 4 12. (three, four) if three < 3

Goal comment
(4, three) fill four from tap

(four, 3) fill three from tap

(0, three) empty four into drain (four, 0) empty three into drain (four + three, 0) empty three
into four

(0, four + three) empty four into three

(three, 0) empty three into four

(0, four) empty four into three

(2, 0) empty three into four

(0, 2) empty four into three

(4, three-diff) pour diff, 4-four, into four from three

(four-diff, 3) pour diff, 3-three, into three from four and a solution is given below four three
rule

The problem solved by using the production rules in combination with an appropriate
control strategy, moving through the problem space until a path from an initial state to a
goal state is found. In this problem solving process, search is the fundamental concept.
For simple problems, it is easier to achieve this goal by hand but there will be cases
where this is far too difficult.

So, State Space Searching solving a particular problem consist of following 4 steps:

1. Define a state space that contain all the possible states for solving a problem

2. Specify 1 more state (from which the problem solving process may start. They are
called initial states).

3. Specify one or more states that would be acceptable as solution to the problem and
called goal states.

4. Specify a set of rules that describes the actions available (production rules).

➡ CONTROL STRATEGIES

A good control strategy should have the following requirements :

1. The first requirement is that it causes motion. In a game playing program the pieces
move on the board and in the water jug problem water is used to fill jugs.

2. The second requirement is that it is systematic, this is a clear requirement for it would
not be sensible to fill a jug and empty it repeatedly nor in a game would it be
advisable to move a piece round and round the board in a cyclic way.

We shall initially consider two systematic approaches to searching.

For more: https://www.slideshare.net/ameykerkar/control-strategies-in-ai

For more: https://www.cet.edu.in/noticefiles/271_AI%20Lect%20Notes.pdf (Page-21)

EXTRA:

MONOTONIC AND NON MONOTONIC LEARNING

1. Monotonic learning is when an agent may not learn any knowledge that contradicts
what it already knows. For example, it may not replace a statement with its negation.
Thus, the knowledge base may only grow with new facts in a monotonic fashion.

The advantages of monotonic learning are:

• Greatly simplified truth-maintenance

• Greater choice in learning strategies

2. Non-monotonic learning is when an agent may learn knowledge that contradicts what
it already knows. So it may replace old knowledge with new if it believes there is sufficient
reason to do so.

The advantages of non-monotonic learning are:

• Increased applicability to real domains,

• Greater freedom in the order things are learned in

A related property is the consistency of the knowledge. If an architecture must maintain a


consistent knowledge base then any learning strategy it uses must be monotonic.

➡ Problem Characteristics

Here we will discuss about 7-problem characteristics. A problem may have different
aspects of representation and explanation. In order to choose the most appropriate
method for a particular problem, it is necessary to analyze the problem along several key
dimensions.

Some of the main key features of a problem are given below.

• ︎Is the problem decomposable into set of sub problems?

• ︎Can the solution step be ignored or undone?

• ︎Is the problem universally predictable?

• ︎Is a good solution to the problem obvious without comparison to all the possible
solutions? ︎ Is the desire solution a state of world or a path to a state?

• ︎Is a large amount of knowledge absolutely required to solve the problem?

• ︎Will the solution of the problem required interaction between the computer and the
person?

The above characteristics of a problem are called as 7-problem characteristics under


which the solution must take place.

For more: https://www.cet.edu.in/noticefiles/271_AI%20Lect%20Notes.pdf (Page 26)

➡ Production System Characteristics

1. Production System
• The production system is a model of computation that can be applied to implement
search algorithms and model human problem solving. Such problem solving
knowledge can be packed up in the form of little quanta called productions.

• A production is a rule consisting of a situation recognition part and an action part. A


production is a situation-action pair in which the left side is a list of things to watch for
and the right side is a list of things to do so.

• When productions are used in deductive systems, the situation that trigger
productions are specified combination of facts. The actions are restricted to being
assertion of new facts deduced directly from the triggering combination. Production
systems may be called premise conclusion pairs rather than situation action pair.

• A production system consists of 4components which are:

a) A set of production rules, which are of the form A→B. Each rule consists of left
hand side constituent that represent the current problem state and a right hand
side that represent an output state. A rule is applicable if its left hand side
matches with the current problem state.

b) A database, which contains all the appropriate information for the particular task.
Some part of the database may be permanent while some part of this may
pertain only to the solution of the current problem.

c) A control strategy that specifies order in which the rules will be compared to the
database of rules and a way of resolving the conflicts that arise when several
rules match simultaneously.

d) A rule applier, which checks the capability of rule by matching the content state
with the left hand side of the rule and finds the appropriate rule from database of
rules.

• The production system can be classified as monotonic, non-monotonic, partially


commutative and commutative.

• Architecture:

Fig. Architecture of Production System

The production rules operate on the knowledge database. Each rule has a precondition—
that is, either satisfied or not by the knowledge database. If the precondition is satisfied,
the rule can be applied. Application of the rule changes the knowledge database. The
control system chooses which applicable rule should be applied and ceases computation
when a termination condition on the knowledge database is satisfied.

We can represent knowledge in a production system as a set of rules of the form

If (condition) THEN (condition)


along with a control system and a database.For example,

If (you have an exam tomorrow)

THEN (study the whole night)

The control system serves as a rule interpreter and sequencer. The database acts as a
context buffer, which records the conditions evaluated by the rules and information on
which the rules act. The production rules are also known as condition – action,
antecedent – consequent, pattern – action, situation – response, feedback – result pairs.

2. Characteristics/Features
Some of the main features of production system are:

a) Expressiveness and intuitiveness: In real world, many times situation comes like “if
this happen-you will do that”, “if this is so-then this should happen” and many more.
The production rules essentially tell us what to do in a given situation.

b) Simplicity: The structure of each sentence in a production system is unique and


uniform as they use “IF-THEN” structure. This structure provides simplicity in
knowledge representation. This feature of production system improves the readability
of production rules.

c) Modularity: This means production rule code the knowledge available in discrete
pieces. Information can be treated as a collection of independent facts which may be
added or deleted from the system with essentially no deleterious side effects.

d) Modifiability: This means the facility of modifying rules. It allows the development of
production rules in a skeletal form first and then it is accurate to suit a specific
application.

e) Knowledge intensive: The knowledge base of production system stores pure


knowledge. This part does not contain any type of control or programming
information. Each production rule is normally written as an English sentence; the
problem of semantics is solved by the very structure of the representation.

3. Disadvantages
a) Opacity: This problem is generated by the combination ofproduction rules. The
opacity is generatedbecause of less prioritization of rules. More priority to a rule has
the less opacity.

b) Inefficiency: During execution of a program several rules may active. A well devised
control strategy reduces this problem. As the rules of the production system are large
in number and they are hardly written in hierarchical manner, it requires some forms of
complex search through all the production rules for each cycle of control program.

c) Absence of learning: Rule based production systems do not store the result of the
problem for future use. Hence, it does not exhibit any type of learning capabilities. So
for each time for a particular problem, some new solutions may come.

d) Conflict resolution: The rules in a production system should not have any type of
conflict operations. When a new rule is added to a database, it should ensure that it
does not have any conflicts with the existing rules.

EXTRA
Algorithm (problem name and specification)
Step 1: Analyze the problem to get the starting state and goal state.

Step 2: Find out the data about the starting state, goalstate

Step 3: Find out the production rules from initial database for proceeding the problem to
goal state.

Step 4: Select some rules from the set of rules that can be applied to data.

Step 5: Apply those rules to the initial state and proceed to get the next state.

Step 6: Determine some new generated states after applying the rules. Accordingly make
them as current state.

Step 7: Finally, achieve some information about the goal state from the recently used
current state and get the goal state.

Step 8: Exit.

After applying the above rules, the user may get the solution of the problem from a given
state to another state. Let us take few examples.

VARIOUS TYPES OF PROBLEMS AND THEIR SOLUTIONS


Here are some of the examples of problems which you can explore on this site for
description along with steps. (Site- https://www.vssut.ac.in/lecture_notes/
lecture1423725949.pdf)

1. Water Jug Problem

2. Missionaries and Carnivals Problem

3. Chess Problem

4. 8-Puzzle Problem

5. Monkey Banana Problem

6. Tower of Hanoi Problem

7. Cryptarithmatic Problem

SEARCHING

• Problem solving in artificial intelligence may be characterised as a systematic search


through a range of possible actions in order to reach some predefined goal or
solution. In AI, problem solving by search algorithms is quite common technique.

• In the coming age of AI, it will have big impact on the technologies of the robotics and
path finding. It is also widely used in travel planning.

• A search algorithm takes a problem as input and returns the solution in the form of an
action sequence. Once the solution is found, the actions it recommends can be
carried out. This phase is called as the execution phase. After formulating a goal and
problem to solve the agent cells, a search procedure to solve it.

• A problem can be defined by 5 components:

a) The initial state: The state from which agent will start.

b) The goal state: The state to be finally reached.

c) The current state: The state at which the agent is present after starting from the
initial state.

d) Successor function: It is the description of possible actions and their outcomes.

e) Path cost: It is a function that assigns a numeric cost to each path.

• The searching algorithms can be various types. When any type of searching is
performed, there may some information about the searching or mayn’t be. Also it is
possible that the searching procedure may depend upon any constraints or rules.

• However, generally searching can be classified into two types i.e. uninformed
searching and informed searching. Also some other classifications of these searches
are given below in the figure .

DIFFERENT TYPES OF SEARCHING

UNINFORMED SEARCH (or Blind search in some books)


AI Net Notes
1. Breadth First Search (BFS)
2. Depth First Search (DFS)
3. Brute Force or Blind Search
4. Difference Between DFS and BFS (can see DS notes also)
5. Greedy Search

Search Notes 2
Depth Limited search
Depth First Iterative Deepening Search (DFIDS)
Bi-directional Search
Comparing the Uninformed Search Algorithms:

• Simple BFS and BDS are complete and optimal but expensive with
respect to space and time.

• DFS requires much less memory if the maximum tree depth is


limited, but has no guarantee of finding any solution, let alone an
optimal one. DLS offers an improvement over DFS if we have some
idea how deep the goal is.

• The best overall is DFID which is complete, optimal and has low
memory requirements, but still exponential time.

INFORMED SEARCH or HEAURISTIC SEARCH


Heuristic is a technique which makes our search algorithm more efficient. Some
heuristics help to guide a search process without sacrificing any claim to
completeness and some sacrificing it. Heuristic is a problem specific knowledge
that decreases expected search efforts. It is a technique which sometimes works
but not always. Heuristic search algorithm uses information about the problem to
help directing the path through the search space. These searches uses some
functions that estimate the cost from the current state to the goal presuming that
such function is efficient. A heuristic function is a function that maps from
problem state descriptions to measure of desirability usually represented as
number. The purpose of heuristic function is to guide the search process in the
most profitable directions by suggesting which path to follow first when more
than is available.

Generally heuristic incorporates domain knowledge to improve efficiency over


blind search. In AI heuristic has a general meaning and also a more specialized
technical meaning. Generally a term heuristic is used for any advice that is
effective but is not guaranteed to work in every case. For example in case of
travelling sales man (TSP) problem we are using a heuristic to calculate the
nearest neighbour. Heuristic is a method that provides a better guess about the
correct choice to make at any junction that would be achieved by random
guessing. This technique is useful in solving though problems which could not be
solved in any other way. Solutions take an infinite time to compute.

Let us see some classifications of heuristic search.

(AI Net Notes)


1. Best First Search
2. Branch and Bound Search
3. A* Search
4. AO* Search (And-Or Graph)
5. Hill Climbing/ gradient descent
• Local Maxima
• Ridges
• Plateau

6. Min-max search (Module 2 after knowledge)


7. Alpha-Beta (α-β) Pruning
8. Constraint Satisfaction Search
9. Planning - components, planning in state space search, various
planning techniques, understanding,
10. Natural language processing (NLP)- goals, applications, ex ..

(Search Notes 2)
• Forward Checking
• Local Search and Metaheuristics
• Iterative/Iterated Local search
• Tabu Search
• Simulated Annealing
• Real Time A*
• Iterative Deepening A* (IDA*)
• Propositional and Predicate Logic

➡ Generate and Test


Generate And Test Algorithm
Generate-and-test search algorithm is a very simple algorithm that guarantees to find a
solution if done systematically and there exists a solution.

Algorithm:
1.Generate a possible solution.
2.Test to see if this is the expected solution.
3.If the solution has been found quit else go to step 1.
Potential solutions that need to be generated vary depending on the kinds of problems. For
some problems the possible solutions may be particular points in the problem space and for
some problems, paths from the start state.
Figure: Generate And Test

Generate-and-test, like depth-first search, requires that complete solutions be generated for
testing. In its most systematic form, it is only an exhaustive search of the problem space.
Solutions can also be generated randomly but solution is not guaranteed. This approach is
what is known as British Museum algorithm: finding an object in the British Museum by
wandering randomly.
Systematic Generate-And-Test
While generating complete solutions and generating random solutions are the two extremes
there exists another approach that lies in between. The approach is that the search process
proceeds systematically but some paths that unlikely to lead the solution are not considered.
This evaluation is performed by a heuristic function.
Depth-first search tree with backtracking can be used to implement systematic generate-and-
test procedure. As per this procedure, if some intermediate states are likely to appear often
in the
tree, it would be better to modify that procedure to traverse a graph rather than a tree.
Generate-And-Test And Planning
Exhaustive generate-and-test is very useful for simple problems. But for complex problems
even heuristic generate-and-test is not very effective technique. But this may be made
effective by combining with other techniques in such a way that the space in which to
search is restricted. An AI program DENDRAL, for example, uses plan-Generate-and-test
technique. First, the planning process uses constraint-satisfaction techniques and creates
lists of recommended and contraindicated substructures. Then the generate-and-test
procedure uses the lists generated and required to explore only a limited set of structures.
Constrained in this way, generate-and-test proved highly effective. A major weakness of
planning is that it often produces inaccurate solutions as there is no feedback from the
world. But if it is used to produce only pieces of solutions then lack of detailed accuracy
becomes unimportant.

OR
➡ Mean or Means End Analysis
• Most of the search strategies either reason forward of backward. However, often a
mixture of the two directions is appropriate. Such mixed strategy would make it possible
to solve the major parts of problem first and solve the smaller problems that arise when
combining them together. Such a technique is called "Means - Ends Analysis”.

• The means-ends analysis process centers around finding the difference between current
state and goal state.

• The problem space of means - ends analysis has an initial state and one or more goal
state, a set of operate with a set of preconditions their application and difference
functions that computes the difference between two state a(i) and s(j).

• A problem is solved using means - ends analysis by:


1. Computing the current state s1 to a goal state s2 and computing their difference
D12.
2. Satisfy the preconditions for some recommended operator op is selected, then to
reduce the difference D12.
3. The operator OP is applied if possible. If not the current state is solved a goal is
created and means- ends analysis is applied recursively to reduce the sub goal.
4. If the sub goal is solved state is restored and work resumed on the original problem.
( the first AI program to use means - ends analysis was the GPS General problem
solver)
means- ends analysis I useful for many human planning activities.

• Consider the example of planing for an office worker. Suppose we have a different table
of three rules:
1. If in out current state we are hungry , and in our goal state we are not hungry , then
either the "visit hotel" or "visit Canteen " operator is recommended.
2. If our current state we do not have money , and if in your goal state we have money,
then the "Visit our bank" operator or the "Visit secretary" operator is recommended.
3. If our current state we do not know where something is , need in our goal state we
do know, then either the "visit office enquiry" , "visit secretary" or "visit co worker "
operator is recommended.

OR
Fig Means-End Analysis in AI

➡ Additional Refinements
Quiescence Search
This involves searching past the terminal search nodes (depth of 0)
and testing all the non-quiescent or 'violent' moves until the situation
becomes calm, and only then apply the evaluator.

Enables programs to detect long capture sequences and calculate


whether or not they are worth initiating.

Expand searches to avoid evaluating a position where tactical


disruption is in progress.

You might also like