Browse Source

Merge pull request #24 from dwalton76/tsai-555

Tsai 555
master
Daniel Walton 7 years ago committed by GitHub
parent
commit
58c9a8bf5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 16
      misc/NOTES-4x4x4.txt
  2. 13
      misc/NOTES-5x5x5.txt
  3. 23
      misc/NOTES-6x6x6.txt
  4. 192
      misc/TODO.txt
  5. 13
      misc/tsai.txt
  6. 16
      rubikscubennnsolver/LookupTable.py
  7. 6
      rubikscubennnsolver/RubiksCube444.py
  8. 3
      rubikscubennnsolver/RubiksCube444Misc.py
  9. 1786
      rubikscubennnsolver/RubiksCube555.py
  10. 46
      rubikscubennnsolver/RubiksCube666.py
  11. 10
      rubikscubennnsolver/__init__.py
  12. 3
      usr/bin/rubiks-cube-solver.py

16
misc/NOTES-4x4x4.txt

@ -1,5 +1,8 @@ @@ -1,5 +1,8 @@
These are the numbers from running --test against the 4x4x4 test cases
time ./utils/test.py --test-cubes utils/test_cubes.json.small --size 4x4x4
4x4x4 original numbers
======================
4x4x4 min solution 172 steps
@ -254,3 +257,16 @@ difference but using --cpu-min also adds 10 steps to the solution length. @@ -254,3 +257,16 @@ difference but using --cpu-min also adds 10 steps to the solution length.
89.16user 9.66system 1:42.10elapsed 96%CPU (0avgtext+0avgdata 236004maxresident)k
454952inputs+0outputs (1major+437930minor)pagefaults 0swaps
Removed Lw, Dw, Bw from IDA searches
Removed --cpu-min option
====================================
4x4x4 avg centers solution 18.12 steps
4x4x4 avg edges solution 25.82 steps
4x4x4 avg solution 64.8 steps
4x4x4 min solution 58 steps (DLUBUURUDFRRDDLURDLUFBBFFFFBLUURRBFFFULUDDUDLDBFFRRURDRBULBRBLLFBRLBULBRRLUFLBFDRLBLLRFFDDDBDDBU)
4x4x4 max solution 71 steps (FLDRFFBLFDLRURUUFBUBLRUFUDUBULLFRUBLRRRUDFDFDUBBRRDLUFDDRFBDDFBDDDRFDLUDBLRBLFFBUFBLLLURRBBLRULB)
73.08user 10.40system 1:23.59elapsed 99%CPU (0avgtext+0avgdata 447820maxresident)k

13
misc/NOTES-5x5x5.txt

@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
********************
Main 5x5x5 test cube
********************
time ./utils/test.py --test-cubes utils/test_cubes.json.small --size 5x5x5
Baseline
========
@ -238,3 +239,15 @@ Adds a few steps but step10 used to take 30s for some cubes and it cut that to < @@ -238,3 +239,15 @@ Adds a few steps but step10 used to take 30s for some cubes and it cut that to <
103.49user 1.64system 1:48.30elapsed 97%CPU (0avgtext+0avgdata 46208maxresident)k
5x5x5 removed --cpu-min option
misc IDA tweaks
==============================
5x5x5 avg centers solution 34.12 steps
5x5x5 avg edges solution 66.94 steps
5x5x5 avg solution 121.88 steps
5x5x5 min solution 105 steps (DFLUDUFLFDLUUBFRRRBLLLUDRUBUFRUDFLUDDRLUDBUFBFDDBUDFRRBFUFURBFFULULRDBBDFBRUFRRULUBURDBDRRLRDRDDLBLLRFFFBBBLDLDDLLLRLDLFFUFDLFBURBRBFFLBBBUBURRDBFDRUL)
5x5x5 max solution 135 steps (DUFURLULDDLUUDFLFRDURDRUBRLDBFDRLUDRRRBURFFBUUDBRBBLBFURRBBFDUFDFRDLBFULRDLLUUFFBRUURDFDBUBLFFBUDBFDLBFFDLRLDFDRLDBUUDLUFRLLBDFUBFRFFLDLRBURBBBLRLLLBR)
211.40user 28.03system 4:24.39elapsed 90%CPU (0avgtext+0avgdata 742620maxresident)k

23
misc/NOTES-6x6x6.txt

@ -43,3 +43,26 @@ toook so long to solve. @@ -43,3 +43,26 @@ toook so long to solve.
6x6x6 max solution 243 steps (FLBRDBLUUDLFDFURLRUFLLBUBBUUFBUFRFRLDLLFDRRFDLLUFUBDRLBFRDBFBFRBBRUUDRRRBUDUUBRRRRUFLDUDUUBBUURDDULBRDDBFFFFLDDRLRLDRUUFLFFBDRBLFBRULFDRBBLFDDDFLUFBURFDDLRBBBFDLFUFLRUULBFLLLUURDBFDRULFUBRDDDRBFFRURLBLBLLUDBFLDDRBLDB)
73.27user 1.35system 1:18.88elapsed 94%CPU (0avgtext+0avgdata 48236maxresident)k
6x6x6
step20
- reverted speed improvement
- build table 7-deep
step60
- just pair oblique edges now, it used to pair and place
==============================
6x6x6 avg centers solution 85.58 steps
6x6x6 avg edges solution 92.92 steps
6x6x6 avg solution 213.8 steps
6x6x6 min solution 188 steps (RURFBFDUUFDDRRFBLBDLULBUBLDBRLBRBFUBRDFUFLDULUFFBDRLBDDFRRBDRRFRBRFDBUDRUDRDLUFBFDDLLLFLRLUDUULRUFBURUFDLLLDLRDDBRUFBLDFDURDDUBUBFRRRURUUBLULRBUBBFFULLRRUBLUDDLDFLFDBLLULRDLFBFRRLUDRUUBDRLLFFFBFDFRLBBBUBFBDUFBRFLFBFD)
6x6x6 max solution 240 steps (RBULFLLLDUFRLLDUFBFUUBUBFBFLLBUFDDFBRLRRDBRFUURUBURRBRBRUFBFLFDLRUBRUDFLLDLLLULBLDDBBLRRDDDLDLFDRUBUDDFRDBRRDDFUFDFLRRRULRUDFFRRFBLFDURBRRFUFLBFFBFRDBBBUFBDUDBLFLUBFLFRFDBDUBDBUULLDUBRDULFFRLUDBBDBLUDFLDBLDLRUUUUFRRR)
Added prevent_OLL() call
========================
6x6x6 avg centers solution 95.08 steps
6x6x6 avg edges solution 89.5 steps
6x6x6 avg solution 205.64 steps
6x6x6 min solution 183 steps (LRFULLDFBFLBBDDLLFFDFUDLLDBUDUFUBRRFUFDRDFBBUBDFFUULUBRFRBBLUUUFBRRUUDUFRLLFBRDFDFRULDDFRUUBRRFDDRRBBLULDLDDBBFDFBLLFRFBBFDRDRDDUFLFBUDRUFLDDBLLBFDUBDBLLBBLFLLBRBUFBDUBRURRLRBRRRFRUDLLUURRLRDDRLBLULULFUURURLBFFDFUBRD)
6x6x6 max solution 224 steps (DUURBLRDDBUDLDBRULRLRFFDBBFRRUFBRURURBFUFBLBBFRLFBBBLDFRULBUUDRDUDBBFBRRLDFBDFLFBULDDDDUDRDFDBLUBLRBLFBRDRRLDFBUUULUFUBLFRLUUDUBFDLLFFUURFRBRLLBLDFDRULDLDDBBFLUULDRFDURFUBRRDFDFLFRDUULRFUBFRFULLLRLRBFFRLBLFDDLUUFBBRD)

192
misc/TODO.txt

@ -1,56 +1,151 @@ @@ -1,56 +1,151 @@
- rebuild the tsai phase3 tables without
====
Misc
====
- update # of moves in the misc files and the README
DONE - 4x4x4
DONE - 5x5x5
DONE - 6x6x6
- 7x7x7
=====
4x4x4
=====
- TPR solver
- Testing with the following
./usr/bin/rubiks-cube-solver.py --state DRFDFRUFDURDDLLUFLDLLBLULFBUUFRBLBFLLUDDUFRBURBBRBDLLDURFFBBRUFUFDRFURBUDLDBDUFFBUDRRLDRBLFBRRLB --cpu-tsai
- TPR reduces centers in 26 moves
- https://alg.cubing.net/?puzzle=4x4x4&setup=F2-_U-_F2-_D_U-_F2-_D_L2-_U2-_B-_D-_R_F-_D_B-_L-_B_F_L-_R_Uw_L-_B_D-_L_B-_Uw-_B-_Dw_B2-_L_U_D-_B2-_L-_Dw-_R_U-_B_R_D-_Rw_B2-_D_R-_B_D-_B_Rw-_F2-_D-_Fw2-_L_Dw2-_F_L_Bw2-_D-_Lw_U-_Lw-_Dw-_F-_Bw_U_Lw2-_Uw2-_R-_Uw&alg=Rw2_B_R-_Fw-_L-_Uw_Rw_%2F%2F_end_of_phase1%0AUw-_Rw2_B_R2_Uw_R-_%2F%2F_end_of_phase2%0AB-_F-_Fw2_R_B-_Uw2_R_U2_B-_Uw2_R-_Rw2_Uw2_x-_y2_%2F%2F_end_of_phase3
- where mine takes 34 moves
https://alg.cubing.net/?puzzle=4x4x4&setup=R2-_U_L2-_F2-_R2-_F2-_D-_F2-_R2-_U2-_R_B-_L_R-_B2-_U_L_R2-_U2-_B2-_Lw2-_B2-_Dw2-_F2-_D2-_Lw2-_U-_F-_Lw2-_L2-_D_Lw2-_B_Uw2-_F2-_U_R-_Rw-_Fw2-_Rw-_D2-_F-_Uw2-_B_L_Fw_B-_U-_Rw_Fw2-_R-_F2-_U2-_Fw&alg=Fw-_U2_F2_R_Fw2_Rw-_U_B_Fw-_L-__%2F%2F_end_of_phase1%0AB-_Uw2_F_D2_Rw_Fw2_Rw_R__%2F%2F_end_of_phase2%0AU-_F2_Uw2_B-_Lw2_D-_L2_Lw2_F_U_Lw2_D2_F2_Dw2_B2_Lw2_%2F%2F_end_of_phase3%0AB2_U2_R2_L-_U-_B2_R_L-_B_R-_U2_R2_F2_D_F2_R2_F2_L2_U-_R2
- The difference is the TPR solver finds 10k phase1 solutions and keeps the best 500 (the
ones with the lowest phase2 centers heuristic). It then searches for a phase2 solution
for those 500 phase1 solutions, it does this by starting with a very low IDA threshold
and incrementing it by one after trying to find a solution for all 500 scenarios. It then
keeps the best 100 phase2 solutions and does the same basic process for finding the best
phase2 + phase3 combo.
I am unable to get phase2 to run fast enough to do this though. TPR does some pruning
that I do not understand. This is the skipAxis2 stuff...need to wrap my head around this.
Note that my phase1 does EO where all edges are oriented correctly. I do this just to speed
up phase2 where it is looking for edges to be EO but in any orientation.
Long term I think bidir IDA is the way to go here, we could just combine phase 1 and phase 2
(which the TPR solver is somewhat doing)
- rebuild the tsai phase3 tables with the following illegal moves
'illegal' : ("Lw", "Lw'", "Lw2",
"Bw", "Bw'", "Bw2",
"Dw", "Dw'", "Dw2"),
phase3 for this cube takes ~90s...test with this one.
./usr/bin/rubiks-cube-solver.py --state FUULURFFRLRBDDDULUDFLFBBFUURRRUBLBLBDLUBDBULDDRDFLFBBRDBFDBLRBLDULUFFRLRDLDBBRLRUFFRUBFDUDFRLFRU --cpu-tsai
- build the 4900 tables for 6x6x6 LFRB centers
2017-12-22 07:38:36,659 LookupTable.py INFO: 4x4x4-step70-tsai-phase3: IDA found match 8 steps in, f_cost 14 (8 + 6)
2017-12-22 07:38:36,659 LookupTable.py INFO: 4x4x4-step70-tsai-phase3: IDA threshold 13, explored 74412 branches, took 0:01:04.261351 (0:01:28.678691 total)
- tsai...need something better
- tsai phase3 takes a while in large part due to calculating symmetry states. We could rebuild the table one move less
but skip doing sym...it might be a net win and the lookup table would be smaller.
- 6x6x6 LR edge pairing build 70 tables and merge them
- This is after they have already been staged and we are pairing them up. When we
pair them up we are forcing them to their final position but that isn't needed.
- cpu-normal phase1 stages all centers but I often see "it leads to OLL" scrolling by. We could
build parity specific tables to help with this.
- Do the same for FB prune table
- If we did EO as part of phase2 (solving the centers) would it reduce the number of moves to pair edges?
- My guess is no, we are already at an avg of 25.82 steps for pairing edges which is pretty darn
good considering all of the centers are solved.
- Add "cube.cpu_mode = 'tsai'" to test.py and run this overnight
time ./utils/test.py --test-cubes utils/test_cubes.json.small --size 4x4x4
- B-Trees...this will benefit all searches
- when this is done delete LookupTableIDA666UDObliqueEdgePairing and keep LookupTableIDA666CpuMaxUDObliqueEdgePairing
- when this is done delete LookupTableIDA555CpuMinUDCentersStage and keep LookupTableIDA555UDCentersStage
- that will eliminate all of the "fake move" crazyness
=====
5x5x5
=====
- edge pairing is still awful...revisit lookup tables but with pattern2 approach
- see ac5a482e45315345db438b61887c240e5e6732d1
- tsai today is
- stage UD centers
- stage LR centers (and in turn FB)
- phase2 starts (solve LR centers and do EO)
- TPR solver
- how the hell does it work so fast?
- ideas
- before we start IDA we could see which EO edge mapping gives us the
shortest edge heuristic and stick with that one. We would need to go
back to the 0 line dummy table and
LookupTableIDA444TsaiPhase2.experimental_ida_search_complete()
Or we could build out a small lookup table (say 3 moves deep) for that
one edge mapping.
- xyzzy's 5x5x5 solver. It is a variation of the TPR solver so need to understand TPR first.
- he does an EO (edge orientation) step. If all larger solvers that use 5x5x5 for edge
pairing could also do EO then maybe we could toss the edge pairing code...there is a
ton of it and it is hideous.
- bidir IDA search
- I need to understand how the TPR solver works before I spend time on bidir IDA
- would allow us to find slighly shorter solutions than we do today
- may potentially allow us tackle much larger IDA searches...TBD
we could save a lot of steps by doing
- stage UD centers
- phase2 (solve LR centers and do EO)
- could always build the full LRFB prube table (165 million entries) if IDA is slow
- tsai phase3 needs to be finished
- pair edges at LB, LF, RB, RF
- LFRB centers must be vertical strips
- tsai phase4
- restrict F, F', B, B' to preserved the 4 edges
- solve centers and finish reduction
=====
6x6x6
=====
- This cube hits OLL:
./usr/bin/rubiks-cube-solver.py --state FBDDDFFUDRFBBLFLLURLDLLUFBLRFDUFLBLLFBFLRRBBFDRRDUBUFRBUBRDLUBFDRLBBRLRUFLBRBDUDFFFDBLUDBBLRDFUUDLBBBRRDRUDLBLDFRUDLLFFUUBFBUUFDLRUDUDBRRBBUFFDRRRDBULRRURULFDBRRULDDRUUULBLLFDFRRFDURFFLDUUBRUFDRFUBLDFULFBFDDUDLBLLRBL
Once fixed comment out the prevent_OLL() call in __init__.py
- Something to explore...stage the centers and then solve them via bidir IDA.
Today we reduce the centers to 5x5x5 and use that solver but it ends up
taking us ~100 steps to solve the centers. We would need to add a phase just
after step40 that stages the outer x-centers (today this happens via 5x5x5
centers solver). It takes us ~34 steps to get to the end of step40...so guess
roughly 45 moves to get the centers staged. We would build a fake_555 and use
it to stage the outer x-centers.
Once all sides are staged there are 4 groups of 8!/(4!*4!) per side so to
solve ULF (which would also solve RBD) would be (8!/(4!*4!))^12 or
13,841,287,201,000,000,000,000...that doesn't seem feasible.
Solving just U (in turn solves D) would be (8!/(4!*4!))^4 or 24,010,000
Solving L and F (in turn solve R and B) would be (8!/(4!*4!))^8 or
576,480,100,000,000 but with two 24,010,000 prune tables for a ratio
of 0.000 000 041 6493128
=====
7x7x7
=====
step80 LFRB appears to be hanging on this one:
LLDBLFDRRFDUBFLLLFLLDFLDUBRULFLFDRDRUBBUDBFLFRUBFLDBFRDRFLLRBDUUFRFURDDDBRRLDUDUBLRLLBUDRUDBUUUUBUUDLDFRURFFUFURRRDLBRFLLUFUULRUBRRURULFUBUURLDBRBDBFRLULLFLDLFRRDLRBFDBBFDDUDRBBUUFLBFBLRDDDBRFLBURFDDRBDRBRLURFUDDUFBBFBFLLRFFLLRDFDBBFBRFDLLURUFDDFLFDFBDFFUBDBRBUDDDBLFBLBRBRURFLBBULLDFURUBBLURFU
=====
8x8x8
=====
- Add support in prevent_OLL()
=================
bidirectional IDA
=================
- would open a lot of doors in terms of tackling much larger IDA searches
- first to try is staging all 5x5x5 centers via one phase
- second to try is staging all 5x5x5 centers via one phase
- combine phases 1 and 2 of tsai?
- start from a solved cube and work your way back to the scrambled cube
- requires us to build prune tables for each scrambled cube
- for 4x4x4 staging centers we can do this in XYZ minutes in python
- for 4x4x4 staging centers we can do this in ~20 minutes in python
- if we only build it out 4 steps deep we can do it in ~20s
- so this would have to be done in C and even then it would still
take some time. I think this is a strategy that could only be
@ -59,9 +154,13 @@ @@ -59,9 +154,13 @@
============
B-Tree notes
============
- B-Tree will benefit all searches
- optimaly load the B-Trees
- support for loading the first two levels in memory and finding the rest on disk
- Once the two bullets above are done we should be able to find a key via
@ -100,7 +199,7 @@ B-Tree notes @@ -100,7 +199,7 @@ B-Tree notes
- Test this against slow 6x6x6 UD oblique:
./usr/bin/rubiks-cube-solver.py --cpu-max --state FBDDDFFUDRFBBLFLLURLDLLUFBLRFDUFLBLLFBFLRRBBFDRRDUBUFRBUBRDLUBFDRLBBRLRUFLBRBDUDFFFDBLUDBBLRDFUUDLBBBRRDRUDLBLDFRUDLLFFUUBFBUUFDLRUDUDBRRBBUFFDRRRDBULRRURULFDBRRULDDRUUULBLLFDFRRFDURFFLDUUBRUFDRFUBLDFULFBFDDUDLBLLRBL
./usr/bin/rubiks-cube-solver.py --state FBDDDFFUDRFBBLFLLURLDLLUFBLRFDUFLBLLFBFLRRBBFDRRDUBUFRBUBRDLUBFDRLBBRLRUFLBRBDUDFFFDBLUDBBLRDFUUDLBBBRRDRUDLBLDFRUDLLFFUUBFBUUFDLRUDUDBRRBBUFFDRRRDBULRRURULFDBRRULDDRUUULBLLFDFRRFDURFFLDUUBRUFDRFUBLDFULFBFDDUDLBLLRBL
2017-12-17 09:52:42,776 RubiksCube666.py INFO: UD inner x-centers staged, 5 steps in
@ -113,19 +212,16 @@ B-Tree notes @@ -113,19 +212,16 @@ B-Tree notes
This search takes about 5 million seek() calls when using binary search...the seeks are the top bottleneck thus the need to move to B-Trees
misc notes
==========
- ida_search() needs to return all of the results at that theshold
Test on this one, 5x5x5-step20-LR-centers-stage finds a solution 12 steps long but I know there is one
that is 10 steps long (I found it via AStar)
./usr/bin/rubiks-cube-solver.py --state RFFFUDUDURBFULULFDBLRLDUFDBLUBBBDDURLRDRFRUDDBFUFLFURRLDFRRRUBFUUDUFLLBLBBULDDRRUFUUUBUDFFDRFLRBBLRFDLLUUBBRFRFRLLBFRLBRRFRBDLLDDFBLRDLFBBBLBLBDUUFDDD
I have a partial patch for this (patches/ida_solutions_use_best.patch) but it needs some work.
We need to pseudo combine multiple phases to get shorter solutions. For example
we need to find multiple solutions for staging UD centers and then for each of those find multiple
solutions for staging LR centers and keep the one that allows us to solve the 5x5x5 centers in the
least number of steps. That is a lot of IDA searches though so this all has to happen after
the bplustree work is done.
This is another slow one
./usr/bin/rubiks-cube-solver.py --state UBULRLBDLDBDDLLDBBRRBFDRFRLLRLBUDUBBUFFUBBFUURDBDUFRDLDLUDBFLBRUFLUFUUBDDRLLLLULFDLLDRFDFBDFLUUFLBFRDBFUBRDRLLUFFBRDBDLUUFRFDRDDBLBRRRBBRRLLLBRRRRRBRRDUUFBFBLDBUFBLULRBUUBDLDDFRFDUDUDFUFDFFUFFUUBRRLLBRULLUFFRUBFDRFDF
2017-12-24 07:20:07,314 __init__.py INFO:
2017-12-24 07:20:07,319 RubiksCube666.py INFO: UD inner x-centers staged, 5 steps in
2017-12-24 07:20:07,320 LookupTable.py INFO: 6x6x6-step20-UD-oblique-edge-pairing: IDA threshold range 6->99
2017-12-24 07:20:07,327 LookupTable.py INFO: 6x6x6-step20-UD-oblique-edge-pairing: IDA threshold 6, explored 42 branches, took 6ms
2017-12-24 07:20:07,471 LookupTable.py INFO: 6x6x6-step20-UD-oblique-edge-pairing: IDA threshold 7, explored 1162 branches, took 144ms
2017-12-24 07:20:10,826 LookupTable.py INFO: 6x6x6-step20-UD-oblique-edge-pairing: IDA threshold 8, explored 30442 branches, took 0:00:03.354795
2017-12-24 07:21:30,345 LookupTable.py INFO: 6x6x6-step20-UD-oblique-edge-pairing: IDA threshold 9, explored 810242 branches, took 0:01:19.518391
2017-12-24 07:22:40,802 LookupTable.py INFO: 6x6x6-step20-UD-oblique-edge-pairing: IDA found match 8 steps in, f_cost 11 (8 + 3)
2017-12-24 07:22:40,802 LookupTable.py INFO: 6x6x6-step20-UD-oblique-edge-pairing: IDA threshold 10, explored 793725 branches, took 0:01:10.457381 (0:02:33.482832 total)
2017-12-24 07:22:40,802 RubiksCube666.py INFO: UD oblique edges paired, 20 steps in

13
misc/tsai.txt

@ -1,13 +0,0 @@ @@ -1,13 +0,0 @@
TPR solution for DRFDFRUFDURDDLLUFLDLLBLULFBUUFRBLBFLLUDDUFRBURBBRBDLLDURFFBBRUFUFDRFURBUDLDBDUFFBUDRRLDRBLFBRRLB
https://alg.cubing.net/?puzzle=4x4x4&setup=F2-_U-_F2-_D_U-_F2-_D_L2-_U2-_B-_D-_R_F-_D_B-_L-_B_F_L-_R_Uw_L-_B_D-_L_B-_Uw-_B-_Dw_B2-_L_U_D-_B2-_L-_Dw-_R_U-_B_R_D-_Rw_B2-_D_R-_B_D-_B_Rw-_F2-_D-_Fw2-_L_Dw2-_F_L_Bw2-_D-_Lw_U-_Lw-_Dw-_F-_Bw_U_Lw2-_Uw2-_R-_Uw&alg=Rw2_B_R-_Fw-_L-_Uw_Rw_%2F%2F_end_of_phase1%0AUw-_Rw2_B_R2_Uw_R-_%2F%2F_end_of_phase2%0AB-_F-_Fw2_R_B-_Uw2_R_U2_B-_Uw2_R-_Rw2_Uw2_x-_y2_%2F%2F_end_of_phase3
Rw2 B R' Fw' L' Uw Rw // end of phase1 (7 moves)
Uw' Rw2 B R2 Uw R' // end of phase2 (6 moves)
B' F' Fw2 R B' Uw2 R U2 B' Uw2 R' Rw2 Uw2 x' y2 // end of phase3
./usr/bin/rubiks-cube-solver.py --state DRFDFRUFDURDDLLUFLDLLBLULFBUUFRBLBFLLUDDUFRBURBBRBDLLDURFFBBRUFUFDRFURBUDLDBDUFFBUDRRLDRBLFBRRLB --cpu-tsai

16
rubikscubennnsolver/LookupTable.py

@ -125,6 +125,22 @@ class LookupTable(object): @@ -125,6 +125,22 @@ class LookupTable(object):
os.unlink('lookup-table-6x6x6-step60-LFRB-solve-inner-x-center-and-oblique-edges.txt.gz.part-ab')
os.unlink('lookup-table-6x6x6-step60-LFRB-solve-inner-x-center-and-oblique-edges.txt.gz.part-ac')
elif self.filename_gz == 'lookup-table-6x6x6-step20-UD-oblique-edge-pairing.txt.gz':
# Download all parts
for extension in ('aa', 'ab', 'ac', 'ad', 'ae', 'af', 'ag', 'ah', 'ai', 'aj', 'ak', 'al'):
url = "https://github.com/dwalton76/rubiks-cube-lookup-tables-%sx%sx%s/raw/master/lookup-table-4x4x4-step50-tsai-phase1.txt.gz.part-%s" %\
(self.parent.size, self.parent.size, self.parent.size, extension)
log.info("Downloading table via 'wget %s'" % url)
subprocess.call(['wget', url])
#subprocess.call('cat lookup-table-4x4x4-step50-tsai-phase1.txt.gz.part-* > lookup-table-4x4x4-step50-tsai-phase1.txt.gz', shell=True)
subprocess.call('cat lookup-table-6x6x6-step20-UD-oblique-edge-pairing.txt.gz.part-* > lookup-table-6x6x6-step20-UD-oblique-edge-pairing.txt.gz', shell=True)
for extension in ('aa', 'ab', 'ac', 'ad', 'ae', 'af', 'ag', 'ah', 'ai', 'aj', 'ak', 'al'):
os.unlink('lookup-table-6x6x6-step20-UD-oblique-edge-pairing.txt.gz-%s' % extension)
elif self.filename_gz == 'lookup-table-4x4x4-step50-tsai-phase1.txt.gz':
# Download all three parts

6
rubikscubennnsolver/RubiksCube444.py

@ -6,7 +6,7 @@ from rubikscubennnsolver.RubiksCube444Misc import ( @@ -6,7 +6,7 @@ from rubikscubennnsolver.RubiksCube444Misc import (
lookup_table_444_last_two_edges_place_F_east,
lookup_table_444_sister_wing_to_F_east,
lookup_table_444_sister_wing_to_U_west,
tsai_phase2_orient_edges,
tsai_phase2_orient_edges_444,
tsai_edge_mapping_combinations,
)
from rubikscubennnsolver.LookupTable import (
@ -304,7 +304,7 @@ class LookupTable444TsaiPhase1(LookupTableIDA): @@ -304,7 +304,7 @@ class LookupTable444TsaiPhase1(LookupTableIDA):
'D' : '0',
}
orient_edges = tsai_phase2_orient_edges
orient_edges = tsai_phase2_orient_edges_444
parent_state = self.parent.state
result = [
@ -1172,7 +1172,7 @@ class RubiksCube444(RubiksCube): @@ -1172,7 +1172,7 @@ class RubiksCube444(RubiksCube):
state_x = state[x]
state_y = state[y]
wing_str = wing_str_map[''.join((state_x, state_y))]
high_low = tsai_phase2_orient_edges[(x, y, state_x, state_y)]
high_low = tsai_phase2_orient_edges_444[(x, y, state_x, state_y)]
if wing_str in edges_to_flip:
if high_low == 'U':

3
rubikscubennnsolver/RubiksCube444Misc.py

@ -80,7 +80,7 @@ lookup_table_444_sister_wing_to_U_west = { @@ -80,7 +80,7 @@ lookup_table_444_sister_wing_to_U_west = {
}
tsai_phase2_orient_edges = {
tsai_phase2_orient_edges_444 = {
(2, 67, 'B', 'D'): 'D',
(2, 67, 'B', 'L'): 'D',
(2, 67, 'B', 'R'): 'D',
@ -1236,6 +1236,7 @@ tsai_phase2_orient_edges = { @@ -1236,6 +1236,7 @@ tsai_phase2_orient_edges = {
}
# These apply to 4x4x4 and 5x5x5
tsai_edge_mapping_combinations = {
0 : (set()),
2 : (

1786
rubikscubennnsolver/RubiksCube555.py

File diff suppressed because it is too large Load Diff

46
rubikscubennnsolver/RubiksCube666.py

@ -264,10 +264,11 @@ class LookupTableIDA666UDObliqueEdgePairing(LookupTableIDA): @@ -264,10 +264,11 @@ class LookupTableIDA666UDObliqueEdgePairing(LookupTableIDA):
2 steps has 82 entries (0 percent, 16.40x previous step)
3 steps has 1,434 entries (0 percent, 17.49x previous step)
4 steps has 24,198 entries (0 percent, 16.87x previous step)
5 steps has 405,916 entries (5 percent, 16.77x previous step)
6 steps has 6,839,392 entries (94 percent, 16.85x previous step)
5 steps has 405,916 entries (0 percent, 16.77x previous step)
6 steps has 6,839,392 entries (5 percent, 16.85x previous step)
7 steps has 116,031,874 entries (94 percent, 16.97x previous step)
Total: 7,271,027 entries
Total: 123,302,901 entries
"""
def __init__(self, parent):
@ -286,7 +287,7 @@ class LookupTableIDA666UDObliqueEdgePairing(LookupTableIDA): @@ -286,7 +287,7 @@ class LookupTableIDA666UDObliqueEdgePairing(LookupTableIDA):
# prune tables
(parent.lt_UD_oblique_edge_pairing_left_only,
parent.lt_UD_oblique_edge_pairing_right_only),
linecount=7271027)
linecount=123302901)
def state(self):
parent_state = self.parent.state
@ -1206,41 +1207,10 @@ class RubiksCube666(RubiksCubeNNNEvenEdges): @@ -1206,41 +1207,10 @@ class RubiksCube666(RubiksCubeNNNEvenEdges):
fake_555.state[144] = self.state[209]
fake_555.sanity_check()
def fake_move_UD_to_UFDB(self):
# How many UD squares are on sides LR? We need to "fake move" those to somewhere on FB for our lookup table to work.
left_fake_move_count = 0
right_fake_move_count = 0
for square_index in (45, 53, 64, 56, 117, 125, 136, 128):
if self.state[square_index] in ('U', 'D'):
self.state[square_index] = 'L'
left_fake_move_count += 1
for square_index in (46, 59, 63, 50, 118, 131, 135, 122):
if self.state[square_index] in ('U', 'D'):
self.state[square_index] = 'L'
right_fake_move_count += 1
if left_fake_move_count > 0:
for square_index in (9, 17, 28, 20, 189, 197, 208, 200, 81, 89, 100, 92, 153, 161, 172, 164):
if self.state[square_index] not in ('U', 'D'):
self.state[square_index] = 'U'
left_fake_move_count -= 1
if not left_fake_move_count:
break
if right_fake_move_count > 0:
for square_index in (10, 23, 27, 14, 190, 203, 207, 194, 82, 95, 99, 86, 154, 167, 171, 158):
if self.state[square_index] not in ('U', 'D'):
self.state[square_index] = 'U'
right_fake_move_count -= 1
if not right_fake_move_count:
break
def group_centers_stage_UD(self):
"""
Stage UD inner x-centers and oblique edges. The 7x7x7 uses this that is why it is in its own method.
"""
self.lt_UD_inner_x_centers_stage.solve()
log.info("UD inner x-centers staged, %d steps in" % self.get_solution_len_minus_rotates(self.solution))

10
rubikscubennnsolver/__init__.py

@ -2970,7 +2970,7 @@ class RubiksCube(object): @@ -2970,7 +2970,7 @@ class RubiksCube(object):
steps = None
if not orbits_with_oll_parity:
return True
return False
if self.size == 4:
if orbits_with_oll_parity == [0]:
@ -3248,8 +3248,7 @@ class RubiksCube(object): @@ -3248,8 +3248,7 @@ class RubiksCube(object):
self.solve_PLL()
if not self.solved():
print("We hit either OLL or PLL parity and could not solve it")
sys.exit(1)
raise SolveError("We hit either OLL or PLL parity and could not solve it")
def get_corner_swap_count(self, debug=False):
@ -3668,7 +3667,10 @@ class RubiksCube(object): @@ -3668,7 +3667,10 @@ class RubiksCube(object):
log.info("")
log.info("")
self.group_centers_guts()
log.info("group center solution (%d steps): %s" % (self.get_solution_len_minus_rotates(self.solution), ' '.join(self.solution)))
log.info("group center solution (%d steps in)" % (self.get_solution_len_minus_rotates(self.solution)))
if self.prevent_OLL():
log.info("prevented OLL (%d steps in)" % (self.get_solution_len_minus_rotates(self.solution)))
self.solution.append('CENTERS_SOLVED')

3
usr/bin/rubiks-cube-solver.py

@ -306,7 +306,7 @@ try: @@ -306,7 +306,7 @@ try:
cube.cpu_mode = 'max'
elif args.cpu_tsai:
cube.cpu_mode = 'tsai'
assert size == 4, "--cpu-tsai option can only be uses for a 4x4x4 cube"
assert size == 4 or size == 5, "--cpu-tsai option can only be uses for 4x4x4 or 5x5x5 cubes"
elif args.cpu_normal:
cube.cpu_mode = 'normal'
else:
@ -394,6 +394,7 @@ try: @@ -394,6 +394,7 @@ try:
except (ImplementThis, SolveError, StuckInALoop, NoSteps, KeyError):
cube.print_cube_layout()
cube.print_cube()
#cube.tsai_phase2_orient_edges_print()
cube.print_solution()
print((cube.get_kociemba_string(True)))
raise

Loading…
Cancel
Save