Hi David,
dobrichev wrote:The effort to determine potential redundant clues in a unique puzzle is solving the puzzle the number of givens times.
Applying {-1} to a puzzle with N givens results in N sub-puzzles.
If the initial puzzle is unique, then solve each of these N sub-puzzles once and determine whether it has unique solution or not. Those with unique solution point that the removed clue is redundant. Those with multiple solutions point that the removed clue is essential.
If we are doing minimization, then we have nothing more to do with the essential clues. The rest of the work is to check if there exist combinations of the previously obtained redundant clues which result in unique solution too.
In order to find all minimal puzzles which clues are subset of the original, I described a possible method by removal single clues, then pairs, then triplets, etc. This is somehow top-down process where we are playing with unique solution (always the same as the solution of the original puzzle) and stopping immediately when moving to multiple solutions.
There is bottom-up process where we can simultaneously remove all redundant clues and then add combinations of them until uniqueness is reached.
In your latest post you describe some hybrid process that follows top-down up to pairs. At this point I am losing the track. For example I can't understand how many times you are creating "a logic table" and how many times you are doing the nested loops.
Do you remove all redundant clues at once and then with the help of UA you are finding all combinations of non-essential clues which result in unique puzzles? If so, then your approach is very similar to this implemented in gridchecker.
In --scan mode, gridchecker has --cluemask option where 81-char mask is given with 0 for forced non-given, 1 for forced given, and anything else for "floating". The solution grid must be given too. Unfortunately, the number of clues in the generated puzzles must be given too, so you must run the process several times for increasing number of givens.
If the number of forced givens is large enough to result in a pseudo-puzzle with less than 1 million solutions, than it is reasonable to find all unhit UA. Else some subset of them is used and this is controlled by other command line parameters (unless I preffered to hardcode some parameters for this case, which is quite possible).
Note that in this process only N-1 pass must be done to obtain the "floating" clues in the cluemask. Esential ones are set to 1, and non-givens are set to 0.
I added this feature to gridchecker when processing
this non-minimal puzzle.
I can look at the source code, explain the details, and possibly do some modifications if there is interest.