

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Main points of this exam paper are: N-Queens Problem, Generates, Four Queens, Intersection, Predicate, Intersect, Symbol System, Physical Symbol, System Hypothesis, Good Representational
Typology: Exams
1 / 3
This page cannot be seen from the preview
Don't miss anything!


(NFQ – Level 8)
Answer question any FOUR questions (All questions carry equal marks).
Examiners: Mr. P. Rothwell Mr. E. A. Parslow Mr. P. O Connor Dr. D. Chambers
prog( _, [] ,[]). prog(L2, [ X | L1], [ X | L3 ]):- member(X, L2), prog(L2, L1, L3),!. prog(L2,[ _ | L1], L3):- prog(L2, L1, L3),!.
?- prog([p, f, d, a, g, c], [ a, p, b, q, c, r], L). [10 marks]
(b) The following Prolog program can be used to solve the N-Queens problem: %gen(X,Y,L) generates a list L of numbers from X to Y nqs(N,S):- gen(1,N,Dxy), Nu1 is 1-N, Nu2 is N-1, gen(Nu1,Nu2,Du), Nv2 is N+N, gen(2,Nv2,Dv), sol(S,Dxy,Dxy,Du,Dv).
Sol([],[],Dy,Du,Dv). Sol([Y|Ylist],[X|Dx1],Dy,Du,Dv):- del(Y,Dy,Dy1), U is X-Y, del(U,Du,Du1), V is X+Y, del(V,Dv,Dv1), sol(Ylist,Dx1,Dy1,Du1,Dv1). In your own words, explain how the above program would try to generate a solution S for the four queens problem. Include an explanation of each line (refer to line numbers) of the program in terms of the representation being used. [10 marks]
(c) Write and fully explain a Prolog program to define the predicate intersect(A, B, C) which assigns to the list C the intersection of the lists A and B (you may use system defined predicates):. E.g. ?- intersect([a,b,c], [d,e,b,c], L). L=[b,c] [5 marks] [Total: 25 marks]
(b) Briefly discuss the following statement with particular reference to the underlined phrases: “Expert systems are knowledge-based programs that provide expert-quality solutions in narrow, well-defined domains.”[6 marks]
(c) With the aid of an example, give a full description of the details of a production rule-based system. Your description should cover: rules, working memory, rule interpreter, conflict resolution, and control of reasoning. [12 marks] [Total: 25 marks]
A Farmer has a wolf, a goat and a cabbage on the left bank of a river. He has one boat. He must row the boat. Only the farmer and one of his possessions can occupy the boat at a time. Also he cannot leave the following pairs alone together: goat and cabbage, wolf and goat. Determine a sequence of moves that will get the farmer and all of his possessions onto the right bank safely.
(b) Based on the representation in part (a) above, outline the essentials of a Prolog program that would solve the problem. [8 marks]
(c) Explain the operation of your program in part (b) above. [7 marks]