% FILE: tribondv3.pro % IMPORT GLOBAL VARIABLE DATA TYPE :- consult('gv.pro'). % IMPORT COMPARISONS CODE :- consult('comparisons.pro'). % EXTENDED TRIBOND SOLVER xtribond(A,B,C) :- declare(count,0), tribond(A,B,C,_,Solution), valueOf(count,Count), write(Solution),write(' count='),write(Count),nl, undeclare(count). xtribond(_,_,_) :- undeclare(count). % TRIBOND SOLVER tribond(A,B,C,CommonThing,Solution) :- simple_pure_tribond(A,B,C,CommonThing,Solution). tribond(A,B,C,CommonThing,Solution) :- simple_mixed_tribond(A,B,C,CommonThing,Solution). % SIMPLE PURE TRIBOND SOLVER simple_pure_tribond(A,B,C,CommonThing,Solution) :- simple_pure_isa_tribond(A,B,C,CommonThing,Solution). simple_pure_tribond(A,B,C,CommonThing,Solution) :- simple_pure_has_tribond(A,B,C,CommonThing,Solution). simple_pure_tribond(A,B,C,CommonThing,Solution) :- simple_pure_vip_tribond(A,B,C,CommonThing,Solution). % SIMPLE PURE ISA TRIBOND SOLVER simple_pure_isa_tribond(X,Y,Z,CC,Solution) :- inc(count),isa(X,CC), inc(count),isa(Y,CC), inc(count),isa(Z,CC), Solution = tribond(isa(X,CC),isa(Y,CC),isa(Z,CC)). % SIMPLE PURE HAS TRIBOND SOLVER simple_pure_has_tribond(X,Y,Z,CC,Solution) :- inc(count),has(X,CC), inc(count),has(Y,CC), inc(count),has(Z,CC), Solution = tribond(has(X,CC),has(Y,CC),has(Z,CC)). % SIMPLE PURE VIP TRIBOND SOLVER simple_pure_vip_tribond(X,Y,Z,CC,Solution) :- inc(count),vip(X,CC), inc(count),vip(Y,CC), inc(count),vip(Z,CC), Solution = tribond(vip(X,CC),vip(Y,CC),vip(Z,CC)). % SIMPLE MIXED TRIBOND SOLVER simple_mixed_tribond(X,Y,Z,CC,Solution) :- inc(count),isa(X,CC),inc(count),has(Y,CC),inc(count),vip(Z,CC), Solution = tribond(isa(X,CC),has(Y,CC),vip(Z,CC)). simple_mixed_tribond(X,Y,Z,CC,Solution) :- inc(count),isa(X,CC),inc(count),vip(Y,CC),inc(count),has(Z,CC), Solution = tribond(isa(X,CC),vip(Y,CC),has(Z,CC)). simple_mixed_tribond(X,Y,Z,CC,Solution) :- inc(count),has(X,CC),inc(count),isa(Y,CC),inc(count),vip(Z,CC), Solution = tribond(has(X,CC),isa(Y,CC),vip(Z,CC)). simple_mixed_tribond(X,Y,Z,CC,Solution) :- inc(count),has(X,CC),inc(count),vip(Y,CC),inc(count),isa(Z,CC), Solution = tribond(has(X,CC),vip(Y,CC),isa(Z,CC)). simple_mixed_tribond(X,Y,Z,CC,Solution) :- inc(count),vip(X,CC),inc(count),isa(Y,CC),inc(count),has(Z,CC), Solution = tribond(vip(X,CC),isa(Y,CC),has(Z,CC)). simple_mixed_tribond(X,Y,Z,CC,Solution) :- inc(count),vip(X,CC),inc(count),has(Y,CC),inc(count),isa(Z,CC), Solution = tribond(vip(X,CC),has(Y,CC),isa(Z,CC)). % FIND ALL PROBLEMS problems :- concepts(SC1,SC2,SC3), distinct(SC1,SC2,SC3), ordered(SC1,SC2,SC3), write(problem(SC1,SC2,SC3)),nl, fail. problems. % FIND ALL TRIBONDS tribonds :- concepts(SC1,SC2,SC3), distinct(SC1,SC2,SC3), ordered(SC1,SC2,SC3), xtribond(SC1,SC2,SC3), fail. tribonds. concepts(A,B,C) :- concept(A),concept(B),concept(C). distinct(A,B,C) :- not(A=B),not(A=C),not(B=C). ordered(A,B,C) :- aless(A,B),aless(B,C).