algorithm-discovery-engine 1.0.0__tar.gz
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.
- algorithm_discovery_engine-1.0.0/.gitignore +221 -0
- algorithm_discovery_engine-1.0.0/LICENSE +21 -0
- algorithm_discovery_engine-1.0.0/PKG-INFO +287 -0
- algorithm_discovery_engine-1.0.0/README.md +264 -0
- algorithm_discovery_engine-1.0.0/languages/cpp/tests/generated_test_data.hpp +117 -0
- algorithm_discovery_engine-1.0.0/languages/cpp/tests/test_runner.cpp +325 -0
- algorithm_discovery_engine-1.0.0/languages/java/src/ads/Benchmark.java +80 -0
- algorithm_discovery_engine-1.0.0/languages/java/src/ads/Solutions.java +266 -0
- algorithm_discovery_engine-1.0.0/languages/java/src/ads/Structures.java +433 -0
- algorithm_discovery_engine-1.0.0/languages/java/src/ads/TestRunner.java +417 -0
- algorithm_discovery_engine-1.0.0/languages/java/src/ads/gen/TestData.java +115 -0
- algorithm_discovery_engine-1.0.0/languages/rust/src/gen/mod.rs +112 -0
- algorithm_discovery_engine-1.0.0/languages/rust/src/lib.rs +7 -0
- algorithm_discovery_engine-1.0.0/languages/rust/src/solutions.rs +236 -0
- algorithm_discovery_engine-1.0.0/languages/rust/src/structures.rs +390 -0
- algorithm_discovery_engine-1.0.0/languages/rust/tests/catalog.rs +259 -0
- algorithm_discovery_engine-1.0.0/pyproject.toml +90 -0
- algorithm_discovery_engine-1.0.0/src/ads/__init__.py +85 -0
- algorithm_discovery_engine-1.0.0/src/ads/benchmark.py +84 -0
- algorithm_discovery_engine-1.0.0/src/ads/problems.py +190 -0
- algorithm_discovery_engine-1.0.0/src/ads/problems_advanced.py +203 -0
- algorithm_discovery_engine-1.0.0/src/ads/structures.py +370 -0
- algorithm_discovery_engine-1.0.0/src/ads/structures_advanced.py +385 -0
- algorithm_discovery_engine-1.0.0/src/algo_discovery/__init__.py +19 -0
- algorithm_discovery_engine-1.0.0/src/algo_discovery/__main__.py +38 -0
- algorithm_discovery_engine-1.0.0/src/algo_discovery/engine.py +64 -0
- algorithm_discovery_engine-1.0.0/src/algo_discovery/features.py +115 -0
- algorithm_discovery_engine-1.0.0/src/algo_discovery/hypotheses.py +251 -0
- algorithm_discovery_engine-1.0.0/src/algo_discovery/models.py +63 -0
- algorithm_discovery_engine-1.0.0/src/gui/__init__.py +3 -0
- algorithm_discovery_engine-1.0.0/src/gui/__main__.py +26 -0
- algorithm_discovery_engine-1.0.0/src/gui/app.py +407 -0
- algorithm_discovery_engine-1.0.0/src/gui/core.py +149 -0
- algorithm_discovery_engine-1.0.0/src/synth/__init__.py +22 -0
- algorithm_discovery_engine-1.0.0/src/synth/__main__.py +66 -0
- algorithm_discovery_engine-1.0.0/src/synth/corpus.py +222 -0
- algorithm_discovery_engine-1.0.0/src/synth/discovery.py +198 -0
- algorithm_discovery_engine-1.0.0/src/synth/grammar.py +174 -0
- algorithm_discovery_engine-1.0.0/src/synth/search.py +432 -0
- algorithm_discovery_engine-1.0.0/tests/test_catalog.py +267 -0
- algorithm_discovery_engine-1.0.0/tests/test_engine.py +76 -0
- algorithm_discovery_engine-1.0.0/tests/test_features.py +127 -0
- algorithm_discovery_engine-1.0.0/tests/test_gui.py +74 -0
- algorithm_discovery_engine-1.0.0/tests/test_hypotheses.py +157 -0
- algorithm_discovery_engine-1.0.0/tests/test_models.py +56 -0
- algorithm_discovery_engine-1.0.0/tests/test_synth.py +280 -0
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py.cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
# Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# UV
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
# uv.lock
|
|
102
|
+
|
|
103
|
+
# poetry
|
|
104
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
105
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
106
|
+
# commonly ignored for libraries.
|
|
107
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
108
|
+
# poetry.lock
|
|
109
|
+
# poetry.toml
|
|
110
|
+
|
|
111
|
+
# pdm
|
|
112
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
113
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
114
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
115
|
+
# pdm.lock
|
|
116
|
+
# pdm.toml
|
|
117
|
+
.pdm-python
|
|
118
|
+
.pdm-build/
|
|
119
|
+
|
|
120
|
+
# pixi
|
|
121
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
122
|
+
# pixi.lock
|
|
123
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
124
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
125
|
+
.pixi
|
|
126
|
+
|
|
127
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
128
|
+
__pypackages__/
|
|
129
|
+
|
|
130
|
+
# Celery stuff
|
|
131
|
+
celerybeat-schedule
|
|
132
|
+
celerybeat.pid
|
|
133
|
+
|
|
134
|
+
# Redis
|
|
135
|
+
*.rdb
|
|
136
|
+
*.aof
|
|
137
|
+
*.pid
|
|
138
|
+
|
|
139
|
+
# RabbitMQ
|
|
140
|
+
mnesia/
|
|
141
|
+
rabbitmq/
|
|
142
|
+
rabbitmq-data/
|
|
143
|
+
|
|
144
|
+
# ActiveMQ
|
|
145
|
+
activemq-data/
|
|
146
|
+
|
|
147
|
+
# SageMath parsed files
|
|
148
|
+
*.sage.py
|
|
149
|
+
|
|
150
|
+
# Environments
|
|
151
|
+
.env
|
|
152
|
+
.envrc
|
|
153
|
+
.venv
|
|
154
|
+
env/
|
|
155
|
+
venv/
|
|
156
|
+
ENV/
|
|
157
|
+
env.bak/
|
|
158
|
+
venv.bak/
|
|
159
|
+
|
|
160
|
+
# Spyder project settings
|
|
161
|
+
.spyderproject
|
|
162
|
+
.spyproject
|
|
163
|
+
|
|
164
|
+
# Rope project settings
|
|
165
|
+
.ropeproject
|
|
166
|
+
|
|
167
|
+
# mkdocs documentation
|
|
168
|
+
/site
|
|
169
|
+
|
|
170
|
+
# mypy
|
|
171
|
+
.mypy_cache/
|
|
172
|
+
.dmypy.json
|
|
173
|
+
dmypy.json
|
|
174
|
+
|
|
175
|
+
# Pyre type checker
|
|
176
|
+
.pyre/
|
|
177
|
+
|
|
178
|
+
# pytype static type analyzer
|
|
179
|
+
.pytype/
|
|
180
|
+
|
|
181
|
+
# Cython debug symbols
|
|
182
|
+
cython_debug/
|
|
183
|
+
|
|
184
|
+
# PyCharm
|
|
185
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
186
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
187
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
188
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
189
|
+
# .idea/
|
|
190
|
+
|
|
191
|
+
# Abstra
|
|
192
|
+
# Abstra is an AI-powered process automation framework.
|
|
193
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
194
|
+
# Learn more at https://abstra.io/docs
|
|
195
|
+
.abstra/
|
|
196
|
+
|
|
197
|
+
# Visual Studio Code
|
|
198
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
199
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
200
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
201
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
202
|
+
# .vscode/
|
|
203
|
+
# Temporary file for partial code execution
|
|
204
|
+
tempCodeRunnerFile.py
|
|
205
|
+
|
|
206
|
+
# Ruff stuff:
|
|
207
|
+
.ruff_cache/
|
|
208
|
+
|
|
209
|
+
# PyPI configuration file
|
|
210
|
+
.pypirc
|
|
211
|
+
|
|
212
|
+
# Marimo
|
|
213
|
+
marimo/_static/
|
|
214
|
+
marimo/_lsp/
|
|
215
|
+
__marimo__/
|
|
216
|
+
|
|
217
|
+
# Streamlit
|
|
218
|
+
.streamlit/secrets.toml
|
|
219
|
+
|
|
220
|
+
# Multi-language solving engine build artifacts
|
|
221
|
+
languages/java/out/
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Darshan Kachare
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: algorithm-discovery-engine
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Multi-language algorithms & data structures solving engine (Java, C++, Rust, Python) with cross-language benchmarks and a local AI synthesizer that rediscovers algorithms from examples.
|
|
5
|
+
Author: dsk-dev-ai
|
|
6
|
+
License: MIT
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Keywords: ai,algorithm-discovery,algorithms,automated-discovery,benchmark,cpp,data-structures,developer-tools,education,java,learning,machine-learning,open-source,python,rust,scientific-computing,sequence-analysis,synthesizer
|
|
9
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Intended Audience :: Education
|
|
12
|
+
Classifier: Intended Audience :: Science/Research
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: C++
|
|
15
|
+
Classifier: Programming Language :: Java
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Rust
|
|
18
|
+
Classifier: Topic :: Education
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
21
|
+
Requires-Python: >=3.10
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
|
|
24
|
+
<div align="center">
|
|
25
|
+
|
|
26
|
+
# algorithm-discovery-engine
|
|
27
|
+
|
|
28
|
+
**One catalog, four languages, zero dependencies — and a synthesizer that rediscovers the algorithms for you.**
|
|
29
|
+
|
|
30
|
+
[](https://github.com/dsk-dev-ai/algorithm-discovery-engine/actions/workflows/ci.yml)
|
|
31
|
+
[](https://github.com/dsk-dev-ai/algorithm-discovery-engine/stargazers)
|
|
32
|
+
[](https://github.com/dsk-dev-ai/algorithm-discovery-engine/forks)
|
|
33
|
+
[](https://opensource.org/licenses/MIT)
|
|
34
|
+
[]()
|
|
35
|
+
[](https://dsk-dev-ai.github.io/algorithm-discovery-engine/)
|
|
36
|
+
[](https://github.com/dsk-dev-ai/algorithm-discovery-engine/pkgs/container/algorithm-discovery-engine)
|
|
37
|
+
[](#desktop-gui)
|
|
38
|
+
[](https://github.com/sponsors/dsk-dev-ai)
|
|
39
|
+
|
|
40
|
+
**Python** · **Java** · **C++** · **Rust**
|
|
41
|
+
|
|
42
|
+
<img src=".github/social-preview.png" alt="algorithm-discovery-engine social preview" width="100%" />
|
|
43
|
+
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
**The same algorithms and data structures, solved, tested, and benchmarked in Java, C++,
|
|
49
|
+
Rust, and Python**, with one `catalog/problems.json` as the single source of truth and
|
|
50
|
+
byte-identical generated test vectors across every language. On top sits a local
|
|
51
|
+
**algorithm synthesizer** that discovers verified algorithms (Kadane, buy-and-sell, jump
|
|
52
|
+
game) from input/output examples alone — no APIs, no model calls.
|
|
53
|
+
|
|
54
|
+
## Features
|
|
55
|
+
|
|
56
|
+
- **Multi-language solving engine** — 10 algorithms + 6 data structures implemented in
|
|
57
|
+
Java, C++17, Rust, and Python (regular + optimized advanced tiers).
|
|
58
|
+
- **Cross-language benchmarks** — a single harness times all four tiers; compare
|
|
59
|
+
strategies (Java's hash-map two-sum vs. the quadratic scans in C++/Rust).
|
|
60
|
+
- **Local algorithm synthesizer** — grammar-based search + strategy templates that
|
|
61
|
+
rediscover known algorithms and surface novel ones, fuzz-verified out-of-sample.
|
|
62
|
+
- **Automated mathematical pattern discovery** — the original engine: feed in a
|
|
63
|
+
sequence, get ranked hypotheses (arithmetic, geometric, quadratic, Fibonacci-like) and
|
|
64
|
+
next-term predictions.
|
|
65
|
+
- **Zero dependencies per language** — no framework, no package, no JIT magic; pure
|
|
66
|
+
standard library in all four tiers.
|
|
67
|
+
- **Desktop GUI** — a Tkinter app (`python -m gui`) built on the standard library only;
|
|
68
|
+
core logic is headless-tested in CI.
|
|
69
|
+
- **Generated-then-committed test vectors** — identical tests enforced by CI in every
|
|
70
|
+
language; a single `--check` keeps them in sync with the catalog.
|
|
71
|
+
- **CI-green by default** — grid of Python 3.10–3.13, Java 21, GCC C++17, stable Rust,
|
|
72
|
+
discovery-smoke, GUI-core smoke, and a strict docs build.
|
|
73
|
+
|
|
74
|
+
## Quick start
|
|
75
|
+
|
|
76
|
+
```sh
|
|
77
|
+
git clone https://github.com/dsk-dev-ai/algorithm-discovery-engine.git
|
|
78
|
+
cd algorithm-discovery-engine
|
|
79
|
+
|
|
80
|
+
python engine/runner.py test # build + run the catalog suite in all 4 languages
|
|
81
|
+
python engine/runner.py bench # benchmark all tiers, side by side
|
|
82
|
+
python engine/runner.py discover # synthesize + verify algorithms from examples
|
|
83
|
+
python -m gui # open the desktop app
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
No install required — Python ≥ 3.10 and (for the non-Python tiers) a JDK, a C++17
|
|
87
|
+
compiler, and the Rust toolchain.
|
|
88
|
+
|
|
89
|
+
## The multi-language engine
|
|
90
|
+
|
|
91
|
+
### Catalog
|
|
92
|
+
|
|
93
|
+
`catalog/problems.json` is the source of truth. Every algorithm and structure carries a
|
|
94
|
+
shared test vector set asserted in **all four languages**.
|
|
95
|
+
|
|
96
|
+
| Algorithms (10) | Data structures (6) |
|
|
97
|
+
| -------------------------------------------------------- | ------------------------------------------------ |
|
|
98
|
+
| `two_sum`, `binary_search`, `merge_sort`, `quick_sort` | `stack`, `queue`, `linked_list`, `bst` |
|
|
99
|
+
| `max_subarray`, `lcs`, `knapsack_01`, `edit_distance` | `trie`, `min_heap` |
|
|
100
|
+
| `graph_bfs`, `graph_dfs` | |
|
|
101
|
+
|
|
102
|
+
### Language tiers
|
|
103
|
+
|
|
104
|
+
```mermaid
|
|
105
|
+
flowchart LR
|
|
106
|
+
C[ catalog/problems.json ] --> G[ engine/gen_tests.py ]
|
|
107
|
+
G --> J[Java tests] & P[Python tests] & R[Rust tests] & X[C++ tests]
|
|
108
|
+
J -. reference impl .-> P
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
| Tier | Location | Approach |
|
|
112
|
+
| ------ | ------------------------ | ---------------------------------------------------- |
|
|
113
|
+
| Java | `languages/java/` | OO reference implementations |
|
|
114
|
+
| C++ | `languages/cpp/` | modern C++17, RAII, iterators |
|
|
115
|
+
| Rust | `languages/rust/` | ownership-safe, zero dependencies |
|
|
116
|
+
| Python | `src/ads/` | regular + advanced (`*_advanced`, mypy strict) |
|
|
117
|
+
|
|
118
|
+
### Sample benchmark (microseconds, lower is better)
|
|
119
|
+
|
|
120
|
+
```
|
|
121
|
+
algorithm Python Java C++ Rust
|
|
122
|
+
merge_sort 928,850 85,358 66,972 39,647
|
|
123
|
+
quick_sort 702,918 41,562 22,942 17,610
|
|
124
|
+
max_subarray 444,168 17,881 9,702 78
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
> Languages may pick different strategies for the same problem (Java's `two_sum` uses a
|
|
128
|
+
> hash map; C++/Rust use a quadratic scan) — the table is a trade-off showcase, not an
|
|
129
|
+
> exact contest.
|
|
130
|
+
|
|
131
|
+
## The synthesizer (the interesting part)
|
|
132
|
+
|
|
133
|
+
`src/synth/` searches for candidate algorithms from input/output examples and verifies
|
|
134
|
+
them out-of-sample before reporting anything.
|
|
135
|
+
|
|
136
|
+
- **Grammar search** (`scan`): enumerates single-pass "scanner" programs until one
|
|
137
|
+
matches the curated examples *and* 60 fuzzed inputs against an independent oracle.
|
|
138
|
+
Kadane, buy-and-sell, and jump-game fall out of examples alone.
|
|
139
|
+
- **Strategy templates** (`vote`, `seen`, `fib`, `circular-kadane`): Boyer-Moore
|
|
140
|
+
voting, hash-set membership, Fibonacci pumping, circular Kadane — all still
|
|
141
|
+
fuzz-verified.
|
|
142
|
+
- **Novelty classification**: `rediscovered` (already in the catalog) vs.
|
|
143
|
+
`new-to-catalog` (a candidate worth porting to the four tiers).
|
|
144
|
+
|
|
145
|
+
Current smoke run: **7 targets · 7 verified · 0 rejected**.
|
|
146
|
+
|
|
147
|
+
```sh
|
|
148
|
+
uv run python -m synth discover --smoke # ~2 min, CI-friendly
|
|
149
|
+
uv run python -m synth discover # full pass
|
|
150
|
+
uv run python -m synth discover --print # include full report JSON
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Output lands in `catalog/discoveries/`: `report.json`, `report.md`, and runnable
|
|
154
|
+
`solutions/*.py`.
|
|
155
|
+
|
|
156
|
+
A discovered jump-game scanner (verified on examples + fuzz):
|
|
157
|
+
|
|
158
|
+
```python
|
|
159
|
+
def discovered_jump_game(arg):
|
|
160
|
+
s0 = 0
|
|
161
|
+
s1 = 0
|
|
162
|
+
for i, x in enumerate(arg):
|
|
163
|
+
s1 = max(s1, i - s0) # how far the current reach overshoots index i
|
|
164
|
+
s0 = max(s0, i + x) # extend the reach
|
|
165
|
+
return s1 == 0
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Pattern discovery (original framework)
|
|
169
|
+
|
|
170
|
+
```python
|
|
171
|
+
from algo_discovery import DiscoveryEngine
|
|
172
|
+
|
|
173
|
+
result = DiscoveryEngine().discover((1, 4, 9, 16, 25))
|
|
174
|
+
print(result.best.name) # "quadratic"
|
|
175
|
+
print(result.best.prediction) # 36
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
10 built-in hypotheses (arithmetic, geometric, quadratic, cubic, powers-of-two,
|
|
179
|
+
Fibonacci-like, affine recurrences, prime, alternating-sign, constant) with confidence,
|
|
180
|
+
explanation, and next-term prediction.
|
|
181
|
+
|
|
182
|
+
```sh
|
|
183
|
+
uv run python -m algo_discovery 1 4 9 16
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## Desktop GUI
|
|
187
|
+
|
|
188
|
+
A small **Tkinter** desktop app (no third-party runtime dependencies) wraps the
|
|
189
|
+
three engines behind a clean dark-themed interface:
|
|
190
|
+
|
|
191
|
+
```sh
|
|
192
|
+
python -m gui # launch from the repo root
|
|
193
|
+
python engine/runner.py gui # same thing via the dispatcher
|
|
194
|
+
ade-gui # if installed with pip/uv
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
| Tab | What it does |
|
|
198
|
+
| ----------------- | ---------------------------------------------------------------------- |
|
|
199
|
+
| **Discover** | Run the synthesizer (smoke/full), view the per-target verified table, open the report. |
|
|
200
|
+
| **Pattern discovery** | Enter an integer sequence, discover ranked hypotheses with next-term predictions. |
|
|
201
|
+
| **Engine** | Check vectors, run pytest, build all tiers, benchmark, open docs/GitHub links. |
|
|
202
|
+
|
|
203
|
+
Core logic lives in `gui/core.py` and is tested headlessly in CI (`-p gui` mypy
|
|
204
|
+
+ `pytest -q tests/test_gui.py`).
|
|
205
|
+
|
|
206
|
+
## Container image
|
|
207
|
+
|
|
208
|
+
Prebuilt on **GitHub Packages** (amd64 + arm64) — no install needed:
|
|
209
|
+
|
|
210
|
+
```sh
|
|
211
|
+
docker pull ghcr.io/dsk-dev-ai/algorithm-discovery-engine:v1.0.0
|
|
212
|
+
docker run --rm ghcr.io/dsk-dev-ai/algorithm-discovery-engine:v1.0.0 --smoke
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
Tags: `latest`, per-version (`v1.0.0`), and per-commit (`sha-<hash>`). The image runs
|
|
216
|
+
the local algorithm synthesizer by default; override with any `python -m` command.
|
|
217
|
+
|
|
218
|
+
## Documentation
|
|
219
|
+
|
|
220
|
+
Full docs: **https://dsk-dev-ai.github.io/algorithm-discovery-engine/**
|
|
221
|
+
|
|
222
|
+
Build locally:
|
|
223
|
+
|
|
224
|
+
```sh
|
|
225
|
+
uv sync --group docs
|
|
226
|
+
uv run mkdocs serve # live preview at http://127.0.0.1:8000
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
## Development
|
|
230
|
+
|
|
231
|
+
```sh
|
|
232
|
+
uv sync --group dev --group docs
|
|
233
|
+
uv run pytest -q # 118+ tests (catalog + synthesizer + GUI core)
|
|
234
|
+
uv run ruff check src tests
|
|
235
|
+
uv run mypy -p algo_discovery -p ads -p synth -p gui
|
|
236
|
+
uv run python -m gui --selftest # headless GUI smoke
|
|
237
|
+
uv run mkdocs build --strict # documentation builds cleanly
|
|
238
|
+
python engine/runner.py check # keep generated vectors in sync before committing
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for the full checklist and how to add a new
|
|
242
|
+
catalog problem or a new discovery target.
|
|
243
|
+
|
|
244
|
+
## Structure
|
|
245
|
+
|
|
246
|
+
```
|
|
247
|
+
catalog/problems.json single source of truth (tests + examples)
|
|
248
|
+
catalog/discovery_targets.json discovery targets (curated examples + oracles)
|
|
249
|
+
catalog/discoveries/ synthesizer reports + discovered solutions
|
|
250
|
+
engine/gen_tests.py generates identical test vectors per language
|
|
251
|
+
engine/runner.py build / test / benchmark / synthesize dispatcher
|
|
252
|
+
src/ads/ Python solving engine (regular + advanced)
|
|
253
|
+
src/algo_discovery/ pattern-discovery framework (original)
|
|
254
|
+
src/synth/ local algorithm synthesizer
|
|
255
|
+
src/gui/ Tkinter desktop app (stdlib only)
|
|
256
|
+
docs/ documentation site (MkDocs Material)
|
|
257
|
+
languages/java/src/ads/ Java tier (+ TestRunner, Benchmark)
|
|
258
|
+
languages/cpp/include/ads/ C++17 headers (+ tests, bench)
|
|
259
|
+
languages/rust/src/ Rust tier (+ examples/benchmark.rs)
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
## Roadmap
|
|
263
|
+
|
|
264
|
+
- Port `new-to-catalog` discoveries (buy-and-sell, jump game, circular Kadane) into the
|
|
265
|
+
four language tiers as first-class catalog problems.
|
|
266
|
+
- Grow the discovery target corpus (graphs, DP, geometry) and tighten the synthesis
|
|
267
|
+
budget so full passes match CI time.
|
|
268
|
+
- Add GitHub Actions generating the social-preview benchmark delta on every push.
|
|
269
|
+
|
|
270
|
+
## Sponsor
|
|
271
|
+
|
|
272
|
+
algorithm-discovery-engine is built and maintained by
|
|
273
|
+
[Darshan Kachare](https://github.com/dsk-dev-ai) through
|
|
274
|
+
[NextGenAI Labs](https://github.com/sponsors/dsk-dev-ai).
|
|
275
|
+
|
|
276
|
+
Sponsorship supports development infrastructure, documentation, and long-term
|
|
277
|
+
maintenance of this open-source platform.
|
|
278
|
+
|
|
279
|
+
<a href="https://github.com/sponsors/dsk-dev-ai">
|
|
280
|
+
<img src="https://img.shields.io/badge/%E2%9D%A4%EF%B8%8F-Sponsor_on_GitHub-red?style=for-the-badge&logo=githubsponsors&logoColor=white" alt="Sponsor algorithm-discovery-engine"/>
|
|
281
|
+
</a>
|
|
282
|
+
|
|
283
|
+
---
|
|
284
|
+
|
|
285
|
+
## License
|
|
286
|
+
|
|
287
|
+
MIT — see [LICENSE](LICENSE).
|