0% found this document useful (0 votes)
21 views11 pages

AI Unit-L

The document provides an overview of Artificial Intelligence (AI), detailing its definition, techniques, and problem-solving methods. It covers state space search, production systems, and various search strategies including breadth-first, depth-first, and heuristic searches. Additionally, it discusses the characteristics and algorithms associated with these techniques, emphasizing their applications and advantages/disadvantages.

Uploaded by

krishkiran2408
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)
21 views11 pages

AI Unit-L

The document provides an overview of Artificial Intelligence (AI), detailing its definition, techniques, and problem-solving methods. It covers state space search, production systems, and various search strategies including breadth-first, depth-first, and heuristic searches. Additionally, it discusses the characteristics and algorithms associated with these techniques, emphasizing their applications and advantages/disadvantages.

Uploaded by

krishkiran2408
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/ 11

St.

PAUL’S DEGREE & PG COLLEGE


(Affiliated to Osmania University)
Street No. 8, Himayathnagar, Hyderabad. Ph.No: 27602533

Artificial Intelligence
UNIT-I

1) What is AI? Write about AI problems and AI Technique?


Artificial Intelligence is a branch of computer science that deals with developing intelligent machines
which can behave like human,think like human and has ability to take decisions by their own.John McCarthy is
the father of Artificial Intelligence.According to him AI is “The science and engineering of making intelligent
machines, especially intelligent computer programs.

AI Technique: AI research concluded that Intelligent requires Knowledge. To compensate


overwhelming quality, knowledge possesses less desirable properties.

✓ It is huge.

✓ It is difficult to characterize correctly.

✓ It is constantly varying.

✓ It differs from data by being organized in a way that corresponds to its application.

✓ It is complicated.

Technique is a method that exploits knowledge that should be represented in such a way:

The knowledge acquires generalization. Situations that share common properties are grouped together.

✓ It can be easily modified to correct errors and to reflect changes in the world.

✓ It can be used in many situations even though it may not be totally accurate.

✓ It can be used to reduce its own volume by narrowing range of possibilities.

2) Defining Problem as a state space search?

The Steps to solve a particular problem are:

✓ Problem definition, that include precise specifications of what initial situation will be as what final
acceptable solutions to the problem.

✓ Problem Analysis, this can have immense impact on the appropriateness of possible techniques for solving
the problem.

✓ Selection of best techniques for solving the particular problem.

To solve the problem of playing a game,we require the rules of the game and targets for wining
as well as representing positions in the game.The opening position can be defined as initial state and a winning
position as a goal state. Moves from initial state to other states leading to the goal state follow legally.

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

✓ A representation of the states the system can be.

✓ A set of operators that can change one state into another state.

✓ An initial state.

✓ A set of final states.This set is often represented by a program that detects terminal states.
EG: Water jug Problem

3) What is Production System? Explain about search problem characteristics and production system
characteristics?

✓ Popularly known as Production rule system.

✓ It is used to implement search algorithms and replicate human problem solving skills.

✓ This problem solving knowledge is encoded in the system in the form of productions.It consists of
2components: Rule and Action.

✓ Rule recognize the condition and the actions part has the knowledge of how to deal with the condition.

Problem Characteristics: A problem may have different aspects of representation and explanation.It is
necessary to analyze the problem along several key dimensions: Some of the 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 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?

Production system Characteristics:

Simplicity: Due to the use of IF-THEN structure each sentence is unique in the production system.

Modularity: The knowledge available is coded in discrete pieces by the production system,which makes it easy
to add,modify or delete the information without any side effects.

Modifiability: This feature allows for the modification of the production rules.

Knowledge intensive: The system only stores knowledge.This type of representation sovles the semantic
problems.

Rules of production system:

 Control/search strategies: Control strategies in AI is a technique tells about which rule has to be applied
next while searching for the solution of a problem within problem space.

➢ It helps to decide which rule has to apply next without getting any stuck at any point.

➢ A good control strategy has two main characteristics:

Control strategy should cause motion:- Each rule applied should cause the motion because if there will be no
motion than such control strategy will never lead to a solution.

Control Strategy should be systematic: Though the strategy applied should create the motion but if do not
follow some systematic strategy than we are likely to reach the same state number of times before reaching the
solution which increases the number of steps.Control strategy should be systematic implies a need for global
and local motion

Types of control/search strategies:

◆ Breadth-First search: It searches along with the breadth and follows first-in - first-out queue data structure
approach.It will start to scan node A first and then B-C-D-E-F-G

Algorithm:

Step1: Place the root inside the queue.

Step2: If the queue is empty then stops and return failure.

Step3: If the FRONT node of the queue is a goal node then stop and return success.

Step4: Remove the FRONT node from the queue. Process it and find all its neighbours that are in ready state
then place them inside the queue in any order.

Step5: Go to step3.

Step6: Exit

Advantages:

✓ The solution will definitely found out by BFS if there is a solution.

✓ BFS will never get trapped in a blind alley,which means unwanted nodes.

✓ If there is more than one solution then it will find a solution with minimal steps.

Disadvantages:

✓ Memory constraints as it stores all the nodes of the present level to go for the next level.

✓ If a solution is far away then it consumes time.

✓ Applications:Finding the shortest path.

◆ Depth first search: It searches along the depth and follows the stack approach.The sequence for scanning
nodes will be A-B-D-E-C-F,it scans all the sub-nodes of parent nodes and then moves to another node.

Algorithm: Step1: PUSH the starting node into the stack.

Step2: If the stack is empty then stop and return failure.

Step3: If the top node of the stack is the goal node,then stop and return success.

Step4: Else POP the top node from the stack and process it .Find all its neighbour
that are in ready state and PUSH them into the stack in any order.

Step5: Go to step3

Step6: Exit
Advantages:

✓ The memory requirements is linear WRT nodes

✓ Less time and space complexity rather than BFS.

✓ The solution can be found out without much more search.

Disadvantages:

✓ Not Guaranteed that it will give you a solution.

✓ Cut-off depth is smaller so time complexity is more.

✓ Determination of depth until the search has proceeded.

Applications:

✓ Finding Connected components.

✓ Topological sorting.

✓ Finding Bridges of the graph.

 Heuristic search: A Heuristic is a technique to solve a problem faster than classic methods,or to find
approximate solution when classic methods cannot.

✓ A heuristic takes a look at search algorithm .At each branching step,it evaluates the available information
and makes a decision on which branch to follow.

Characteristics of heuristic search:

✓ It incorporates domain knowledge to improve efficiency over blind search.

✓ It is a function that when applied to a state returns value as estimated merit of state,with respect to goal

✓ Heuristic evaluation functions estimated likelihood of given state leading to goal state and also estimates
cost from current state to goal.

4) Write about Heuristic Search Techniques:

(a) 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: Generate-And-Test

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.

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.

Eg: Travelling salesman problem

(b) Hill climbing,Best - First search?

Hill climbing: Hill Climbing is heuristic search used for mathematical optimization problems in the
field of Artificial Intelligence . Hill climbing is widely used when a good heuristic is available.It is a
local search algorithm that continuously moves in the direction of increasing value to find the best
solution to the problem.It is also called greedy local search as it only looks to its good immediate
neighbour state and not beyond that.

Features of Hill Climbing:

➢ Produce and Test variation: Hill climbing is the variation of the Generate and Test strategy.

➢ Use of Greedy Approach: Hill climbing calculation search moves toward the path which improves the
expense.

➢ No Backtracking: It doesn’t backtrack the space as it doesn’t recall the past state.

Types of Hill Climbing:

✓ Simple Hill Climbing: It examines the neighboring nodes one by one and selects the first

neighboring node which optimizes the current cost as next node.

Algorithm for Simple Hill climbing :

Step 1 : Evaluate the initial state. If it is a goal state then stop and return success. Otherwise,

make initial state as current state.

Step 2 : Loop until the solution state is found or there are no new operators present which can be applied to
current state.

a) Select a state that has not been yet applied to the current state and apply it to produce a new

state.

b) Perform these to evaluate new state

i. If the current state is a goal state, then stop and return success.

ii. If it is better than the current state, then make it current state and proceed further.

iii. If it is not better than the current state, then continue in the loop until a solution is found.

Step 3 : Exit

✓ Steepest-Ascent Hill climbing : It first examines all the neighboring nodes and then

selects the node closest to the solution state as next node.

Step 1 : Evaluate the initial state. If it is goal state then exit else make the current state as initial

state

Step 2 : Repeat these steps until a solution is found or current state does not change

i. Let ‘target’ be a state such that any successor of the current state will be better than it;

ii. for each operator that applies to the current state

a. apply the new operator and create a new state


b. evaluate the new state

c. if this state is goal state then quit else compare with ‘target’

d. if this state is better than ‘target’, set this state as ‘target’

e. if target is better than current state set current state to Target

Step 3 : Exit

✓ Stochastic hill climbing : It does not examine all the neighboring nodes before deciding

which node to select .It just selects a neighboring node at random, and decides whether to move to that
neighbor or to examine another.It is also an area search algorithm,it modifies one solution and searches the
relatively local area of search space until the local optima is found.

✓ Simulated Annealing Heuristic Search: It is an algorithm that never makes a move towards lower esteem
destined to be incomplete that it can stall out on a nearby extreme.Annealing in metallurgy and material
science is the process used to harden metals and glass by heating them to a high temperature and then
gradually cooling them,thus allowing the material to reach a low energy state.

 Select a neighbor at random.

 If better than current state go there otherwise go there with some probability.

 Probability goes down with time.

Variation of hill climbing downhill moves may be made.The probability that the metal will jump to a
higher energy level is given by

P(δE) = exp(-δE /kt)

Where k is a constant known as Boltzmann's constant.δE is to change in the value of the objective function

Problems associated with Hill climbing:

 Local Maximum: At a local maximum all neighboring states have a values which is worse than than the
current state. Since hill climbing uses greedy approach, it will not move to the worse state and terminate
itself. The process will end even though a better solution may exist.

 Plateau : On plateau all neighbors have same value . Hence, it is not possible to select the

best direction.

 Ridge : Any point on a ridge can look like peak because movement in all possible

directions is downward. Hence the algorithm stops when it reaches this state

Best - first Search: In BFS and DFS, when we are at a node, we can consider any of the adjacent as next

node. So both BFS and DFS blindly explore paths without considering any cost function. The idea of Best First
Search is to use an evaluation function to decide which adjacent is most promising and then explore. Best First
Search falls under the category of Heuristic Search or Informed Search.

Algorithm: Step 1: Place the starting node or root node into the queue.

Step 2: If the queue is empty, then stop and return failure.

Step 3: If the first element of the queue is our goal node, then stop and return success.
Step 4: Else, remove the first element from the queue. Expand it and compute the estimated goal
distance for each child. Place the children in the queue in ascending order to the goal
distance.

Step 5: Go to step-3

Step 6: Exit.

Implementation:

Let us solve an example for implementing above BFS algorithm.

Step 1:

Consider the node A as our root node. So the first element of the queue is A which is not our goal node,

so remove it from the queue and find its neighbour that are to inserted in ascending order.

|A|

Step 2:

The neighbours of A are B and C. They will be inserted into the queue in ascending order.

|B| C| A|

Step 3:

Now B is on the FRONT end of the queue. So calculate the neighbours of B that are maintaining a least

distance from the roof.

|F| E| D| C| B

Step 4:

Now the node F is on the FRONT end of the queue. But as it has no further children, so remove it from

the queue and proceed further.

|E |D| C| F

Step 5:

Now E is the FRONT end. So the children of E are J and K. Insert them into the queue in ascending order.

|K| J| D| C| E

Step 6:

Now K is on the FRONT end and as it has no further children, so remove it and proceed further

|J| D| C| K

Step7:

Also, J has no corresponding children. So remove it and proceed further.

|D| C| J

Step 8:
Now D is on the FRONT end and calculates the children of D and put it into the queue.

|I| C| D

Step9:

Now I is the FRONT node and it has no children. So proceed further after removing this node from the

queue.

|C| I

Step 10:

Now C is the FRONT node .So calculate the neighbours of C that are to be inserted in ascending order

into the queue.

|G| H| C

Step 11:

Now remove G from the queue and calculate its neighbour that is to insert in ascending order into the

queue.

|M| L| H| G

Step12:

Now M is the FRONT node of the queue which is our goal node. So stop here and exit.

|L|H| M

Advantage:
✓ It is more efficient than that of BFS and DFS.

✓ Time complexity of Best first search is much less than Breadth first search.

✓ The Best first search allows us to switch between paths by gaining the benefits of both breadth first and depth first search.
Because, depth first is good because a solution can be found without computing all nodes and Breadth first search is good
because it does not get trapped in dead ends.

Disadvantages:
Sometimes, it covers more distance than our consideration.

AO* Search:(And-Or graph):

A* search is the most commonly form of best-first search.It uses the heuristic function h(n) and cost to
reach the node n from the start stage g(n).It finds the shortest path through the search using the heuristic
function.This search algorithm expands fewer search tree and gives optimal results faster.

Algorithm of A* Search :

Step 1: Place the starting node into OPEN and find its f (n) value.

Step 2:Check if the OPEN list is empty or not.If the list is empty,then return failure and stop.

Step 3:Select the node from the OPEN list which has the smallest value of the evaluation function (g+h).If node n is
the goal node ,then return success and stop otherwise,

Step 4: Expand node n and generate all successors,and put n into the CLOSED list.For each successor ‘n’ check
whether ‘n’ is already in the OPEN or CLOSED list.If not then compute the evaluation function for ‘n’ and place it into
the OPEN list.

Step 5: Else,if the node ‘n’ is already in OPEN and CLOSED then it should be attached to the back pointer which
reflects the lowest g(n) value.

Step 6: Return to step2.


(C ) Problem Reduction?

We already know about the divide and conquer strategy, a solution to a problem can be obtained by
decomposing it into smaller sub-problems. Each of this sub-problem can then be solved to get its sub-solution.
These sub-solutions can then be recombined to get a solution as a whole. That is called Problem Reduction.
This method generates arc which is called as AND arcs. One AND arc may point to any number of successor
nodes, all of which must be solved for an arc to point to a solution.

AO* Search: (And-Or) Graph:

The Depth first search and Breadth first search given earlier for OR trees or graphs can be easily

adopted by AND-OR graph. The main difference lies in the way termination conditions are determined, since
all goals following an AND nodes must be realized; where as a single goal node following an OR node will do.
So for this purpose we are using AO* algorithm.

Algorithm:

Step 1: Place the starting node into OPEN.

Step 2: Compute the most promising solution tree say T0.

Step 3: Select a node n that is both on OPEN and a member of T0. Remove it from OPEN and

place it in CLOSE.

Step 4: If n is the terminal goal node then leveled n as solved and leveled all the ancestors of n

as solved. If the starting node is marked as solved then success and exit.

Step 5: If n is not a solvable node, then mark n as unsolvable. If starting node is marked as

unsolvable, then return failure and exit.

Step 6: Expand n. Find all its successors and find their h (n) value, push them into OPEN.

Step 7: Return to Step 2.

Step 8: Exit.

( d ) Constraint satisfaction?

Many problems in AI can be considered as problems of constraint satisfaction, in which the goal

state satisfies a given set of constraint. constraint satisfaction problems can be solved by using any of the search
strategies. The general form of the constraint satisfaction procedure is as follows:

Until a complete solution is found or until all paths have led to lead ends, do
1. select an unexpanded node of the search graph.

2. Apply the constraint inference rules to the selected node to generate all possible new constraints.

3. If the set of constraints contains a contradiction, then report that this path is a dead end.

4. If the set of constraints describes a complete solution then report success.

5. If neither a constraint nor a complete solution has been found then apply the rules to generate new partial
solutions. Insert these partial solutions into the search graph.

Example: consider the crypt arithmetic problems.

SEND

+ MORE

----------

MONEY

Assign decimal digit to each of the letters in such a way that the answer to the problem is correct to the same
letter occurs more than once , it must be assign the same digit each time . no two different letters may be
assigned the same digit. Consider the crypt arithmetic problem.

CONSTRAINTS:-

1. No two digit can be assigned to same letter.

2. Only single digit number can be assign to a letter.

3. No two letters can be assigned same digit.

4. Assumption can be made at various levels such that they do not contradict each other.

5. The problem can be decomposed into secured constraints. A constraint satisfaction approach may be used.

6. Any of search techniques may be used.

7. Backtracking may be performed as applicable us applied search techniques.

8. Rule of arithmetic may be followed.


( e) Means-ends 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 the arise when combining them together. Such a technique is called "Means
- Ends Analysis".

How means ends analysis works:

✓ First evaluate the difference between Initial state and final state.

✓ Select the various operators which can be applied for each difference.

✓ Apply the operator at each difference,which reduces the difference between the current and goal state.

Algorithm for Means - ends analysis:

➢ Compare CURRENT to GOAL,If there is no difference between both then return success and exit.

➢ Else,select the most significant difference and reduce it by doing the following steps until the success or
failure occurs.

(a) Select a new operator O which is applicable for the current difference and if there is no such opeartor
then signal failure.

(b) Attempt to apply operator O to CURRENT.Make a description of two states.

I. O-start ,a state in which )’s preconditions are satisfied.

II. O-Result,the state that would result if O were applied in O-start.

(c) If

(First part)<-------MEA(CURRENT,O-START)

And

(LAST part<-------MEA(O-Result,GOAL) are successful then signal success and return the
result of combining FIRST-PART,O,LAST PART

You might also like