Champagne,
Here is the overdue description of how my slim program works, it is based on permutation string theory.
How a Permutation Solver WorksThe permutation solver uses three steps to find and analyze logic, a find step, a slim step, and a weak-set assign step. The purpose here is to discuss the slim step within a little framework. This is purposely kept at the conceptual level because any attempt I might make at a detailed description is sure to cause confusion.
There is a working example at the bottom to make up for the brevity. This example is one of the first few eliminations from the puzzle TOP1465 #3. The elimination is rather small and makes a good example.
FindThe find program constructs a path made of sets while calculating the allowed permutations for each group of sets as the path develops. The permutations for each step are calculated differentially to save time. Each step is saved for future reference by the slim program. This find program can find different things depending on what is used to start the permutation database.
- Code: Select all
Assertion Finds Produces
-----------------------------------------------------------------------
Falsehood 0 permutation condition elimination path
Truth 1 permutation condition puzzle solution
Truth N permutation condition multi-solutions
Set (1T +nF) 0 nodes in permutation base elimination path
(and) 1 permutation condidition puzzle solution
Eliminations and assignments appear in the permutation data base as columns (equivalent to individual candidates) that become all 0s or all 1s respectivly.
Slim, Permutation String Theory
Slimming is probably the most complex step in the process.
Slimming defines an ordered set-space in which permutations become linear strings connecting an assertion (in set0) to a contradiction (in setN). It is useful to imagine a large bundle of permutations that connect set0 to setN, each set in the sequence then provides a constraint that can eliminate permutations in the bundle. The goal is to find which sets in the sequence are responsible for preventing which permutations from connecting one end of the set path to the other. Sets that block permutations must be in the solution, sets that don't can be discarded.
Step 1. One bundle of permutations is generated starting from the falsehood in set0 traveling through the ordered sets to setN. This bundle initially grows as more sets are added and then shrinks to 0 permutations as it reaches setN. This must happen because the truth (now a contradiction) in setN is not compatible (cannot share permutations) with the falsehood in set0. This fact was established in the initial find program. The exact order of sets is chosen to minimize the total number of permutations otherwise, it has no importance.
Step 2. A second bundle of permutations is generated starting with the truth (contradiction) on the right running in the opposite direction to the falsehood on the left. This bundle behaves the same way except when it arrives at set0 there will be one permutation left that contains a truth at the same candidate that started the falsehood.
The trick to the algorithm is testing each permutation at each set on the way back to see if that set prevents any left permutations from joining right permutations. More specifically, a falsehood permutation from the left cannot be allowed to connect to a truth permutation from the right. If that happens, then there is no elimination. The sets that prevent this from happening belong to the set logic solution and the others can be discarded.
- Code: Select all
****--------------
*****************-------
****************************--
****************-------------------------- perm a
S0****S1****S2****S3****S4----S5----S6----S7----SN
forward -------->
<-----------return
S0----S1----S2****S3****S4****S5****S6****S7****SN
--------------------------****************-------- perm a
--------------------****************--------------
--****************************--------------------
--------**********--------------------------------
^S2 discarded
^S4 retained
---- logical permutation
**** valid permutation
The algorithm conceptually turns a complex problem into a linear one, at least from the implementer's point of view. The complexity is retained inside of the permutations.
Assigning LinksetsAlthough discovering which sets can be linksets and which must be sets is a complex problem, it is not computationally difficult because this has been already decided by the logic form produced by slim. Well almost, occasionally there may be multiple choices but these will always produce the same eliminations with the same group of sets.
This process can be dome in to steps to save time. The first step recognizes that any time a candidate is contained in only one set, that set must be a weak set. Other simple heuristics can also be used, the last step is to test remaining sets individually.
ExampleThe following is an example printout generated to debug the original algorithm when it was being developed, some of the output lines are not important. The main points are the forward pass and the reverse order pass. The permutation base (sometimes just one permutation) is shown for each step.
Do not trust the output as absolute truth as I cannot be sure what I was tweaking at the time. However, it is a good example for visualizing the process.
- Code: Select all
FORWARD BUNDLE
load count = 844
25.211.4 R29 1.94 p266 -- 996-351
Cont =================1======================== (initial falsehood)
c66+ ________1________1_______________1____1___ (added set)
........0........1...............0....0... (perm base '.' = empty)
b26+ ______111_______11____________11__________
......000.......01............00.0....0...
r16+ _____1111_________________________________
.....1000.......01............00.0....0...
c56+ _______1_______________________11____1__1_
.....1000.......01............0010...00.0.
.....1000.......01............0000...10.0.
.....1000.......01............0000...00.1.
b56+ ________________________________11________
.....1000.......01............0010...00.0.
n95+ ________________________________________11
.....1000.......01............0010...00.01
c58+ __________________________________11___1_1
.....1000.......01............001000.00001
n75+ ____________________________________11_1__
.....1000.......01............001000100001
c55+ ____1_______________________1_______1_____
....01000.......01..........0.001000100001
n35+ _____________________1______1__1__________
....01000.......01...1......0.001000100001
B21+ 11_______1__________11____________________
00..010000......01..01......0.001000100001
r31+ __________________111111__________________
00..010000......01000100....0.001000100001
b16+ _____1________11_____________1____________
00..010000....0001000100....00001000100001
n31+ __________________1_____1_1__1____________
00..010000....00010001001.0.00001000100001
00..010000....00010001000.1.00001000100001
b14+ __________11____________11________________
00..01000000..0001000100100.00001000100001
00..01000010..0001000100001.00001000100001
00..01000001..0001000100001.00001000100001
00..01000000..0001000100011.00001000100001
n23+ ___________1_1_1__________________________
00..01000000.10001000100100.00001000100001
00..01000010.10001000100001.00001000100001
00..01000001.00001000100001.00001000100001
00..01000000.10001000100011.00001000100001
b15+ __11________11____________11______________
000001000000010001000100100000001000100001
000001000001000001000100001000001000100001
n32+ ___________________1_____1_1______________
Contradiction in N32...
N32+ ___________________1_____1_1______________
===================0=====0=0==============
- Code: Select all
REVERSE TRACE
+B15 __11________11____________11______________
SAVE ..11........11............11..............
PRE 11..11111111.11111111111111.11111111111111
RA1 .....1...........1...1..........1...1....1
RX1 ..........................................
RA0 11..1.1111....111.111.11....1111.111.1111.
RX0 ..11......1.1............1.1..............
(1) 000001000001000001000100001000001000100001
(1) 000001000000010001000100100000001000100001
B15+ __11________11____________11______________
-------------1-----0-----00---------------
-------------0-----0-----01---------------
ZOO -------------1-----1-----11---------------
+N23 ___________1_1_1__________________________
SAVE .............1............................
PRE 11..11111111..1111111111111.11111111111111
RA1 .....1...........1...1..........1...1....1
RX1 ..........................................
RA0 11..1.1111....111.111.11....1111.111.1111.
RX0 ..........................................
(1) 00--01000000-10001000100011-00001000100001
(1) 00--01000001-00001000100001-00001000100001
(1) 00--01000010-10001000100001-00001000100001
(1) 00--01000000-10001000100100-00001000100001
N23+ ___________1_1_1__________________________
-----------1---0---0-----00---------------
-----------1---0---0-----01---------------
-----------0---1---0-----00---------------
-----------0---1---0-----01---------------
ZOO -----------1---1---1-----11---------------
+B14 __________11____________11________________
SAVE ...........1.............1................
PRE 11..111111....11111111111.1.11111111111111
RA1 .....1...........1...1..........1...1....1
RX1 ..........................................
RA0 11..1.1111....111.111.11....1111.111.1111.
RX0 ..........................................
(1) 00--01000000--0001000100011-00001000100001
(1) 00--01000001--0001000100001-00001000100001
(1) 00--01000010--0001000100001-00001000100001
(1) 00--01000000--0001000100100-00001000100001
B14+ __________11____________11________________
---------------0---0----1-0---------------
---------------0---0----1-1---------------
---------------1---0----1-0---------------
---------------1---0----1-1---------------
ZOO ---------------1---1----1-1---------------
+N31 __________________1_____1_1__1____________
SAVE ........................1.1...............
PRE 11..111111....1111111111....11111111111111
RA1 .....1...........1...1..........1...1....1
RX1 ..........................................
RA0 11..1.1111....111.111.11....1111.111.1111.
RX0 ..........................................
(1) 00--010000----00010001000-1-00001000100001
(1) 00--010000----00010001001-0-00001000100001
N31+ __________________1_____1_1__1____________
---------------0--10---------0------------
---------------1--10---------0------------
---------------0--00---------1------------
---------------1--00---------1------------
ZOO ---------------1--11---------1------------
+B16 _____1________11_____________1____________
SAVE ...............1.............1............
PRE 11..111111......11111111....1.111111111111
RA1 .....1...........1...1..........1...1....1
RX1 ..........................................
RA0 11..1.1111......1.111.11....1.11.111.1111.
RX0 ..............11.............1............
(1) 00--010000----0001000100----00001000100001
B16+ _____1________11_____________1____________
-----1------------10----------------------
-----1------------00----------------------
ZOO -----1------------11----------------------
+R31 __________________111111__________________
SAVE ..................11......................
PRE 11..111111......11..11......1.111111111111
RA1 .....1...........1...1..........1...1....1
RX1 ..........................................
RA0 11..1.1111......1...1.......1.11.111.1111.
RX0 ..................11..11..................
(1) 00--010000------01000100----0-001000100001
R31+ __________________111111__________________
-----1---------------1--------------------
ZOO -----1---------------1--------------------
+B21 11*******1**********11********************
SAVE ..........................................
PRE ....11111.......11...1......1.111111111111
RA1 .....1...........1...1..........1...1....1
RX1 ..........................................
RA0 ....1.111.......1...........1.11.111.1111.
RX0 11.......1..........1.....................
(1) 00--010000------01--01------0-001000100001
B21+ 11_______1__________11____________________
-----1---------------1--------------------
ZOO -----1---------------1--------------------
+N35 _____________________1______1__1__________
SAVE .....................1....................
PRE ....11111.......11..........1.111111111111
RA1 .....1...........1..............1...1....1
RX1 .....................1....................
RA0 ....1.111.......1...........1.11.111.1111.
RX0 ..........................................
(1) ----01000-------01---1------0-001000100001
N35+ _____________________1______1__1__________
-----1----------------------1--0----------
-----1----------------------0--1----------
ZOO -----1----------------------1--1----------
+C55 ____1_______________________1_______1_____
SAVE ............................1.............
PRE .....1111.......11............111111111111
RA1 .....1...........1..............1...1....1
RX1 ..........................................
RA0 ......111.......1.............11.111.1111.
RX0 ....1.......................1.............
(1) ----01000-------01----------0-001000100001
C55+ ____1_______________________1_______1_____
-----1-------------------------0----1-----
-----1-------------------------1----1-----
ZOO -----1-------------------------1----1-----
+N75 ____________________________________11_1__
SAVE ....................................1.....
PRE .....1111.......11............111111.11111
RA1 .....1...........1..............1........1
RX1 ....................................1.....
RA0 ......111.......1.............11.111.1111.
RX0 ..........................................
(1) -----1000-------01------------001000100001
N75+ ____________________________________11_1__
-----1-------------------------0-----1-0--
-----1-------------------------1-----1-0--
-----1-------------------------0-----0-1--
-----1-------------------------1-----0-1--
ZOO -----1-------------------------1-----1-1--
+C58 __________________________________11___1_1
SAVE .......................................1..
PRE .....1111.......11............1111...11.11
RA1 .....1...........1..............1........1
RX1 ..........................................
RA0 ......111.......1.............11.1...11.1.
RX0 ..................................11...1..
(1) -----1000-------01------------001000-00001
C58+ __________________________________11___1_1
-----1-------------------------0-----1---1
-----1-------------------------1-----1---1
-----1-------------------------0-----0---1
-----1-------------------------1-----0---1
ZOO -----1-------------------------1-----1---1
+N95 ________________________________________11
SAVE .........................................1
PRE .....1111.......11............1111...11.1.
RA1 .....1...........1..............1.........
RX1 .........................................1
RA0 ......111.......1.............11.1...11.1.
RX0 ..........................................
(1) -----1000-------01------------0010---00-01
N95+ ________________________________________11
-----1-------------------------0-----1--1-
-----1-------------------------1-----1--1-
-----1-------------------------0-----0--1-
-----1-------------------------1-----0--1-
ZOO -----1-------------------------1-----1--1-
+B56 ________________________________11________
SAVE ................................11........
PRE .....1111.......11............1111...11.1.
RA1 .....1...........1........................
RX1 ................................1.........
RA0 ......111.......1.............11.1....1...
RX0 .....................................1..1.
(1) -----1000-------01------------0010---00-0-
B56+ ________________________________11________
-----1-------------------------010---1--1-
-----1-------------------------110---1--1-
-----1-------------------------010---0--1-
-----1-------------------------110---0--1-
-----1-------------------------001---1--1-
-----1-------------------------101---1--1-
-----1-------------------------001---0--1-
-----1-------------------------101---0--1-
ZOO -----1-------------------------111---1--1-
+C56 _______1_______________________11____1__1_
SAVE ................................1....1..1.
PRE .....1111.......11............11.1....1...
RA1 .....1...........1........................
RX1 ..........................................
RA0 ......111.......1.............11.1....1...
RX0 ..........................................
(1) -----1000-------01------------0000---00-1-
(1) -----1000-------01------------0000---10-0-
(1) -----1000-------01------------0010---00-0-
C56+ _______1_______________________11____1__1_
-----1-1-----------------------0-0--------
-----1-1-----------------------0-1--------
-----1-0-----------------------1-0--------
-----1-0-----------------------1-1--------
ZOO -----1-1-----------------------1-1--------
+R16 _____1111_________________________________
SAVE .....1....................................
PRE ......111.......11............11.1....1...
RA1 .................1........................
RX1 .....1....................................
RA0 ......111.......1.............11.1....1...
RX0 ..........................................
(1) -----1000-------01------------00-0----0---
R16+ _____1111_________________________________
------100----------------------1-0--------
------100----------------------1-1--------
------010----------------------0-0--------
------010----------------------0-1--------
------001----------------------1-0--------
------001----------------------1-1--------
ZOO ------111----------------------1-1--------
+B26 ______111_______11____________11__________
SAVE ......11.......................1..........
PRE ........1........1...............1....1...
RA1 .................1........................
RX1 ..........................................
RA0 ........1........................1....1...
RX0 ......11........1.............11..........
(1) ------000-------01------------00-0----0---
B26+ ______111_______11____________11__________
--------0--------1---------------0--------
--------0--------1---------------1--------
--------1--------1---------------0--------
--------1--------1---------------1--------
ZOO --------1--------1---------------1--------
+C66 ________1________1_______________1____1___
SAVE ........1........................1........
PRE .................1........................
RA1 ..........................................
RX1 .................1........................
RA0 .................1........................
RX0 ........1........0...............1....1...
(1) --------0--------1---------------0----0---
C66+ ________1________1_______________1____1___
-----------------1------------------------
ZOO -----------------1------------------------
17set (18) r17 u_ f1 s=1
Edit: clean up spelling/wording