Using Cellular Automata to find AIC's

Programs which generate, solve, and analyze Sudoku puzzles

Re: Using Cellular Automata to find AIC's

Postby StrmCkr » Fri Feb 04, 2022 3:16 pm

AHS-XZ is not easy to code.

true, many attempts to mke the code work The hange up I have lands in this area.

What exactly is used to determine the Restricted common between the to sets

(idea on the drawing board is with ahs sets that share many same digits the rc and x cells can be the same cell which is the inversion of the als rc rule that rc cells can't be in both sets)
Als xz constructs.

N cells with n+1 digits:
2 als, with 2 shared digits.

a shared Common digit in 1 sector,
that isn't in a shared cell Of both als

non restricted common.
a digit common to both als but not the Same digit as Rc

My current code uses the above functionality exactly On the swapped arrays
as I have hidden and naked data coded seperatly.
Elimination code is trickery as it's internal and external

- The Rc is determined by digit by sector In current code
There is always 2 cells shared.

Mostly I've never finished This code as the general consensus is that als-xz finds it anyway. So it's been a long term back burner project with minimal functionality as my hangup is what constitutes the RC for these sets.
Some do, some teach, the rest look it up.
stormdoku
User avatar
StrmCkr
 
Posts: 1433
Joined: 05 September 2006

Re: Using Cellular Automata to find AIC's

Postby yzfwsf » Fri Feb 04, 2022 3:51 pm

StrmCkr wrote:
AHS-XZ is not easy to code.

true, many attempts to mke the code work The hange up I have lands in this area.

What exactly is used to determine the Restricted common between the to sets


An RCC of ALS is to make one of the ALS lose a kind of candidate and make it a Locked Set.
And an RCC of AHS-XZ is to make one of the AHS lose a cell and make it a Locked Set.
In this way, there will be two types of RCC of AHS, one type is overlapping cells that
do not contain their common candidates, and the other is that the cells containing
their common candidates are located in the same House, and these cells cannot contain
any other candidates that make up the AHS.
yzfwsf
 
Posts: 921
Joined: 16 April 2019

Re: Using Cellular Automata to find AIC's

Postby StrmCkr » Fri Feb 04, 2022 6:12 pm

An RCC of ALS is to make one of the ALS lose a kind of candidate and make it a Locked Set.
And an RCC of AHS-XZ is to make one of the AHS lose a cell and make it a Locked Set.
In this way, there will be two types of RCC of AHS, one type is overlapping cells that
do not contain their common candidates,
and the other is that the cells containing
their common candidates are located in the same House, and these cells cannot contain
any other candidates that make up the AHS.


the first one in green is the one my code functions with

Code: Select all
+-------------------+----------------------+-----------------+
| 3       158  2458 | 6       458     7    | 9    24    14   |
| 69      7    46   | 49      1       2    | 3    8     5    |
| 2589    158  2458 | 4589    3       4589 | 146  2467  147  |
+-------------------+----------------------+-----------------+
| 7       6    125  | 3       245     145  | 8    9     24   |
| 258     58   9    | 4578    6       458  | 247  1     3    |
| 4       3    128  | 789     278     189  | 27   5     6    |
+-------------------+----------------------+-----------------+
| 168     9    678  | 2       -8(47)  3    | 5    467   1478 |
| 568     4    5678 | 1       9       58   | 26   3     278  |
| -1(58)  2    3    | (4578)  (4578)  6    | 14   47    9    |
+-------------------+----------------------+-----------------+

A) 72.75.76 @5,8
B) 58,75,76 @ 4,7
x: 75,76

thanks :)
for the red sections this the one i couldn't wrap my head around in code

Code: Select all
+-----------------------+-------------------+-------------------------+
| 679(123)  4     5     | 67   6789   89    | 68(2)   9-8(1)  89(123) |
| 2369      2369  269   | 1    45689  4589  | 2568    7       2389    |
| 8         169   1679  | 567  2      3     | 456     1459    149     |
+-----------------------+-------------------+-------------------------+
| 23456     2356  246   | 9    358    7     | 1       4568    48      |
| 145679    1569  14679 | 25   158    1258  | 3       45689   4789    |
| 13579     8     179   | 4    135    6     | 57      2       79      |
+-----------------------+-------------------+-------------------------+
| 12469     1269  3     | 267  14679  1249  | 4(278)  4-1(8)  5       |
| 12459     7     1249  | 8    1459   12459 | 4(2)    3       6       |
| 12456     1256  8     | 3    14567  1245  | 9       14      14(27)  |
+-----------------------+-------------------+-------------------------+



    AHS A) R1C1789 [1,2,3]
    AHS b) R7C78,R8C7 ,R9C9 [278]
    X: Digit 2 { R1C7, R8C7 }
    Z: {cells that don't contain 2} R7C8,R1C8

iF that's correct I can finally finish my code after like 3 years of stuck.

once those work move into these. next lvl is doubly linked
Code: Select all
+------------------------+-------------------+-------------------------------+
| -679(123)  4     5     | 67   6789   89    | 68(2)      9-8(1)    -89(123) |
| 2369       2369  269   | 1    45689  4589  | 568-2      7         2389     |
| 8          169   1679  | 567  2      3     | 456        459-1     149      |
+------------------------+-------------------+-------------------------------+
| 23456      2356  246   | 9    358    7     | 1          456-8     48       |
| 145679     1569  14679 | 25   158    1258  | 3          4569-8    4789     |
| 13579      8     179   | 4    135    6     | 57         2         79       |
+------------------------+-------------------+-------------------------------+
| 12469      1269  3     | 267  14679  1249  | -4(+7-28)  -4(+8-1)  5        |
| 12459      7     1249  | 8    1459   12459 | 4(2)       3         6        |
| 12456      1256  8     | 3    14567  1245  | 9          4(1)      -4(12-7) |
+------------------------+-------------------+-------------------------------+


    AHS A) R1C1789 [1,2,3]
    AHS b) R7C78,R8C7 ,R9C89 [1278]
    X: Digit 2 { R1C7, R8C7 }, Digit 1 { R1C8,R9C8 }
    Z: {cells that don't contain 2} R7C8,R1C8,R9C8
    Z: {cells that don't contain 1} R78C7, R1C7

ps: sorry RsW for hijacking this thread for a bit.
Some do, some teach, the rest look it up.
stormdoku
User avatar
StrmCkr
 
Posts: 1433
Joined: 05 September 2006

Re: Using Cellular Automata to find AIC's

Postby RSW » Mon Feb 07, 2022 4:16 am

I've now expanded the kinds of ALSs that my solver can work with. Previously, it would only create an ALS based strong link if there were 2 digits that occurred only once each in the ALS. Now allowing for digits to occur in more than one cell, strong links now exist between every possible pairing of digits. So, where previously an ALS would yield no more than one strong link, each ALS now yields (n+n^2)/2 strong links, where n is the number of candidates in the ALS. That's an enormous increase in the number of strong links. Of course most of these can only form weak links with another cell that shares the ALS's house, or certain intersecting houses. Still, it's allowed my solver to find more AICs and shorter AICs than before.

While updating the solver program, I realized that a lot of strong/weak link code was unnecessary. It was the result of not having the logic clear in my mind when I originally coded it. So, I'd put in a lot of unnecessary tests and restrictions. I was able to delete quite a bit of code, and simplify what remained. I'm still testing it, but it hasn't come up with any erroneous AICs yet.
RSW
 
Posts: 669
Joined: 01 December 2018
Location: Western Canada

Re: Using Cellular Automata to find AIC's

Postby yzfwsf » Mon Feb 07, 2022 4:38 am

RSW wrote: each ALS now yields (n+n^2)/2 strong links, where n is the number of candidates in the ALS.

I think it should be (n^2-n)/2 strong links. There is a strong interference between any 2 kinds of candidates in ALS. My code uses the same logic and processing.
yzfwsf
 
Posts: 921
Joined: 16 April 2019

Re: Using Cellular Automata to find AIC's

Postby RSW » Mon Feb 07, 2022 6:55 am

yzfwsf wrote:I think it should be (n^2-n)/2 strong links.

Yes, you are correct. I'm using zero based arrays, and was using the upper bound (which is actually n-1) when I did the calculation. In any event, the number of strong links is roughly proportional to n^2. And the total number of weak links appears to be roughly proportional to the square of the number of strong links. As a result, my solver is now returning hundreds of thousands of AICs which give eliminations, unless I put a limit on the number.

For example, Leren's Puzzle 71:
000193700050080004070500000500070800286000300400000569300269000020030006000005008
After basics, produces these statistics:

BiLocal links: 54
BiValue links: 24
UR links: 0
Group X Links: 51
ALS links: 5125 (previously about 70..100)
Total Weak Links: 134267 (previously about 800..1600)

522305 Total AICs
82952 duplicate AICs
435529 unique AICs but with duplicate eliminations
3824 AICs with unique eliminations

Fortunately, because of the cleanup that I've done to the program code, the AIC solver hasn't slowed down as much as I'd feared. It took about 2 minutes to find the 522305 AIC's in the example puzzle, and I think I can still do a lot more optimization on the code.
RSW
 
Posts: 669
Joined: 01 December 2018
Location: Western Canada

Re: Using Cellular Automata to find AIC's

Postby yzfwsf » Mon Feb 07, 2022 8:19 am

RSW wrote:For example, Leren's Puzzle 71:
000193700050080004070500000500070800286000300400000569300269000020030006000005008
After basics, produces these statistics:

BiLocal links: 54
BiValue links: 24
UR links: 0
Group X Links: 51
ALS links: 5125 (previously about 70..100)
Total Weak Links: 134267 (previously about 800..1600)

522305 Total AICs
82952 duplicate AICs
435529 unique AICs but with duplicate eliminations
3824 AICs with unique eliminations

I used 2 kinds of filters, all ALS consisting of bi-value cells are ignored, and a ALS containing locked subset is ignored.
yzfwsf
 
Posts: 921
Joined: 16 April 2019

Re: Using Cellular Automata to find AIC's

Postby StrmCkr » Mon Feb 07, 2022 1:46 pm

Are you deleting duplicate als nodes?

My filter only allows unique setups to be processed
When it builds als tables.
Like a pair in the same box on a row won't save as
Box & row, instead it only saves one of them.
Same thing with triples.

522305 chains???

Mine isnt even come close to that number.

Gonna have to check my builder to see if it's generating the
left and right or if it's just doing 1 side.
{ checked its, 1 direction only}
Last edited by StrmCkr on Mon Feb 07, 2022 2:54 pm, edited 1 time in total.
Some do, some teach, the rest look it up.
stormdoku
User avatar
StrmCkr
 
Posts: 1433
Joined: 05 September 2006

Re: Using Cellular Automata to find AIC's

Postby yzfwsf » Mon Feb 07, 2022 2:52 pm

StrmCkr wrote:Are you deleting duplicate als nodes?

I use hashmap to map nodes to IDs. So there will be no duplicate nodes.Use the adjacency list to establish a direct strong and weak relationship between these IDs. If this relationship has been established between two IDs, it will not be established repeatedly.
yzfwsf
 
Posts: 921
Joined: 16 April 2019

Re: Using Cellular Automata to find AIC's

Postby RSW » Mon Feb 07, 2022 7:09 pm

yzfwsf wrote:I used 2 kinds of filters, all ALS consisting of bi-value cells are ignored, and a ALS containing locked subset is ignored.

My AIC generator used to check for bivalue cells, but I may have accidentally removed that filter. I'll have to check. As for ALSs containing locked sets, I'll need to think about the logic. I can envision one situation where that might prevent a useful ALS from being created. But perhaps it's not possible in practice. I'll have to research this further.

StrmCkr wrote:Are you deleting duplicate als nodes?

My filter only allows unique setups to be processed
When it builds als tables.
Like a pair in the same box on a row won't save as
Box & row, instead it only saves one of them.
Same thing with triples.

Because of the way that my program generates the ALS cell combinations, duplicate nodes can never occur. However, it sometimes deliberately creates two different strong links for the same ALS. This happens in the case where a node's cells occupy both a single box and a single row or column. In this case it creates a strong link using a box restricted node and a second strong link using a row/column restricted node. I do this for two reasons:
1. The house restriction is stored as part of the strong link, and the data structure currently has only has a single variable for this.
2. This allows for faster processing later when generating the weak link array.

Since there are always far fewer strong links than weak links, it's more efficient to do as much processing as possible at the strong link stage. This saves having to do repeated processing when generating the weak links.
RSW
 
Posts: 669
Joined: 01 December 2018
Location: Western Canada

Previous

Return to Software