Skip to content

Commit

Permalink
improve phase2 pruning
Browse files Browse the repository at this point in the history
  • Loading branch information
cs0x7f committed Nov 11, 2018
1 parent 2893019 commit 4986b36
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 57 deletions.
27 changes: 16 additions & 11 deletions Search.java
Expand Up @@ -628,24 +628,29 @@ private int phase2(int edge, int esym, int corn, int csym, int mid, int maxl, in
int cornx = CoordCube.CPermMove[corn][CubieCube.SymMoveUD[csym][m]];
int csymx = CubieCube.SymMult[cornx & 0xf][csym];
cornx >>= 4;
if (CoordCube.getPruning(CoordCube.MCPermPrun,
cornx * CoordCube.N_MPERM + CoordCube.MPermConj[midx][csymx]) >= maxl) {
continue;
}
int edgex = CoordCube.EPermMove[edge][CubieCube.SymMoveUD[esym][m]];
int esymx = CubieCube.SymMult[edgex & 0xf][esym];
edgex >>= 4;
if (CoordCube.getPruning(CoordCube.EPermCCombPPrun,
edgex * CoordCube.N_COMB + CoordCube.CCombPConj[CubieCube.Perm2CombP[cornx] & 0xff][CubieCube.SymMultInv[esymx][csymx]]) >= maxl) {
continue;
}
int edgei = CubieCube.getPermSymInv(edgex, esymx, false);
int corni = CubieCube.getPermSymInv(cornx, csymx, true);
if (CoordCube.getPruning(CoordCube.EPermCCombPPrun,
(edgei >> 4) * CoordCube.N_COMB + CoordCube.CCombPConj[CubieCube.Perm2CombP[corni >> 4] & 0xff][CubieCube.SymMultInv[edgei & 0xf][corni & 0xf]]) >= maxl) {

int prun = CoordCube.getPruning(CoordCube.EPermCCombPPrun,
(edgei >> 4) * CoordCube.N_COMB + CoordCube.CCombPConj[CubieCube.Perm2CombP[corni >> 4] & 0xff][CubieCube.SymMultInv[edgei & 0xf][corni & 0xf]]);
if (prun > maxl + 1) {
break;
} else if (prun >= maxl) {
m += 0x42 >> m & 3 & (maxl - prun);
continue;
}
prun = Math.max(
CoordCube.getPruning(CoordCube.MCPermPrun,
cornx * CoordCube.N_MPERM + CoordCube.MPermConj[midx][csymx]),
CoordCube.getPruning(CoordCube.EPermCCombPPrun,
edgex * CoordCube.N_COMB + CoordCube.CCombPConj[CubieCube.Perm2CombP[cornx] & 0xff][CubieCube.SymMultInv[esymx][csymx]]));
if (prun >= maxl) {
m += 0x42 >> m & 3 & (maxl - prun);
continue;
}

int ret = phase2(edgex, esymx, cornx, csymx, midx, maxl - 1, depth + 1, m);
if (ret >= 0) {
move[depth] = Util.ud2std[m];
Expand Down
81 changes: 35 additions & 46 deletions pruningValue.txt
@@ -1,12 +1,30 @@
1 20
2 74
3 326
4 1859
5 14416
6 115532
7 571641
8 867356
9 870912
1 4
2 14
3 58
4 272
5 1118
6 3531
7 8653
8 17292
9 29420
10 41991
11 54976
12 62730
13 66096
14 66432
1 4
2 15
3 54
4 239
5 1079
6 4660
7 19183
8 71653
9 207487
10 354378
11 385203
12 387482
13 387520
1 3
2 17
3 126
Expand All @@ -25,41 +43,12 @@
7 136145
8 166210
9 166320
1 4
1 3
2 15
3 62
4 348
5 1789
6 7901
7 27290
8 56230
9 64826
10 66078
11 66348
12 66432
1 4
2 14
3 58
4 272
5 1118
6 3531
7 8653
8 17292
9 29420
10 41991
11 54976
12 62730
13 66096
14 66432
1 2
2 7
3 51
4 538
5 6379
6 74743
7 851311
8 8802059
9 60900935
10 137137169
11 140908281
12 140908410
3 106
4 951
5 9826
6 89711
7 447496
8 662070
9 663552

0 comments on commit 4986b36

Please sign in to comment.