chisao 0.1.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.
- chisao-0.1.0/.gitattributes +2 -0
- chisao-0.1.0/.github/workflows/ci.yml +35 -0
- chisao-0.1.0/.gitignore +27 -0
- chisao-0.1.0/CHANGELOG.md +24 -0
- chisao-0.1.0/LICENSE +21 -0
- chisao-0.1.0/PKG-INFO +39 -0
- chisao-0.1.0/README.md +2 -0
- chisao-0.1.0/benchmarks/README.md +72 -0
- chisao-0.1.0/benchmarks/sfu_benchmark.py +1045 -0
- chisao-0.1.0/examples/quickstart.py +35 -0
- chisao-0.1.0/pyproject.toml +65 -0
- chisao-0.1.0/src/chisao/__init__.py +110 -0
- chisao-0.1.0/src/chisao/_gpu.py +47 -0
- chisao-0.1.0/src/chisao/core.py +3921 -0
- chisao-0.1.0/src/chisao/seeding.py +360 -0
- chisao-0.1.0/src/chisao/single_whip.py +1372 -0
- chisao-0.1.0/tests/test_api.py +29 -0
- chisao-0.1.0/tests/test_recovery.py +68 -0
- chisao-0.1.0/tests/test_seeding.py +48 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
fail-fast: false
|
|
14
|
+
matrix:
|
|
15
|
+
python-version: ["3.9", "3.10", "3.11", "3.12"]
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
20
|
+
uses: actions/setup-python@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: ${{ matrix.python-version }}
|
|
23
|
+
|
|
24
|
+
- name: Install (CPU / NumPy backend)
|
|
25
|
+
run: |
|
|
26
|
+
python -m pip install --upgrade pip
|
|
27
|
+
pip install -e ".[dev]"
|
|
28
|
+
|
|
29
|
+
- name: Lint
|
|
30
|
+
run: |
|
|
31
|
+
ruff check src tests
|
|
32
|
+
black --check src tests
|
|
33
|
+
|
|
34
|
+
- name: Test
|
|
35
|
+
run: pytest -q
|
chisao-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*.egg-info/
|
|
5
|
+
*.egg
|
|
6
|
+
build/
|
|
7
|
+
dist/
|
|
8
|
+
.eggs/
|
|
9
|
+
|
|
10
|
+
# Virtual envs
|
|
11
|
+
.venv/
|
|
12
|
+
venv/
|
|
13
|
+
env/
|
|
14
|
+
|
|
15
|
+
# Testing / coverage
|
|
16
|
+
.pytest_cache/
|
|
17
|
+
.coverage
|
|
18
|
+
htmlcov/
|
|
19
|
+
.ruff_cache/
|
|
20
|
+
|
|
21
|
+
# Editors / OS
|
|
22
|
+
.vscode/
|
|
23
|
+
.idea/
|
|
24
|
+
.DS_Store
|
|
25
|
+
|
|
26
|
+
# CuPy / build artifacts
|
|
27
|
+
*.so
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to ChiSao are documented here. Format follows
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versioning is
|
|
5
|
+
[SemVer](https://semver.org/).
|
|
6
|
+
|
|
7
|
+
## [0.1.0] — unreleased
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
- First standalone release. Extracted from the SunBURST package
|
|
11
|
+
(`sunburst.utils.chisao` + `sunburst.utils.single_whip`) into an independent
|
|
12
|
+
`chisao` package and repository.
|
|
13
|
+
- `chisao.seeding`: decoupled population seeders.
|
|
14
|
+
- `carry_tiger_seed` / `carry_tiger_rays` — structured ray-based seeding
|
|
15
|
+
(vertex-to-vertex, vertex-to-edge, wall-to-wall, QR-orthonormal sunburst),
|
|
16
|
+
lifted from `CarryTigerToMountain` without the evidence machinery.
|
|
17
|
+
- `random_seed` — uniform baseline seeder.
|
|
18
|
+
- `optimize(func, bounds, seeder=...)` — high-level wrapper that seeds a
|
|
19
|
+
population and runs `sticky_hands`, mirroring the paper's two-seeder comparison.
|
|
20
|
+
- src-layout packaging, MIT license, pytest suite (CPU), GitHub Actions CI.
|
|
21
|
+
|
|
22
|
+
### Notes
|
|
23
|
+
- Core optimizer (`sticky_hands`) carries internal version `3.2.0`, unchanged
|
|
24
|
+
from the SunBURST source.
|
chisao-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ira Wolfson
|
|
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.
|
chisao-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: chisao
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: GPU-native parallel optimizer for multimodal black-box functions via convergence-anticonvergence oscillation
|
|
5
|
+
Project-URL: Homepage, https://github.com/beastraban/chisao
|
|
6
|
+
Project-URL: Repository, https://github.com/beastraban/chisao
|
|
7
|
+
Project-URL: Issues, https://github.com/beastraban/chisao/issues
|
|
8
|
+
Author-email: Ira Wolfson <irawolfsonprof@gmail.com>
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: black-box-optimization,global-optimization,gpu,mode-finding,multimodal-optimization,optimization,population-methods
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Topic :: Scientific/Engineering
|
|
22
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
23
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
24
|
+
Requires-Python: >=3.9
|
|
25
|
+
Requires-Dist: numpy>=1.20
|
|
26
|
+
Requires-Dist: scipy>=1.7
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: black>=23.0; extra == 'dev'
|
|
29
|
+
Requires-Dist: pytest-cov>=4.0; extra == 'dev'
|
|
30
|
+
Requires-Dist: pytest>=7.0; extra == 'dev'
|
|
31
|
+
Requires-Dist: ruff>=0.1; extra == 'dev'
|
|
32
|
+
Provides-Extra: gpu
|
|
33
|
+
Requires-Dist: cupy>=11.0; extra == 'gpu'
|
|
34
|
+
Provides-Extra: profile
|
|
35
|
+
Requires-Dist: psutil>=5.8; extra == 'profile'
|
|
36
|
+
Description-Content-Type: text/markdown
|
|
37
|
+
|
|
38
|
+
# chisao
|
|
39
|
+
ChiSao optimizer
|
chisao-0.1.0/README.md
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# ChiSao SFU Benchmark
|
|
2
|
+
|
|
3
|
+
Reproduces the ChiSao mode-recovery results from the paper on the
|
|
4
|
+
[Simon Fraser University optimization test suite](https://www.sfu.ca/~ssurjano/optimization.html):
|
|
5
|
+
42 functions, both seeders (`random` and `carry_tiger`), across dimension.
|
|
6
|
+
|
|
7
|
+
This harness covers the **ChiSao** columns of the paper (random vs carry\_tiger
|
|
8
|
+
recovery rate and wall-clock). The CPU baselines (Differential Evolution,
|
|
9
|
+
Basin-Hopping, CMA-ES) are reported separately and are not part of this script.
|
|
10
|
+
|
|
11
|
+
## Run
|
|
12
|
+
|
|
13
|
+
From the repository root, with the package installed (`pip install -e .`):
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
# quick smoke (seconds on CPU)
|
|
17
|
+
python benchmarks/sfu_benchmark.py --funcs rastrigin sphere ackley --dims 2 --trials 2
|
|
18
|
+
|
|
19
|
+
# a multimodal group across low dimensions
|
|
20
|
+
python benchmarks/sfu_benchmark.py --group multimodal --dims 2 4 8 --trials 10
|
|
21
|
+
|
|
22
|
+
# the full suite, paper dimensions, JSON output
|
|
23
|
+
python benchmarks/sfu_benchmark.py --dims 2 4 8 16 32 64 --trials 10 --out sfu_results.json
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
CLI options:
|
|
27
|
+
|
|
28
|
+
| Flag | Meaning |
|
|
29
|
+
| -------------- | ------------------------------------------------------------- |
|
|
30
|
+
| `--funcs` | Specific functions (names from the registry). |
|
|
31
|
+
| `--group` | One of `multimodal`, `multimodal_2d`, `bowl`, `valley`, ... |
|
|
32
|
+
| `--dims` | Dimensions to test (default `2 4 8`). |
|
|
33
|
+
| `--trials` | Independent trials per function/dim (default `5`). |
|
|
34
|
+
| `--out` | Write full results to a JSON file. |
|
|
35
|
+
| `--source-dir` | Point at a working tree instead of the installed package. |
|
|
36
|
+
|
|
37
|
+
By default the harness does `import chisao` (the installed package). GPU is used
|
|
38
|
+
automatically when CuPy is present; otherwise it runs on NumPy (the high
|
|
39
|
+
dimensions are slow on CPU — use a GPU for `d >= 16`).
|
|
40
|
+
|
|
41
|
+
## Paper run settings
|
|
42
|
+
|
|
43
|
+
Each trial seeds a population and runs `chisao.sticky_hands` with the settings
|
|
44
|
+
below (see `run_one` in `sfu_benchmark.py`). These are the settings that
|
|
45
|
+
reproduce the paper — in particular, the `random` seeder only matches the
|
|
46
|
+
paper's numbers with `reseed_strategy='sunburst'` and `cannon_through_sky=True`:
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
N = 50 * (10 + ceil(log2(max(2, D)))) # population size
|
|
50
|
+
params = dict(
|
|
51
|
+
method='lbfgs',
|
|
52
|
+
n_converge=10,
|
|
53
|
+
n_anticonverge=5,
|
|
54
|
+
n_oscillations=3,
|
|
55
|
+
stick_tolerance=1e-3,
|
|
56
|
+
reseed_strategy='sunburst', # Repulse Monkey
|
|
57
|
+
cannon_through_sky=True,
|
|
58
|
+
estimate_widths=False,
|
|
59
|
+
)
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
The two seeders (`seed_random`, `seed_carry_tiger`) are defined in the script.
|
|
63
|
+
`seed_carry_tiger` is the same 4-component ray recipe exposed by the package as
|
|
64
|
+
`chisao.carry_tiger_seed` (vertex-to-vertex, vertex-to-edge, wall-to-wall, and a
|
|
65
|
+
QR-orthonormal sunburst from the domain center), with
|
|
66
|
+
`n_rays = 10 + log2(d)` and 50 samples per ray.
|
|
67
|
+
|
|
68
|
+
## Success criterion
|
|
69
|
+
|
|
70
|
+
A trial succeeds if a recovered peak lies within the function's L∞ tolerance of
|
|
71
|
+
a global optimum (`tol` in `FUNC_REGISTRY`). Functions with multiple equivalent
|
|
72
|
+
optima (`multi_opt=True`) are matched against the nearest of their global optima.
|