Sei sulla pagina 1di 49

Articial Intelligence

15CS562

Module I

Syllabus

ˆ What is articial intelligence?

ˆ Problems, Problem Spaces and search

ˆ Heuristic search technique

Ch 1, 2 and 3

What is AI?

Intelligence

"ability to learn, understand and think" (Oxford dictionary)

Denition

1
Articial Intelligence 15CS562

AI is the study of how to make computers do things which at the moment people
do better.

AI applications in use

1. Recommendation eg. online shopping


2. Classication eg. separating spam from the mails.
3. Commuting eg. autonomous driving vehicle
4. Social networking eg. suggetions of friends based on pictures
5. Mobile eg. hands free operations ie. voice commads

Brief history

Alan Turing

CSE Mar, 2018 2 of 49


Articial Intelligence 15CS562

Task domains of AI

AI Questions

1. The underlying Assumption

2. AI Technique

CSE Mar, 2018 3 of 49


Articial Intelligence 15CS562

3. Level of the Model

4. Criteria for Success

Assumption: Physical symbol system hypothesis

A physical symbol system holds a set of entities, called symbols. As it moves


through time, produces symbol structures.

A physical symbol system has the necessary and sucient means for general intel-
ligent action.

AI Technique

Intelligence requires knowledge. Knowledge has less desirable properties such as


- Voluminous, Hard to characterize accurately, constantly changing, diers from
the data that can be used.

AI technique is a method that exploits knowledge that should be represented in


such a way that: Knowledge captures generalization, It can be understood by
people who must provide it, It can be easily modied to correct errors, It can be
used in variety of situations.

Level of the Model

Level of human intelligence is modelled as to,

1. Test psychological theories of human performance

2. Enable computers to understand human reasoning

3. Enable people to understand computer reasoning

CSE Mar, 2018 4 of 49


Articial Intelligence 15CS562

4. Exploit what knowledge we can glean from people

Criteria for Success as Turing test

The "standard interpretation" of the Turing Test, in which player C, the interroga-
tor, is given the task of trying to determine which player - A or B - is a computer
and which is a human.

The interrogator is limited to using the responses to written questions to make the
determination. If the interrogator cannot make out the dierence between A and
B then computer passes the turing test.

Case study

1. Tic-Tac-Toe game

2. Question answering

CSE Mar, 2018 5 of 49


Articial Intelligence 15CS562

Above problems are considered to illustrate approach to problem solving.

Tic-Tac-Toe

player 1 - X, player 2 - O

Three solutions to Tic-Tac-Toe game are provided below, each one with

1. increased complexity

2. use of generalization

3. clarity of knowledge

4. extensibility of their approach.

Program I

1 - X, 2 - O

Data structure:

CSE Mar, 2018 6 of 49


Articial Intelligence 15CS562

Board - 9 element vector with 1-9 for each square. An element contain 0 if it is
blank, 1 if it is lled by X or 2 if it is lled with O.

Movetable - A large vector of elements, where each element is a 9 element vector.


Total of 39 elements.

Algorithm:

To make a move do the following.

1. View the vector as a ternary number. Convert it to a decimal number.

2. Use the computed number as an index into movetable and access the vector
stored there.

3. Set the new board to that vector.

Comments:

CSE Mar, 2018 7 of 49


Articial Intelligence 15CS562

1. A lot of space to store the movetable

2. A lot of work to specify all the entries in the movetable

3. Dicult to extend.

Program 2

Data structure:

A nine element vector representing the board. But instead of using 0, 1, 2, we


store 2 for blank, 3 for X and 5 for O.

Turn:

An integer indicating which move of the game is about to be played. 1 indicates


the rst move, 9 the last.

Algorithm:

Make2: procedure return 5 if the center square s blank. Else any other non blank
square (2, 4, 6, 8).

Posswin(p): procedure returns 0 if the player p cannot win on his next move;
otherwise it returns the number of the square that constitutes a winning move. If
the product is 18(3x3x2), then X can win. If the product is 50(5x5x2) then O can
win.

Go(n): procedure makes a move in the square n. Set board[n] to 3 if turn is odd
otherwise 5.

The algorithm has a built in strategy for each move. It makes the odd numbered
moves if it is playing X. The strategy for each turn is as follows:

CSE Mar, 2018 8 of 49


Articial Intelligence 15CS562

Turn=1, Go(1)
Turn=2, if board[5] is blank Go(5) else Go(1)
Turn=3, if board[9] is blank Go(9) else Go(3)
Turn=4, if Posswin(X) is not 0 then Go(Posswin(X)) else Go(Make2)
...

Comments:

1. Not ecient in time, as it has to check several conditions before making each
move.

2. Easier to understand the program's strategy.

3. Hard to generalize.

Program 3

To decide on the next move, look ahead at the board positions that result from
each possible move. Decide which position is best as described below.

1. If it is a win, give it the highest rating

2. Otherwise, consider all the moves the opponent could make next. Assume
the opponent will make the move that is worst for us. Assign the rating of
that move to the current node.

3. The best node is then the one with the highest rating.

Comments:

1. Require much more time to consider all posiible moves.

CSE Mar, 2018 9 of 49


Articial Intelligence 15CS562

2. Could be extended to handle more complicated games.

Question Answering problem

Mary went shopping for a new coat. She found a red one she really liked. When
she got it home, she discovered that it went perfectly with her favourite dress.

Q1. What did Mary go shopping for?


Q2. What did Mary find that she liked?
Q3. Did Mary buy anything?

Program 1

1. Match predened templates to questions to generate text patterns.

2. Match text patterns to input texts to get answers.

"What did X Y" "Mary go shopping for Z" Z= a new coat.

Program 2

Structured representation of sentences.

Program 3:

Background world knowledge.

CSE Mar, 2018 10 of 49


Articial Intelligence 15CS562

Problems, Problem Spaces and search

Dening the problem as a state space search

ˆ Dene a state space that contains all the possible congurations of the rele-
vant objects.

ˆ Specify one or more states within that space that describe possible situations
from which the problem solving process may start ( initial state)

ˆ Specify one or more states that would be acceptable as solutions to the


problem. ( goal states)

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

Problem solving involves:

ˆ problem denition as specications of inputs and outputs

ˆ problem analysis

ˆ knowledge representation

ˆ Selection of best technique to solve problem

Problem solving = Searching for a goal state.

e.g use graph or tree to illustrate start state, goal state, successor function, and
one or more solutions.

Playing Chess

CSE Mar, 2018 11 of 49


Articial Intelligence 15CS562

ˆ Each position can be described by an 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 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.

State Space search

ˆ State space is a set of legal positions.

ˆ Staring at the initial state.

ˆ Using the rules to move from one state to another.

ˆ Attempting to end up in a goal state.

e.g searching for AI notes in google, where you restrict your search space to AI
subject.

Water Jug problem

CSE Mar, 2018 12 of 49


Articial Intelligence 15CS562

Problem specication

1. Start state (0,0)

2. Goal state (2, n)

3. Rules (sample only)

1 Fill the 4 gallon jug (4,-) (x, y) → (4, y) if x < 4


2 Fill the 3 gallon jug (-,3) (x, y) → (x, 3) if y < 3
4 Empty the 4 gallon jug (0,3) (x, y) → (0, 3) if x > 0

Rules

CSE Mar, 2018 13 of 49


Articial Intelligence 15CS562

Solution

Step Action (x, y) state Rule


1 Start 4L=0, 3L=0
2 Fill in 3L jug to max 4L=0, 3L=3 2
3 Pour into 4L jug 4L=3, 3L=0 9
4 Fill again 3L jug to max 4L=3, 3L=3 2
5 Pour into 4L jug to its max 4L=4, 3L=2 7
6 Empty the 4L on the ground 4L=0, 3L=2 5
7 Pour all the water from 3L to 4L jug 4L=2, 3L=0 Goal

Search Trees

CSE Mar, 2018 14 of 49


Articial Intelligence 15CS562

Production Systems

A production system consists of four basic components:

1. A set of rules of the form Ci → Ai where Ci is the condition part and Ai is


the action part. The condition determines when a given rule is applied, and
the action determines what happens when it is applied.

2. One or more knowledge databases that contain whatever information is rel-


evant for the given problem. Some parts of the database may be permanent,
while others may temporary and only exist during the solution of the cur-
rent problem. The information in the databases may be structured in any
appropriate manner.

3. A control strategy that determines the order in which the rules are applied
to the database, and provides a way of resolving any conicts that can arise
when several rules match at once.

4. A rule applier which is the computational system that implements the control
strategy and applies the rules.

e.g.,

CSE Mar, 2018 15 of 49


Articial Intelligence 15CS562

R1: If light=green Then proceed


R2: if light=red Then Stop
R3: If light=red Then proceed.

Conicting rules R2 and R3 arise due to clash in expert opinoions or no data. We


can resolve conicts by priority, longest matching rule or most recently updated
rule.

Classes of production systems

1. A monotonic production system, where application of a rule never prevents


the latter application of another rule that could have been applied at the
time the rst rule was selected.

2. Non-monotonic system in which this is not true.

3. A partially commutative production system, where application of a particular


sequence of rules transform state x to y, then any permutation of those rules
also transform state x to y.

4. A commutative production system is a production system that is both mono-


tonic and partially commutative.

Control strategies

Good control strategy must i) cause motion ii) be systematic iii) Ecient. The
various search algorithms, shown below, are used as control strategies.

CSE Mar, 2018 16 of 49


Articial Intelligence 15CS562

Breadth rst search

CSE Mar, 2018 17 of 49


Articial Intelligence 15CS562

The goal node J found before N.

BFS Algorithm

1. Set NodeList to initial state

2. Until a goal state is found or NodeList ie empty:

ˆ Remove the rst element E from NodeList


ˆ For each rule that match the state E
 Apply a rule to generate a new state
 If new state is a goal state return this state
 Otherwise add the new state to the end of the NodeList

Depth rst search

The goal node N will be found before the goal node J

CSE Mar, 2018 18 of 49


Articial Intelligence 15CS562

DFS Algorithm

1. If the initial state is goal state, return success

2. Otherwise do the following until success or failure

ˆ Generate a successor E of the initial state


ˆ If there are no more successors return failure
ˆ Call depth rst search with E as the initial state

BFS & DFS comparison

BFS will not get trapped exploring a blind alley unlike DFS. BFS nds minimal
solution if there are multiple solutions. BFS will cover tree up to level n before
level n+1 is explored.

DFS will nd solution without traversing the whole tree and is space ecient.

Heuristic search

ˆ Heuristics can be used to guide a search algorithm in a large search space.

ˆ Heuristic is a strategy or procedure used to aid in the ecient solution of a


problem.

ˆ It is nothing but a practical rule of thumb derived by domain expert.

ˆ Also known as "Objective Function" in search algorithms.

ˆ There are dierent ways of dening a heuristic function h to estimate how


far o the goal a given node is;

CSE Mar, 2018 19 of 49


Articial Intelligence 15CS562

ˆ and there are dierent ways of using h to decide which node is "best".

Example

The travelling salesman problem:

A salesman has a list of cities, each of which he must visit exactly once. These are
direct roads between each pair of cities on the list. Find the rute salesman follow
for the shortest possible round trip that starts and nishes at any one of the cities.

Nearest neighbor heuristic

1. Select a starting city,

2. Select the one closest to the current city.

3. Repeat step 2 until all cities have been visited.

CSE Mar, 2018 20 of 49


Articial Intelligence 15CS562

O(n2 ) vs o(n!)

A heuristic function is a function that maps from problem state description to


measure of desirability usually represented as number.

Problem Characteristics

To choose an appropriate method for a particular problem, consider the following


characteristcs.

1. Is the problem decomposable?


Integration:

A simple blocks world:

CSE Mar, 2018 21 of 49


Articial Intelligence 15CS562

CLEAR(x) -> ON(x, Table) CLEAR(x) and clear(y) -> ON(x,y)

1. Can solution steps be ignored or undone?


Theorem proving: A lemma that has been proved can be ignored for next
steps. Ignorable.
The 8 puzle: Recoverable.

CSE Mar, 2018 22 of 49


Articial Intelligence 15CS562

Moves can be undone and back tracked.


Playing chess: Moves cannot be retracted. Irrecoverable.
Summary
Ignorable problems can be solved using a simple control structure that never
backtracks. Recoverable problems can be solved using backtracking. Irrecov-
erable problems can be solved by recoverable style methods via planning.

2. Is the universe predictable?


8-puzle - 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 player will do on their turns. Uncertain outcome!.
For 'certain outcome' problems, planning can use to generate a sequence of
operators that is guaranteed to lead a solution.
For uncertain outcome problems, a sequence of generated operators can only
have a good probability.
Plan revision is made as the plan is carried out and the necesary feedback is
provided.

3. Is a good solution absolute or relative?

(a) Marcus was a man.

CSE Mar, 2018 23 of 49


Articial Intelligence 15CS562

(b) Marcus was a Popmeian.


(c) Marcus was born in 40 A.D
(d) All men are mortal.
(e) All pompeian dies when the volcano erupted in 79 A.D
(f) No mortal lives longer than 150 years.
(g) It is now 1991 A.D

Is Marcus alive?

Axioms 1, 4 => Marcus is mortal


Axioms 3, 7 => Marcus' age is 1951 years
Axioms 6 => Marcus is dead.

OR

Axioms 7, 5 => All pompeans are dead now.


Axioms 2 => Marcus is dead.

Dierent reasonng paths lead to the answer. It does not matter which path
we follow.
Traveling salesman problem - We have to try all paths to nd the shortest
one.
These two problems illustrates the dierence between any-path and best-
path problems. any-path problems can be solved in reasonable amount of
time.

4. Is the solution a state or a path?


Water jug problem solution is a state. Natural language Understanding
Natural Language is a path.
"The bank president ate a dish of pasta salad with the fork"

CSE Mar, 2018 24 of 49


Articial Intelligence 15CS562

The solution to this problem is a sequences of operations or interpretations


that produces the nal state.

5. What is the role of knowledge?


Playing chess require very little knowledge as set of legal moves.
Deciding which news paper supports a specic political party require great
deal of knowledge.

6. Does the task require human-interaction?

ˆ Solitary, in which the computer is given a problem description and


produces an answer with no intermediate communication. (Theorem
proving)
ˆ Conversational, in which there is intermediate communication between
the person and the computer. (Medial diagnosis)

Production System Characteristics

Monotonic Nonmonotonic
Partially commutative Theorem proving Robot navigation
Not partially commutative Chemical synthesis Bridge

Problem Solving Methods

1. Forward from the Start state

2. Backward from the Goal state.

3. Matching

CSE Mar, 2018 25 of 49


Articial Intelligence 15CS562

4. Tree and/or Graph

5. Heuristic Methods

6. etc.

Heuristic Search Techniques

Heuristic Search Techniques

ˆ Generate and Test

ˆ Hill Climbing

 Steepest-Ascent hill climbing


 Simulated Annealing

ˆ Best rst search

 OR Graphs
 A* Algorithm
 Agendas

ˆ Problem reduction

 AND-OR Graphs
 AO* Algorithm

ˆ Constraint satisfaction

ˆ Means-ends analysis

Generate and Test

CSE Mar, 2018 26 of 49


Articial Intelligence 15CS562

1. Generate a possible solution (path or point).

2. Test to see it for solution (compare the end points of the path or compare
the points).

3. If found, quit else return to step 1.

This method is basically a depth rst search as complete solutions must be created
before testing.

If the generation of the possible solution is done systematically, then this procedure
will nd a 'good' if it exists.

In case of the large problem space, this might takes a long time.

Even if with the help of heuristic function, this algorithm is not very eective, so
most of the time it is used to restrict the search space.

Hill Climbing/Greedy local search

CSE Mar, 2018 27 of 49


Articial Intelligence 15CS562

ˆ It is a variant of generate and test.

ˆ From the feedback the direction of the search is determined.

Simple Hill Climbing

1. Evaluate the initial state. If it is the Goal, return otherwise continue.

2. Repeat until a solution is found or there are no new operators left to be


applied of current state:

ˆ Select an operator and apply it to produce new state.


ˆ Evaluate the new state - If it is a goal, return and quit Else, if it is
better than current state, make it current state else continue.

Compare with generate & test

CSE Mar, 2018 28 of 49


Articial Intelligence 15CS562

ˆ The key dierence in the generate and test and this hill climbing one is the
use of an evaluation function.

ˆ For the algorithm to work, the denition of "better" must be provided as


every time we are comparing as "the generated solution is better than the
existing one or not".

ˆ It is also possible to consider all the moves from the current state and a best
among them is selected. This is Steepest-Ascent Hill Climbing.

Steepest-Ascent Hill Climbing

1. Evaluate the initial state. If it is a goal state, then return it and quit.
Otherwise continue with the initial state as current state.

2. Loop until a solution is found or until a complete iteration produces no


change to current state.

ˆ a. Let SUCC be a state such that any possible successor of the current
state will be better than SUCC.
ˆ b. For each operator that applies to the current state do:
 i. Apply the operator and generate a new state.
 ii. Evaluate a new state. If it is a goal state, then return it and
quit. If not, compare it to SUCC. If it is better, then set SUCC to
this state. If it is not better, leave SUCC alone.
ˆ c. If the SUCC is better than current state, then set current state to
SUCC.

Hill climbing problems

CSE Mar, 2018 29 of 49


Articial Intelligence 15CS562

Remedy: Introduce randomness.

Simulated Annealing

ˆ SA is an eective and general form of optimization

ˆ Useful in nding global optima in the presence of local optima

ˆ Annealing refers to the way metals cool and anneal

ˆ Objective function: probability(accepting uphil move)

 p = e-∆ E/kT
 p = [1,0] when T=[∞, 0]
 Decreasing temperature schedule

Simulated Annealing algorithm

CSE Mar, 2018 30 of 49


Articial Intelligence 15CS562

ˆ Evaluate the initial state. If it is goal state then quit otherwise make the
current state this initial state and proceed.

ˆ Make variable BEST_STATE to current state

ˆ Set temperature, T, according to the annealing schedule

ˆ Repeat
∆ E  dierence between the values of current and new states

1. If this new state is goal state then quit


2. If better than the current state then set BEST_STATE as the new state
3. Otherwise the new state as current state with probability p'.
4. Revise T in the annealing schedule dependent on number of nodes in
tree.

Until a solution is found or no more new operators

ˆ Return BEST_STATE as the answer

Observations

ˆ SA algorithm is basically hill-climbing except instead of picking the best


move, it picks a random move.

ˆ Used in TSP and VLSI routing

Best-rst search: OR-Graph

CSE Mar, 2018 31 of 49


Articial Intelligence 15CS562

ˆ The central idea of best-rst search based on heuristic is to expand the path
that seems most promising.

ˆ This is the way of combining the advantages of depth rst and breadth rst
search into a single method

OPEN & CLOSED data structures

OPEN - nodes that have been generated and have had the heuristic function
applied to them but which have not yet been examined.

OPEN is actually a priority queue in which the elements with the highest priority
are those with the most promising value of the heuristic function.

CLOSED - nodes that have been examined. We need to keep these nodes in

CSE Mar, 2018 32 of 49


Articial Intelligence 15CS562

memory if we want to search a graph rather than a tree, since whenever a new
node is generated, we need to check whether it has been generated before.

BFS Algorithm

1. Start with OPEN containing just the initial state

2. Until a goal is found or there are no nodes in OPEN do:

ˆ a) Pick best node on OPEN


ˆ b) Generate its successors
ˆ c) For each successor do:
 i) If it has not been generated before, evaluate h, add to OPEN
and record its parent
 ii) If it has been generated before, change the parent if this path
is better than the previous one. In that case, update the cost of
getting to this node and any successors that this node may already
have.

Best-rst search: A*

f(n) is evaluation function that estimates least cost solution through node n.

f(n) = g(n) + h'(n)

CSE Mar, 2018 33 of 49


Articial Intelligence 15CS562

ˆ f(n) is the estimated total cost of the cheapest solution through n

ˆ g(n) gives the path cost from the start node to node n

ˆ h(n) names as heuristic function is the estimated cost of the cheapest path
from n to the goal node.

ˆ overestimation if if h'(n) > h(n)

ˆ under estimation if h'(n) < h(n)

The heuristic is admissible if h'(n) ≤ h(n)

Example 1

h(n) < Min( cost( path(n, goal)))

CSE Mar, 2018 34 of 49


Articial Intelligence 15CS562

Example 2

Example

CSE Mar, 2018 35 of 49


Articial Intelligence 15CS562

A* Algorithm

1. Put initial node in the list OPEN and CLOSED as empty

2. Loop: if OPEN is empty exit with failure

3. Select the rst node on OPEN and put it into CLOSED. Call this node n.

4. if n is a goal node, exit successfully with solution path from s to n.

5. Expand node n by its successors.

6. If successors not in OPEN or CLOSED set the parent as n

7. If already in OPEN decide if parent link has to be changed.

8. If already in CLOSED decide new f values have to be computed.

CSE Mar, 2018 36 of 49


Articial Intelligence 15CS562

Compare to Dijkstra's algorithm

A* Algorithm

ˆ f(n) = g(n) + h(n)

ˆ Each step expand the node with lowest value of f(n)

ˆ No other optimal algorithm is guaranteed to expand fewer node than A*

Dijkstra;s algorithm

ˆ f(b) = g(n), as a special case of A* where h(n) = 0

ˆ Each step expand all closes unexamined nodes

ˆ Can be implemented more eciently without a h(x) value at each node.

BFS

ˆ g(n) = 1, h(n) = 0

Problem Reduction: AND-OR Graph

Applications

ˆ Network routing

ˆ AI path nding

ˆ Image processing

CSE Mar, 2018 37 of 49


Articial Intelligence 15CS562

AND-OR graph for problem reduction

1. Given the Goal node, nd its possible o-springs.

2. Expand nodes in the least cost path and estimate h of the newly generated
children.

3. Propagate values to ancestors cost of the AND clauses or minimum of the


cost of the OR clauses.

4. If the estimated cost of a solution becomes greater than FUTILITY then


abandon the search. Any solution with higher cost is too expensive to be
practical.

5. If the estimated cost of the solution is 0, propagate the solution as SOLVED.

6. Else Repeat from 2.

Operation of problem reduction example

CSE Mar, 2018 38 of 49


Articial Intelligence 15CS562

AO* Algorithm

1. Given the Goal node, nd its possible o-springs.

2. Expand nodes in the least cost path and estimate h of the newly generated
children.

3. Propagate values to ancestors cost of the AND clauses or minimum of the


cost of the OR clauses.

4. If the estimated cost of a solution becomes greater than FUTILITY then


abandon the search. Any solution with higher cost is too expensive to be
practical.

5. If the estimated cost of the solution is 0, propagate the solution as SOLVED.

6. Else Repeat from 2.

Constraint Satisfaction

CSE Mar, 2018 39 of 49


Articial Intelligence 15CS562

ˆ The general problem is to nd a solution that satises a set of constraints.

 Set of variables {x1 , x2 , . . . , xi }


 Set of domains D (possible values associated with each variable)
 Set of constraints C restricting the values that the variables can simul-
taneously take.

ˆ Examples of this technique are design problem, labelling graphs, robot path
planning and cryptarithmetic puzzles (see last year).

Map coloring

ˆ Variables WA, NT, Q, NSW, V, SA, T

ˆ Domains D = {red, green, blue}

ˆ Constraints - adjacent regions must have diferent colors

Cryptarithmetic

S E N D 9 5 6 7
+ M O R E + 1 0 8 5
------------- ----------
M O N E Y 1 0 6 5 2

CSE Mar, 2018 40 of 49


Articial Intelligence 15CS562

ˆ Variables D, E, M, N, O, R, S, Y

ˆ Domains {0, 1, 2, 3 ,4, 5, 6, 7, 8, 9 }

ˆ Constraints

1. Letters take unique digits.


2. Arithmetic constraints

Constraint propagation

1. M=1

ˆ Since two single digit numbers plus a carry cannot total more than 19

2. S = 8 or 9

ˆ S + M + C3 > 9 (to generate the carry)


ˆ S + 1 + C3 > 9
ˆ S + C3 > 8
ˆ C3 <= 1 (ie. C3 is at most 1)

3. O = 0

ˆ M is already 1
ˆ S = 8 or 9

4. N = E or E+1

ˆ depending on the value of C2


ˆ N cannot have the same value as E (as per the denition)
ˆ N = E+1 & C2 = 1
ˆ C2 = 1 i N + R + C1 > 9 or N + R > 8

CSE Mar, 2018 41 of 49


Articial Intelligence 15CS562

ˆ N + R cannot be > 18 (otherwise E=9 contradicts with S=9)

Guess

At this point, let us assume that no more constraints can be generated.

Then to make progress from here, we must guess. Suppose E=2 (we choose to
guess a value for E because it occurs three times). Now the next cycle begins

Constraint propagation

1. N = 3

ˆ N=E+1

2. R = 8 or 9

ˆ R + N(3) + C1 (1 or 0) = 2 or 12
ˆ R + 3 + (0 or 1) = 12 since N is already 3 otherwise sum is -ve

3. 2 + D = Y or 2 + D = 10 + Y

Guess

CSE Mar, 2018 42 of 49


Articial Intelligence 15CS562

1. C1 = 1, we eventually reach dead ends. The process will backtrack and try
C1 =0

2. 2 + D = 10 + Y, D = 8 or 9, cannot happen because S and R must be 8 or


9. Three letters cannot sg=hare two value.

Algorithm:

1. Propagate available constraints:

2. If union of constraints discovered above denes a solution return solution.

3. If union of constraints discovered above denes a contradiction return failure.

4. Make a guess in order to proceed. Repeat until a solution is found or all


possible solutions exhausted:

CSE Mar, 2018 43 of 49


Articial Intelligence 15CS562

Means-Ends Analysis

MEA operations

CSE Mar, 2018 44 of 49


Articial Intelligence 15CS562

MEA dierence table

CSE Mar, 2018 45 of 49


Articial Intelligence 15CS562

MEA progress

CSE Mar, 2018 46 of 49


Articial Intelligence 15CS562

MEA Algorithm

1. Until the goal is reached or no more procedures are available:

ˆ Describe the current state, the goal state and the dierences between
the two.
ˆ Use the dierence the describe a procedure that will hopefully get nearer
to goal.
ˆ Use the procedure and update current state.

2. If goal is reached then success otherwise fail.

Observations

CSE Mar, 2018 47 of 49


Articial Intelligence 15CS562

ˆ Both forward and backward search

ˆ Based on dierence between current and goal state

ˆ Find the operator to reduce the dierence

ˆ If the operator is not found, set up a subproblem

Issues in the Design of Search Programs:

ˆ The direction in which to conduct search (forward Vs. backward)

ˆ How to select applicable rules (matching)

ˆ How to present each node process (knowledge representation and frame)

Assignment

1. Dene AI. What are the task domains of AI?

2. Describe i) physical symbol system hypothesis ii) Turing test.

3. Describe AI technique? Illustrate using Tic-Tac-Toe game.

4. Describe state space search? Illustrate using water jug problem.

5. Describe producion system and problem characteristics.

6. Compare BFS and DFS search methods.

7. Dene heuristic. Explain Manhattan distance with 8-tile puzle.

8. What is the dierences between generate & test and hill climbing. How
simulated annealing overcome the problems in hill climbing.

9. What is the dierences between best rst search and A* algorithms?

CSE Mar, 2018 48 of 49


Articial Intelligence 15CS562

10. What is the objective function used in A* search. Find the path between 0
and 3 for the following graph.

.
Use h(n) < Min( cost( path(n, goal))).

11. Write the AO* algorithm.

CSE Mar, 2018 49 of 49

Potrebbero piacerti anche