From 6873d9b7319d503c075ab39ae1fad8adfa791e43 Mon Sep 17 00:00:00 2001 From: Simon Condon Date: Sat, 17 Dec 2022 00:24:42 +0000 Subject: [PATCH] Oops, another GraphPlan (search node equality) fix. Another (positive) test case passes now. --- .../Planning/GraphPlan/GraphPlanTests.cs | 2 +- src/SCClassicalPlanning/Planning/GraphPlan/GraphPlan.cs | 2 +- src/SCClassicalPlanning/Planning/GraphPlan/PlanningGraph.cs | 6 ++---- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/SCClassicalPlanning.Tests/Planning/GraphPlan/GraphPlanTests.cs b/src/SCClassicalPlanning.Tests/Planning/GraphPlan/GraphPlanTests.cs index b8e9382..2d713e9 100644 --- a/src/SCClassicalPlanning.Tests/Planning/GraphPlan/GraphPlanTests.cs +++ b/src/SCClassicalPlanning.Tests/Planning/GraphPlan/GraphPlanTests.cs @@ -13,7 +13,7 @@ public static class GraphPlanTests .AndEachOf(() => new Problem[] { SpareTire.ExampleProblem, - //AirCargo.ExampleProblem, + AirCargo.ExampleProblem, BlocksWorld.ExampleProblem, //BlocksWorld.LargeExampleProblem, }) diff --git a/src/SCClassicalPlanning/Planning/GraphPlan/GraphPlan.cs b/src/SCClassicalPlanning/Planning/GraphPlan/GraphPlan.cs index 1ceda3b..7457583 100644 --- a/src/SCClassicalPlanning/Planning/GraphPlan/GraphPlan.cs +++ b/src/SCClassicalPlanning/Planning/GraphPlan/GraphPlan.cs @@ -178,7 +178,7 @@ public SearchNode(PlanningGraph.Level graphLevel, Goal goal) public override bool Equals(object? obj) => obj is SearchNode node && Equals(node); // NB: this struct is private - so we don't need to look at the planning graph, since it'll always match - public bool Equals(SearchNode node) => Equals(Goal, node.Goal); + public bool Equals(SearchNode node) => graphLevel.Index == node.graphLevel.Index && Equals(Goal, node.Goal); public override int GetHashCode() => HashCode.Combine(Goal); diff --git a/src/SCClassicalPlanning/Planning/GraphPlan/PlanningGraph.cs b/src/SCClassicalPlanning/Planning/GraphPlan/PlanningGraph.cs index c8e45a5..88e2703 100644 --- a/src/SCClassicalPlanning/Planning/GraphPlan/PlanningGraph.cs +++ b/src/SCClassicalPlanning/Planning/GraphPlan/PlanningGraph.cs @@ -429,8 +429,7 @@ public bool ContainsNonMutex(IEnumerable propositions) /// Representation of a proposition node in a planning graph. /// /// NB: We don't make use of the SCGraphTheory abstraction for the planning graph because none of the algorithms that use - /// it query it via graph theoretical algorithms - so it would be needless complexity. Easy enough to change - /// should we ever want to do that (probably just by layering some structs over the top of these existing classes). + /// it query it via graph theoretical algorithms - so it would be needless complexity. /// [DebuggerDisplay("{Proposition}")] public class PropositionNode @@ -453,8 +452,7 @@ public class PropositionNode /// Representation of an action node in a planning graph. /// /// NB: We don't make use of SCGraphTheory abstraction for the planning graph because none of the algorithms that use - /// it query it via graph theoretical algorithms - so it would be needless complexity. Easy enough to change - /// should we ever want to do that (probably just by layering some structs over the top of these existing classes). + /// it query it via graph theoretical algorithms - so it would be needless complexity. /// [DebuggerDisplay("{Action.Identifier}: {Action.Effect}")] public class ActionNode