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

AI Notes_22ECT505B (3)

The document outlines the process of problem-solving in Artificial Intelligence, emphasizing the importance of defining problems, analyzing them, and choosing appropriate solving techniques. It discusses concepts such as problem spaces, search strategies, and the General Problem Solver (GPS) while highlighting the role of heuristics and control strategies in efficient problem-solving. Additionally, it covers problem characteristics, decomposition, and the predictability of problem universes, providing examples like the Water Jug Problem and the 8-Puzzle.

Uploaded by

prajwal354120
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

AI Notes_22ECT505B (3)

The document outlines the process of problem-solving in Artificial Intelligence, emphasizing the importance of defining problems, analyzing them, and choosing appropriate solving techniques. It discusses concepts such as problem spaces, search strategies, and the General Problem Solver (GPS) while highlighting the role of heuristics and control strategies in efficient problem-solving. Additionally, it covers problem characteristics, decomposition, and the predictability of problem universes, providing examples like the Water Jug Problem and the 8-Puzzle.

Uploaded by

prajwal354120
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 15

SUB: ARTIFICIAL

INTELLIGENCE
SUB CODE: 22ECT505B

1
PROBLEMS, PROBLEM SPACES AND SEARCH

To solve the problem of building a system you should take the following steps:
1. Define the problem accurately including detailed specifications and what constitutes
a suitable solution.
2. Scrutinize the problem carefully, for some features may have a central affect on
the chosen method of solution.
3. Segregate and represent the background knowledge needed in the solution of
the problem.
4. Choose the best solving techniques for the problem to solve a solution.

Problem solving is a process of generating solutions from observed data.


• a ‘problem’ is characterized by a set of goals,
• a set of objects, and
• a set of operations.
These could be ill-defined and may evolve during problem solving.
• A ‘problem space’ is an abstract space.
 A problem space encompasses all valid states that can be generated by the
application of any combination of operators on any combination of objects.
 The problem space may contain one or more solutions. A solution is a
combination of operations and objects that achieve the goals.
• A ‘search’ refers to the search for a solution in a problem space.
 Search proceeds with different types of ‘search control strategies’.
 The depth-first search and breadth-first search are the two common search
strategies.

2.1 AI - General Problem Solving

Problem solving has been the key area of concern for Artificial Intelligence.

Problem solving is a process of generating solutions from observed or given data. It is however
not always possible to use direct methods (i.e. go directly from data to solution). Instead,
problem solving often needs to use indirect or modelbased methods.

General Problem Solver (GPS) was a computer program created in 1957 by Simon and Newell
to build a universal problem solver machine. GPS was based on Simon and Newell’s theoretical
work on logic machines. GPS in principle can solve any formalized symbolic problem, such as
theorems proof and geometric problems and chess playing. GPS solved many simple problems,
such as the Towers of Hanoi, that could be sufficiently formalized, but GPS could not solve any
real-world problems.

To build a system to solve a particular problem, we need to:


 Define the problem precisely – find input situations as well as final situations for
an acceptable solution to the problem

2
 Analyze the problem – find few important features that may have impact on the
appropriateness of various possible techniques for solving the problem
 Isolate and represent task knowledge necessary to solve the problem
 Choose the best problem-solving technique(s) and apply to the particular problem

Problem definitions
A problem is defined by its ‘elements’ and their ‘relations’. To provide a formal description of a
problem, we need to do the following:

a. Define a state space that contains all the possible configurations of the relevant
objects, including some impossible ones.
b. Specify one or more states that describe possible situations, from which the problem-
solving process may start. These states are called initial states.
c. Specify one or more states that would be acceptable solution to the problem.

These states are called goal states.

Specify a set of rules that describe the actions (operators) available.

The problem can then be solved by using the rules, in combination with an appropriate control
strategy, to move through the problem space until a path from an initial state to a goal state is
found. This process is known as ‘search’. Thus:

 Search is fundamental to the problem-solving process.


 Search is a general mechanism that can be used when a more
direct method is not known.
 Search provides the framework into which more direct methods for
solving subparts of a problem can be embedded. A very large number
of AI problems are formulated assearch problems.
 Problem space

A problem space is represented by a directed graph, where nodes represent search state and paths
represent the operators applied to change the state.

To simplify search algorithms, it is often convenient to logically and programmatically represent


a problem space as a tree. A tree usually decreases the complexity of a search at a cost. Here,
the cost is due to duplicating some nodes on the tree that were linked numerous times in the
graph,
e.g. node B and node D.

A tree is a graph in which any two vertices are connected by exactly one path. Alternatively, any
connected graph with no cycles is a tree.

3
• Problem solving: The term, Problem Solving relates to analysis in AI. Problem solving may be
characterized as a systematic search through a range of possible actions to reach some
predefined goal or solution. Problem-solving methods are categorized as special purpose and
general purpose.

• A special-purpose method is tailor-made for a particular problem, often exploits very


specific features of the situation in which the problem is embedded.

• A general-purpose method is applicable to a wide variety of problems. One General-purpose


technique used in AI is ‘means-end analysis’: a step-bystep, or incremental, reduction of the
difference between current state and final goal.

4
2.3 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 one
of a set of target positions. It means that the solution involves using known techniques and a
systematic search. This is quite a common method in Artificial Intelligence.

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

2.3.2 The 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?

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.
.
Refer to class notes
5
2.3.3 Control Strategies

The word ‘search’ refers to the search for a solution in a problem space.
• Search proceeds with different types of ‘search control strategies’.
• A strategy is defined by picking the order in which the nodes expand.
The Search strategies are evaluated along the following dimensions: Completeness, Time
complexity, Space complexity, Optimality (the search- related terms are first explained, and
then the search algorithms and control strategies are illustrated next).
“Control Strategies are the one used to decide which rule has to be applied next during the
process of searching solution to a problem”.
a) The first requirement of a good control strategy is that it causes motion: if these strategies do
not cause motion will never lead to solution.
b) The second requirement of a good control strategy is that it is be systematic means these
strategies should consists of particular sequence of operators before finding solution to a
problem.

Difference between Breadth-First search and Depth-First search

6
BFS:

Tree structure
Tree is a way of organizing objects, related in a hierarchical fashion.
• Tree is a type of data structure in which each element is attached to one or more
7
elements directly beneath it.
• The connections between elements are called branches.
• Tree is often called inverted trees because it is drawn with the root at the top.
• The elements that have no elements below them are called leaves.
• A binary tree is a special type: each element has only two branches below it.
Properties
• Tree is a special case of a graph.
• The topmost node in a tree is called the root node.
• At root node all operations on the tree begin.
• A node has at most one parent.
• The topmost node (root node) has no parents.
• Each node has zero or more child nodes, which are below it .
• The nodes at the bottommost level of the tree are called leaf nodes.
Since leaf nodes are at the bottom most level, they do not have
children.
• A node that has a child is called the child’s parent node.
• The depth of a node n is the length of the path from the root to the node.
• The root node is at depth zero.

Heuristic Search:

Is a technique that improves the efficiency of a search process, they are like tour guides.

Travelling salesman problem: Refer to class notes

8
Problem solution
In the state space, a solution is a path from the initial state to a goal state or, sometimes, just a
goal state.
 A solution cost function assigns a numeric cost to each path; it also gives the cost
of applying the operators to the states.
 A solution quality is measured by the path cost function; and an optimal solution has the
lowest path cost among all solutions.
 The solutions can be any or optimal or all.
 The importance of cost depends on the problem and the type of solution asked

• Problem description
A problem consists of the description of:
 The current state of the world,
 The actions that can transform one state of the world into another,
 The desired state of the world.
The following action one taken to describe the problem:
 State space is defined explicitly or implicitly
A state space should describe everything that is needed to solve a problem and nothing that is
not needed to solve the problem.
 Initial state is start state
 Goal state is the conditions it has to fulfill.
The description by a desired state may be complete or
partial.
 Operators are to change state
 Operators do actions that can transform one state into another;
 Operators consist of: Preconditions and Instructions;

Preconditions provide partial description of the state of the world that must be true in order to
perform the action, and
Instructions tell the user how to create the next state.
 Operators should be as general as possible, so as to reduce their number.
 Elements of the domain has relevance to the problem
 Knowledge of the starting point.
 Problem solving is finding a solution
 Find an ordered sequence of operators that transform the current (start)
state into a goal state.

9
 Restrictions are solution quality any, optimal, or all
 Finding the shortest sequence, or
 finding the least expensive sequence defining cost, or
 finding any sequence as quickly as possible.
This can also be explained with the help of algebraic function as given below.

PROBLEM CHARACTERISTICS

Heuristics cannot be generalized, as they are domain specific. Production systems provide ideal
techniques for representing such heuristics in the form of IF-THEN rules. Most problems
requiring simulation of intelligence use heuristic search extensively. Some heuristics are used to
define the control structure that guides the search process, as seen in the example described
above. But heuristics can also be encoded in the rules to represent the domain knowledge. Since
most AI problems make use of knowledge and guided search through the knowledge, AI can be
described as the study of techniques for solving exponentially hard problems in polynomial time
by exploiting knowledge about problem domain.

To use the heuristic search for problem solving, we suggest analysis of the problem for the
following considerations:
 Decomposability of the problem into a set of independent smaller subproblems
 Possibility of undoing solution steps, if they are found to be unwise
 Predictability of the problem universe
 Possibility of obtaining an obvious solution to a problem without comparison of all other
possible solutions
 Type of the solution: whether it is a state or a path to the goal state
 Role of knowledge in problem solving
 Nature of solution process: with or without interacting with the user

The general classes of engineering problems such as planning, classification, diagnosis,


monitoring and design are generally knowledge intensive and use a large amount of heuristics.
Depending on the type of problem, the knowledge representation schemes and control strategies
for search are to be adopted. Combining heuristics with the two basic search strategies have been
discussed above. There are a number of other general-purpose search techniques which are
essentially heuristics based. Their efficiency primarily depends on how they exploit the domain-
specific knowledge to abolish undesirable paths. Such search methods are called ‘weak
methods’, since the progress of the search depends heavily on the way the domain knowledge is
exploited. A few of such search techniques which form the centre of many AI systems are briefly
presented in the following sections.

Problem Decomposition

Suppose to solve the expression is: + (X³ + X² + 2X + 3sinx) dx

10
This problem can be solved by breaking it into smaller problems, each of which we can solve by
using a small collection of specific rules. Using this technique of problem decomposition, we can
solve very large problems very easily. This can be considered as an intelligent behaviour.

Can Solution Steps be Ignored?

Suppose we are trying to prove a mathematical theorem: first we proceed considering that
proving a lemma will be useful. Later we realize that it is not at all useful. We start with another
one to prove the theorem. Here we simply ignore the first method.
Consider the 8-puzzle problem to solve: we make a wrong move and realize that mistake. But
here, the control strategy must keep track of all the moves, so that we can backtrack to the initial
state and start with some new move.
Consider the problem of playing chess. Here, once we make a move we never recover from that
step. These problems are illustrated in the three important classes of problems mentioned below:
1. Ignorable, in which solution steps can be ignored. Eg: Theorem Proving
2. Recoverable, in which solution steps can be undone. Eg: 8-Puzzle
3. Irrecoverable, in which solution steps cannot be undone. Eg: Chess

Is the Problem Universe Predictable?

Consider the 8-Puzzle problem. Every time we make a move, we know exactly what will happen.
This means that it is possible to plan an entire sequence of moves and be confident what the
resulting state will be. We can backtrack to earlier moves if they prove unwise.

Suppose we want to play Bridge. We need to plan before the first play, but we cannot play with
certainty. So, the outcome of this game is very uncertain. In case of 8-Puzzle, the outcome is
very certain. To solve uncertain outcome problems, we follow the process of plan revision as the
plan is carried out and the necessary feedback is provided. The disadvantage is that the planning
in this case is often very expensive.

Is Good Solution Absolute or Relative?


Consider the problem of answering questions based on a database of simple facts such as the
following:

11
1. Siva was a man.
2. Siva was a worker in a company.
3. Siva was born in 1905.
4. All men are mortal.
5. All workers in a factory died when there was an accident in 1952.
6. No mortal lives longer than 100 years.
Suppose we ask a question: ‘Is Siva alive?’
By representing these facts in a formal language, such as predicate logic, and then using formal
inference methods we can derive an answer to this question easily.
There are two ways to answer the question shown below:
Method I:
1. Siva was a man.
2. Siva was born in 1905.
3. All men are mortal.
4. Now it is 2008, so Siva’s age is 103 years.
5. No mortal lives longer than 100 years.
Method II:
1. Siva is a worker in the company.
2. All workers in the company died in 1952.
Answer: So Siva is not alive. It is the answer from the above methods.

We are interested to answer the question; it does not matter which path we follow. If we follow
one path successfully to the correct answer, then there is no reason to go back and check another
path to lead the solution.

Issues in the Design of Search Programs


Each search process can be considered to be a tree traversal. The object of the search is to find a
path from the initial state to a goal state using a tree. The number of nodes generated might be
huge; and in practice many of the nodes would not be needed. The secret of a good search
routine is to generate only those nodes that are likely to be useful, rather than having a precise
tree. The rules are used to represent the tree implicitly and only to create nodes explicitly if they
are actually to be of use.

The following issues arise when searching:


• The tree can be searched forward from the initial node to the goal state or backwards from
the goal state to the initial state.
• To select applicable rules, it is critical to have an efficient procedure for matching rules against
states.
• How to represent each node of the search process? This is the knowledge representation
problem or the frame problem. In games, an array suffices; in other problems, more complex
data structures are needed.

Finally in terms of data structures, considering the water jug as a typical problem do we use a
graph or tree? The breadth-first structure does take note of all nodes generated but the depth-
first one can be modified.
12
Check duplicate nodes

1. Observe all nodes that are already generated, if a new node is present.
2. If it exists add it to the graph.
3. If it already exists, then
a. Set the node that is being expanded to the point to the already existing node
corresponding to its successor rather than to the new one. The new one can be
thrown away.

b. If the best or shortest path is being determined, check to see if this path is better or
worse than the old one. If worse, do nothing.

Better save the new path and work the change in length through the chain of successor nodes if
necessary.

Example: Tic-Tac-Toe

State spaces are good representations for board games such as Tic-Tac-Toe. The position of a
game can be explained by the contents of the board and the player whose turn is next. The board
can be represented as an array of 9 cells, each of which may contain an X or O or be empty.
• State:
 Player to move next: X or O.
 Board configuration:

• Operators: Change an empty cell to X or O.


• Start State: Board empty; X’s turn.
• Terminal States: Three X’s in a row; Three O’s in a row; All cells full.

Search Tree

The sequence of states formed by possible moves is called a search tree. Each level of the tree is
called a ply.

Since the same state may be reachable by different sequences of moves, the state space may in
general be a graph. It may be treated as a tree for simplicity, at the cost of duplicating states.

13
Solving problems using search
• Given an informal description of the problem, construct a formal description as a state space:
 Define a data structure to represent the state.
 Make a representation for the initial state from the given data.
 Write programs to represent operators that change a given state representation to a
new state representation.
 Write a program to detect terminal states.

• Choose an appropriate search technique:


 How large is the search space?
 How well structured is the domain?
 What knowledge about the domain can be used to guide the search?

14
15

You might also like