trust-bo 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.
- trust_bo-0.1.0/.github/ISSUE_TEMPLATE/benchmark_report.yml +25 -0
- trust_bo-0.1.0/.github/ISSUE_TEMPLATE/bug_report.yml +34 -0
- trust_bo-0.1.0/.github/ISSUE_TEMPLATE/feature_request.yml +18 -0
- trust_bo-0.1.0/.github/PULL_REQUEST_TEMPLATE.md +10 -0
- trust_bo-0.1.0/.github/workflows/ci.yml +48 -0
- trust_bo-0.1.0/.github/workflows/release.yml +86 -0
- trust_bo-0.1.0/.gitignore +23 -0
- trust_bo-0.1.0/CHANGELOG.md +35 -0
- trust_bo-0.1.0/CONTRIBUTING.md +33 -0
- trust_bo-0.1.0/Cargo.lock +5691 -0
- trust_bo-0.1.0/Cargo.toml +33 -0
- trust_bo-0.1.0/LICENSE +21 -0
- trust_bo-0.1.0/PKG-INFO +375 -0
- trust_bo-0.1.0/README.md +348 -0
- trust_bo-0.1.0/benchmarks/README.md +16 -0
- trust_bo-0.1.0/benchmarks/bench_resume.py +48 -0
- trust_bo-0.1.0/benchmarks/benchmark.py +333 -0
- trust_bo-0.1.0/benchmarks/benchmark_50d.py +278 -0
- trust_bo-0.1.0/benchmarks/benchmark_multi_tr.py +142 -0
- trust_bo-0.1.0/benchmarks/benchmark_multi_tr_v2.py +126 -0
- trust_bo-0.1.0/benchmarks/benchmark_native.py +65 -0
- trust_bo-0.1.0/benchmarks/benchmark_tandem.py +215 -0
- trust_bo-0.1.0/benchmarks/benchmark_tandem_v2.py +220 -0
- trust_bo-0.1.0/benchmarks/benchmark_v2.py +362 -0
- trust_bo-0.1.0/benchmarks/cfd_neuralfoil_benchmark.py +376 -0
- trust_bo-0.1.0/benchmarks/cfd_scale_benchmark.py +352 -0
- trust_bo-0.1.0/benchmarks/crossover_analysis.py +210 -0
- trust_bo-0.1.0/benchmarks/large_budget_benchmark.py +293 -0
- trust_bo-0.1.0/benchmarks/midbudget_benchmark.py +423 -0
- trust_bo-0.1.0/benchmarks/rolling_integration_test.py +248 -0
- trust_bo-0.1.0/benchmarks/su2/airfoil_mesh.py +278 -0
- trust_bo-0.1.0/benchmarks/su2/su2_evaluator.py +142 -0
- trust_bo-0.1.0/benchmarks/su2/su2_runner.py +249 -0
- trust_bo-0.1.0/benchmarks/su2_cfd_benchmark.py +336 -0
- trust_bo-0.1.0/benchmarks/su2_mo_benchmark.py +316 -0
- trust_bo-0.1.0/benchmarks/zdt_ehvi_benchmark.py +262 -0
- trust_bo-0.1.0/benchmarks/zdt_test.py +234 -0
- trust_bo-0.1.0/cfd/f1wing_optimize.py +140 -0
- trust_bo-0.1.0/cfd/generate_airfoil.py +69 -0
- trust_bo-0.1.0/cfd/mock_cfd.py +117 -0
- trust_bo-0.1.0/cfd/naca_optimize.py +136 -0
- trust_bo-0.1.0/docs/ALGORITHM.md +783 -0
- trust_bo-0.1.0/docs/BENCHMARK.md +650 -0
- trust_bo-0.1.0/docs/DEVELOPMENT.md +1114 -0
- trust_bo-0.1.0/docs/PERFORMANCE_ASSESSMENT.md +113 -0
- trust_bo-0.1.0/docs/RELEASE_NOTES_v0.1.0-alpha.md +46 -0
- trust_bo-0.1.0/docs/ROADMAP.md +308 -0
- trust_bo-0.1.0/docs/architecture_phase3.md +425 -0
- trust_bo-0.1.0/docs/phase3_5_plan.md +131 -0
- trust_bo-0.1.0/examples/mock_airfoil/README.md +17 -0
- trust_bo-0.1.0/examples/mock_airfoil/run_optimization.py +79 -0
- trust_bo-0.1.0/examples/quickstart_ackley.py +55 -0
- trust_bo-0.1.0/pyproject.toml +52 -0
- trust_bo-0.1.0/python/trust_bo/__init__.py +19 -0
- trust_bo-0.1.0/python/trust_bo/engine.py +237 -0
- trust_bo-0.1.0/python/trust_bo/history.py +93 -0
- trust_bo-0.1.0/python/trust_bo/integrations/__init__.py +0 -0
- trust_bo-0.1.0/python/trust_bo/integrations/optuna.py +103 -0
- trust_bo-0.1.0/python/trust_bo/multiobjective.py +350 -0
- trust_bo-0.1.0/python/trust_bo/rolling_engine.py +344 -0
- trust_bo-0.1.0/python/trust_bo/space.py +136 -0
- trust_bo-0.1.0/python/trust_bo/tandem.py +269 -0
- trust_bo-0.1.0/src/acquisition.rs +249 -0
- trust_bo-0.1.0/src/batch.rs +58 -0
- trust_bo-0.1.0/src/bin/branin_demo.rs +337 -0
- trust_bo-0.1.0/src/candidate.rs +128 -0
- trust_bo-0.1.0/src/cem.rs +260 -0
- trust_bo-0.1.0/src/gp.rs +292 -0
- trust_bo-0.1.0/src/hypervolume.rs +93 -0
- trust_bo-0.1.0/src/lib.rs +738 -0
- trust_bo-0.1.0/src/normalize.rs +10 -0
- trust_bo-0.1.0/src/pareto.rs +107 -0
- trust_bo-0.1.0/src/surrogate.rs +202 -0
- trust_bo-0.1.0/src/tr.rs +265 -0
- trust_bo-0.1.0/src/types.rs +152 -0
- trust_bo-0.1.0/tests/test_gp_comparison.py +161 -0
- trust_bo-0.1.0/tests/test_multi_tr.py +78 -0
- trust_bo-0.1.0/tests/test_phase0.py +138 -0
- trust_bo-0.1.0/tests/test_phase1.py +70 -0
- trust_bo-0.1.0/tests/test_phase2.py +131 -0
- trust_bo-0.1.0/tests/test_phase2_native.py +191 -0
- trust_bo-0.1.0/tests/test_phase3.py +100 -0
- trust_bo-0.1.0/tests/test_phase3_ablation.py +128 -0
- trust_bo-0.1.0/tests/test_phase3_eval.py +205 -0
- trust_bo-0.1.0/tests/test_phase4.py +151 -0
- trust_bo-0.1.0/tests/test_tandem.py +135 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
name: Benchmark / real-world result
|
|
2
|
+
description: Share results from using TRust-BO on a real problem (good or bad!)
|
|
3
|
+
labels: [benchmark]
|
|
4
|
+
body:
|
|
5
|
+
- type: textarea
|
|
6
|
+
id: problem
|
|
7
|
+
attributes:
|
|
8
|
+
label: Problem description
|
|
9
|
+
description: What did you optimize? Dimensions, budget, constraints.
|
|
10
|
+
validations:
|
|
11
|
+
required: true
|
|
12
|
+
- type: textarea
|
|
13
|
+
id: results
|
|
14
|
+
attributes:
|
|
15
|
+
label: Results
|
|
16
|
+
description: Best value found, wall-clock time, comparison with other tools if any.
|
|
17
|
+
validations:
|
|
18
|
+
required: true
|
|
19
|
+
- type: input
|
|
20
|
+
id: environment
|
|
21
|
+
attributes:
|
|
22
|
+
label: Environment
|
|
23
|
+
placeholder: "Ubuntu 24.04, Python 3.11, laptop CPU (no GPU)"
|
|
24
|
+
validations:
|
|
25
|
+
required: false
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
name: Bug report
|
|
2
|
+
description: Something doesn't work as expected
|
|
3
|
+
labels: [bug]
|
|
4
|
+
body:
|
|
5
|
+
- type: textarea
|
|
6
|
+
id: description
|
|
7
|
+
attributes:
|
|
8
|
+
label: What happened?
|
|
9
|
+
description: A clear description of the bug, and what you expected instead.
|
|
10
|
+
validations:
|
|
11
|
+
required: true
|
|
12
|
+
- type: textarea
|
|
13
|
+
id: reproduction
|
|
14
|
+
attributes:
|
|
15
|
+
label: Minimal reproduction
|
|
16
|
+
description: The smallest script that reproduces the problem.
|
|
17
|
+
render: python
|
|
18
|
+
validations:
|
|
19
|
+
required: false
|
|
20
|
+
- type: input
|
|
21
|
+
id: version
|
|
22
|
+
attributes:
|
|
23
|
+
label: TRust-BO version / commit
|
|
24
|
+
placeholder: "0.1.0 / abc1234"
|
|
25
|
+
validations:
|
|
26
|
+
required: true
|
|
27
|
+
- type: input
|
|
28
|
+
id: environment
|
|
29
|
+
attributes:
|
|
30
|
+
label: Environment
|
|
31
|
+
description: OS, Python version, Rust version (if building from source).
|
|
32
|
+
placeholder: "Ubuntu 24.04, Python 3.11, rustc 1.85"
|
|
33
|
+
validations:
|
|
34
|
+
required: true
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
name: Feature request
|
|
2
|
+
description: Suggest an idea or improvement
|
|
3
|
+
labels: [enhancement]
|
|
4
|
+
body:
|
|
5
|
+
- type: textarea
|
|
6
|
+
id: problem
|
|
7
|
+
attributes:
|
|
8
|
+
label: What problem does this solve?
|
|
9
|
+
description: Describe the use case — e.g. the optimization problem you're trying to run.
|
|
10
|
+
validations:
|
|
11
|
+
required: true
|
|
12
|
+
- type: textarea
|
|
13
|
+
id: solution
|
|
14
|
+
attributes:
|
|
15
|
+
label: Proposed solution
|
|
16
|
+
description: What you'd like to happen. API sketches welcome.
|
|
17
|
+
validations:
|
|
18
|
+
required: false
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
## Summary
|
|
2
|
+
|
|
3
|
+
<!-- What does this PR change, and why? -->
|
|
4
|
+
|
|
5
|
+
## Checklist
|
|
6
|
+
|
|
7
|
+
- [ ] Tests added/updated (`pytest` for Python-facing behavior, `cargo test` for Rust internals)
|
|
8
|
+
- [ ] `cargo test --release` passes
|
|
9
|
+
- [ ] `maturin develop --release && pytest tests/ -q` passes
|
|
10
|
+
- [ ] CHANGELOG.md updated (for user-facing changes)
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
test:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
strategy:
|
|
14
|
+
fail-fast: false
|
|
15
|
+
matrix:
|
|
16
|
+
python-version: ["3.10", "3.11"]
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
|
+
|
|
20
|
+
- uses: actions/setup-python@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: ${{ matrix.python-version }}
|
|
23
|
+
|
|
24
|
+
- uses: dtolnay/rust-toolchain@stable
|
|
25
|
+
|
|
26
|
+
- name: Cache Rust build
|
|
27
|
+
uses: Swatinem/rust-cache@v2
|
|
28
|
+
|
|
29
|
+
- name: Rust tests
|
|
30
|
+
run: cargo test --release
|
|
31
|
+
|
|
32
|
+
# `maturin develop` requires a virtualenv; `pip install .` builds the
|
|
33
|
+
# same wheel via the maturin build backend and works anywhere
|
|
34
|
+
- name: Build and install package
|
|
35
|
+
run: pip install .
|
|
36
|
+
|
|
37
|
+
# The core package must import with no optional deps (numpy only).
|
|
38
|
+
# Regression guard for the lazy legacy-tandem import in __init__.py.
|
|
39
|
+
- name: Import smoke (no extras)
|
|
40
|
+
run: python -c "import trust_bo; from trust_bo import TRustBOEngine, MultiObjectiveEngine"
|
|
41
|
+
|
|
42
|
+
# scipy / scikit-learn are only needed for the deprecated TandemEngine
|
|
43
|
+
# (legacy-tandem extra) and its tests; the core package does not require them.
|
|
44
|
+
- name: Install test deps
|
|
45
|
+
run: pip install pytest scipy scikit-learn
|
|
46
|
+
|
|
47
|
+
- name: Python tests
|
|
48
|
+
run: pytest tests/ -q
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
# v* タグの push で起動。abi3-py39 wheel(Python 3.9+ 共通)を各 OS でビルドし、
|
|
4
|
+
# GitHub Release にアセット添付 → PyPI へ trusted publishing で公開する。
|
|
5
|
+
#
|
|
6
|
+
# ⚠️ このワークフローは外部公開(PyPI / GitHub Release)を行う。タグ push は人間が確認後に行うこと。
|
|
7
|
+
# PyPI 側で trusted publisher(OIDC, この repo の release.yml)を事前登録しておく必要がある。
|
|
8
|
+
|
|
9
|
+
on:
|
|
10
|
+
push:
|
|
11
|
+
tags:
|
|
12
|
+
- "v*"
|
|
13
|
+
workflow_dispatch:
|
|
14
|
+
|
|
15
|
+
permissions:
|
|
16
|
+
contents: write # GitHub Release 作成・アセット添付
|
|
17
|
+
|
|
18
|
+
jobs:
|
|
19
|
+
build-wheels:
|
|
20
|
+
name: wheel (${{ matrix.os }})
|
|
21
|
+
runs-on: ${{ matrix.os }}
|
|
22
|
+
strategy:
|
|
23
|
+
fail-fast: false
|
|
24
|
+
matrix:
|
|
25
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
26
|
+
steps:
|
|
27
|
+
- uses: actions/checkout@v4
|
|
28
|
+
- uses: dtolnay/rust-toolchain@stable
|
|
29
|
+
- name: Build abi3 wheel
|
|
30
|
+
uses: PyO3/maturin-action@v1
|
|
31
|
+
with:
|
|
32
|
+
command: build
|
|
33
|
+
args: --release --out dist
|
|
34
|
+
- uses: actions/upload-artifact@v4
|
|
35
|
+
with:
|
|
36
|
+
name: wheels-${{ matrix.os }}
|
|
37
|
+
path: dist/*.whl
|
|
38
|
+
|
|
39
|
+
build-sdist:
|
|
40
|
+
name: sdist
|
|
41
|
+
runs-on: ubuntu-latest
|
|
42
|
+
steps:
|
|
43
|
+
- uses: actions/checkout@v4
|
|
44
|
+
- name: Build sdist
|
|
45
|
+
uses: PyO3/maturin-action@v1
|
|
46
|
+
with:
|
|
47
|
+
command: sdist
|
|
48
|
+
args: --out dist
|
|
49
|
+
- uses: actions/upload-artifact@v4
|
|
50
|
+
with:
|
|
51
|
+
name: sdist
|
|
52
|
+
path: dist/*.tar.gz
|
|
53
|
+
|
|
54
|
+
github-release:
|
|
55
|
+
name: GitHub Release
|
|
56
|
+
needs: [build-wheels, build-sdist]
|
|
57
|
+
runs-on: ubuntu-latest
|
|
58
|
+
if: startsWith(github.ref, 'refs/tags/')
|
|
59
|
+
steps:
|
|
60
|
+
- uses: actions/download-artifact@v4
|
|
61
|
+
with:
|
|
62
|
+
path: dist
|
|
63
|
+
merge-multiple: true
|
|
64
|
+
- name: Attach artifacts to GitHub Release
|
|
65
|
+
uses: softprops/action-gh-release@v2
|
|
66
|
+
with:
|
|
67
|
+
files: dist/*
|
|
68
|
+
generate_release_notes: true
|
|
69
|
+
|
|
70
|
+
pypi-publish:
|
|
71
|
+
name: Publish to PyPI
|
|
72
|
+
needs: [build-wheels, build-sdist]
|
|
73
|
+
runs-on: ubuntu-latest
|
|
74
|
+
if: startsWith(github.ref, 'refs/tags/')
|
|
75
|
+
environment: pypi
|
|
76
|
+
permissions:
|
|
77
|
+
id-token: write # PyPI trusted publishing (OIDC)
|
|
78
|
+
steps:
|
|
79
|
+
- uses: actions/download-artifact@v4
|
|
80
|
+
with:
|
|
81
|
+
path: dist
|
|
82
|
+
merge-multiple: true
|
|
83
|
+
- name: Publish
|
|
84
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
85
|
+
with:
|
|
86
|
+
packages-dir: dist
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Rust
|
|
2
|
+
/target/
|
|
3
|
+
|
|
4
|
+
# Python
|
|
5
|
+
__pycache__/
|
|
6
|
+
*.pyc
|
|
7
|
+
.venv/
|
|
8
|
+
*.egg-info/
|
|
9
|
+
dist/
|
|
10
|
+
.pytest_cache/
|
|
11
|
+
|
|
12
|
+
# Build artifacts (built by `maturin develop`)
|
|
13
|
+
*.so
|
|
14
|
+
*.pyd
|
|
15
|
+
|
|
16
|
+
# Generated outputs (benchmarks, CFD runs, reports)
|
|
17
|
+
*.csv
|
|
18
|
+
*.zip
|
|
19
|
+
*.log
|
|
20
|
+
results/
|
|
21
|
+
final_report.txt
|
|
22
|
+
task_log.txt
|
|
23
|
+
*interim_report.txt
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
Format based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
5
|
+
|
|
6
|
+
## [Unreleased]
|
|
7
|
+
|
|
8
|
+
### Added
|
|
9
|
+
|
|
10
|
+
- **Trust Region Bayesian Optimization engine written in Rust** (TuRBO-style),
|
|
11
|
+
exposed to Python via PyO3. No GPU, no BLAS/LAPACK, no cloud required.
|
|
12
|
+
- **MLP Bootstrap Ensemble surrogate** (5 members, warm-started between rounds)
|
|
13
|
+
with CEM acquisition optimization inside the trust region.
|
|
14
|
+
- **Native Rust Phase 2** (Tandem Residual-GP): a pure-Rust Matern 5/2 micro-GP
|
|
15
|
+
fits the residuals of the MLP ensemble near the incumbent for endgame
|
|
16
|
+
refinement. Enabled with `config={"enable_phase2": True}`. No sklearn needed.
|
|
17
|
+
+32% over plain TRust-BO at 50D, +55% at 10D (Ackley, 3-seed median).
|
|
18
|
+
- **Constraint handling** via a feasibility surrogate (EI × P(feasible)).
|
|
19
|
+
- **Async parallel / rolling evaluation** (`RollingTRustBOEngine`, SLURM-ready)
|
|
20
|
+
for expensive solvers where evaluations take minutes to hours.
|
|
21
|
+
- **Multi-objective optimization** (`MultiObjectiveEngine`): Chebyshev scalarization
|
|
22
|
+
(any number of objectives) and a closed-form 2-objective Expected Hypervolume
|
|
23
|
+
Improvement (EHVI) implemented in Rust. Exposes `pareto_front()` / `hypervolume()`.
|
|
24
|
+
- **Real CFD airfoil pipelines**: NeuralFoil (H-1, learned surrogate) and
|
|
25
|
+
SU2 RANS (H-2, real steady Navier-Stokes, Ma=0.3 Re=3e6 SA). Multi-objective
|
|
26
|
+
Cl/Cd optimization validated on SU2 (K-2-8).
|
|
27
|
+
- **Save/resume**: `engine.save("study.zip")` / `TRustBOEngine.load(...)`.
|
|
28
|
+
- **Optuna sampler** integration (`trust_bo.integrations.optuna`).
|
|
29
|
+
- 91 tests passing (63 Python + 28 Rust), CPU-only.
|
|
30
|
+
|
|
31
|
+
### Deprecated
|
|
32
|
+
|
|
33
|
+
- `TandemEngine` / `TandemEngineV2` (sklearn-based Phase 2). Use
|
|
34
|
+
`TRustBOEngine(config={"enable_phase2": True})` instead. The old classes
|
|
35
|
+
remain available behind the `legacy-tandem` extra and will be removed in v0.2.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Contributing to TRust-BO
|
|
2
|
+
|
|
3
|
+
Thank you for your interest! This is a one-person project so far — any help is genuinely appreciated.
|
|
4
|
+
|
|
5
|
+
## Bug reports & feature requests
|
|
6
|
+
|
|
7
|
+
Please open an [Issue](https://github.com/K092203/TRust-BO/issues). Include your OS, Python version, and a minimal reproduction if possible.
|
|
8
|
+
|
|
9
|
+
## Pull requests
|
|
10
|
+
|
|
11
|
+
PRs are welcome. Start small — a typo fix or a single bug fix is a great first PR.
|
|
12
|
+
|
|
13
|
+
1. Fork and create a branch
|
|
14
|
+
2. Make your change
|
|
15
|
+
3. **Add tests** — `pytest` for Python-facing behavior, `cargo test` for Rust internals
|
|
16
|
+
4. Make sure everything passes:
|
|
17
|
+
```bash
|
|
18
|
+
pip install maturin numpy pytest scipy scikit-learn
|
|
19
|
+
cargo test --release
|
|
20
|
+
maturin develop --release
|
|
21
|
+
pytest tests/ -q
|
|
22
|
+
```
|
|
23
|
+
(`scipy` / `scikit-learn` are only needed while the deprecated
|
|
24
|
+
`TandemEngine` is still bundled — it will be removed in v0.2.)
|
|
25
|
+
|
|
26
|
+
## Code style
|
|
27
|
+
|
|
28
|
+
- Rust: `cargo fmt` (rustfmt defaults)
|
|
29
|
+
- Python: [Black](https://github.com/psf/black) defaults
|
|
30
|
+
|
|
31
|
+
## Benchmark results wanted!
|
|
32
|
+
|
|
33
|
+
If you use TRust-BO on a **real CFD problem** (or any real engineering optimization), please share your results in an Issue — good or bad. Real-world feedback is the most valuable contribution at this stage.
|