mapFolding 0.8.2__py3-none-any.whl → 0.8.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mapFolding/__init__.py +6 -2
- mapFolding/basecamp.py +11 -5
- mapFolding/filesystem.py +134 -109
- mapFolding/oeis.py +1 -1
- mapFolding/reference/__init__.py +7 -0
- mapFolding/reference/jobsCompleted/[2x19]/p2x19.py +197 -0
- mapFolding/reference/jobsCompleted/__init__.py +50 -0
- mapFolding/reference/jobsCompleted/p2x19/p2x19.py +29 -0
- mapFolding/someAssemblyRequired/__init__.py +37 -18
- mapFolding/someAssemblyRequired/_theTypes.py +35 -0
- mapFolding/someAssemblyRequired/_tool_Make.py +92 -0
- mapFolding/someAssemblyRequired/_tool_Then.py +65 -0
- mapFolding/someAssemblyRequired/_toolboxAntecedents.py +326 -0
- mapFolding/someAssemblyRequired/_toolboxContainers.py +306 -0
- mapFolding/someAssemblyRequired/_toolboxPython.py +76 -0
- mapFolding/someAssemblyRequired/getLLVMforNoReason.py +20 -1
- mapFolding/someAssemblyRequired/ingredientsNumba.py +17 -24
- mapFolding/someAssemblyRequired/synthesizeNumbaFlow.py +112 -149
- mapFolding/someAssemblyRequired/synthesizeNumbaJob.py +247 -0
- mapFolding/someAssemblyRequired/transformDataStructures.py +167 -100
- mapFolding/someAssemblyRequired/transformationTools.py +63 -678
- mapFolding/syntheticModules/__init__.py +1 -0
- mapFolding/syntheticModules/numbaCount_doTheNeedful.py +36 -33
- mapFolding/theDao.py +13 -11
- mapFolding/theSSOT.py +69 -119
- {mapfolding-0.8.2.dist-info → mapfolding-0.8.4.dist-info}/METADATA +4 -2
- mapfolding-0.8.4.dist-info/RECORD +49 -0
- {mapfolding-0.8.2.dist-info → mapfolding-0.8.4.dist-info}/WHEEL +1 -1
- tests/conftest.py +34 -29
- tests/test_computations.py +40 -31
- tests/test_filesystem.py +3 -3
- tests/test_other.py +4 -3
- mapFolding/someAssemblyRequired/synthesizeNumbaJobVESTIGIAL.py +0 -413
- mapfolding-0.8.2.dist-info/RECORD +0 -39
- {mapfolding-0.8.2.dist-info → mapfolding-0.8.4.dist-info}/entry_points.txt +0 -0
- {mapfolding-0.8.2.dist-info → mapfolding-0.8.4.dist-info}/licenses/LICENSE +0 -0
- {mapfolding-0.8.2.dist-info → mapfolding-0.8.4.dist-info}/top_level.txt +0 -0
mapFolding/__init__.py
CHANGED
|
@@ -22,17 +22,21 @@ Special directories:
|
|
|
22
22
|
- .cache/: Stores cached data from external sources like OEIS to improve performance
|
|
23
23
|
- syntheticModules/: Contains dynamically generated, optimized implementations of the
|
|
24
24
|
core algorithm created by the code transformation framework
|
|
25
|
+
- reference/: Historical implementations and educational resources for algorithm exploration
|
|
26
|
+
- reference/jobsCompleted/: Contains successful computations for previously unknown values,
|
|
27
|
+
including first-ever calculations for 2x19 and 2x20 maps (OEIS A001415)
|
|
25
28
|
|
|
26
29
|
This package strives to balance algorithm readability and understandability with
|
|
27
30
|
high-performance computation capabilities, allowing users to compute map folding
|
|
28
31
|
totals for larger dimensions than previously feasible.
|
|
29
32
|
"""
|
|
30
|
-
from mapFolding.basecamp import countFolds
|
|
31
|
-
from mapFolding.oeis import clearOEIScache, getOEISids, OEIS_for_n
|
|
33
|
+
from mapFolding.basecamp import countFolds
|
|
34
|
+
from mapFolding.oeis import clearOEIScache, getOEISids, OEIS_for_n, oeisIDfor_n
|
|
32
35
|
|
|
33
36
|
__all__ = [
|
|
34
37
|
'clearOEIScache',
|
|
35
38
|
'countFolds',
|
|
36
39
|
'getOEISids',
|
|
37
40
|
'OEIS_for_n',
|
|
41
|
+
'oeisIDfor_n',
|
|
38
42
|
]
|
mapFolding/basecamp.py
CHANGED
|
@@ -14,13 +14,13 @@ implementation, and optional persistence of results.
|
|
|
14
14
|
|
|
15
15
|
from collections.abc import Sequence
|
|
16
16
|
from mapFolding.beDRY import outfitCountFolds, setCPUlimit, validateListDimensions
|
|
17
|
-
from mapFolding.filesystem import getPathFilenameFoldsTotal, saveFoldsTotal
|
|
17
|
+
from mapFolding.filesystem import getPathFilenameFoldsTotal, saveFoldsTotal, saveFoldsTotalFAILearly
|
|
18
18
|
from mapFolding.theSSOT import ComputationState, getPackageDispatcher, The
|
|
19
19
|
from os import PathLike
|
|
20
|
-
from pathlib import
|
|
20
|
+
from pathlib import PurePath
|
|
21
21
|
|
|
22
22
|
def countFolds(listDimensions: Sequence[int]
|
|
23
|
-
, pathLikeWriteFoldsTotal:
|
|
23
|
+
, pathLikeWriteFoldsTotal: PathLike[str] | PurePath | None = None
|
|
24
24
|
, computationDivisions: int | str | None = None
|
|
25
25
|
, CPUlimit: int | float | bool | None = None
|
|
26
26
|
) -> int:
|
|
@@ -57,13 +57,19 @@ def countFolds(listDimensions: Sequence[int]
|
|
|
57
57
|
concurrencyLimit: int = setCPUlimit(CPUlimit, The.concurrencyPackage)
|
|
58
58
|
computationStateInitialized: ComputationState = outfitCountFolds(mapShape, computationDivisions, concurrencyLimit)
|
|
59
59
|
|
|
60
|
+
if pathLikeWriteFoldsTotal is not None:
|
|
61
|
+
pathFilenameFoldsTotal = getPathFilenameFoldsTotal(computationStateInitialized.mapShape, pathLikeWriteFoldsTotal)
|
|
62
|
+
saveFoldsTotalFAILearly(pathFilenameFoldsTotal)
|
|
63
|
+
else:
|
|
64
|
+
pathFilenameFoldsTotal = None
|
|
65
|
+
|
|
60
66
|
dispatcherCallableProxy = getPackageDispatcher()
|
|
61
67
|
computationStateComplete: ComputationState = dispatcherCallableProxy(computationStateInitialized)
|
|
68
|
+
# computationStateComplete: ComputationState = The.dispatcher(computationStateInitialized)
|
|
62
69
|
|
|
63
70
|
computationStateComplete.getFoldsTotal()
|
|
64
71
|
|
|
65
|
-
if
|
|
66
|
-
pathFilenameFoldsTotal: Path = getPathFilenameFoldsTotal(computationStateComplete.mapShape, pathLikeWriteFoldsTotal)
|
|
72
|
+
if pathFilenameFoldsTotal is not None:
|
|
67
73
|
saveFoldsTotal(pathFilenameFoldsTotal, computationStateComplete.foldsTotal)
|
|
68
74
|
|
|
69
75
|
return computationStateComplete.foldsTotal
|
mapFolding/filesystem.py
CHANGED
|
@@ -13,117 +13,142 @@ consistent naming conventions and path resolution strategies to ensure that:
|
|
|
13
13
|
The module serves as the interface between the computational components of the package
|
|
14
14
|
and the filesystem, abstracting away the details of file operations and path management.
|
|
15
15
|
"""
|
|
16
|
+
from mapFolding.theSSOT import The
|
|
17
|
+
from os import PathLike
|
|
16
18
|
from pathlib import Path, PurePath
|
|
19
|
+
from sys import modules as sysModules
|
|
17
20
|
from typing import Any
|
|
18
|
-
from os import PathLike
|
|
19
21
|
import os
|
|
20
22
|
|
|
21
23
|
def getFilenameFoldsTotal(mapShape: tuple[int, ...]) -> str:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
def getPathFilenameFoldsTotal(mapShape: tuple[int, ...], pathLikeWriteFoldsTotal:
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
def
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
24
|
+
"""
|
|
25
|
+
Create a standardized filename for a computed `foldsTotal` value.
|
|
26
|
+
|
|
27
|
+
This function generates a consistent, filesystem-safe filename based on map dimensions.
|
|
28
|
+
Standardizing filenames ensures that results can be reliably stored and retrieved,
|
|
29
|
+
avoiding potential filesystem incompatibilities or Python naming restrictions.
|
|
30
|
+
|
|
31
|
+
Parameters:
|
|
32
|
+
mapShape: A sequence of integers representing the dimensions of the map.
|
|
33
|
+
|
|
34
|
+
Returns:
|
|
35
|
+
filenameFoldsTotal: A filename string in format 'pMxN.foldsTotal' where M,N are sorted dimensions.
|
|
36
|
+
|
|
37
|
+
Notes:
|
|
38
|
+
The filename format ensures:
|
|
39
|
+
- No spaces in the filename
|
|
40
|
+
- Safe filesystem characters
|
|
41
|
+
- Unique extension (.foldsTotal)
|
|
42
|
+
- Python-safe strings (no starting with numbers, no reserved words)
|
|
43
|
+
- The 'p' prefix preserves compatibility with Lunnan's original code.
|
|
44
|
+
"""
|
|
45
|
+
return 'p' + 'x'.join(str(dimension) for dimension in sorted(mapShape)) + '.foldsTotal'
|
|
46
|
+
|
|
47
|
+
def getPathFilenameFoldsTotal(mapShape: tuple[int, ...], pathLikeWriteFoldsTotal: PathLike[str] | PurePath | None = None) -> Path:
|
|
48
|
+
"""
|
|
49
|
+
Get a standardized path and filename for the computed foldsTotal value.
|
|
50
|
+
|
|
51
|
+
This function resolves paths for storing computation results, handling different
|
|
52
|
+
input types including directories, absolute paths, or relative paths. It ensures
|
|
53
|
+
that all parent directories exist in the resulting path.
|
|
54
|
+
|
|
55
|
+
Parameters:
|
|
56
|
+
mapShape: List of dimensions for the map folding problem.
|
|
57
|
+
pathLikeWriteFoldsTotal (getPathJobRootDEFAULT): Path, filename, or relative path and filename.
|
|
58
|
+
If None, uses default path. If a directory, appends standardized filename.
|
|
59
|
+
|
|
60
|
+
Returns:
|
|
61
|
+
pathFilenameFoldsTotal: Absolute path and filename for storing the foldsTotal value.
|
|
62
|
+
|
|
63
|
+
Notes:
|
|
64
|
+
The function creates any necessary directories in the path if they don't exist.
|
|
65
|
+
"""
|
|
66
|
+
|
|
67
|
+
if pathLikeWriteFoldsTotal is None:
|
|
68
|
+
pathFilenameFoldsTotal = getPathRootJobDEFAULT() / getFilenameFoldsTotal(mapShape)
|
|
69
|
+
else:
|
|
70
|
+
pathLikeSherpa = Path(pathLikeWriteFoldsTotal)
|
|
71
|
+
if pathLikeSherpa.is_dir():
|
|
72
|
+
pathFilenameFoldsTotal = pathLikeSherpa / getFilenameFoldsTotal(mapShape)
|
|
73
|
+
elif pathLikeSherpa.is_file() and pathLikeSherpa.is_absolute():
|
|
74
|
+
pathFilenameFoldsTotal = pathLikeSherpa
|
|
75
|
+
else:
|
|
76
|
+
pathFilenameFoldsTotal = getPathRootJobDEFAULT() / pathLikeSherpa
|
|
77
|
+
|
|
78
|
+
pathFilenameFoldsTotal.parent.mkdir(parents=True, exist_ok=True)
|
|
79
|
+
return pathFilenameFoldsTotal
|
|
80
|
+
|
|
81
|
+
# TODO learn how to see this from the user's perspective
|
|
82
|
+
def getPathRootJobDEFAULT() -> Path:
|
|
83
|
+
pathJobDEFAULT = The.pathPackage / "jobs"
|
|
84
|
+
if 'google.colab' in sysModules:
|
|
85
|
+
pathJobDEFAULT = Path("/content/drive/MyDrive") / "jobs"
|
|
86
|
+
pathJobDEFAULT.mkdir(parents=True, exist_ok=True)
|
|
87
|
+
return pathJobDEFAULT
|
|
88
|
+
|
|
89
|
+
def _saveFoldsTotal(pathFilename: PathLike[str] | PurePath, foldsTotal: int) -> None:
|
|
90
|
+
pathFilenameFoldsTotal = Path(pathFilename)
|
|
91
|
+
pathFilenameFoldsTotal.parent.mkdir(parents=True, exist_ok=True)
|
|
92
|
+
pathFilenameFoldsTotal.write_text(str(foldsTotal))
|
|
93
|
+
|
|
94
|
+
def saveFoldsTotal(pathFilename: PathLike[str] | PurePath, foldsTotal: int) -> None:
|
|
95
|
+
"""
|
|
96
|
+
Save `foldsTotal` value to disk with multiple fallback mechanisms.
|
|
97
|
+
|
|
98
|
+
This function attempts to save the computed `foldsTotal` value to the specified
|
|
99
|
+
location, with backup strategies in case the primary save attempt fails.
|
|
100
|
+
The robustness is critical since these computations may take days to complete.
|
|
101
|
+
|
|
102
|
+
Parameters:
|
|
103
|
+
pathFilename: Target save location for the `foldsTotal` value
|
|
104
|
+
foldsTotal: The computed value to save
|
|
105
|
+
|
|
106
|
+
Notes:
|
|
107
|
+
If the primary save fails, the function will attempt alternative save methods:
|
|
108
|
+
1. Print the value prominently to stdout
|
|
109
|
+
2. Create a fallback file in the current working directory
|
|
110
|
+
3. As a last resort, simply print the value
|
|
111
|
+
"""
|
|
112
|
+
try:
|
|
113
|
+
_saveFoldsTotal(pathFilename, foldsTotal)
|
|
114
|
+
except Exception as ERRORmessage:
|
|
115
|
+
try:
|
|
116
|
+
print(f"\nfoldsTotal foldsTotal foldsTotal foldsTotal foldsTotal\n\n{foldsTotal=}\n\nfoldsTotal foldsTotal foldsTotal foldsTotal foldsTotal\n")
|
|
117
|
+
print(ERRORmessage)
|
|
118
|
+
print(f"\nfoldsTotal foldsTotal foldsTotal foldsTotal foldsTotal\n\n{foldsTotal=}\n\nfoldsTotal foldsTotal foldsTotal foldsTotal foldsTotal\n")
|
|
119
|
+
randomnessPlanB = (int(str(foldsTotal).strip()[-1]) + 1) * ['YO_']
|
|
120
|
+
filenameInfixUnique = ''.join(randomnessPlanB)
|
|
121
|
+
pathFilenamePlanB = os.path.join(os.getcwd(), 'foldsTotal' + filenameInfixUnique + '.txt')
|
|
122
|
+
writeStreamFallback = open(pathFilenamePlanB, 'w')
|
|
123
|
+
writeStreamFallback.write(str(foldsTotal))
|
|
124
|
+
writeStreamFallback.close()
|
|
125
|
+
print(str(pathFilenamePlanB))
|
|
126
|
+
except Exception:
|
|
127
|
+
print(foldsTotal)
|
|
128
|
+
return None
|
|
129
|
+
|
|
130
|
+
def saveFoldsTotalFAILearly(pathFilename: PathLike[str] | PurePath) -> None:
|
|
131
|
+
if Path(pathFilename).exists():
|
|
132
|
+
raise FileExistsError(f"{pathFilename=} exists: a battle of overwriting might cause tears.")
|
|
133
|
+
if not Path(pathFilename).parent.exists():
|
|
134
|
+
raise FileNotFoundError(f"I received {pathFilename=} 0.000139 seconds ago from a function that promised it created the parent directory, but the parent directory does not exist. Fix that now, so your computation doesn't get deleted later. And be compassionate to others.")
|
|
135
|
+
foldsTotal = 149302889205120
|
|
136
|
+
_saveFoldsTotal(pathFilename, foldsTotal)
|
|
137
|
+
if not Path(pathFilename).exists():
|
|
138
|
+
raise FileNotFoundError(f"I just wrote a test file to {pathFilename=}, but it does not exist. Fix that now, so your computation doesn't get deleted later. And continually improve your empathy skills.")
|
|
139
|
+
foldsTotalRead = int(Path(pathFilename).read_text())
|
|
140
|
+
if foldsTotalRead != foldsTotal:
|
|
141
|
+
raise FileNotFoundError(f"I wrote a test file to {pathFilename=} with contents of {str(foldsTotal)=}, but I read {foldsTotalRead=} from the file. Python says the values are not equal. Fix that now, so your computation doesn't get corrupted later. And be pro-social.")
|
|
142
|
+
|
|
143
|
+
def writeStringToHere(this: str, pathFilename: PathLike[str] | PurePath) -> None:
|
|
144
|
+
"""
|
|
145
|
+
Write a string to a file, creating parent directories if needed.
|
|
146
|
+
|
|
147
|
+
Parameters:
|
|
148
|
+
this: The string content to write to the file
|
|
149
|
+
pathFilename: The target file path where the string should be written
|
|
150
|
+
"""
|
|
151
|
+
pathFilename = Path(pathFilename)
|
|
152
|
+
pathFilename.parent.mkdir(parents=True, exist_ok=True)
|
|
153
|
+
pathFilename.write_text(str(this))
|
|
154
|
+
return None
|
mapFolding/oeis.py
CHANGED
mapFolding/reference/__init__.py
CHANGED
|
@@ -26,11 +26,18 @@ Categories of reference implementations:
|
|
|
26
26
|
- total_countPlus1vsPlusN.py - Optimized counting with different increment strategies
|
|
27
27
|
- rotatedEntryPoint.py - Alternative entry point implementation (demonstration)
|
|
28
28
|
|
|
29
|
+
5. Published computations:
|
|
30
|
+
- jobsCompleted/ - Contains the source code and results of significant new computations:
|
|
31
|
+
- [2,19] - First-ever computation of the 2x19 map (completed Jan 2025)
|
|
32
|
+
- [2,20] - First-ever computation of the 2x20 map (completed Jan 2025)
|
|
33
|
+
- These calculations extend the known values for OEIS sequence A001415
|
|
34
|
+
|
|
29
35
|
These reference implementations are valuable for:
|
|
30
36
|
- Understanding the algorithm's historical development
|
|
31
37
|
- Comparing performance characteristics across implementation strategies
|
|
32
38
|
- Studying optimization techniques and their effects
|
|
33
39
|
- Verifying the correctness of the core algorithm against known solutions
|
|
40
|
+
- Reproducing published computational results that extend mathematical knowledge
|
|
34
41
|
|
|
35
42
|
Note: These implementations are for reference only and not used in the production
|
|
36
43
|
code path of the package. The active implementation resides in theDao.py with
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import numpy
|
|
2
|
+
import numba
|
|
3
|
+
|
|
4
|
+
@numba.jit(numba.types.int64(), cache=True, parallel=False, boundscheck=False, error_model='numpy', fastmath=True, nopython=True, forceinline=True, looplift=True, no_cfunc_wrapper=False, no_cpython_wrapper=False, _nrt=True, )
|
|
5
|
+
def goGoGadgetAbsurdity():
|
|
6
|
+
|
|
7
|
+
foldsTotal = numba.types.int64(0)
|
|
8
|
+
my = numpy.array([3,1,1,2,1,2,3,2,0], dtype=numpy.int64)
|
|
9
|
+
foldsSubTotals = numpy.array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], dtype=numpy.int64)
|
|
10
|
+
gapsWhere = numpy.array([1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
|
11
|
+
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
|
12
|
+
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
|
13
|
+
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0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0, 0, 0, 0],
|
|
90
|
+
[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
91
|
+
[ 0, 2, 1, 4, 3, 6, 5, 8, 7,10, 9,12,11,14,13,16,15,18,17,20,19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
92
|
+
[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
93
|
+
[ 0, 2, 1, 4, 3, 6, 5, 8, 7,10, 9,12,11,14,13,16,15,18,17,20,19,22,21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
94
|
+
[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
95
|
+
[ 0, 2, 1, 4, 3, 6, 5, 8, 7,10, 9,12,11,14,13,16,15,18,17,20,19,22,21,24,23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
96
|
+
[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
97
|
+
[ 0, 2, 1, 4, 3, 6, 5, 8, 7,10, 9,12,11,14,13,16,15,18,17,20,19,22,21,24,23,26,25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
98
|
+
[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
99
|
+
[ 0, 2, 1, 4, 3, 6, 5, 8, 7,10, 9,12,11,14,13,16,15,18,17,20,19,22,21,24,23,26,25,28,27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
100
|
+
[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
101
|
+
[ 0, 2, 1, 4, 3, 6, 5, 8, 7,10, 9,12,11,14,13,16,15,18,17,20,19,22,21,24,23,26,25,28,27,30,29, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
102
|
+
[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, 0, 0, 0, 0, 0, 0, 0],
|
|
103
|
+
[ 0, 2, 1, 4, 3, 6, 5, 8, 7,10, 9,12,11,14,13,16,15,18,17,20,19,22,21,24,23,26,25,28,27,30,29,32,31, 0, 0, 0, 0, 0, 0],
|
|
104
|
+
[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33, 0, 0, 0, 0, 0],
|
|
105
|
+
[ 0, 2, 1, 4, 3, 6, 5, 8, 7,10, 9,12,11,14,13,16,15,18,17,20,19,22,21,24,23,26,25,28,27,30,29,32,31,34,33, 0, 0, 0, 0],
|
|
106
|
+
[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35, 0, 0, 0],
|
|
107
|
+
[ 0, 2, 1, 4, 3, 6, 5, 8, 7,10, 9,12,11,14,13,16,15,18,17,20,19,22,21,24,23,26,25,28,27,30,29,32,31,34,33,36,35, 0, 0],
|
|
108
|
+
[ 0, 1, 2, 3, 4, 5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 0, 0, 0, 0],
|
|
134
|
+
[ 0, 3, 4, 1, 2, 7, 8, 5, 6,11,12, 9,10,15,16,13,14,19,20,17,18,23,22,21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
135
|
+
[ 0, 3, 4, 1, 2, 7, 8, 5, 6,11,12, 9,10,15,16,13,14,19,20,17,18,23,24,21,22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
136
|
+
[ 0, 1, 2, 5, 6, 3, 4, 9,10, 7, 8,13,14,11,12,17,18,15,16,21,22,19,20,25,24,23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
137
|
+
[ 0, 1, 2, 5, 6, 3, 4, 9,10, 7, 8,13,14,11,12,17,18,15,16,21,22,19,20,25,26,23,24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
138
|
+
[ 0, 3, 4, 1, 2, 7, 8, 5, 6,11,12, 9,10,15,16,13,14,19,20,17,18,23,24,21,22,27,26,25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
139
|
+
[ 0, 3, 4, 1, 2, 7, 8, 5, 6,11,12, 9,10,15,16,13,14,19,20,17,18,23,24,21,22,27,28,25,26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
140
|
+
[ 0, 1, 2, 5, 6, 3, 4, 9,10, 7, 8,13,14,11,12,17,18,15,16,21,22,19,20,25,26,23,24,29,28,27, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
141
|
+
[ 0, 1, 2, 5, 6, 3, 4, 9,10, 7, 8,13,14,11,12,17,18,15,16,21,22,19,20,25,26,23,24,29,30,27,28, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
142
|
+
[ 0, 3, 4, 1, 2, 7, 8, 5, 6,11,12, 9,10,15,16,13,14,19,20,17,18,23,24,21,22,27,28,25,26,31,30,29, 0, 0, 0, 0, 0, 0, 0],
|
|
143
|
+
[ 0, 3, 4, 1, 2, 7, 8, 5, 6,11,12, 9,10,15,16,13,14,19,20,17,18,23,24,21,22,27,28,25,26,31,32,29,30, 0, 0, 0, 0, 0, 0],
|
|
144
|
+
[ 0, 1, 2, 5, 6, 3, 4, 9,10, 7, 8,13,14,11,12,17,18,15,16,21,22,19,20,25,26,23,24,29,30,27,28,33,32,31, 0, 0, 0, 0, 0],
|
|
145
|
+
[ 0, 1, 2, 5, 6, 3, 4, 9,10, 7, 8,13,14,11,12,17,18,15,16,21,22,19,20,25,26,23,24,29,30,27,28,33,34,31,32, 0, 0, 0, 0],
|
|
146
|
+
[ 0, 3, 4, 1, 2, 7, 8, 5, 6,11,12, 9,10,15,16,13,14,19,20,17,18,23,24,21,22,27,28,25,26,31,32,29,30,35,34,33, 0, 0, 0],
|
|
147
|
+
[ 0, 3, 4, 1, 2, 7, 8, 5, 6,11,12, 9,10,15,16,13,14,19,20,17,18,23,24,21,22,27,28,25,26,31,32,29,30,35,36,33,34, 0, 0],
|
|
148
|
+
[ 0, 1, 2, 5, 6, 3, 4, 9,10, 7, 8,13,14,11,12,17,18,15,16,21,22,19,20,25,26,23,24,29,30,27,28,33,34,31,32,37,36,35, 0],
|
|
149
|
+
[ 0, 1, 2, 5, 6, 3, 4, 9,10, 7, 8,13,14,11,12,17,18,15,16,21,22,19,20,25,26,23,24,29,30,27,28,33,34,31,32,37,38,35,36]]], dtype=numpy.int64)
|
|
150
|
+
while my[6] > 0:
|
|
151
|
+
if my[6] <= 1 or track[1, 0] == 1:
|
|
152
|
+
if my[6] > the[1]:
|
|
153
|
+
foldsSubTotals[my[8]] += the[1]
|
|
154
|
+
else:
|
|
155
|
+
my[1] = 0
|
|
156
|
+
my[3] = track[3, my[6] - 1]
|
|
157
|
+
my[0] = 1
|
|
158
|
+
while my[0] <= the[0]:
|
|
159
|
+
if connectionGraph[my[0], my[6], my[6]] == my[6]:
|
|
160
|
+
my[1] += 1
|
|
161
|
+
else:
|
|
162
|
+
my[7] = connectionGraph[my[0], my[6], my[6]]
|
|
163
|
+
while my[7] != my[6]:
|
|
164
|
+
gapsWhere[my[3]] = my[7]
|
|
165
|
+
if track[2, my[7]] == 0:
|
|
166
|
+
my[3] += 1
|
|
167
|
+
track[2, my[7]] += 1
|
|
168
|
+
my[7] = connectionGraph[my[0], my[6], track[1, my[7]]]
|
|
169
|
+
my[0] += 1
|
|
170
|
+
my[5] = my[2]
|
|
171
|
+
while my[5] < my[3]:
|
|
172
|
+
gapsWhere[my[2]] = gapsWhere[my[5]]
|
|
173
|
+
if track[2, gapsWhere[my[5]]] == the[0] - my[1]:
|
|
174
|
+
my[2] += 1
|
|
175
|
+
track[2, gapsWhere[my[5]]] = 0
|
|
176
|
+
my[5] += 1
|
|
177
|
+
while my[6] > 0 and my[2] == track[3, my[6] - 1]:
|
|
178
|
+
my[6] -= 1
|
|
179
|
+
track[1, track[0, my[6]]] = track[1, my[6]]
|
|
180
|
+
track[0, track[1, my[6]]] = track[0, my[6]]
|
|
181
|
+
if my[6] > 0:
|
|
182
|
+
my[2] -= 1
|
|
183
|
+
track[0, my[6]] = gapsWhere[my[2]]
|
|
184
|
+
track[1, my[6]] = track[1, track[0, my[6]]]
|
|
185
|
+
track[1, track[0, my[6]]] = my[6]
|
|
186
|
+
track[0, track[1, my[6]]] = my[6]
|
|
187
|
+
track[3, my[6]] = my[2]
|
|
188
|
+
my[6] += 1
|
|
189
|
+
|
|
190
|
+
foldsTotal = foldsSubTotals.sum().item()
|
|
191
|
+
print(foldsTotal)
|
|
192
|
+
with numba.objmode():
|
|
193
|
+
open('c:/apps/mapFolding/mapFolding/jobs/[2x19]/[2x19].foldsTotal', 'w').write(str(foldsTotal))
|
|
194
|
+
return foldsTotal
|
|
195
|
+
|
|
196
|
+
if __name__ == '__main__':
|
|
197
|
+
goGoGadgetAbsurdity()
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"""
|
|
2
|
+
New Contribution to OEIS A001415: First-ever calculations for 2x19 and 2x20 maps
|
|
3
|
+
|
|
4
|
+
My first computation of the 2x19 map completed on 01/10/2025.
|
|
5
|
+
My first computation of the 2x20 map completed on 01/14/2025.
|
|
6
|
+
|
|
7
|
+
These represent the first-ever calculations of fold patterns for these dimensions
|
|
8
|
+
and extend the known values in the Online Encyclopedia of Integer Sequences (OEIS)
|
|
9
|
+
for series A001415 "Number of ways of folding a 2 X n strip of stamps".
|
|
10
|
+
|
|
11
|
+
Directory Structure:
|
|
12
|
+
--------------------------------------------------------------------------
|
|
13
|
+
(.venv) > dir mapFolding/reference/jobsCompleted
|
|
14
|
+
|
|
15
|
+
01/10/2025 02:27 AM 14 [2,19].foldsTotal # First 2x19 calculation
|
|
16
|
+
01/14/2025 02:04 PM 15 [2,20].foldsTotal # First 2x20 calculation
|
|
17
|
+
--------------------------------------------------------------------------
|
|
18
|
+
|
|
19
|
+
In the subfolder [2x19]:
|
|
20
|
+
--------------------------------------------------------------------------
|
|
21
|
+
(.venv) > dir mapFolding/reference/jobsCompleted/[2x19]
|
|
22
|
+
|
|
23
|
+
02/12/2025 03:48 PM 19,822 p2x19.py # Optimized algorithm implementation
|
|
24
|
+
01/21/2025 03:36 AM 50,219 stateJob.pkl # Serialized computation state
|
|
25
|
+
01/22/2025 07:15 AM 14 [2x19].foldsTotal # Result of calculation
|
|
26
|
+
01/21/2025 03:37 AM 9,678,080 [2x19].ll # LLVM IR code generated from the optimized algorithm
|
|
27
|
+
--------------------------------------------------------------------------
|
|
28
|
+
|
|
29
|
+
A version of the algorithm tuned to compute a 2x19 map took approximately 28 hours of computation.
|
|
30
|
+
The LLVM IR file ([2x19].ll) was generated using the getLLVMforNoReason module and provides
|
|
31
|
+
insight into the low-level optimizations that made this computation possible.
|
|
32
|
+
|
|
33
|
+
Alternative Implementation:
|
|
34
|
+
--------------------------------------------------------------------------
|
|
35
|
+
(.venv) > dir mapFolding/reference/jobsCompleted/p2x19
|
|
36
|
+
|
|
37
|
+
02/16/2025 07:01 PM 14 p2x19.foldsTotal # Alternative implementation result
|
|
38
|
+
02/16/2025 12:40 AM 6,423 p2x19.py # Alternative optimized algorithm
|
|
39
|
+
--------------------------------------------------------------------------
|
|
40
|
+
|
|
41
|
+
This alternative implementation took approximately 18 hours of computation and demonstrates
|
|
42
|
+
how code transformation and algorithm optimization can significantly reduce computation time.
|
|
43
|
+
|
|
44
|
+
To use these values in your own research, you can access them through the OEIS_for_n function:
|
|
45
|
+
```
|
|
46
|
+
from mapFolding import oeisIDfor_n
|
|
47
|
+
result = oeisIDfor_n('A001415', 19) # For the 2x19 calculation
|
|
48
|
+
result = oeisIDfor_n('A001415', 20) # For the 2x20 calculation
|
|
49
|
+
```
|
|
50
|
+
"""
|