cleaned up code
[ker1415-1.git] / report / src / task14part1.pl
index 74f01a7..bb1aa53 100644 (file)
@@ -1,18 +1,32 @@
 :- [diagnosis].\r
 \r
-generateHittingSetTree(SD, COMP, OBS, HS, HSTREE) :- %test with problem1(SD,COMP,OBS), generateHittingSetTree(SD,COMP,OBS,[],HSTREE). This needs to report node([a1], [node([a2], [leaf])]).\r
-       tp(SD, COMP, OBS, HS, CS) -> generateParts(SD, COMP, OBS, HS, CS, HSTREE) ; generateParts(_,_,_,_, [], HSTREE).  %second part of the OR is needed to translate an empty conflict set into a leaf.       \r
+%test with problem1(SD,COMP,OBS),\r
+%generateHittingSetTree(SD,COMP,OBS,[],HSTREE). This needs to report node([a1],\r
+%[node([a2], [leaf])]).\r
+%second part of the OR is needed to translate an empty conflict set into a leaf.       \r
+generateHittingSetTree(SD, COMP, OBS, HS, HSTREE) :-\r
+       tp(SD, COMP, OBS, HS, CS) -> generateParts(SD, COMP, OBS, HS, CS, HSTREE);\r
+       generateParts(_,_,_,_, [], HSTREE).     \r
\r
+%generates leaf if at the end of all possible conflict sets in a branch\r
+generateParts(_,_,_,_, [],leaf).\r
+%generates node if the conflict set isn't empty and goes on.\r
+generateParts(SD, COMP, OBS, HS, CS, node(CS, RESTOFTREE)) :- \r
+       %repairs the branch by branching out for each item in the conflict set and\r
+       %generating new conflict sets for the next node\r
+       repairBranch(SD, COMP, OBS, HS, CS, RESTOFTREE). \r
        \r
-generateParts(_,_,_,_, [],leaf).%generates leaf if at the end of all possible conflict sets in a branch\r
-generateParts(SD, COMP, OBS, HS, CS, node(CS, RESTOFTREE)) :- %generates node if the conflict set isn't empty and goes on.\r
-       repairBranch(SD, COMP, OBS, HS, CS, RESTOFTREE). %repairs the branch by branching out for each item in the conflict set and generating new conflict sets for the next node\r
-       \r
-                               \r
-repairBranch(SD, COMP, OBS, HS, [CONFLICTITEM], [BRANCH]) :- %single item left in conflict set\r
-       append(HS, [CONFLICTITEM], HSNEW), %add the used conflict set item for this branch to the new hitting set\r
-       generateHittingSetTree(SD, COMP, OBS, HSNEW, BRANCH). %find the next new conflict set with the new hitted item\r
-repairBranch(SD, COMP, OBS, HS, [CSHEAD|CSTAIL], [BRANCHHEAD|BRANCHTAIL]) :- %multiple items left in conflict set\r
-       append(HS, [CSHEAD], HSNEW), %add the used conflict set item for this branch to the new hitting set\r
-       generateHittingSetTree(SD, COMP, OBS, HSNEW, BRANCHHEAD), %find the next new conflict set with the new hitted item\r
-       repairBranch(SD, COMP, OBS, HS, CSTAIL, BRANCHTAIL). %goes on in recursion for each item in the conflict set of the current node\r
-       
\ No newline at end of file
+%single item left in conflict set\r
+repairBranch(SD, COMP, OBS, HS, [CONFLICTITEM], [BRANCH]) :- \r
+       %add the used conflict set item for this branch to the new hitting set\r
+       append(HS, [CONFLICTITEM], HSNEW),\r
+       %find the next new conflict set with the new hitted item\r
+       generateHittingSetTree(SD, COMP, OBS, HSNEW, BRANCH).\r
+%multiple items left in conflict set\r
+repairBranch(SD, COMP, OBS, HS, [CSHEAD|CSTAIL], [BRANCHHEAD|BRANCHTAIL]) :-\r
+       %add the used conflict set item for this branch to the new hitting set\r
+       append(HS, [CSHEAD], HSNEW),\r
+       %find the next new conflict set with the new hitted item\r
+       generateHittingSetTree(SD, COMP, OBS, HSNEW, BRANCHHEAD),\r
+       %goes on in recursion for each item in the conflict set of the current node\r
+       repairBranch(SD, COMP, OBS, HS, CSTAIL, BRANCHTAIL).\r