Questions: 69

Answers by our Experts: 50

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Write simple fact for the followings and run suitable query. i. Shyam likes Ram ii. Everyone likes Ram iii. Shyam likes everybody iv. Shyam likes everybody and everybody likes Shyam v. Shyam likes Ram or Shyam likes Aparna vi. Shyam does not like pizza vii. Shyam likes Ram if Shyam likes Aparna.


Write simple fact for the followings and run suitable query


ABSKINMENT 1


mark 10


Due date: 13.12.21


Makea kwodgane of customer order ontry and Pse queries against the customer order entry logichose that


1 find no, of customers in a gran city


2 nd the number for a given tom name


3 find the inventory level for a given item number



Write a list of facts that are points on a graph (ex: point(1,3).)




• Sample fact: point(1,3).




• Add at least 6 more.




Write a rule that determines whether a line going through 2 points is horizontal. A Horizontal line requires that the Y value be the same. The X value must be different.




• The planned query is horizontal (X1,Y1,X2,Y2).




• This means that horizontal(4 variables ) needs to be the head (left part) of a rule, and the body (right side of the rule) needs to include rules about point( ? , ?).




• The head is followed by :- and then the facts that must be true.





Write another rule that determines whether a line going through 2 points is vertical.





Run a query to see all the points in your knowledgebase that start with X=1.




• Example: To find all the loves which had love object = Amy, you ran the query loves(X,Amy).




Run a query to test two points in your knowledgebase:









maximum(

    [minimum(

     [maximum([minimum([l(2),l(12)]),minimum([l(6),l(10)])]),

      maximum([minimum([l(8),l(19)]),minimum([l(17),l(21)])])]),

     minimum(

     [maximum([minimum([l(5),l(4)]),minimum([l(15),l(9)])]),

      maximum([minimum([l(12),l(16)]),minimum([l(2),l(12)])])])])

For this question you must author prolog code that allows you to apply alpha/beta pruning to a tree in this form using the top-level syntax: ?- alphabeta(T,V) where < T > is a tree in the form above and < V > is the final value. When called your code should also print out the value for each node processed and the pruning steps as it goes of the form:

"Leaf Value: 2" "Max node Value: 4" "Min node Value: 2" "Alpha Prune." "Beta Prune."


This homework is about finding a path in a labyrinth modelled as ann×n-grid of white and blackcells. Suppose a robot starts in the upper lefthand corner and wants to move to the lower righthandcorner. It can move horizontally and vertically (but not diagonally), and it can only move via whitecells. In Prolog, we represent the grid as a list of lists of the atomsw(forwhite) andb(forblack).We store the grid given to us using the predicate grid/1.


We represent cells as terms of the formX/Yand we represent the current state as the cell at whichthe robot currently is located. First implement a predicate calledwhite/1that you can use to checkwhether a given cellX/Yis white. Then implement a predicatemove/2which generates all legalfollow-up states for a given state, when used with enforced backtracking.


Write a procedure map_square(List,Result) that calculates the squared value of each element of List and returns the result in the list Result. For example:


How to find number of children(X,Y) based on male(X), female(X) and/or parent(X,Y)?


Write a list of facts that are points on a graph (ex: point(1,3).)

  • Sample fact: point(1,3).
  • Add at least 6 more.

Write a rule that determines whether a line going through 2 points is horizontal. A Horizontal line requires that the Y value be the same. The X value must be different.

Write another rule that determines whether a line going through 2 points is vertical.

Save the file with a .pl extension.

Open a prolog session on panther (swipl)

consult your knowledgebase by typing [your filename without the .pl].

list the knowledgebase using : listing.

  • see all the lines in your .pl file

Run a query to see all the points in your knowledgebase that start with X=1.

Run a query to test two points in your knowledgebase

Run these queries that show all the possible horizontal lines made with the points in the database: horizontal (X1,Y1,X2,Y2). . Repeat for vertical (X1,Y1,X2,Y2).

  • A will bind to a point(? , ?) and B will bind to another point(? ?).
  • type ; to keep getting all the answer

2. Given a detail of rooms available at Miraculous Hotel in Table 1 below:

 

Type of

Number and

Room size

Number of

Price (RM)

Room

Type of Bed

(m2)

guests

 

Single

1 Single bed

40

1

160

Double

1 Queen bed

45

2

210

Triple

3 Single beds

60

3

280

Family

2 Queen beds

70

4

350

 

 

Table 1

 

 


   Build Prolog query for the following:

 

(1)    Display all the room type with the room price less than RM 300 and suitable for three guests and below.


LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS