Question: 4.3 Consider the following two questions that are logically equivalent: (a) ? schedule(riva at Start, riva at End, Schedule), member( arrive( malcesine at), Schedule), before(

4.3 Consider the following two questions that are logically equivalent:

(a) ? schedule(riva at Start, riva at End, Schedule), member( arrive( malcesine at), Schedule), before( 17:00, Start).

(b) ? sail( riva at Start, _), before( 17:00, Start), schedule( riva at Start, riva at End, Schedule), member( arrive(malcesine at _), Schedule). Compare the ways Prolog constructs the answer in case

(a) and in case (b). Which question produces the answer more efficiently? Why? Can we simplify question

(b) to: ?- before( 17:00, Start), schedule( riva at Start, riva at End, Schedule), member(arrive( malcesine at _), Schedule). You can also measure the actual Prolog execution times when answering these questions. This can be done by a Prolog built-in predicate which is for this purpose typically called by statistics( runtime, T). T is a list of two values: first, total execution time in milliseconds from the start of the Prolog session, and second, execution time since the previous call of statistics( runtime, ). For example: ?- statistics(runtime, T1), schedule(...), statistics( runtime, T2). Suppose Prolog answered, among other things, T2 =[1315, 215]. This means that to solve the query schedule(...), Prolog needed 215 msec.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Management And Artificial Intelligence Questions!

Q:

a