Revision 36f45145
Added by Leszek Koltunski 10 months ago
src/main/java/org/distorted/objectlib/algsolvers/PhaseSolutionFinder.java | ||
---|---|---|
17 | 17 |
|
18 | 18 |
public class PhaseSolutionFinder |
19 | 19 |
{ |
20 |
private final static double LOG2 = Math.log(2); |
|
21 |
|
|
20 | 22 |
private final static int MAX_MEMORY = 6*1024*1024; // 6MB max for the MitM table |
21 | 23 |
private final static int MAX_LENGTH = 10; |
22 | 24 |
private final SolvedObject mObject; |
... | ... | |
94 | 96 |
Static4D[] quats = mObject.getQuats(); |
95 | 97 |
int numQuats = quats.length; |
96 | 98 |
int numCubits = mObject.getCubitPositions().length; |
99 |
|
|
100 |
double tmp = Math.log(numQuats) / LOG2; |
|
101 |
double numBytes = numCubits*tmp/8; |
|
102 |
int numBytesInt = (int)Math.ceil(numBytes); // this many bytes will be needed to store |
|
103 |
// one position in the MiTM table |
|
104 |
|
|
105 |
int branchingFactor = mObject.getBranchingFactor(); |
|
106 |
int t = MAX_MEMORY/numBytesInt; |
|
107 |
double maxDepth = Math.log(t) / Math.log(branchingFactor); |
|
108 |
|
|
109 |
return (int)maxDepth; |
|
97 | 110 |
} |
98 | 111 |
|
99 | 112 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/objectlib/algsolvers/SolvedObject.java | ||
---|---|---|
282 | 282 |
} |
283 | 283 |
} |
284 | 284 |
|
285 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
286 |
|
|
287 |
int getBranchingFactor() |
|
288 |
{ |
|
289 |
int factor = 0; |
|
290 |
int numAxis = mAxis.length; |
|
291 |
|
|
292 |
for(int a=0; a<numAxis; a++) |
|
293 |
{ |
|
294 |
int numL = mRotateable[a].length; |
|
295 |
|
|
296 |
for(int l=0; l<numL; l++) |
|
297 |
if( mRotateable[a][l] ) |
|
298 |
{ |
|
299 |
int basicAngle = mBasicAngles[a][l]; |
|
300 |
factor += (basicAngle-1); |
|
301 |
} |
|
302 |
} |
|
303 |
|
|
304 |
return factor; |
|
305 |
} |
|
285 | 306 |
} |
Also available in: Unified diff
minor