Skip to content

Commit

Permalink
Added more data to work with
Browse files Browse the repository at this point in the history
  • Loading branch information
kris701 committed Apr 9, 2024
1 parent 4034a35 commit ff9d817
Show file tree
Hide file tree
Showing 9 changed files with 10,027 additions and 10 deletions.
3 changes: 2 additions & 1 deletion Benchmarks/README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# Benchmarks
Benchmakrs are from the repository: https://github.com/davidcarmel/SudokuSolver/tree/main/data
* `dataset1` are from https://github.com/davidcarmel/SudokuSolver/tree/main/data
* `dataset2` is a part of the dataset https://www.kaggle.com/datasets/radcliffe/3-million-sudoku-puzzles-with-ratings
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
9,999 changes: 9,999 additions & 0 deletions Benchmarks/dataset2/data.txt

Large diffs are not rendered by default.

12 changes: 8 additions & 4 deletions SudokuSolver.Tests/BaseTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,26 @@ public static class BaseTests
public static readonly TimeSpan Timeout = TimeSpan.FromSeconds(10);
private static readonly List<string> _benchmarks = new List<string>()
{
"../../../../Benchmarks/11puzzles.txt",
"../../../../Benchmarks/timan.txt",
"../../../../Benchmarks/mypuzzles.txt",
"../../../../Benchmarks/95puzzles.txt",
"../../../../Benchmarks/dataset1/11puzzles.txt",
"../../../../Benchmarks/dataset1/timan.txt",
"../../../../Benchmarks/dataset1/mypuzzles.txt",
"../../../../Benchmarks/dataset1/95puzzles.txt",
"../../../../Benchmarks/dataset2/data.txt",
};

public static IEnumerable<object[]> TestCases()
{
foreach (var benchmark in _benchmarks)
{
var file = new FileInfo(benchmark);
var fileName = file.Name.Replace(file.Extension, "");
foreach (var line in File.ReadAllLines(benchmark))
{
var values = new List<byte>();
foreach (var c in line)
values.Add(byte.Parse($"{c}"));
yield return new object[] {
fileName,
line,
values
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class BacktrackSolverTests

[TestMethod]
[DynamicData(nameof(Data), DynamicDataSourceType.Method)]
public void Can_Solve(string boardStr, List<byte> boardValues)
public void Can_Solve(string dataset, string boardStr, List<byte> boardValues)
{
// ARRANGE
var board = new SudokuBoard(boardValues.ToArray());
Expand Down
21 changes: 17 additions & 4 deletions SudokuSolver.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SudokuSolver", "SudokuSolve
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Benchmarks", "Benchmarks", "{069C67E9-B21A-4C20-9D18-562DA9326703}"
ProjectSection(SolutionItems) = preProject
Benchmarks\11puzzles.txt = Benchmarks\11puzzles.txt
Benchmarks\95puzzles.txt = Benchmarks\95puzzles.txt
Benchmarks\mypuzzles.txt = Benchmarks\mypuzzles.txt
Benchmarks\README.md = Benchmarks\README.md
Benchmarks\timan.txt = Benchmarks\timan.txt
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SudokuSolver.Tests", "SudokuSolver.Tests\SudokuSolver.Tests.csproj", "{561BB1DE-4F85-445A-B602-224AD537377B}"
Expand All @@ -23,6 +19,19 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
README.md = README.md
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dataset1", "dataset1", "{8699A9C1-A6E2-43B7-B034-F575AB4D2C0A}"
ProjectSection(SolutionItems) = preProject
Benchmarks\dataset1\11puzzles.txt = Benchmarks\dataset1\11puzzles.txt
Benchmarks\dataset1\95puzzles.txt = Benchmarks\dataset1\95puzzles.txt
Benchmarks\dataset1\mypuzzles.txt = Benchmarks\dataset1\mypuzzles.txt
Benchmarks\dataset1\timan.txt = Benchmarks\dataset1\timan.txt
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dataset2", "dataset2", "{A8AD45CF-BFB8-4F2E-B5B2-4B769E0B7862}"
ProjectSection(SolutionItems) = preProject
Benchmarks\dataset2\data.txt = Benchmarks\dataset2\data.txt
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -51,6 +60,10 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{8699A9C1-A6E2-43B7-B034-F575AB4D2C0A} = {069C67E9-B21A-4C20-9D18-562DA9326703}
{A8AD45CF-BFB8-4F2E-B5B2-4B769E0B7862} = {069C67E9-B21A-4C20-9D18-562DA9326703}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {63F787CA-FC58-4CA0-AB55-E60192A099B9}
EndGlobalSection
Expand Down

0 comments on commit ff9d817

Please sign in to comment.