Scheduling in SICStus Prolog using CLPr

From: Vinyak Joshi (vinayak.joshi_at_maximizelearning.com)
Date: 05/31/04


Date: 31 May 2004 06:58:50 -0700

Consider the program "Scheduling-Part1.pl", attached herewith in
SICStus Prolog.
 
For the query "schedule(OptimumSchedule, EarliestFinishTime)." the
output is
 
"OptimumSchedule = [task1/res3/4/_A,task2/res3/2/_B,task3/res3/2/_C,task4/res3/20/_D,task5/res1/20/12.0,
task6/res2/11/10.0,task7/res2/11/21.0,task8/res2/10/0.0,task9/res1/12/0.0,task10/res1/0/32.0],
EarliestFinishTime = 32.0,
{_C=<8.0},
{_D=<12.0},
{_B-_C=< -2.0},
{_C-_D=< -2.0},
{_B>=0.0},
{_A>=0.0},
{_C-_A+_E>=6.0} "
 
The output besides being in terms of inequalities, has an extra
variable _E.
 
In order to get the output directly in terms of the minimum
StartTimes, rather than in a range, I modified the program
as in Scheduling-Part2.pl as attached herewith (refer to the
"single_start" method).
 
Now for the querry "schedule(OptimumSchedule, EarliestFinishTime)."
there is no output.
I then set up a Spy point as "spy single_start/2.".
The program then executes properly till the "single_start", the
"single_start" is called and executes properly till task5, where after
it crashes.
 
The corresponding trace is as follows :
 
 + 1 1 Call:
single_start([task1/res3/4/_1857,task2/res3/2/_1033,task3/res3/2/_1121,task4/res3/20/_1227,task5/res1/20/12.0,task6/res2/11/10.0,task7/res2/11/21.0,task8/res2/10/0.0,task9/res1/12/0.0|...],32.0)
?
 + 2 2 Call:
single_start([task2/res3/2/_1033,task3/res3/2/_1121,task4/res3/20/_1227,task5/res1/20/12.0,task6/res2/11/10.0,task7/res2/11/21.0,task8/res2/10/0.0,task9/res1/12/0.0,task10/res1/0/32.0],32.0)
?
 + 3 3 Call:
single_start([task3/res3/2/_1121,task4/res3/20/_1227,task5/res1/20/12.0,task6/res2/11/10.0,task7/res2/11/21.0,task8/res2/10/0.0,task9/res1/12/0.0,task10/res1/0/32.0],32.0)
?
 + 4 4 Call:
single_start([task4/res3/20/_1227,task5/res1/20/12.0,task6/res2/11/10.0,task7/res2/11/21.0,task8/res2/10/0.0,task9/res1/12/0.0,task10/res1/0/32.0],32.0)
?
 + 5 5 Call:
single_start([task5/res1/20/12.0,task6/res2/11/10.0,task7/res2/11/21.0,task8/res2/10/0.0,task9/res1/12/0.0,task10/res1/0/32.0],32.0)
?
 + 6 6 Call:
single_start([task6/res2/11/10.0,task7/res2/11/21.0,task8/res2/10/0.0,task9/res1/12/0.0,task10/res1/0/32.0],32.0)
?
 + 7 7 Call:
single_start([task7/res2/11/21.0,task8/res2/10/0.0,task9/res1/12/0.0,task10/res1/0/32.0],32.0)
?
 + 8 8 Call:
single_start([task8/res2/10/0.0,task9/res1/12/0.0,task10/res1/0/32.0],32.0)
?
 + 9 9 Call:
single_start([task9/res1/12/0.0,task10/res1/0/32.0],32.0) ?
 + 10 10 Call: single_start([task10/res1/0/32.0],32.0) ?
 + 11 11 Call: single_start([],32.0) ?
 + 11 11 Exit: single_start([],32.0) ?
       12 11 Call: minimize(32.0) ?
       12 11 Exit: minimize(32.0) ?
 + 10 10 Exit: single_start([task10/res1/0/32.0],32.0) ?
       13 10 Call: minimize(0.0) ?
       13 10 Exit: minimize(0.0) ?
 + 9 9 Exit:
single_start([task9/res1/12/0.0,task10/res1/0/32.0],32.0) ?
       14 9 Call: minimize(0.0) ?
       14 9 Exit: minimize(0.0) ?
 + 8 8 Exit:
single_start([task8/res2/10/0.0,task9/res1/12/0.0,task10/res1/0/32.0],32.0)
?
       15 8 Call: minimize(21.0) ?
       15 8 Exit: minimize(21.0) ?
 + 7 7 Exit:
single_start([task7/res2/11/21.0,task8/res2/10/0.0,task9/res1/12/0.0,task10/res1/0/32.0],32.0)
?
       16 7 Call: minimize(10.0) ?
       16 7 Exit: minimize(10.0) ?
 + 6 6 Exit:
single_start([task6/res2/11/10.0,task7/res2/11/21.0,task8/res2/10/0.0,task9/res1/12/0.0,task10/res1/0/32.0],32.0)
?
       17 6 Call: minimize(12.0) ?
       17 6 Exit: minimize(12.0) ?
 + 5 5 Exit:
single_start([task5/res1/20/12.0,task6/res2/11/10.0,task7/res2/11/21.0,task8/res2/10/0.0,task9/res1/12/0.0,task10/res1/0/32.0],32.0)
?
       18 5 Call: minimize(_1227) ?
       18 5 Fail: minimize(_1227) ?
 + 4 4 Fail:
single_start([task4/res3/20/_1227,task5/res1/20/12.0,task6/res2/11/10.0,task7/res2/11/21.0,task8/res2/10/0.0,task9/res1/12/0.0,task10/res1/0/32.0],32.0)
?
 + 3 3 Fail:
single_start([task3/res3/2/_1121,task4/res3/20/_1227,task5/res1/20/12.0,task6/res2/11/10.0,task7/res2/11/21.0,task8/res2/10/0.0,task9/res1/12/0.0,task10/res1/0/32.0],32.0)
?
 + 2 2 Fail:
single_start([task2/res3/2/_1033,task3/res3/2/_1121,task4/res3/20/_1227,task5/res1/20/12.0,task6/res2/11/10.0,task7/res2/11/21.0,task8/res2/10/0.0,task9/res1/12/0.0,task10/res1/0/32.0],32.0)
?
/11/10.0,task7/res2/11/21.0,task8/res2/10/0.0,task9/res1/12/0.0,task10/res1/0/32.0],32.0)
?
 + 1 1 Fail:
single_start([task1/res3/4/_1857,task2/res3/2/_1033,task3/res3/2/_1121,task4/res3/20/_1227,task5/res1/20/12.0,task6/res2/11/10.0,task7/res2/11/21.0,task8/res2/10/0.0,task9/res1/12/0.0|...],32.0)
?
no
% zip
| ?-
| ?-
 
I do not understand what is going wrong in the minimization process. I
shall be grateful if you help me identify the problem or suggest
alternative ways of going about the problem. (The program output
should give "single value minimum StartTimes" instead of ranges.)
Thanking you in anticipation.

Regards
Vinayak Joshi



Relevant Pages

  • Re: Printing files every step
    ... snip ... ... your code is 100% correct from the coding and logic points of view. ... Does "the user has to close files properly" imply that if I fail to ... Note that the standard says that exit() closes all open streams (and ...
    (comp.lang.c)
  • Re: Exiting without printing
    ... > Can someone direct me to the proper perldoc file which explains the ... > easiest way to exit a Perl app? ... There is just about no way that this command could cause a program to fail ... Saying "it fails" is about as ...
    (comp.lang.perl.misc)
  • Re: I need help please!
    ... santosh wrote in message ... It can fail when the operator sends the end-of-file sequence ... wish to exit from the program. ... writing menus and prompts and dialog boxes and stupid crap like ...
    (comp.lang.c)
  • Re: "gdth: update deprecated pci_find_device" is incorrect
    ... in jejb/scsi-rc-fixes-2.6.git is incorrect. ... You don't decrement pci refcount on exit. ... Also you do not so on fail paths... ...
    (Linux-Kernel)