% %--------------------------------------% % Example network plans % %--------------------------------------% % first network plan; 6 solutions for N = 3 % no solution for N < 3 ac1(a, b). ac1(a, c). ac1(a, d). ac1(a, e). ac1(a, f). ac1(a, g). ac1(b, c). ac1(c, d). ac1(d, e). ac1(e, f). ac1(f, g). ac1(g, b). ac1(g, h). ac1(h, b). % second network plan; 6 solutions for N = 3 % no solution for N < 3 ac2(a, b). ac2(b, c). ac2(c, d). ac2(d, a). ac2(g, a). ac2(g, b). ac2(g, c). ac2(g, d). % third network plan; 18 solutions for N = 3 % 2 solutions for N = 2 % no solutions for N < 2 ac3(a, b). ac3(b, c). ac3(c, d). ac3(d, a). %--------------------------------------% % Helper functions % %--------------------------------------% % counts the number of solutions for given N % and a selected network plan in `acOverlap` countSolutions(N, Count) :- findall(_X, channelise(N, _XS), Res), length(Res, Count). % makes access point overlapping symmetric % replace _ with the index of a target network plan acOverlap(X, Y) :- ac1(X, Y). acOverlap(X, Y) :- ac1(Y, X). % unifies all access points to ACS accessPoints(ACS) :- setof(X, Y^acOverlap(X, Y), ACS). %--------------------------------------% % Your solution % %--------------------------------------% % implement channelise(?N, -CS). channelise(_N, []).