Вот написал полную программу.... но не работает (((
Код
domains
VMas=integer*
R=rebro(integer,integer)
RMas=R*
predicates
inlist(integer, VMas)
path(integer,integer,VMas,RMas,VMas)
path1(integer,VMas,VMas,RMas,VMas)
smezh(integer,integer,VMas,RMas)
prinad(R, RMas)
gamilton(VMas,RMas,VMas)
vseversh(VMas,VMas,RMas)
clauses
gamilton(VM, RM, P):-
path(_,_,VM,RM,P),
vseversh(P,VM,RM).
vseversh(P,VM,RM):-
not(inlist(B,VM)),
not(inlist(B,P)).
path(A,Z,VM,RM,P):-
path1(A,[Z],VM,RM,P).
path1(A,[A|P1],_,_,[A|P1]).
path1(A,[Y|P1],VM,RM,P):-
smezh(X,Y,VM,RM),
inlist(X,P1),
path1(A,[X,Y|P1],VM,RM,P).
smezh(X,Y,VM,RM):-
prinad(rebro(X,Y),RM);
prinad(rebro(Y,X),RM).
prinad(X, [X|_]).
prinad(X, [_|L]):-prinad(X, L).
inlist(X, [X|_]).
inlist(X, [_|L]):-inlist(X, L).
/* goal*/
/* gamilton([1,2,3,4],[rebro(1,2),rebro(2,4),rebro(2,3),rebro(3,4)],X)*/
/* path(1,3,[1,2,3,4],[rebro(1,2),rebro(2,4),rebro(2,3),rebro(3,1)],X)*/
Она даже путь не может посчитать... никак не могу найти ошибку