14 lines
312 B
Plaintext
14 lines
312 B
Plaintext
#include "data20.lp".
|
|
|
|
% % Generate
|
|
{ cycle(X,Y) : path(X,Y) } = 1 :- node(X).
|
|
{ cycle(X,Y) : path(X,Y) } = 1 :- node(Y).
|
|
% Define
|
|
reached(Y) :- cycle(a,Y).
|
|
reached(Y) :- cycle(X,Y), reached(X).
|
|
% Test
|
|
:- node(Y), not reached(Y).
|
|
% Display
|
|
#show cycle/2.
|
|
% Optimize
|
|
#minimize { C,X,Y : cycle(X,Y), edge(X,Y,C) }. |