Skip to content

Commit

Permalink
Oops, another GraphPlan (search node equality) fix. Another (positive…
Browse files Browse the repository at this point in the history
…) test case passes now.
  • Loading branch information
sdcondon committed Dec 17, 2022
1 parent e9963bd commit 6873d9b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public static class GraphPlanTests
.AndEachOf(() => new Problem[]
{
SpareTire.ExampleProblem,
//AirCargo.ExampleProblem,
AirCargo.ExampleProblem,
BlocksWorld.ExampleProblem,
//BlocksWorld.LargeExampleProblem,
})
Expand Down
2 changes: 1 addition & 1 deletion src/SCClassicalPlanning/Planning/GraphPlan/GraphPlan.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
6 changes: 2 additions & 4 deletions src/SCClassicalPlanning/Planning/GraphPlan/PlanningGraph.cs
Original file line number Diff line number Diff line change
Expand Up @@ -429,8 +429,7 @@ public bool ContainsNonMutex(IEnumerable<Literal> propositions)
/// Representation of a proposition node in a planning graph.
/// <para/>
/// 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.
/// </summary>
[DebuggerDisplay("{Proposition}")]
public class PropositionNode
Expand All @@ -453,8 +452,7 @@ public class PropositionNode
/// Representation of an action node in a planning graph.
/// <para/>
/// 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.
/// </summary>
[DebuggerDisplay("{Action.Identifier}: {Action.Effect}")]
public class ActionNode
Expand Down

0 comments on commit 6873d9b

Please sign in to comment.