|
@@ -15,13 +15,17 @@ I wrote [a blog post](https://blog.ligthert.net/posts/exploration-fun-and-proces
|
|
|
* Split workloads among several computers
|
|
* Split workloads among several computers
|
|
|
|
|
|
|
|
## Usage
|
|
## Usage
|
|
|
-To use the sudoku solver, run the binary with all the parameters available:
|
|
|
|
|
|
|
+To use the sudoku solver, run the binary with all the `-row` parameters available. Use other parameters to tune our output or CPU usage.
|
|
|
```
|
|
```
|
|
|
Usage of ./sudoku-funpark:
|
|
Usage of ./sudoku-funpark:
|
|
|
-numcpu int
|
|
-numcpu int
|
|
|
Number of CPU cores to assign to this task. (default 12)
|
|
Number of CPU cores to assign to this task. (default 12)
|
|
|
|
|
+ -output string
|
|
|
|
|
+ Type of output. 'human' for human readable. 'flat' for flat as stored in memory output. 'json' for JSON output. (default "human")
|
|
|
-part int
|
|
-part int
|
|
|
Process part x in n parts. Cannot be lower than 1, or higher than specified in split. (default 1)
|
|
Process part x in n parts. Cannot be lower than 1, or higher than specified in split. (default 1)
|
|
|
|
|
+ -print string
|
|
|
|
|
+ 'short': normal output;'long': normal output with timestamps; 'silent': Only print the results; (default "short")
|
|
|
-row1 string
|
|
-row1 string
|
|
|
1st row of the sudoku puzzle. (default "000000000")
|
|
1st row of the sudoku puzzle. (default "000000000")
|
|
|
-row2 string
|
|
-row2 string
|
|
@@ -50,7 +54,7 @@ Instead of using the 3x3 blocks with 3x3 digits, it uses horizontal rows from to
|
|
|
## Example
|
|
## Example
|
|
|
To see the solver in action, run the tool with the following parameters.
|
|
To see the solver in action, run the tool with the following parameters.
|
|
|
|
|
|
|
|
-For a short running (~15 seconds) example:
|
|
|
|
|
|
|
+For a short running (~14 seconds) example:
|
|
|
> $ ./sudoku-funpark -row1 769104802 -row2 154800060 -row3 832700154 -row4 600900328 -row5 045328670 -row6 328670945 -row7 597410280 -row8 006283090 -row9 200590006
|
|
> $ ./sudoku-funpark -row1 769104802 -row2 154800060 -row3 832700154 -row4 600900328 -row5 045328670 -row6 328670945 -row7 597410280 -row8 006283090 -row9 200590006
|
|
|
|
|
|
|
|
For a long running (~1 hours 15 minutes) example:
|
|
For a long running (~1 hours 15 minutes) example:
|
|
@@ -58,40 +62,40 @@ For a long running (~1 hours 15 minutes) example:
|
|
|
|
|
|
|
|
The outpot (of the short running parameters) will look something like this:
|
|
The outpot (of the short running parameters) will look something like this:
|
|
|
```
|
|
```
|
|
|
-./sudoku-funpark -row1 769104802 -row2 154800060 -row3 832700154 -row4 600900328 -row5 045328670 -row6 328670945 -row7 597410280 -row8 006283090 -row9 200590006
|
|
|
|
|
-2025/01/24 00:05:58 Loading blocks
|
|
|
|
|
-2025/01/24 00:05:58 Loaded blocks (34.587221ms)
|
|
|
|
|
-2025/01/24 00:05:58 Populating blocks
|
|
|
|
|
-2025/01/24 00:05:58 Populated blocks (438.73054ms)
|
|
|
|
|
-2025/01/24 00:05:58 Number of (potential) solutions: 26542080
|
|
|
|
|
-2025/01/24 00:05:58 Validating solutions
|
|
|
|
|
-2025/01/24 00:05:59 Processing: 6% (1729332/26542080); Rate (avg): 1729330/sec for 1.000003166s; Time left (est.): 14 seconds
|
|
|
|
|
-2025/01/24 00:06:00 Processing: 13% (3461753/26542080); Rate (avg): 1732418/sec for 1.000002285s; Time left (est.): 13 seconds
|
|
|
|
|
-2025/01/24 00:06:01 Processing: 19% (5228965/26542080); Rate (avg): 1767215/sec for 1.000019297s; Time left (est.): 12 seconds
|
|
|
|
|
-2025/01/24 00:06:02 Processing: 26% (6996958/26542080); Rate (avg): 1767992/sec for 1.000200176s; Time left (est.): 11 seconds
|
|
|
|
|
-2025/01/24 00:06:03 Processing: 33% (8767450/26542080); Rate (avg): 1770495/sec for 1.000016352s; Time left (est.): 10 seconds
|
|
|
|
|
-2025/01/24 00:06:04 Processing: 39% (10576900/26542080); Rate (avg): 1809450/sec for 1.000014638s; Time left (est.): 8 seconds
|
|
|
|
|
-2025/01/24 00:06:05 Processing: 46% (12400058/26542080); Rate (avg): 1823158/sec for 1.000352862s; Time left (est.): 7 seconds
|
|
|
|
|
-2025/01/24 00:06:06 Processing: 53% (14185155/26542080); Rate (avg): 1785095/sec for 1.000254888s; Time left (est.): 6 seconds
|
|
|
|
|
-2025/01/24 00:06:07 Processing: 60% (15968402/26542080); Rate (avg): 1783245/sec for 1.000002305s; Time left (est.): 5 seconds
|
|
|
|
|
-2025/01/24 00:06:08 Processing: 66% (17655770/26542080); Rate (avg): 1687370/sec for 1.000068309s; Time left (est.): 5 seconds
|
|
|
|
|
-2025/01/24 00:06:09 Processing: 73% (19442885/26542080); Rate (avg): 1787111/sec for 1.000006984s; Time left (est.): 3 seconds
|
|
|
|
|
-2025/01/24 00:06:10 Processing: 79% (21183545/26542080); Rate (avg): 1740661/sec for 1.000002395s; Time left (est.): 3 seconds
|
|
|
|
|
-2025/01/24 00:06:11 Processing: 86% (22998945/26542080); Rate (avg): 1815402/sec for 1.000113534s; Time left (est.): 1 second
|
|
|
|
|
-2025/01/24 00:06:12 Processing: 90% (24109203/26542080); Rate (avg): 1110261/sec for 1.000312346s; Time left (est.): 2 seconds
|
|
|
|
|
-2025/01/24 00:06:13 Processing: 100% (26542080/26542080); Rate (avg): 0/sec for 1.000117421s; Time left (est.): N/A
|
|
|
|
|
-2025/01/24 00:06:13 Validated solutions (15.002654066s)
|
|
|
|
|
-2025/01/24 00:06:13
|
|
|
|
|
|
|
+./sudoku-funpark -row1 769104802 -row2 154800060 -row3 832700154 -row4 600900328 -row5 045328670 -row6 328670945 -row7 597410280 -row8 006283090 -row9 200590006
|
|
|
|
|
+Loading blocks... Done! (38.957376ms)
|
|
|
|
|
+Populating blocks... Done! (92.087174ms)
|
|
|
|
|
+Number of (potential) solutions: 26542080
|
|
|
|
|
+Validating solutions
|
|
|
|
|
+Processing: 8% (2131893/26542080); Rate: 2131884/sec for 1.000028115s; Time left (est.): 11s
|
|
|
|
|
+Processing: 16% (4292163/26542080); Rate: 2160219/sec for 1.000087826s; Time left (est.): 10s
|
|
|
|
|
+Processing: 24% (6438334/26542080); Rate: 2146157/sec for 1.000017364s; Time left (est.): 9s
|
|
|
|
|
+Processing: 32% (8529362/26542080); Rate: 2090965/sec for 1.000367121s; Time left (est.): 8s
|
|
|
|
|
+Processing: 40% (10737065/26542080); Rate: 2207530/sec for 1.000072427s; Time left (est.): 7s
|
|
|
|
|
+Processing: 48% (12958905/26542080); Rate: 2221755/sec for 1.000003187s; Time left (est.): 6s
|
|
|
|
|
+Processing: 57% (15163877/26542080); Rate: 2204929/sec for 1.000002717s; Time left (est.): 5s
|
|
|
|
|
+Processing: 65% (17254760/26542080); Rate: 2090742/sec for 1.00008452s; Time left (est.): 4s
|
|
|
|
|
+Processing: 73% (19513142/26542080); Rate: 2258348/sec for 1.000071076s; Time left (est.): 3s
|
|
|
|
|
+Processing: 82% (21795213/26542080); Rate: 2282028/sec for 1.000076024s; Time left (est.): 2s
|
|
|
|
|
+Processing: 90% (24048891/26542080); Rate: 2253645/sec for 1.000146957s; Time left (est.): 1s
|
|
|
|
|
+Processing: 98% (26226252/26542080); Rate: 2177215/sec for 1.000129955s; Time left (est.): 0s
|
|
|
|
|
+Processing: 100% (26542080/26542080); Rate: 315792/sec for 1.000105149s; Time left (est.): 0s
|
|
|
|
|
+Validated solutions (13.001683829s)
|
|
|
|
|
+
|
|
|
Solution #1:
|
|
Solution #1:
|
|
|
-769154832
|
|
|
|
|
-154832769
|
|
|
|
|
-832769154
|
|
|
|
|
-671945328
|
|
|
|
|
-945328671
|
|
|
|
|
-328671945
|
|
|
|
|
-597416283
|
|
|
|
|
-416283597
|
|
|
|
|
-283597416
|
|
|
|
|
|
|
+╔═══════════╗
|
|
|
|
|
+║769│154│832╢
|
|
|
|
|
+║154│832│769╢
|
|
|
|
|
+║832│769│154╢
|
|
|
|
|
+╟───┼───┼───╢
|
|
|
|
|
+║671│945│328╢
|
|
|
|
|
+║945│328│671╢
|
|
|
|
|
+║328│671│945╢
|
|
|
|
|
+╟───┼───┼───╢
|
|
|
|
|
+║597│416│283╢
|
|
|
|
|
+║416│283│597╢
|
|
|
|
|
+║283│597│416╢
|
|
|
|
|
+╚═══════════╝
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
## Caveats
|
|
## Caveats
|