Skip to content

Commit

Permalink
Merge pull request #32 from rvhuang/wip-debug-helper-2
Browse files Browse the repository at this point in the history
Improve algorithm observation APIs
  • Loading branch information
rvhuang authored Jan 14, 2019
2 parents e5fe133 + 127d302 commit 29000d7
Show file tree
Hide file tree
Showing 11 changed files with 91 additions and 63 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ dotnet: 2.2

install:
- dotnet restore src/Heuristic.Linq.sln
- dotnet restore src/Heuristic.Linq.Example.sln

script:
- dotnet build src/Heuristic.Linq.sln
- dotnet build src/Heuristic.Linq.Example.sln
- dotnet test src/Heuristic.Linq.Test/Heuristic.Linq.Test.csproj -c Release
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Heuristic.Linq\Heuristic.Linq.csproj" />
<PackageReference Include="linq-to-astar" Version="1.1.0" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Heuristic.Linq\Heuristic.Linq.csproj" />
<PackageReference Include="linq-to-astar" Version="1.1.0" />
</ItemGroup>

<ItemGroup>
Expand Down
64 changes: 64 additions & 0 deletions src/Heuristic.Linq.Example.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27428.2015
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Heuristic.Linq.Example", "Heuristic.Linq.Example\Heuristic.Linq.Example.csproj", "{2A7970EB-AFC3-476E-83B4-EB2175AA26ED}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Heuristic.Linq.Example.PathFinding", "Heuristic.Linq.Example.PathFinding\Heuristic.Linq.Example.PathFinding.csproj", "{4A5F4997-8FCC-4DE0-8954-DC69F7AC499E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Heuristic.Linq.Example.EightPuzzle", "Heuristic.Linq.Example.EightPuzzle\Heuristic.Linq.Example.EightPuzzle.csproj", "{16307EF6-A7BB-4E54-8496-9F39CAE78D90}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2A7970EB-AFC3-476E-83B4-EB2175AA26ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2A7970EB-AFC3-476E-83B4-EB2175AA26ED}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2A7970EB-AFC3-476E-83B4-EB2175AA26ED}.Debug|x64.ActiveCfg = Debug|Any CPU
{2A7970EB-AFC3-476E-83B4-EB2175AA26ED}.Debug|x64.Build.0 = Debug|Any CPU
{2A7970EB-AFC3-476E-83B4-EB2175AA26ED}.Debug|x86.ActiveCfg = Debug|Any CPU
{2A7970EB-AFC3-476E-83B4-EB2175AA26ED}.Debug|x86.Build.0 = Debug|Any CPU
{2A7970EB-AFC3-476E-83B4-EB2175AA26ED}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2A7970EB-AFC3-476E-83B4-EB2175AA26ED}.Release|Any CPU.Build.0 = Release|Any CPU
{2A7970EB-AFC3-476E-83B4-EB2175AA26ED}.Release|x64.ActiveCfg = Release|Any CPU
{2A7970EB-AFC3-476E-83B4-EB2175AA26ED}.Release|x64.Build.0 = Release|Any CPU
{2A7970EB-AFC3-476E-83B4-EB2175AA26ED}.Release|x86.ActiveCfg = Release|Any CPU
{2A7970EB-AFC3-476E-83B4-EB2175AA26ED}.Release|x86.Build.0 = Release|Any CPU
{4A5F4997-8FCC-4DE0-8954-DC69F7AC499E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4A5F4997-8FCC-4DE0-8954-DC69F7AC499E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4A5F4997-8FCC-4DE0-8954-DC69F7AC499E}.Debug|x64.ActiveCfg = Debug|Any CPU
{4A5F4997-8FCC-4DE0-8954-DC69F7AC499E}.Debug|x64.Build.0 = Debug|Any CPU
{4A5F4997-8FCC-4DE0-8954-DC69F7AC499E}.Debug|x86.ActiveCfg = Debug|Any CPU
{4A5F4997-8FCC-4DE0-8954-DC69F7AC499E}.Debug|x86.Build.0 = Debug|Any CPU
{4A5F4997-8FCC-4DE0-8954-DC69F7AC499E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4A5F4997-8FCC-4DE0-8954-DC69F7AC499E}.Release|Any CPU.Build.0 = Release|Any CPU
{4A5F4997-8FCC-4DE0-8954-DC69F7AC499E}.Release|x64.ActiveCfg = Release|Any CPU
{4A5F4997-8FCC-4DE0-8954-DC69F7AC499E}.Release|x64.Build.0 = Release|Any CPU
{4A5F4997-8FCC-4DE0-8954-DC69F7AC499E}.Release|x86.ActiveCfg = Release|Any CPU
{4A5F4997-8FCC-4DE0-8954-DC69F7AC499E}.Release|x86.Build.0 = Release|Any CPU
{16307EF6-A7BB-4E54-8496-9F39CAE78D90}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{16307EF6-A7BB-4E54-8496-9F39CAE78D90}.Debug|Any CPU.Build.0 = Debug|Any CPU
{16307EF6-A7BB-4E54-8496-9F39CAE78D90}.Debug|x64.ActiveCfg = Debug|Any CPU
{16307EF6-A7BB-4E54-8496-9F39CAE78D90}.Debug|x64.Build.0 = Debug|Any CPU
{16307EF6-A7BB-4E54-8496-9F39CAE78D90}.Debug|x86.ActiveCfg = Debug|Any CPU
{16307EF6-A7BB-4E54-8496-9F39CAE78D90}.Debug|x86.Build.0 = Debug|Any CPU
{16307EF6-A7BB-4E54-8496-9F39CAE78D90}.Release|Any CPU.ActiveCfg = Release|Any CPU
{16307EF6-A7BB-4E54-8496-9F39CAE78D90}.Release|Any CPU.Build.0 = Release|Any CPU
{16307EF6-A7BB-4E54-8496-9F39CAE78D90}.Release|x64.ActiveCfg = Release|Any CPU
{16307EF6-A7BB-4E54-8496-9F39CAE78D90}.Release|x64.Build.0 = Release|Any CPU
{16307EF6-A7BB-4E54-8496-9F39CAE78D90}.Release|x86.ActiveCfg = Release|Any CPU
{16307EF6-A7BB-4E54-8496-9F39CAE78D90}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C5E73D1C-3461-42FF-817B-0EF9965EFCAE}
EndGlobalSection
EndGlobal
2 changes: 1 addition & 1 deletion src/Heuristic.Linq.Example/Heuristic.Linq.Example.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Heuristic.Linq\Heuristic.Linq.csproj" />
<PackageReference Include="linq-to-astar" Version="1.1.0" />
</ItemGroup>
</Project>
11 changes: 7 additions & 4 deletions src/Heuristic.Linq.Test/ObserverTest.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Moq;
using System;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using Xunit;
Expand All @@ -22,9 +23,11 @@ public class ObserverTest
[InlineData(nameof(RecursiveBestFirstSearch))]
public void TestIProgressOnlyCreatedOnce(string algorithmName)
{
var factory = new Mock<IAlgorithmObserverFactory>();
var factory = new Mock<IAlgorithmObserverFactory<Point>>();
var progress = new Progress<AlgorithmState<Point, Point>>();

factory.Setup(f => f.Create(It.IsAny<HeuristicSearchBase<Point, Point>>())).Returns(() => new Progress<AlgorithmState<Point, Point>>());
progress.ProgressChanged += (o, e) => Debug.WriteLine("{0}\t{1} ({2})", e.Node.Step, e.Node.Level, nameof(progress.ProgressChanged));
factory.Setup(f => f.Create(It.IsAny<HeuristicSearchBase<Point, Point>>())).Returns(() => progress);

var queryable = HeuristicSearch.Use(algorithmName, start, goal, (step, lv) => step.GetFourDirections(unit), null, factory.Object);
var obstacles = new[] { new Point(5, 5), new Point(6, 6), new Point(7, 7), new Point(8, 8), new Point(9, 9) };
Expand All @@ -44,7 +47,7 @@ orderby step.GetManhattanDistance(goal)
[InlineData(nameof(RecursiveBestFirstSearch))]
public void TestLastFlagFound(string algorithmName)
{
var factory = new Mock<IAlgorithmObserverFactory>();
var factory = new Mock<IAlgorithmObserverFactory<Point>>();
var progress = new Mock<IProgress<AlgorithmState<Point, Point>>>();
var actual = default(AlgorithmFlag?);
var expected = (AlgorithmFlag?)AlgorithmFlag.Found;
Expand Down Expand Up @@ -73,7 +76,7 @@ orderby step.GetManhattanDistance(goal)
[InlineData(nameof(RecursiveBestFirstSearch))]
public void TestLastFlagNotFound(string algorithmName)
{
var factory = new Mock<IAlgorithmObserverFactory>();
var factory = new Mock<IAlgorithmObserverFactory<Point>>();
var progress = new Mock<IProgress<AlgorithmState<Point, Point>>>();
var actual = default(AlgorithmFlag?);
var expected = (AlgorithmFlag?)AlgorithmFlag.NotFound;
Expand Down
42 changes: 0 additions & 42 deletions src/Heuristic.Linq.sln
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,8 @@ VisualStudioVersion = 15.0.27428.2015
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Heuristic.Linq", "Heuristic.Linq\Heuristic.Linq.csproj", "{3CBF214D-8F76-4EA2-8B52-F517C4C44D5E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Heuristic.Linq.Example", "Heuristic.Linq.Example\Heuristic.Linq.Example.csproj", "{2A7970EB-AFC3-476E-83B4-EB2175AA26ED}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Heuristic.Linq.Test", "Heuristic.Linq.Test\Heuristic.Linq.Test.csproj", "{E13EDB71-C5DB-40B0-A097-94ACB803347B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Heuristic.Linq.Example.PathFinding", "Heuristic.Linq.Example.PathFinding\Heuristic.Linq.Example.PathFinding.csproj", "{4A5F4997-8FCC-4DE0-8954-DC69F7AC499E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Heuristic.Linq.Example.EightPuzzle", "Heuristic.Linq.Example.EightPuzzle\Heuristic.Linq.Example.EightPuzzle.csproj", "{16307EF6-A7BB-4E54-8496-9F39CAE78D90}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -34,18 +28,6 @@ Global
{3CBF214D-8F76-4EA2-8B52-F517C4C44D5E}.Release|x64.Build.0 = Release|Any CPU
{3CBF214D-8F76-4EA2-8B52-F517C4C44D5E}.Release|x86.ActiveCfg = Release|Any CPU
{3CBF214D-8F76-4EA2-8B52-F517C4C44D5E}.Release|x86.Build.0 = Release|Any CPU
{2A7970EB-AFC3-476E-83B4-EB2175AA26ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2A7970EB-AFC3-476E-83B4-EB2175AA26ED}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2A7970EB-AFC3-476E-83B4-EB2175AA26ED}.Debug|x64.ActiveCfg = Debug|Any CPU
{2A7970EB-AFC3-476E-83B4-EB2175AA26ED}.Debug|x64.Build.0 = Debug|Any CPU
{2A7970EB-AFC3-476E-83B4-EB2175AA26ED}.Debug|x86.ActiveCfg = Debug|Any CPU
{2A7970EB-AFC3-476E-83B4-EB2175AA26ED}.Debug|x86.Build.0 = Debug|Any CPU
{2A7970EB-AFC3-476E-83B4-EB2175AA26ED}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2A7970EB-AFC3-476E-83B4-EB2175AA26ED}.Release|Any CPU.Build.0 = Release|Any CPU
{2A7970EB-AFC3-476E-83B4-EB2175AA26ED}.Release|x64.ActiveCfg = Release|Any CPU
{2A7970EB-AFC3-476E-83B4-EB2175AA26ED}.Release|x64.Build.0 = Release|Any CPU
{2A7970EB-AFC3-476E-83B4-EB2175AA26ED}.Release|x86.ActiveCfg = Release|Any CPU
{2A7970EB-AFC3-476E-83B4-EB2175AA26ED}.Release|x86.Build.0 = Release|Any CPU
{E13EDB71-C5DB-40B0-A097-94ACB803347B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E13EDB71-C5DB-40B0-A097-94ACB803347B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E13EDB71-C5DB-40B0-A097-94ACB803347B}.Debug|x64.ActiveCfg = Debug|Any CPU
Expand All @@ -58,30 +40,6 @@ Global
{E13EDB71-C5DB-40B0-A097-94ACB803347B}.Release|x64.Build.0 = Release|Any CPU
{E13EDB71-C5DB-40B0-A097-94ACB803347B}.Release|x86.ActiveCfg = Release|Any CPU
{E13EDB71-C5DB-40B0-A097-94ACB803347B}.Release|x86.Build.0 = Release|Any CPU
{4A5F4997-8FCC-4DE0-8954-DC69F7AC499E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4A5F4997-8FCC-4DE0-8954-DC69F7AC499E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4A5F4997-8FCC-4DE0-8954-DC69F7AC499E}.Debug|x64.ActiveCfg = Debug|Any CPU
{4A5F4997-8FCC-4DE0-8954-DC69F7AC499E}.Debug|x64.Build.0 = Debug|Any CPU
{4A5F4997-8FCC-4DE0-8954-DC69F7AC499E}.Debug|x86.ActiveCfg = Debug|Any CPU
{4A5F4997-8FCC-4DE0-8954-DC69F7AC499E}.Debug|x86.Build.0 = Debug|Any CPU
{4A5F4997-8FCC-4DE0-8954-DC69F7AC499E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4A5F4997-8FCC-4DE0-8954-DC69F7AC499E}.Release|Any CPU.Build.0 = Release|Any CPU
{4A5F4997-8FCC-4DE0-8954-DC69F7AC499E}.Release|x64.ActiveCfg = Release|Any CPU
{4A5F4997-8FCC-4DE0-8954-DC69F7AC499E}.Release|x64.Build.0 = Release|Any CPU
{4A5F4997-8FCC-4DE0-8954-DC69F7AC499E}.Release|x86.ActiveCfg = Release|Any CPU
{4A5F4997-8FCC-4DE0-8954-DC69F7AC499E}.Release|x86.Build.0 = Release|Any CPU
{16307EF6-A7BB-4E54-8496-9F39CAE78D90}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{16307EF6-A7BB-4E54-8496-9F39CAE78D90}.Debug|Any CPU.Build.0 = Debug|Any CPU
{16307EF6-A7BB-4E54-8496-9F39CAE78D90}.Debug|x64.ActiveCfg = Debug|Any CPU
{16307EF6-A7BB-4E54-8496-9F39CAE78D90}.Debug|x64.Build.0 = Debug|Any CPU
{16307EF6-A7BB-4E54-8496-9F39CAE78D90}.Debug|x86.ActiveCfg = Debug|Any CPU
{16307EF6-A7BB-4E54-8496-9F39CAE78D90}.Debug|x86.Build.0 = Debug|Any CPU
{16307EF6-A7BB-4E54-8496-9F39CAE78D90}.Release|Any CPU.ActiveCfg = Release|Any CPU
{16307EF6-A7BB-4E54-8496-9F39CAE78D90}.Release|Any CPU.Build.0 = Release|Any CPU
{16307EF6-A7BB-4E54-8496-9F39CAE78D90}.Release|x64.ActiveCfg = Release|Any CPU
{16307EF6-A7BB-4E54-8496-9F39CAE78D90}.Release|x64.Build.0 = Release|Any CPU
{16307EF6-A7BB-4E54-8496-9F39CAE78D90}.Release|x86.ActiveCfg = Release|Any CPU
{16307EF6-A7BB-4E54-8496-9F39CAE78D90}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
12 changes: 6 additions & 6 deletions src/Heuristic.Linq/Heuristic.Linq.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
Expand All @@ -8,17 +8,17 @@
<Authors>Robert Vandenberg Huang</Authors>
<Product>Linq To A*</Product>
<PackageLicenseUrl>https://raw.githubusercontent.com/rvhuang/linq-to-astar/master/LICENSE</PackageLicenseUrl>
<Version>1.2.0-beta</Version>
<Version>1.2.0-beta2</Version>
<PackageId>linq-to-astar</PackageId>
<PackageTags>linq;astar;heuristic</PackageTags>
<Copyright>© 2019 Robert Vandenberg Huang</Copyright>
<Description>LINQ to A* is a POC aimed to incorporate LINQ into A* as well as other heuristic search algorithms. With the library, LINQ can now be used as query expression to state conditions and fetch shortest path found by the algorithm.</Description>
<Description>LINQ to A* is a POC aimed to bring LINQ to A* and other heuristic search algorithms. The library enables LINQ to be used as the query expression to the algorithm.</Description>
<PackageIconUrl>https://raw.githubusercontent.com/rvhuang/linq-to-astar/master/favicon.ico</PackageIconUrl>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<SignAssembly>false</SignAssembly>
<PackageReleaseNotes>1. New interface IAlgorithmObserverFactory and a set of APIs have been added to support algorithm observation.
2. All built-in algorithms now can be observed.
3. Fix incorrect documentation comments.</PackageReleaseNotes>
<PackageReleaseNotes>1. The interface IAlgorithmObserverFactory has been redesigned for easier use.
2. All APIs that accept IAlgorithmObserverFactory arguments have been changed.
3. Fix grammatical errors in documentation comments.</PackageReleaseNotes>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand Down
10 changes: 5 additions & 5 deletions src/Heuristic.Linq/HeuristicSearch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public static HeuristicSearchBase<TStep, TStep> AStar<TStep>(TStep from, TStep t
/// <param name="observerFactory">The object that is able to create <see cref="IProgress{T}"/> instances.</param>
/// <returns>The instance that is ready to be applied with LINQ expressions.</returns>
/// <exception cref="ArgumentNullException"><paramref name="expander"/> is null.</exception>
public static HeuristicSearchBase<TStep, TStep> AStar<TStep>(TStep from, TStep to, Func<TStep, int, IEnumerable<TStep>> expander, IEqualityComparer<TStep> comparer, IAlgorithmObserverFactory observerFactory)
public static HeuristicSearchBase<TStep, TStep> AStar<TStep>(TStep from, TStep to, Func<TStep, int, IEnumerable<TStep>> expander, IEqualityComparer<TStep> comparer, IAlgorithmObserverFactory<TStep> observerFactory)
{
return new HeuristicSearchInitial<TStep>(nameof(AStar), from, to, comparer, expander) { AlgorithmObserverFactory = observerFactory };
}
Expand Down Expand Up @@ -132,7 +132,7 @@ public static HeuristicSearchBase<TStep, TStep> BestFirstSearch<TStep>(TStep fro
/// <param name="observerFactory">The object that is able to create <see cref="IProgress{T}"/> instances.</param>
/// <returns>The instance that is ready to be applied with LINQ expressions.</returns>
/// <exception cref="ArgumentNullException"><paramref name="expander"/> is null.</exception>
public static HeuristicSearchBase<TStep, TStep> BestFirstSearch<TStep>(TStep from, TStep to, Func<TStep, int, IEnumerable<TStep>> expander, IEqualityComparer<TStep> comparer, IAlgorithmObserverFactory observerFactory)
public static HeuristicSearchBase<TStep, TStep> BestFirstSearch<TStep>(TStep from, TStep to, Func<TStep, int, IEnumerable<TStep>> expander, IEqualityComparer<TStep> comparer, IAlgorithmObserverFactory<TStep> observerFactory)
{
return new HeuristicSearchInitial<TStep>(nameof(BestFirstSearch), from, to, comparer, expander) { AlgorithmObserverFactory = observerFactory };
}
Expand Down Expand Up @@ -177,7 +177,7 @@ public static HeuristicSearchBase<TStep, TStep> RecursiveBestFirstSearch<TStep>(
/// <param name="observerFactory">The object that is able to create <see cref="IProgress{T}"/> instances.</param>
/// <returns>The instance that is ready to be applied with LINQ expressions.</returns>
/// <exception cref="ArgumentNullException"><paramref name="expander"/> is null.</exception>
public static HeuristicSearchBase<TStep, TStep> RecursiveBestFirstSearch<TStep>(TStep from, TStep to, Func<TStep, int, IEnumerable<TStep>> expander, IEqualityComparer<TStep> comparer, IAlgorithmObserverFactory observerFactory)
public static HeuristicSearchBase<TStep, TStep> RecursiveBestFirstSearch<TStep>(TStep from, TStep to, Func<TStep, int, IEnumerable<TStep>> expander, IEqualityComparer<TStep> comparer, IAlgorithmObserverFactory<TStep> observerFactory)
{
return new HeuristicSearchInitial<TStep>(nameof(RecursiveBestFirstSearch), from, to, comparer, expander) { AlgorithmObserverFactory = observerFactory };
}
Expand Down Expand Up @@ -222,7 +222,7 @@ public static HeuristicSearchBase<TStep, TStep> IterativeDeepeningAStar<TStep>(T
/// <param name="observerFactory">The object that is able to create <see cref="IProgress{T}"/> instances.</param>
/// <returns>The instance that is ready to be applied with LINQ expressions.</returns>
/// <exception cref="ArgumentNullException"><paramref name="expander"/> is null.</exception>
public static HeuristicSearchBase<TStep, TStep> IterativeDeepeningAStar<TStep>(TStep from, TStep to, Func<TStep, int, IEnumerable<TStep>> expander, IEqualityComparer<TStep> comparer, IAlgorithmObserverFactory observerFactory)
public static HeuristicSearchBase<TStep, TStep> IterativeDeepeningAStar<TStep>(TStep from, TStep to, Func<TStep, int, IEnumerable<TStep>> expander, IEqualityComparer<TStep> comparer, IAlgorithmObserverFactory<TStep> observerFactory)
{
return new HeuristicSearchInitial<TStep>(nameof(IterativeDeepeningAStar), from, to, comparer, expander) { AlgorithmObserverFactory = observerFactory };
}
Expand Down Expand Up @@ -320,7 +320,7 @@ public static HeuristicSearchBase<TStep, TStep> Use<TStep>(string algorithmName,
/// <returns>The instance that is ready to be applied with LINQ expressions.</returns>
/// <exception cref="ArgumentNullException"><paramref name="algorithmName"/> or <paramref name="expander"/> is null.</exception>
/// <exception cref="ArgumentException"><paramref name="algorithmName"/> cannot be found.</exception>
public static HeuristicSearchBase<TStep, TStep> Use<TStep>(string algorithmName, TStep from, TStep to, Func<TStep, int, IEnumerable<TStep>> expander, IEqualityComparer<TStep> comparer, IAlgorithmObserverFactory observerFactory)
public static HeuristicSearchBase<TStep, TStep> Use<TStep>(string algorithmName, TStep from, TStep to, Func<TStep, int, IEnumerable<TStep>> expander, IEqualityComparer<TStep> comparer, IAlgorithmObserverFactory<TStep> observerFactory)
{
try
{
Expand Down
2 changes: 1 addition & 1 deletion src/Heuristic.Linq/HeuristicSearchBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public abstract class HeuristicSearchBase<TFactor, TStep> : IEnumerable<TFactor>
/// </summary>
public INodeComparer<TFactor, TStep> NodeComparer => _nc;

internal IAlgorithmObserverFactory AlgorithmObserverFactory { get; set; }
internal IAlgorithmObserverFactory<TStep> AlgorithmObserverFactory { get; set; }

internal bool IsReversed { get; set; } // Consider exposing this.

Expand Down
Loading

0 comments on commit 29000d7

Please sign in to comment.