Академический Документы
Профессиональный Документы
Культура Документы
This Lab is based on the book by Ivan Bratko, Prolog Programming for Artificial Intelligence, Third
Edition, 2001, Pearson Education Ltd., Second Impression 2007 (in India).
Do the following:
1. Find the time taken by the method to execute the query given at the end of Table 1. [Hint: Read
and Use time/2 predicate given in the LPA Win-Prolog help]
2. Comparing the program in Table 1 (of Lab 4) and Table 1 (of this Lab), make a table of
predicates of Table 1 and Table 3 by stating which predicate(s) in Table 3 does the analogous or
similar work of which predicate(s) in Table 1.
3. Change the program for any other scheduling problem involving at least 10 tasks and 15
precedence relations.
4. Name your files as L5_AI_YourID_pN and zip them as L5_AI_YourID.zip and transmit to
instructor’s email id. Replace the text YourID by your BITS IDNumber and N in pN by problem
number 1, 2, or 3 as the case may be.
% Problem-specific relations for the task-scheduling problem.
% The particular scheduling problem of Figure 12.8 is also defined by its
% precedence graph and an initial (empty) schedule as a start node for search.
The first list specifies the waiting tasks and their durations; the ヘ
second list specifies the currently executed tasks and their finishing ヘ
times, ordered so that F1 =< F2, F2 =< F3 ... . Fintime is the ヘ
latest completion time of current engagements of the processors.
*/
insert( S/A, [T/B | L], [S/A, T/B | L], F, F) :- % Task lists are ordered
A =< B, !.
prec( t1, t4). prec( t1, t5). prec( t2, t4). prec( t2, t5).
prec( t3, t5). prec( t3, t6). prec( t3, t7).
% A start node
start( [t1/4, t2/2, t3/2, t4/20, t5/20, t6/11, t7/11] * [idle/0, idle/0, idle/0] * 0).
Table 1