Skip to content

Commit f1fd09d

Browse files
committed
To bugs in GraphPlan fixed (missing search and wrong nogood handling).
1 parent 4682183 commit f1fd09d

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,8 @@ public List<List<ActionSchema>> graphPlan(Problem problem) {
6060
return solution;
6161
}
6262
// if graph and nogoods have both leveled off then return failure
63-
if (levelledOff(graph) && leveledOff(nogoods)) {
63+
if (levelledOff(graph) && leveledOff(nogoods))
6464
return null;
65-
}
6665
// graph ← EXPAND-GRAPH(graph, problem)
6766
graph = expandGraph(graph);
6867
}
@@ -85,11 +84,12 @@ public List<List<ActionSchema>> graphPlan(Problem problem) {
8584
* of their preconditions are mutex.
8685
* • The goal is to reach a state at level S 0 such that all the goals are satisfied.
8786
* • The cost of each action is 1.
87+
*
8888
* Here a simple depth-first search is used.
8989
*
9090
* @param graph The planning graph.
9191
* @param goals Goals of the planning problem.
92-
* @param numLevel Number of levels in the graph.
92+
* @param level Number of levels in the graph.
9393
* @param nogoods A hash table to store previously calculated results.
9494
* @return a solution if found else null
9595
*/
@@ -110,10 +110,8 @@ private List<List<ActionSchema>> extractSolution(Graph graph, List<Literal> goal
110110
setOfPossibleActions.add(possibleActionsPerLiteral);
111111
}
112112
List<List<ActionSchema>> allPossibleSubSets = generateCombinations(setOfPossibleActions);
113-
boolean validSet;
114-
List<ActionSchema> setToBeTaken = null;
115113
for (List<ActionSchema> possibleSet : allPossibleSubSets) {
116-
validSet = true;
114+
boolean validSet = true;
117115
ActionSchema firstAction, secondAction;
118116
for (int i = 0; i < possibleSet.size(); i++) {
119117
firstAction = possibleSet.get(i);

0 commit comments

Comments
 (0)