UAs generation for bands 1+2

 

UAs generation for bands 1+2 is called in G17B:GoM10(), the entry in the process after  the set band1+band+table of bands3 has been prepared.

 

The call is genuasb12.Initgen().

 

The files used are

 

go_17_bands.h and go_17_bands_cpp.h where is the code for GEN_UAS_B12

Zh1b2bh and zh1b2b.cpp where is the brute force for one band and the brute force for 2 bands.

 

Main UAs generation :

 

 

The main UAs generation is limited to 5 digits. A special brute force 2 bands limited to 5 digits  will be used to produce UAs.

 

Elementary  generation process

 

 

 

The first phase elementary generation is BuildFloorsAndCollectOlds(floors_2d[i])

 a call to process a set of digits (floor) shown as a 9 bit field.

 

Tables contains the valid floor for 2;3;4 digits the floors for more digit are expressed as complementary 9 bits field of the previous tables.

 

The process is done with a growing number of digits. So, generally speaking, the best chance to have a subset (and then to ignore the UAs) is in past calls this comes in the UA table update. We have also to consider known UAs in Band1 and Band2, this is done in a separate check, these UAs are not in the final table.

 

The first step is to prepare the solution and the PM for the floor. Doing that, it is verified that none digit is solved (it would be redundant with a previous floor process).

 

Then, a subtable of band1 UAs and band2 UAs not hit by solved cells is worked out. Ignored UAs could not be subsets of UAs produced in this run.

 

All valid solutions are worked out in the brute force and the UAs produced are checked for subset in band1 or band 2, then entered in the UA table Add() process where the final check for subsets supersets is done.

 

UA 64 bits table and Add() process

 

Storing UAs and checking additions for subsets superset appears in several places in the process.

All these tables have he same structure

 

Bits 0-26 and 32-58 are used to store the 2 bands bit fields

Bits 59-63 contain the size of the UA (number of bits set to 1)

The table is sorted in increasing order of the “numeric” value.

The Add receive as parameter

 

The table pointer

The number of existing UAs

The UA to process

 

The calling process is responsible to avoid overflow. The Add process does not know the limit size of the table

 

The corresponding routine is in the file sk_t_cpp.h.

 

Working out the UAs using the brute force

 

Where and how does it work

 

The UAs generation for 2 bands is done in the file ZH1b2b.

As we are looking here for UAs wit 2 to 5 digits, a special brute force limited to 5 digits is used.

The general process is

 

A) assign digits out floor

B) Find all valid solutions and extract the corresponding UA

 

Assignment of all digits “out floor” is summarized in a 128 bit field “solved cells.”

PM and solution per active digit are moved in the first locations of the relevant places (no need to have a mapping of digits except if this is needed for debugging)

And the search can start.

 

All this is done in ZH2B5_GLOBAL and ZH2B5. The solutions per digit are copied fron Z2B_GLOBAL where is the initial value .

 

The guess solving process is similar to the last guess step in the general brute force.

 

The digit with the lowest count is selected,

All possible solutions for this digit are searched and loaded in table using the special “One digit” brute force

Each such solution is a guess to try

 

Note: An elementary step has been limited to 30 fresh UAs.(see ZH2B5_GLOBAL::ValidSol5.

Only the 30 smallest UAs of a single step are sent back to the main process. This is also valid for socket UAs

 

Note 2: We use the same Update5() with in some place no control of the number of digits. Clearing a cell for an empty digit is useless, but does not disturb the process.

 

Note 3: the data structure in ZH2B is not exactly the same as in the global brute force. Here the rows unsolved are in a separate 128 bits field. This was the data structure of a former brute force. Each digit occupy 6 bits (6 rows) so with <=5 digits, all the rows unsolved bits are in the same 32 bits integer.

 

BuildFloorsAndCollectOlds(int fl) summary

 

This is where is the elementary sequence.

 

uint64_t solved_cells= zh2b5_g.FindUAsInit(fl, 0);

 

Call the brute force to solve “out floor” digits and prepare the PM and the solutions per digit for the

Active digits.

 

Solved-cells is used to select band 1 and band 2UAs having no cell “out floor”.

 

zh2b5_g.CollectUas5()

 

Does the search of valid solutions and send back the corresponding table of UAs

 

Each UA is then filtered (size and subsets in band 1 band2) and, if not filtered sent to the table Add() process (insert in the right place and check for subsets supersets.)

 

Calling sequence

 

Nothing special to comment here                int GENUAS_B12::Initgen()

After data initialization in the brute force and reshaping of band 1 band 2 UAs in 64 bits, all the  floors to process are sent to the elementary process.

 

Note: as a UA has a minimum of 2 cells per digit, we find here all UAs of size <=10

 

 

More  UAs generation :

 

 

Here we don’t have an exhaustive search of UAs with more than 5 digits. The first test done long ago pushed to add in the primary table UAs limited to one or 2 mini rows in one of the 2 bands.

 

As we made an exhaustive search for <= 5 digits, we cover now 6-7 digits.

The process is very similar to what will be done for socket UAs. We take a pair in mini row as example.

 

I restart from our example

 

123 456 789

457 189 623

986 327 415

 

235 874 196

614 293 857

879 615 342

 

Gangster band1

149 258 367 | 134 258 679 | 467 128 359

Gangster band2

268 137 459 | 268 179 345 | 138 459 276

 

Not all pairs are of interest. Here. 3r4c2 5r4c3 can produce UAs, we have 5,3 in column 2,3 in the band 1.

2r4c1 3r4c2 would not work, we have no “3” in band1 column 1.

 

To find UAs with cells r4c2 r4c3, we look for all band 1 solution grids changing the gangster

 

Revised gangster band 1

149 238 567 | 134 258 679 | 467 128 359

 

And we work out all valid solutions in band 1 for 6-floors and 7-floors including the digits 5 3 of the pair.

 

This can  done for one mini row or 2 mini rows in 2 different stack, and for pairs and triplets in mini rows. Currently, 2 triplets is not covered.

 

This is another kind of brute force.

The code to use is ZHONE (one band)

In ZHONE the rows unsolved are , as in the original code, in bits 27-29 of the 32 bit field describing the band.

The guessing strategy is specific to this process. The digits are solved one by one. The UA status of digits previously solved is carried down.

The process is cancelled (redundancy) if one digit is solved will all cells true (same as in the solution grid)