0% found this document useful (0 votes)
34 views18 pages

AI Notes11

Uploaded by

nazmul
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)
34 views18 pages

AI Notes11

Uploaded by

nazmul
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/ 18

Artificial Intelligence Question Bank for 1st Internals with Solution

1. Explain Steepest Assent Hill Climbing with advantages and disadvantages with
solution
Ans:
A useful variation on simple hill climbing considers all the moves from the
current state and selects the best one as the next state. This method is called
Steepest Assent Hill Climbing or Gradient Search. This is contrasts with the
basic method in which the first state is better than the current state is selected.
This algorithm works as follows
Steepest-Ascent Hill Climbing
1. Evaluate the initial state. It is also a goal state them return it and quit.
Otherwise continue with the initial state as the current state
2. Loop the Solution is found or a complete iteration produces no change to the
current state
(a) Let SUCC be a state such that any possible successor to the current state will
be better than the SUCC
(b) For each operator that applies to the current state do:
i. Apply the operator and generate new state
ii. Evaluate the new state.
If it is the 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 then leave SUCC alone
( c ) If SUCC is better than the current state, then set current state to
the SUCC
Advantages:
1. Considers all the moves from the current state.
2. Selects the best one as the next state.

Disadvantages:
1. Both Simple and Steepest Ascent Hill Climbing may fail to find a solution,
i.e., both may terminate by not finding a goal state but land to a state
from no better state can be generated.
2. This will happen if the program reaches local maxima, a plateau or a ridge.

Local Maxima:
1. Local maximum is a state that is better than all its neighbors but not better than
other states far away.
2. In a local maximum all moves appears to make things worse.
3. Local maximum is frustrating because they almost appear within sight of
solution,
4. This case is called foothills

A plateau:
1. A plateau is a flat area is a search state in which whole set of neighbor states
have a same value
2. It is not possible to determine the best direction of move by local comparison
A ridge:
1. Ridge is a special kind of local maximum
2. It is the area of the search space which is higher than the surrounding area
which has a slope
3. But due to orientation in high region, set of available moves and the direction of
the move it is difficult to traverse in single direction

Solutions for problems:


1. Backtracking to some earlier node and try doing in other direction ( Local
maximum)
2. Make a big jump in some direction and try to get to a new section of search space
( Plateau)
3. Apply two or more rules before doing the test (ridge)

2. Solve he following crypto arithmetic problem: SEND+MORE= MONEY

Crypt Arithmetic Problem:

It is an arithmetic problem which is represented in letters. It involves the decoding


of digit represented by a character. It is in the form of some arithmetic equation
where digits are distinctly represented by some characters. The problem requires
finding of the digit represented by each character.

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

Step 1:

In the above problem, M must be 1,. You can visulazise that, this is an addition
problem. The sum of two digit numbers cannot be more than ),000. Also M cannot
be zero according to the rules, since it is the first letter.

Step 2:

Now in the column s10,s+1>_10 . S must be 8 because there is a 1 carried over from
the column EON or 9. O must be 0(if s=8 and there is a 1 carried or s=9 and there is
no 1 carried) or 1(if S=9 and there is a 1 carried). But 1 is already taken, so O must
be 0
Step 3:

There cannot be a carry from the column EON because In the column EON, E
cannot be equal to N. So there must be any digit +0<10, unless there is a carry
from the column NRE and E=9. But this cannot be the case because then N
would be 0 and 0 is already taken. So E<9 and there is no carry from this
column. Therefore S=9 because 9+1=10

Step 4:

In the column EON, E cannot be equal to N. So there must be carry digit is a


carry from the column NRE and E+1=N. Now we look at the column NRE, we
know that E+1=N. Since we know that carry from this column N=R=1E( if there
is no carry from the column DEY) or N+R+1=1E( if there is no carry from the
column
DEY)

Let us see both the cases


- no carry N + R =10 + (N+1) = N+9
-
- R=9
- But 9 is already taken , so this will not work

- Carry: N + R + 1 = 9R= 9-1=8. This must be solution for R

Step 5:
Now just think what are the digits we have left? They are 7,6,5,4,3,and 2. We
know there must be a carry from the column DEY. So D+E>10. N=E+1, So E
cannot be 7 because then N would be 8 which is already taken , D is almost 7, so
E cannot be 2 because then D+E<10 and E cannot be 3 because then D+E=10 and
Y=0, but 0 is already taken. Also E cannot be 4 because if D>6, D+E<10 and D\id
D=6 or D=7 then Y=0or Y=1 which are both taken. So E is 5 or 6
If E=6 then D=7 and Y=3. So this part will work but look the column N8E. Point
that there is a carry from the column D5YN+8+1=16( As there is a carry from
this column) But then N=7 and 7 is taken by D there E=5
Step 6:
We now have goten theis important digit, it gets much rasuer from here
N+8+1=15,N=6

Step 7:
The digits left are 7,4,3 and 2. We know there is a carry form the column D5Y, so
the only pair that works is D=7 and Y=2

Crypt arithmetic puzzle:

Two kinds of rules:


1. Rules that define valid constraint propagation.
2. Rules that suggest guesses when necessary.
3. Explain production system in detail with its characteristics

1. Is the problem decomposable?

2. Can solution steps be ignored or undone?

3. Is the universe predictable?


These three problems :
Theorem proving
8-puzzle
chess - indicates the difference between three class of problems
 Ignorable ( Eg., theorem proving) in which steps can be ignored
 Recoverable( Eg., 8-puzzle) in which solutions steps can be undone
 Irrecoverable ( Eg., Chess) in which solution steps cannot be undone

4. Is a good solution absolute or relative?

5. Is the solution a state or a path?


State:
E.g., Bank President ate a dish of pasta salad with a fork

Path:

Single Path:
Two Path:

4. Define Artificial Intelligence and list task domain of AI.


Ans: Definition:
Artificial Intelligence is a way of making a computer, a computer-controlled
robot, or a software think intelligently, in the similar manner the intelligent
humans think.
OR
The ability of a system to calculate, reason, perceive relationships and analogies,
learn from experience, store and retrieve information from memory, solve
problems, comprehend complex ideas, use natural language fluently, classify,
generalize, and adapt new situations.

Task domain of AI:


Diagram

Classification:
Ans:
Mundane Tasks
 Perception
 Vision
 Speech
 Natural Language
 Understanding
 Generation
 Translation
 Commonsense Reasoning
 Robot Control

Formal Tasks
 Games
 Chess
 Backgammon
 Checker, Go
 Mathematics
 Geometry
 Logic
 Integral Calculus
 Proving Property of Programs

Expert Tasks
 Engineering
 Design
 Fault Finding
 Manufacturing Planning
 Scientific Analysis
 Medical Diagnosis
 Financial Analysis
5. Explain production system in detail with its categories

Ans:

Diagram:

All non-monotonic reasoning are concerned with consistency. Inconsistency is


resolved, by removing the relevant conclusion(s) derived by default rules.

Example:

The value (true/false) of propositions such as “Tweety is a bird” accepts default


that is normally true such as “Birds typically fly”.
A conclusion derived was “Tweety Flies”.

Approaches of reasoning:

Three approaches
1. Symbolic reasoning
2. Statistical reasoning
3. Fuzzy logic reasoning

6. Write the algorithm for conversion of clause form along with example
7. Write the algorithm to unify(L1,L2)/Explain unification algorithm

Ans: Algorithm:
Algorithm Unify(L1,L2)
1. If L1 or L2 are both variables or constants, then:
(a) If L1 and L2 are identical, then return NIL
(b) Else if L1 is a variable, then if L1 occurs in L2 then return (FAIL),
else return (L2/L1)
(c ) Else if L1 is a variable, then if L2 occurs in L1 then return (FAIL),
else return (L1/L2)
(d) Else return (FAIL)
2. If the initial predicate symbols in L1 and L2 are not identical, then return (FAIL)
3. If L1 and L2 have different numbers of arguments, then return (FAIL)
4. Set SUBST to NIL. (At the end of this procedure, SUBST will contain all the
substitutions used to unify L1 and L2)
5. For i←1 to number of arguments in L1:
(a) Call Unify with the arguments of L1 and the i th argument of L2, putting result
in S
(b) If S contains FAIL, then return (FAIL)
(c) If S is not equal to NIL then:
(i) Apply S to the remainder to both L1 and L2
(ii) SUBST: = APPEND(S<SUBST)
6. Return SUBST

Explanation-Unification Algorithm:
 Given two terms  T1 and  T2  which are to be unified
 If T1 is a variable then instance of T1 to T2
 Otherwise, T2 is a variable then instance of T2 to T1
 Otherwise ,if T1 and T2 are complex terms with the same number /arguments
 Find the principle factor of F1 in T1 and principal factor of F2 in T2
 If these are the same then take the ordered set of arguments (A1,…..,AN) of T1
and ordered set of arguments (B1,…., BN ) of T2.For each pair of arguments AM
and BM from same position of the term AM must unify with BM
 Otherwise fail

8. State and explain algorithm for best first search with an example
Ans: Best-First Search:
 OPEN: nodes that have been generated, but have not examined.
 This is organized as a priority queue.
 CLOSED: nodes that have already been examined.
 Whenever a new node is generated, check whether it has been
generated before.

Algorithm:
1. OPEN = {initial state}.
2. Loop until a goal is found or there are no nodes left in OPEN:
- Pick the best node in OPEN
- Generate its successors
- For each successor:
new  evaluate it, add it to OPEN, record its parent
generated before  change parent, update successors
f(n) (heuristic function) = g(n) + h(n)
h(n) (heuristic factor) = estimated cost of the cheapest path from node n to a goal
state.
g(n) (depth factor) = cost of the cheapest path from the initial state to node n.

Greedy search:
h(n) = estimated cost of the cheapest path from node n to a goal state.
Neither optimal nor complete
Uniform-cost search:
g(n) = cost of the cheapest path from the initial state to node n.
Optimal and complete, but very inefficient

9. Explain problem reduction with respect to AND-OR graph/ Explain problem


reduction algorithm with an example

Ans:

Explanation

10. What are properties of good system for representation of knowledge? Explain
approaches to knowledge representation. List the issues of Knowledge
representation

Ans:
Representation of knowledge :
Using mathematical logic as the representational formalism I English sentence
 Spot is a Dog –
English sentences can be represented as logic
 Dog(Spot)
logical representation as facts
 x:dog(x) ->hastail(x)
using deductive mechanism as logic and generating new representation object
 hastail(Spot)
Using backward mapping function
 Spot has a tail

Knowledge Representation Schemas:


 Logic based representation – first order predicate logic, Prolog
 Procedural representation – rules, production system
 Network representation – semantic networks, conceptual graphs
 Structural representation – scripts, frames, objects

Issues of Knowledge representation :

Approaches to knowledge representation:

 Inferential Efficiency – the ability to incorporate into the knowledge


structure knowledge information that can be used to focus the attention of
the inference mechanism in the most promising direction

 Acquisitional Efficiency – the ability to acquire new information easily. The


simplest way involves direct insertion, by a person, of a new knowledge into
the database. The program itself will be able to control the knowledge.

 Inferential adequacy – the ability to manipulate representational structures


in such a way as to drive new structures corresponding to new knowledge
inferred from old

11. A water jug problem ststes “You are given two jugs, first one with 4-gallon
capacity and the second one with 3-galloncapacity. Neither have any measuring
markers on it. There is a pump that can be used to fill the jugs with water. How
can you get exactly 2 gallon of water into 4-gallon jug.”
Ans: Definition
Example: State Space Search: Water Jug Problem
Rules:
The role of the condition in the left side of a rule
 restrict the application of the rule
 more efficient
1. (x, y)  (4, y) Fill the 4 gallon jug
if x  4
2. (x, y)  (x, 3) Fill the 3 gallon jug
if y  3
3. (x, y)  (x  d, y) Pour some water out of 4 gallon jug
if x  0
4. (x, y)  (x, y  d) Pour some water out of 3 gallon jug
if y  0
5. (x, y)  (0, y) Empty 4 gallon jug to the ground
if x  0
6. (x, y)  (x, 0) Empty 4 gallon jug to the ground
if y  0
7. (x, y)  (4, y  (4  x)) Pour water from 3 gallon jug into 4 gallon jug
if x  y  4, y  0 until 4 gallon jug is full
8. (x, y)  (x  (3  y), 3) Pour water from 4 gallon jug into 3 gallon
if x  y  3, x  0 jug until3 gallon jug is full

9. (x, y)  (x  y, 0) Pour all water from 3 gallon jug into 4 gallon


if x  y  4, y  0 jug

10. (x, y)  (0, x  y) 0) Pour all water from 4 gallon jug into3 gallon
if x  y  3, x  0 jug
11. (0, 2)  (2, 0) Pour 2 gallons from the 3- gallon jug into
the 4-gallon jug

12. (2, y)  (0, y) Pour 2 gallons in the 4- gallons jug


to the ground

Steps:
1. Both empty
2. fill three gallon jug
3. Pour water from 3 gallon jug to 4 gallon jug
4. Fill 3 gallon jug
5. Pour water from 3 gallon jug to 4 gallon jug
6. Empty 4 gallon water to the ground
7. Pour all water from 3 gallon jug to 4 gallon jug

4-Gallon Jug 3-Gallon Jug Rule applied


1. (0, 0) ----
2. (0, 3) 2
3. (3, 0) 9
4. (3, 3) 2
5. (4, 2) 4
6. (0, 2) 5/12
7. (2, 0) 9/11
12. Explain problem characteristics with respect to Heuristic search / Explain the
principle of Heuristic Search Problem.
Ans: Strategies: Heuristic Search
A heuristic function is a function that maps from problem state description to
measure od desirability usually represented a numbers. Here the aspects of
problem state are considered , they aspects are evaluated and the weights given
to individual aspects are chosen in such a way that the value of the heuristic
function at a given node in the search process gives as good is on the estimate as
possible of whether that no desired path to a solution
 Heuristic: involving or serving as an aid to learning, discovery, or problem-
solving by experimental and especially trial-and-error methods. Merriam-
Webster’s dictionary)
 Heuristic technique improves the efficiency of a search process, possibly by
sacrificing claims of completeness or optimality.

Example: The Travelling Salesman Problem


“A salesman has a list of cities, each of which he must visit exactly once. There
are direct roads between each pair of cities on the list. Find the route the
salesman should follow for the shortest possible round trip that both starts and
finishes at any one of the cities.”

Nearest neighbour 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.

One Path:

Two Path among cities:


13. Explain Simulated Annealing
Ans: Simulated Annealing:
Annealing is the process of heating and cooling a metal to change its internal
structure for modifying its physical properties. When the metal cools, its new
structure is seized, and the metal retains its newly obtained properties. In simulated
annealing process, the temperature is kept variable.

We initially set the temperature high and then allow it to ‘cool' slowly as the
algorithm proceeds. When the temperature is high, the algorithm is allowed to accept
worse solutions with high frequency.
 A variation of hill climbing in which, at the beginning of the process, some
downhill moves may be made.
 To do enough exploration of the whole space early on, so that the final
solution is relatively insensitive to the starting state.
 Lowering the chances of getting caught at a local maximum, or plateau, or a
ridge.

Physical Annealing:

 Comes from the physical process of annealing in which substances are raised
to high energy levels (melted) and then cooled to solid state.
 The probability of moving to a higher energy state, instead of lower is
 p = e^(-E/kT)
 where E is the positive change in energy level, T is the temperature,
and k is Boltzmann’s constant.

Process:

 Physical substances are melted and then gradually cooled until some solid
state is reached.
 The goal is to produce a minimal-energy state.
 Annealing schedule: if the temperature is lowered sufficiently slowly, then the
goal will be attained.
 Nevertheless, there is some probability for a transition to a higher energy state:
e-E/kT.
At the beginning, the temperature is high.
 As the temperature becomes lower
 kT becomes lower
 E/kT gets bigger
 (-E/kT) gets smaller
 e^(-E/kT) gets smaller
As the process continues, the probability of a downhill move gets smaller and smaller
Algorithm:
1. Evaluate the initial state.
2. Loop until a solution is found or there are no new operators left to be applied:
- Set T according to an annealing schedule
- Selects and applies a new operator
- Evaluate the new state:
goal  quit
E = Val(current state) - Val(new state)
E < 0  new current state
else  new current state with probability e-E/kT.
 E represents the change in the value of the objective function.
 Since the physical relationships no longer apply, drop k. So p = e^(-E/T)
 We need an annealing schedule, which is a sequence of values of T: T0, T1, T2,
...

14. Discuss forward and backward reasoning Explain with example


Ans: Forward Chaining:

Using deduction to reach a conclusion from a set of antecedents is called


forward chaining.
 Forward chaining employs the system starts from a set of facts, and a set
of rules, and tries to find a way of using those rules and facts to deduce a
conclusion or come up with a suitable course of action.
 This is known as data-driven reasoning because the reasoning starts from a
set of data and ends up at the goal, which is the conclusion.
 When applying forward chaining, the first step is to take the facts in the
fact database and see if any combination of these matches all the
antecedents of one of the rules in the rule database.
 When all the antecedents of a rule are matched by facts in the database,
then this rule is triggered.
 Usually, when a rule is triggered, it is then fired, which means its
conclusion is added to the facts database. If the conclusion of the rule that
has fired can be an action or a recommendation.
It is a strategy of an expert system to answer the question, “What can
happen next?”

Here, the Inference Engine follows the chain of conditions and derivations and
finally deduces the outcome. It considers all the facts and rules, and sorts them
before concluding to a solution.
This strategy is followed for working on conclusion, result, or effect. For
example, prediction of share market status as an effect of changes in interest
rates.

Backward Chaining:
An alternative method, backward chaining, starts from a conclusion and
tries to show it by following a logical path backward from the conclusion
to a set of antecedents that are in the database of facts.

With this strategy, an expert system finds out the answer to the question, 
“Why this happened?”
On the basis of what has already happened, the Inference Engine tries to
find out which conditions could have happened in the past for this result.
This strategy is followed for finding out cause or reason. For example,
diagnosis of blood cancer in humans.

Rules: (Comparing forward and backward chaining)


1. A Λ B → (C Headache and fever → pain killer)
2. A → D (headache → sick)
3. C Λ D → E (Headache and fever and sick → emergency)
4. B Λ E Λ F → G (Fever and emergency and heart problem →
Serious problem)
5. A Λ E → H (headache and emergency → cardiac)
6. D Λ E Λ H → I (Fever and emergency and cardiac → intensive)

Facts:
1. A (headache)
2. B (fever)
3. F (heart problem)
Goal:
1. H (heart patient)

15. Explain Hill Climbing/Simple Hill Climbing algorithm with example

Ans: Hill climbing is a variant of generate-and-test in which feedback from the


test procedure is used to help the generator decide which direction to move in the
search space. A test function argumenta with heuristic function provides an
estimation of how close a given state is to a goal state since cost estimation is
almost minimum with time .Hill climbing is used when a good heuristic function
is available for evaluating states but no other useful knowledge is available.
For Eg., the heuristic function is just distance between the current location and
the location of the tall buildings. And the desirable states are those in which this
distance is minimized
The simplest way to implement Hill Climbing is as follows
Algorithm : Simple Hill Climbing
1. Evaluate the initial state. If it is also a goal state than return it and quit.
Otherwise , continue with the initial state as the current state
2. Loop until the solution is found or until there are no new operators left to be
applied in the current state:
(a) Select an operator that has not yet been applied to the current state and
apply it to produce a new state.
(b) Evaluate the new state.
(i) If it is the goal state then return it and quit.
(ii) If not goal state but it is better than the current state, then
make it the current state
(iii) If it is not better than the current state, then continue in the
loop.

16.Consider the following facts

Convert the above facts into wff hen in clause form and prove “Did Marcus hate
Caesar” using resolution

Convert the above facts into wff hen in clause form and prove “Was Marcus
loyal to Caesar” using resolution

You might also like