feat: Extra i

This commit is contained in:
Renge 2024-02-23 14:09:42 -05:00
parent 51433dedb1
commit bae2763db1
3 changed files with 23 additions and 101 deletions

View File

@ -0,0 +1,11 @@
#include "randompath1000". % 2nd way of reading input facts
path(X,Y) :- edge(X,Y).
% Way 1
%path(X,Y) :- edge(X,Z), path(Z,Y).
% Way 2
%path(X,Y) :- path(X,Z), edge(Z,Y).
% Way 3
%path(X,Y) :- path(X,Z), path(Z,Y).
%cycle(X) :- path(X,X).

View File

@ -160,7 +160,7 @@ xsb
['A/cycle.P'].
timePath.
```
| Number of Nodes | Way1 | Way 2 | Way3 |
| Number of Nodes | Way1 | Way 2 | Way 3 |
| --------------- | ------ | ------ | --------------- |
| 200 | 0.0 | 0.0 | 0.407 |
| 500 | 0.031 | 0.031 | 6.125 |
@ -168,6 +168,17 @@ timePath.
| 2000 | 0.391 | 0.391 | Too long to run |
| 5000 | 2.484 | 3.093 | Too long to run |
| 10000 | 10.344 | 13.125 | Too long to run |
```shell
clingo Extra/cycle.lp| grep "^Time"
```
| Number of Nodes | Way1 | Way 2 | Way 3 |
| --------------- | ------ | ------ | --------------- |
| 200 | 0.041 | 0.041 | 1.284 |
| 500 | 0.271 | 0.264 | 20.948 |
| 1000 | 1.199 | 1.204 | Too long to run |
| 2000 | 5.683 | 5.364 | Too long to run |
| 5000 | 65.162 | 66.672 | Too long to run |
Runtime of the third way is much higher than the first two ways
### II
See Extra/2.pl

View File

@ -1,100 +0,0 @@
edge(2, 2).
edge(1, 1).
edge(2, 3).
edge(8, 3).
edge(5, 6).
edge(3, 9).
edge(5, 7).
edge(2, 2).
edge(10, 5).
edge(7, 1).
edge(7, 7).
edge(1, 6).
edge(2, 9).
edge(7, 9).
edge(10, 4).
edge(6, 7).
edge(1, 4).
edge(4, 1).
edge(7, 1).
edge(7, 10).
edge(6, 10).
edge(1, 2).
edge(2, 10).
edge(7, 4).
edge(9, 1).
edge(7, 4).
edge(2, 10).
edge(9, 8).
edge(7, 7).
edge(1, 5).
edge(8, 2).
edge(5, 4).
edge(10, 10).
edge(10, 2).
edge(4, 7).
edge(2, 1).
edge(9, 3).
edge(6, 10).
edge(1, 6).
edge(8, 10).
edge(9, 8).
edge(1, 1).
edge(9, 9).
edge(2, 2).
edge(7, 2).
edge(1, 4).
edge(9, 9).
edge(6, 5).
edge(10, 3).
edge(4, 4).
edge(7, 9).
edge(3, 7).
edge(8, 9).
edge(10, 1).
edge(1, 4).
edge(6, 5).
edge(6, 3).
edge(2, 4).
edge(1, 7).
edge(9, 2).
edge(1, 2).
edge(2, 1).
edge(5, 9).
edge(4, 5).
edge(7, 3).
edge(10, 6).
edge(9, 9).
edge(8, 6).
edge(3, 2).
edge(1, 9).
edge(6, 7).
edge(5, 7).
edge(1, 1).
edge(2, 7).
edge(7, 1).
edge(2, 7).
edge(9, 9).
edge(1, 10).
edge(6, 9).
edge(9, 9).
edge(8, 8).
edge(6, 2).
edge(5, 2).
edge(6, 7).
edge(10, 1).
edge(8, 3).
edge(3, 2).
edge(1, 4).
edge(1, 5).
edge(1, 3).
edge(3, 10).
edge(8, 5).
edge(6, 3).
edge(3, 4).
edge(3, 2).
edge(1, 9).
edge(8, 9).
edge(1, 1).
edge(1, 4).
edge(3, 6).