Skip to content

Commit 8dd02a8

Browse files
committed
Bug in level-off detection fixed. The use of nogoods as proposed in the textbook seems not to guarantee termination.
1 parent 6183425 commit 8dd02a8

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

aima-core/src/main/java/aima/core/logic/planning/GraphPlanAlgorithm.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,12 @@ public List<List<ActionSchema>> graphPlan(Problem problem) {
6464
// solution ← EXTRACT-SOLUTION(graph, goals, NUMLEVELS(graph), nogoods)
6565
List<List<ActionSchema>> solution = extractSolution(graph, goals, tl, nogoods);
6666
// if solution ≠ failure then return solution
67-
if (solution != null && solution.size() != 0)
67+
if (solution != null)
6868
return solution;
69-
} else
69+
} else {
7070
// seems to be missing in the book - but needed to guarantee termination! (RLu)
7171
nogoods.put(tl, goals);
72+
}
7273
// if graph and nogoods have both leveled off then return failure
7374
if (levelledOff(graph) && leveledOff(nogoods))
7475
return null;

aima-core/src/test/java/aima/test/core/unit/logic/planning/GraphPlanAlgorithmTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
/**
1212
* @author samagra
13+
* @author Ruediger Lunde
1314
*/
1415
public class GraphPlanAlgorithmTest {
1516
@Test

0 commit comments

Comments
 (0)