strange behaviour

From: ab <amir_at_eisa.net.au>
Date: Sat 10 Nov 2001 11:54:28 PM GMT
Message-ID: <047f01c16a43$09593980$0200a8c0@tester>
Hi everyone,

I am experiencing some strange behaviour with eclipse.  I run the below
code, and it responds that is has "Found a solution with cost 5", but keeps
running and doesn't display anything.  Looking at it with
make_display_matrix(L/0, solve) shows that it is running intro problems with
the last three items in the Solution list.

Any ideas?

Thanks





:-lib(fd).

:-local struct(task(start,need,same,prohib,use)).

solve(Solution):-

Solution=
[UH406,UH499,UH414,UH411,UH405,UH420,UH410,UH421,HQ1,UH200,HD1,HT1,DB,DEVHOS
T,MEDUSA,UNICORN],

UH406 = task with [need : [UH411,UH414,UH405] ,same : [], prohib: [], use :
P1],

UH499 = task with [need : [HQ1, UH200, UH420, DEVHOST,UH414] ,same : [],
prohib: [], use : P2],

UH414 = task with [need : [UH405,UH411] ,same : [], prohib: [], use : D1],

UH411 = task with [need : [] ,same : [], prohib: [], use : D1],

UH405 = task with [need : [] ,same : [], prohib: [], use : D1],

UH420 = task with [need : [UH411] ,same : [], prohib: [UH406], use : P3],

UH410 = task with [need : [UH414] ,same : [], prohib: [], use : P4],

UH421 = task with [need : [UH414] ,same : [], prohib: [], use : P4],

HQ1 = task with [need : [DEVHOST,HD1] ,same : [], prohib: [], use : D4],

UH200= task with [need : [] ,same : [], prohib: [], use : P6],

HD1= task with [need : [] ,same : [], prohib: [], use : D4],

HT1= task with [need : [HD1] ,same : [], prohib: [], use : D4],

DB = task with [need : [HT1] ,same : [], prohib: [], use : P7],

DEVHOST = task with [need : [] ,same : [], prohib: [], use : D4],

MEDUSA = task with [need : [DEVHOST,UNICORN] ,same : [], prohib: [], use :
P8],

UNICORN = task with [need : [DEVHOST] ,same : [], prohib: [], use : D5],

starts(Solution,L),

L :: 1..16,

make_display_matrix(L/0, solve),

% Precedence constraints

( foreach(task with [start:Si,need:NeededTasks], Solution) do

( foreach(task with [start:Sj], NeededTasks), param(Si) do Si #> Sj)

),

% Select machines that have to be migrated at the same time

( foreach(task with [start:Si,same:SameTasks], Solution) do

( foreach(task with [start:Sj], SameTasks), param(Si) do Si #= Sj)

),

% Select machines that cannot be migrated at the same time

( foreach(task with [start:Si,prohib:ProhibTasks], Solution) do

( foreach(task with [start:Sj], ProhibTasks), param(Si) do Si #\= Sj)

),





% minimize cost

min_max((

no_overlaps(Solution), %two tasks wich need the same guy cannot be at the
same time

labeling(L),max(L,X)

),X),

nl,

write(L),nl.

max([X],X).

max([X|L],X):-max(L,Y), Y =< X.

max([X|L],Y):-max(L,Y), Y > X.





starts([],[]).

starts([task with [start : X] |L],[X|L2]):-starts(L,L2).

no_overlaps(Tasks) :-

( fromto(Tasks, [Task0|Tasks0], Tasks0, []) do

( foreach(Task1,Tasks0), param(Task0) do

Task0 = task with [start:S0, use:R0],

Task1 = task with [start:S1, use:R1],

( R0 == R1 ->

no_overlap(S0, S1)

;

true

)

)

).

no_overlap(Si,Sj) :-

Sj #> Si.

no_overlap(Si,Sj) :-

Si #> Sj.
Received on Sat Nov 10 04:58:57 2001

This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:07:11 PM GMT GMT