saealib 0.1.0b1__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.
- saealib-0.1.0b1/.dockerignore +0 -0
- saealib-0.1.0b1/.github/ISSUE_TEMPLATE/bug_report.md +19 -0
- saealib-0.1.0b1/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- saealib-0.1.0b1/.github/ISSUE_TEMPLATE/refactor.md +15 -0
- saealib-0.1.0b1/.github/ISSUE_TEMPLATE/task.md +11 -0
- saealib-0.1.0b1/.github/pull_request_template.md +18 -0
- saealib-0.1.0b1/.github/workflows/docs.yml +77 -0
- saealib-0.1.0b1/.github/workflows/lint.yml +34 -0
- saealib-0.1.0b1/.github/workflows/publish.yml +45 -0
- saealib-0.1.0b1/.github/workflows/test.yml +30 -0
- saealib-0.1.0b1/.gitignore +176 -0
- saealib-0.1.0b1/CHANGELOG.md +28 -0
- saealib-0.1.0b1/CONTRIBUTING.md +91 -0
- saealib-0.1.0b1/Dockerfile +20 -0
- saealib-0.1.0b1/LICENSE +21 -0
- saealib-0.1.0b1/PKG-INFO +206 -0
- saealib-0.1.0b1/README.md +169 -0
- saealib-0.1.0b1/docker-compose.yml +6 -0
- saealib-0.1.0b1/docs/Makefile +20 -0
- saealib-0.1.0b1/docs/_static/.gitkeep +0 -0
- saealib-0.1.0b1/docs/_templates/autosummary/class.rst +32 -0
- saealib-0.1.0b1/docs/_templates/sidebar/versions.html +12 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.AcquisitionFunction.rst +39 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.Algorithm.rst +43 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.Archive.rst +111 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.ArchiveMixin.rst +43 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.CallbackManager.rst +47 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.Constraint.rst +39 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.Crossover.rst +35 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.CrossoverBLXAlpha.rst +35 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.CrossoverOnePoint.rst +35 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.CrossoverSBX.rst +35 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.CrossoverTwoPoint.rst +35 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.CrossoverUniform.rst +35 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.EnsembleSurrogateManager.rst +35 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.Event.rst +31 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.ExpectedImprovement.rst +39 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.GA.rst +43 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.GenerationBasedStrategy.rst +35 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.GenerationEndEvent.rst +31 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.GenerationStartEvent.rst +31 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.GlobalSurrogateManager.rst +35 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.Individual.rst +39 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.IndividualBasedStrategy.rst +35 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.Initializer.rst +35 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.LHSInitializer.rst +35 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.LocalSurrogateManager.rst +35 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.LowerConfidenceBound.rst +39 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.MaxUncertainty.rst +39 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.MeanPrediction.rst +39 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.Mutation.rst +35 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.MutationGaussian.rst +35 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.MutationPolynomial.rst +35 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.MutationUniform.rst +35 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.OptimizationStrategy.rst +35 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.Optimizer.rst +71 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.PSO.rst +43 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.ParentSelection.rst +35 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.Population.rst +99 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.PopulationAttribute.rst +31 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.PostAskEvent.rst +31 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.PostCrossoverEvent.rst +31 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.PostEvaluationEvent.rst +31 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.PostMutationEvent.rst +31 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.PostSurrogateFitEvent.rst +31 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.PreSelectionStrategy.rst +35 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.ProbabilityOfFeasibility.rst +39 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.Problem.rst +39 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.RBFsurrogate.rst +39 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.Result.rst +31 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.RouletteWheelSelection.rst +35 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.RunEndEvent.rst +31 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.RunStartEvent.rst +31 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.SequentialSelection.rst +35 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.Surrogate.rst +39 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.SurrogateEndEvent.rst +31 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.SurrogateManager.rst +35 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.SurrogatePrediction.rst +31 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.SurrogateStartEvent.rst +31 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.SurvivorSelection.rst +35 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.Termination.rst +35 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.TournamentSelection.rst +35 -0
- saealib-0.1.0b1/docs/api/_autosummary/saealib.TruncationSelection.rst +35 -0
- saealib-0.1.0b1/docs/api/acquisition.md +25 -0
- saealib-0.1.0b1/docs/api/algorithms.md +31 -0
- saealib-0.1.0b1/docs/api/callbacks.md +42 -0
- saealib-0.1.0b1/docs/api/highlevel.md +17 -0
- saealib-0.1.0b1/docs/api/index.md +19 -0
- saealib-0.1.0b1/docs/api/initialization.md +10 -0
- saealib-0.1.0b1/docs/api/operators.md +50 -0
- saealib-0.1.0b1/docs/api/optimizer.md +9 -0
- saealib-0.1.0b1/docs/api/population.md +13 -0
- saealib-0.1.0b1/docs/api/problem.md +10 -0
- saealib-0.1.0b1/docs/api/strategies.md +23 -0
- saealib-0.1.0b1/docs/api/surrogate.md +39 -0
- saealib-0.1.0b1/docs/api/termination.md +17 -0
- saealib-0.1.0b1/docs/api/utils.md +5 -0
- saealib-0.1.0b1/docs/conf.py +99 -0
- saealib-0.1.0b1/docs/getting_started/index.md +11 -0
- saealib-0.1.0b1/docs/getting_started/installation.md +47 -0
- saealib-0.1.0b1/docs/getting_started/quickstart.md +52 -0
- saealib-0.1.0b1/docs/getting_started/what_is_saealib.md +52 -0
- saealib-0.1.0b1/docs/googleb2b2a6492b1c5bc1.html +1 -0
- saealib-0.1.0b1/docs/index.md +105 -0
- saealib-0.1.0b1/docs/make.bat +35 -0
- saealib-0.1.0b1/docs/tutorials/acquisition_functions.md +16 -0
- saealib-0.1.0b1/docs/tutorials/callbacks.md +192 -0
- saealib-0.1.0b1/docs/tutorials/constraints.md +196 -0
- saealib-0.1.0b1/docs/tutorials/custom_components.md +183 -0
- saealib-0.1.0b1/docs/tutorials/index.md +14 -0
- saealib-0.1.0b1/docs/tutorials/multi_objective.md +217 -0
- saealib-0.1.0b1/docs/tutorials/single_objective.md +263 -0
- saealib-0.1.0b1/docs/user_guide/architecture.md +70 -0
- saealib-0.1.0b1/docs/user_guide/index.md +7 -0
- saealib-0.1.0b1/examples/sample_saga_rbf_gb.py +73 -0
- saealib-0.1.0b1/examples/sample_saga_rbf_ib.py +74 -0
- saealib-0.1.0b1/examples/sample_saga_rbf_moo.py +115 -0
- saealib-0.1.0b1/examples/sample_saga_rbf_novelty_ensemble.py +102 -0
- saealib-0.1.0b1/examples/sample_saga_rbf_ps.py +75 -0
- saealib-0.1.0b1/examples/sample_sapso_rbf.py +84 -0
- saealib-0.1.0b1/pyproject.toml +105 -0
- saealib-0.1.0b1/src/saealib/__init__.py +211 -0
- saealib-0.1.0b1/src/saealib/acquisition/__init__.py +23 -0
- saealib-0.1.0b1/src/saealib/acquisition/base.py +81 -0
- saealib-0.1.0b1/src/saealib/acquisition/ei.py +95 -0
- saealib-0.1.0b1/src/saealib/acquisition/lcb.py +84 -0
- saealib-0.1.0b1/src/saealib/acquisition/mean.py +67 -0
- saealib-0.1.0b1/src/saealib/acquisition/pof.py +82 -0
- saealib-0.1.0b1/src/saealib/acquisition/uncertainty.py +76 -0
- saealib-0.1.0b1/src/saealib/algorithms/__init__.py +0 -0
- saealib-0.1.0b1/src/saealib/algorithms/base.py +82 -0
- saealib-0.1.0b1/src/saealib/algorithms/ga.py +185 -0
- saealib-0.1.0b1/src/saealib/algorithms/pso.py +299 -0
- saealib-0.1.0b1/src/saealib/api.py +387 -0
- saealib-0.1.0b1/src/saealib/callback/__init__.py +41 -0
- saealib-0.1.0b1/src/saealib/callback/events.py +143 -0
- saealib-0.1.0b1/src/saealib/callback/handlers.py +98 -0
- saealib-0.1.0b1/src/saealib/callback/manager.py +89 -0
- saealib-0.1.0b1/src/saealib/comparators.py +519 -0
- saealib-0.1.0b1/src/saealib/context.py +95 -0
- saealib-0.1.0b1/src/saealib/execution/__init__.py +0 -0
- saealib-0.1.0b1/src/saealib/execution/initializer.py +178 -0
- saealib-0.1.0b1/src/saealib/execution/runner.py +59 -0
- saealib-0.1.0b1/src/saealib/operators/__init__.py +0 -0
- saealib-0.1.0b1/src/saealib/operators/crossover.py +311 -0
- saealib-0.1.0b1/src/saealib/operators/mutation.py +215 -0
- saealib-0.1.0b1/src/saealib/operators/repair.py +26 -0
- saealib-0.1.0b1/src/saealib/operators/selection.py +270 -0
- saealib-0.1.0b1/src/saealib/optimizer.py +252 -0
- saealib-0.1.0b1/src/saealib/population.py +780 -0
- saealib-0.1.0b1/src/saealib/problem.py +170 -0
- saealib-0.1.0b1/src/saealib/py.typed +0 -0
- saealib-0.1.0b1/src/saealib/strategies/__init__.py +0 -0
- saealib-0.1.0b1/src/saealib/strategies/base.py +56 -0
- saealib-0.1.0b1/src/saealib/strategies/gb.py +82 -0
- saealib-0.1.0b1/src/saealib/strategies/ib.py +90 -0
- saealib-0.1.0b1/src/saealib/strategies/ps.py +86 -0
- saealib-0.1.0b1/src/saealib/surrogate/__init__.py +0 -0
- saealib-0.1.0b1/src/saealib/surrogate/archive_manager.py +153 -0
- saealib-0.1.0b1/src/saealib/surrogate/base.py +51 -0
- saealib-0.1.0b1/src/saealib/surrogate/manager.py +342 -0
- saealib-0.1.0b1/src/saealib/surrogate/per_objective.py +87 -0
- saealib-0.1.0b1/src/saealib/surrogate/prediction.py +63 -0
- saealib-0.1.0b1/src/saealib/surrogate/rbf.py +176 -0
- saealib-0.1.0b1/src/saealib/surrogate/sklearn_surrogate.py +257 -0
- saealib-0.1.0b1/src/saealib/surrogate/torch_surrogate.py +137 -0
- saealib-0.1.0b1/src/saealib/surrogate/training_set.py +404 -0
- saealib-0.1.0b1/src/saealib/termination.py +137 -0
- saealib-0.1.0b1/src/saealib/utils/__init__.py +3 -0
- saealib-0.1.0b1/src/saealib/utils/indicators.py +81 -0
- saealib-0.1.0b1/tests/data/test_integration.json +1 -0
- saealib-0.1.0b1/tests/scripts/generate_test_integration.py +122 -0
- saealib-0.1.0b1/tests/test_acquisition.py +336 -0
- saealib-0.1.0b1/tests/test_callback.py +774 -0
- saealib-0.1.0b1/tests/test_constraint.py +163 -0
- saealib-0.1.0b1/tests/test_gp_surrogate.py +213 -0
- saealib-0.1.0b1/tests/test_integration.py +116 -0
- saealib-0.1.0b1/tests/test_moo.py +614 -0
- saealib-0.1.0b1/tests/test_operators.py +330 -0
- saealib-0.1.0b1/tests/test_optimizer_validate.py +171 -0
- saealib-0.1.0b1/tests/test_per_objective.py +198 -0
- saealib-0.1.0b1/tests/test_population.py +834 -0
- saealib-0.1.0b1/tests/test_pso.py +365 -0
- saealib-0.1.0b1/tests/test_sklearn_surrogate.py +290 -0
- saealib-0.1.0b1/tests/test_strategies.py +306 -0
- saealib-0.1.0b1/tests/test_surrogate_manager.py +827 -0
- saealib-0.1.0b1/tests/test_termination.py +222 -0
- saealib-0.1.0b1/tests/test_torch_surrogate.py +185 -0
- saealib-0.1.0b1/tests/test_training_set.py +468 -0
- saealib-0.1.0b1/uv.lock +2322 -0
|
File without changes
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug Report
|
|
3
|
+
about: Create a report to help us improve
|
|
4
|
+
title: "[BUG] "
|
|
5
|
+
labels: bug
|
|
6
|
+
assignees: ''
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Description
|
|
10
|
+
|
|
11
|
+
## Steps to Reproduce
|
|
12
|
+
|
|
13
|
+
## Expected Behavior
|
|
14
|
+
|
|
15
|
+
## Actual Behavior
|
|
16
|
+
|
|
17
|
+
## Screenshots / Screen Recording
|
|
18
|
+
|
|
19
|
+
## Environment
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature Request
|
|
3
|
+
about: Suggest a new idea or feature for this project
|
|
4
|
+
title: "[FEAT] "
|
|
5
|
+
labels: enhancement
|
|
6
|
+
assignees: ''
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Summary
|
|
10
|
+
|
|
11
|
+
## Acceptance Criteria
|
|
12
|
+
- [ ]
|
|
13
|
+
- [ ]
|
|
14
|
+
|
|
15
|
+
## Implementation Tasks
|
|
16
|
+
- [ ]
|
|
17
|
+
- [ ]
|
|
18
|
+
|
|
19
|
+
## References
|
|
20
|
+
-
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Refactor / Improvement
|
|
3
|
+
about: Code cleanup, technical debt, or performance improvements
|
|
4
|
+
title: "[REFACTOR] "
|
|
5
|
+
labels: refactor, improvement
|
|
6
|
+
assignees: ''
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Target Area
|
|
10
|
+
|
|
11
|
+
## Motivation
|
|
12
|
+
|
|
13
|
+
## Proposal
|
|
14
|
+
|
|
15
|
+
## Risks / Impact
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
## Related Issue
|
|
2
|
+
Closes #
|
|
3
|
+
|
|
4
|
+
## Overview
|
|
5
|
+
<!-- Explain the overview and its background. -->
|
|
6
|
+
|
|
7
|
+
## Changes
|
|
8
|
+
<!-- List the summary of changes in bullet points. -->
|
|
9
|
+
-
|
|
10
|
+
-
|
|
11
|
+
|
|
12
|
+
## Verification Steps
|
|
13
|
+
<!-- Explain the steps for verifying operation -->
|
|
14
|
+
|
|
15
|
+
## Concerns
|
|
16
|
+
<!-- List points to note and potential impacts -->
|
|
17
|
+
|
|
18
|
+
## Other
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
name: Docs
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: ["main", "dev-docs"]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: ["main"]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
build:
|
|
11
|
+
name: Build docs
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
with:
|
|
16
|
+
fetch-depth: 0
|
|
17
|
+
|
|
18
|
+
- uses: astral-sh/setup-uv@v5
|
|
19
|
+
with:
|
|
20
|
+
enable-cache: true
|
|
21
|
+
|
|
22
|
+
- name: Install dependencies
|
|
23
|
+
run: uv sync --group docs
|
|
24
|
+
|
|
25
|
+
- name: Build docs (strict)
|
|
26
|
+
run: uv run sphinx-build -W -b html docs docs/_build/html
|
|
27
|
+
|
|
28
|
+
- name: Upload artifact
|
|
29
|
+
uses: actions/upload-artifact@v4
|
|
30
|
+
with:
|
|
31
|
+
name: html-docs
|
|
32
|
+
path: docs/_build/html/
|
|
33
|
+
retention-days: 7
|
|
34
|
+
|
|
35
|
+
deploy-release:
|
|
36
|
+
name: Deploy release (main)
|
|
37
|
+
needs: build
|
|
38
|
+
if: github.ref == 'refs/heads/main'
|
|
39
|
+
runs-on: ubuntu-latest
|
|
40
|
+
permissions:
|
|
41
|
+
contents: write
|
|
42
|
+
steps:
|
|
43
|
+
- uses: actions/checkout@v4
|
|
44
|
+
with:
|
|
45
|
+
fetch-depth: 0
|
|
46
|
+
|
|
47
|
+
- uses: astral-sh/setup-uv@v5
|
|
48
|
+
with:
|
|
49
|
+
enable-cache: true
|
|
50
|
+
|
|
51
|
+
- name: Install dependencies
|
|
52
|
+
run: uv sync --group docs
|
|
53
|
+
|
|
54
|
+
- name: Build all versions with sphinx-multiversion
|
|
55
|
+
run: uv run sphinx-multiversion docs docs/_build/html
|
|
56
|
+
|
|
57
|
+
- name: Create root redirect to latest release
|
|
58
|
+
run: |
|
|
59
|
+
LATEST=$(git tag -l 'v*' --sort=-version:refname | head -1)
|
|
60
|
+
LATEST=${LATEST:-main}
|
|
61
|
+
{
|
|
62
|
+
echo '<!DOCTYPE html>'
|
|
63
|
+
echo '<html><head>'
|
|
64
|
+
echo ' <meta charset="utf-8">'
|
|
65
|
+
echo " <title>Redirecting to ${LATEST}...</title>"
|
|
66
|
+
echo " <meta http-equiv=\"refresh\" content=\"0; url=${LATEST}/\">"
|
|
67
|
+
echo " <link rel=\"canonical\" href=\"${LATEST}/\" />"
|
|
68
|
+
echo '</head><body>'
|
|
69
|
+
echo " <p>Redirecting to <a href=\"${LATEST}/\">${LATEST}</a></p>"
|
|
70
|
+
echo '</body></html>'
|
|
71
|
+
} > docs/_build/html/index.html
|
|
72
|
+
|
|
73
|
+
- name: Deploy to gh-pages branch
|
|
74
|
+
uses: peaceiris/actions-gh-pages@v4
|
|
75
|
+
with:
|
|
76
|
+
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
77
|
+
publish_dir: docs/_build/html
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
name: Lint
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ "main" ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ "main" ]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
ruff:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: ["3.10"]
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- name: Checkout code
|
|
18
|
+
uses: actions/checkout@v4
|
|
19
|
+
|
|
20
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
21
|
+
uses: actions/setup-python@v5
|
|
22
|
+
with:
|
|
23
|
+
python-version: ${{ matrix.python-version }}
|
|
24
|
+
|
|
25
|
+
- name: Install dependencies
|
|
26
|
+
run: |
|
|
27
|
+
python -m pip install --upgrade pip
|
|
28
|
+
pip install ruff
|
|
29
|
+
|
|
30
|
+
- name: Run Ruff (Lint)
|
|
31
|
+
run: ruff check . --output-format=github
|
|
32
|
+
|
|
33
|
+
- name: Run Ruff (Format)
|
|
34
|
+
run: ruff format --check .
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
name: Deploy to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
build:
|
|
10
|
+
name: Build distribution
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
|
|
13
|
+
steps:
|
|
14
|
+
- name: Checkout code
|
|
15
|
+
uses: actions/checkout@v4
|
|
16
|
+
- name: Install uv
|
|
17
|
+
uses: astral-sh/setup-uv@v4
|
|
18
|
+
with:
|
|
19
|
+
enable-cache: true
|
|
20
|
+
- name: Build package
|
|
21
|
+
run: uv build
|
|
22
|
+
- name: Upload distribution artifacts
|
|
23
|
+
uses: actions/upload-artifact@v4
|
|
24
|
+
with:
|
|
25
|
+
name: dist
|
|
26
|
+
path: dist/
|
|
27
|
+
|
|
28
|
+
publish:
|
|
29
|
+
name: Publish to PyPI
|
|
30
|
+
needs: build
|
|
31
|
+
runs-on: ubuntu-latest
|
|
32
|
+
environment:
|
|
33
|
+
name: pypi
|
|
34
|
+
url: https://pypi.org/project/saealib/
|
|
35
|
+
permissions:
|
|
36
|
+
id-token: write
|
|
37
|
+
|
|
38
|
+
steps:
|
|
39
|
+
- name: Download distribution artifacts
|
|
40
|
+
uses: actions/download-artifact@v4
|
|
41
|
+
with:
|
|
42
|
+
name: dist
|
|
43
|
+
path: dist/
|
|
44
|
+
- name: Publish to PyPI
|
|
45
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
name: Test
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ "main" ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ "main" ]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
name: Run tests with pytest
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
strategy:
|
|
14
|
+
matrix:
|
|
15
|
+
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
|
16
|
+
|
|
17
|
+
steps:
|
|
18
|
+
- name: Checkout code
|
|
19
|
+
uses: actions/checkout@v4
|
|
20
|
+
- name: Install uv
|
|
21
|
+
uses: astral-sh/setup-uv@v4
|
|
22
|
+
with:
|
|
23
|
+
enable-cache: true
|
|
24
|
+
python-version: ${{ matrix.python-version }}
|
|
25
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
26
|
+
run: uv python install ${{ matrix.python-version }}
|
|
27
|
+
- name: Install dependencies
|
|
28
|
+
run: uv sync --all-extras --dev
|
|
29
|
+
- name: Run tests
|
|
30
|
+
run: uv run pytest
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
# Created by https://www.toptal.com/developers/gitignore/api/python
|
|
2
|
+
# Edit at https://www.toptal.com/developers/gitignore?templates=python
|
|
3
|
+
|
|
4
|
+
### Python ###
|
|
5
|
+
# Byte-compiled / optimized / DLL files
|
|
6
|
+
__pycache__/
|
|
7
|
+
*.py[cod]
|
|
8
|
+
*$py.class
|
|
9
|
+
|
|
10
|
+
# C extensions
|
|
11
|
+
*.so
|
|
12
|
+
|
|
13
|
+
# Distribution / packaging
|
|
14
|
+
.Python
|
|
15
|
+
build/
|
|
16
|
+
develop-eggs/
|
|
17
|
+
dist/
|
|
18
|
+
downloads/
|
|
19
|
+
eggs/
|
|
20
|
+
.eggs/
|
|
21
|
+
lib/
|
|
22
|
+
lib64/
|
|
23
|
+
parts/
|
|
24
|
+
sdist/
|
|
25
|
+
var/
|
|
26
|
+
wheels/
|
|
27
|
+
share/python-wheels/
|
|
28
|
+
*.egg-info/
|
|
29
|
+
.installed.cfg
|
|
30
|
+
*.egg
|
|
31
|
+
MANIFEST
|
|
32
|
+
|
|
33
|
+
# PyInstaller
|
|
34
|
+
# Usually these files are written by a python script from a template
|
|
35
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
36
|
+
*.manifest
|
|
37
|
+
*.spec
|
|
38
|
+
|
|
39
|
+
# Installer logs
|
|
40
|
+
pip-log.txt
|
|
41
|
+
pip-delete-this-directory.txt
|
|
42
|
+
|
|
43
|
+
# Unit test / coverage reports
|
|
44
|
+
htmlcov/
|
|
45
|
+
.tox/
|
|
46
|
+
.nox/
|
|
47
|
+
.coverage
|
|
48
|
+
.coverage.*
|
|
49
|
+
.cache
|
|
50
|
+
nosetests.xml
|
|
51
|
+
coverage.xml
|
|
52
|
+
*.cover
|
|
53
|
+
*.py,cover
|
|
54
|
+
.hypothesis/
|
|
55
|
+
.pytest_cache/
|
|
56
|
+
cover/
|
|
57
|
+
|
|
58
|
+
# Translations
|
|
59
|
+
*.mo
|
|
60
|
+
*.pot
|
|
61
|
+
|
|
62
|
+
# Django stuff:
|
|
63
|
+
*.log
|
|
64
|
+
local_settings.py
|
|
65
|
+
db.sqlite3
|
|
66
|
+
db.sqlite3-journal
|
|
67
|
+
|
|
68
|
+
# Flask stuff:
|
|
69
|
+
instance/
|
|
70
|
+
.webassets-cache
|
|
71
|
+
|
|
72
|
+
# Scrapy stuff:
|
|
73
|
+
.scrapy
|
|
74
|
+
|
|
75
|
+
# Sphinx documentation
|
|
76
|
+
docs/_build/
|
|
77
|
+
|
|
78
|
+
# PyBuilder
|
|
79
|
+
.pybuilder/
|
|
80
|
+
target/
|
|
81
|
+
|
|
82
|
+
# Jupyter Notebook
|
|
83
|
+
.ipynb_checkpoints
|
|
84
|
+
|
|
85
|
+
# IPython
|
|
86
|
+
profile_default/
|
|
87
|
+
ipython_config.py
|
|
88
|
+
|
|
89
|
+
# pyenv
|
|
90
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
91
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
92
|
+
# .python-version
|
|
93
|
+
|
|
94
|
+
# pipenv
|
|
95
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
96
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
97
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
98
|
+
# install all needed dependencies.
|
|
99
|
+
#Pipfile.lock
|
|
100
|
+
|
|
101
|
+
# poetry
|
|
102
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
103
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
104
|
+
# commonly ignored for libraries.
|
|
105
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
106
|
+
#poetry.lock
|
|
107
|
+
|
|
108
|
+
# pdm
|
|
109
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
110
|
+
#pdm.lock
|
|
111
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
112
|
+
# in version control.
|
|
113
|
+
# https://pdm.fming.dev/#use-with-ide
|
|
114
|
+
.pdm.toml
|
|
115
|
+
|
|
116
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
117
|
+
__pypackages__/
|
|
118
|
+
|
|
119
|
+
# Celery stuff
|
|
120
|
+
celerybeat-schedule
|
|
121
|
+
celerybeat.pid
|
|
122
|
+
|
|
123
|
+
# SageMath parsed files
|
|
124
|
+
*.sage.py
|
|
125
|
+
|
|
126
|
+
# Environments
|
|
127
|
+
.env
|
|
128
|
+
.venv
|
|
129
|
+
env/
|
|
130
|
+
venv/
|
|
131
|
+
ENV/
|
|
132
|
+
env.bak/
|
|
133
|
+
venv.bak/
|
|
134
|
+
|
|
135
|
+
# Spyder project settings
|
|
136
|
+
.spyderproject
|
|
137
|
+
.spyproject
|
|
138
|
+
|
|
139
|
+
# Rope project settings
|
|
140
|
+
.ropeproject
|
|
141
|
+
|
|
142
|
+
# mkdocs documentation
|
|
143
|
+
/site
|
|
144
|
+
|
|
145
|
+
# mypy
|
|
146
|
+
.mypy_cache/
|
|
147
|
+
.dmypy.json
|
|
148
|
+
dmypy.json
|
|
149
|
+
|
|
150
|
+
# Pyre type checker
|
|
151
|
+
.pyre/
|
|
152
|
+
|
|
153
|
+
# pytype static type analyzer
|
|
154
|
+
.pytype/
|
|
155
|
+
|
|
156
|
+
# Cython debug symbols
|
|
157
|
+
cython_debug/
|
|
158
|
+
|
|
159
|
+
# PyCharm
|
|
160
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
161
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
162
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
163
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
164
|
+
#.idea/
|
|
165
|
+
|
|
166
|
+
### Python Patch ###
|
|
167
|
+
# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
|
|
168
|
+
poetry.toml
|
|
169
|
+
|
|
170
|
+
# ruff
|
|
171
|
+
.ruff_cache/
|
|
172
|
+
|
|
173
|
+
# LSP config files
|
|
174
|
+
pyrightconfig.json
|
|
175
|
+
|
|
176
|
+
# End of https://www.toptal.com/developers/gitignore/api/python
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.1.0b1] - 2026-05-03
|
|
9
|
+
|
|
10
|
+
Initial beta release of saealib.
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **High-level API**: `minimize()` and `maximize()` functions for quick setup with sensible defaults
|
|
15
|
+
- **Low-level API**: `Optimizer` builder with swappable components via `set_algorithm()`, `set_surrogate_manager()`, and `set_strategy()`
|
|
16
|
+
- **Algorithms**: Genetic Algorithm (`GA`) with crossover, mutation, and selection operators
|
|
17
|
+
- **Surrogate models**: RBF (Radial Basis Function) surrogate with configurable kernels
|
|
18
|
+
- **Acquisition functions**: pluggable acquisition function interface with built-in implementations
|
|
19
|
+
- **Optimization strategies**: `IndividualBasedStrategy`, `GenerationBasedStrategy`, `PreSelectionStrategy`
|
|
20
|
+
- **Multi-objective support**: Pareto-based archive and multi-objective problem interface
|
|
21
|
+
- **Constraint handling**: feasibility-aware selection and result reporting
|
|
22
|
+
- **Callbacks**: extensible callback interface for monitoring and early stopping
|
|
23
|
+
- **Archive**: solution archive with sorting and feasibility tracking
|
|
24
|
+
- **Problem definition**: `Problem` class supporting minimization (`weight=-1`) and maximization (`weight=+1`)
|
|
25
|
+
- **Termination criteria**: configurable stopping conditions
|
|
26
|
+
- **Type hints**: fully typed public API, PEP 561 compliant (`py.typed` marker included)
|
|
27
|
+
|
|
28
|
+
[0.1.0b1]: https://github.com/shlka/saealib/releases/tag/v0.1.0b1
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
Thank you for your interest in contributing to `saealib`! We welcome contributions from everyone. This document outlines the process for contributing to this project.
|
|
2
|
+
|
|
3
|
+
### 1. Development Environment Setup
|
|
4
|
+
|
|
5
|
+
This project uses **[uv](https://github.com/astral-sh/uv)** for dependency management and **[Ruff](https://github.com/astral-sh/ruff)** for linting and formatting.
|
|
6
|
+
|
|
7
|
+
1. **Install uv** (if you haven't already):
|
|
8
|
+
```bash
|
|
9
|
+
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
2. **Clone the repository**:
|
|
14
|
+
```bash
|
|
15
|
+
git clone https://github.com/shlka/saealib.git
|
|
16
|
+
cd saealib
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
3. **Install dependencies**:
|
|
21
|
+
```bash
|
|
22
|
+
uv pip install -e .[dev]
|
|
23
|
+
# Or if you are using a virtual environment managed by uv:
|
|
24
|
+
uv sync
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### 2. Coding Style
|
|
30
|
+
|
|
31
|
+
We adhere to strict coding standards to ensure maintainability.
|
|
32
|
+
|
|
33
|
+
* **Linter & Formatter**: We use `ruff`. Please ensure your code passes all checks before submitting a PR.
|
|
34
|
+
```bash
|
|
35
|
+
ruff check .
|
|
36
|
+
ruff format .
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
* **Type Hinting**: Type hints are strongly encouraged for all public APIs.
|
|
41
|
+
* **Docstrings**: We follow the **NumPy style** docstrings.
|
|
42
|
+
|
|
43
|
+
### 3. Testing Policy
|
|
44
|
+
|
|
45
|
+
We use `pytest` for testing. Since this library involves stochastic evolutionary algorithms, we have a specific testing strategy to distinguish between "expected random variations" and "regressions."
|
|
46
|
+
|
|
47
|
+
#### Running Tests
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
pytest
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
#### Test Categories
|
|
54
|
+
|
|
55
|
+
1. **Smoke Tests**: Checks if the example code runs without errors.
|
|
56
|
+
2. **Unit Tests**: Verifies data structures (`Population`) and deterministic logic (`Repair`, `Constraints`).
|
|
57
|
+
3. **Regression Tests (Fixed Seed)**: Checks if the optimization results exactly match the recorded snapshots using a fixed random seed.
|
|
58
|
+
|
|
59
|
+
#### Handling Regression Test Failures
|
|
60
|
+
|
|
61
|
+
`test_integration` serves as both regression testing and integration testing.
|
|
62
|
+
If `test_integration` fails, check the following:
|
|
63
|
+
|
|
64
|
+
* **Case A: Refactoring (No logic change)**
|
|
65
|
+
* **Goal**: The results must match bit-for-bit.
|
|
66
|
+
* **Action**: If the test fails, you likely introduced a bug. Fix your code. **Do not update the snapshot.**
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
* **Case B: Logic Change / Feature Addition**
|
|
70
|
+
* **Goal**: The results are expected to change.
|
|
71
|
+
* **Action**:
|
|
72
|
+
1. Run the snapshot generation script:
|
|
73
|
+
```bash
|
|
74
|
+
python scripts/generate_test_integration.py
|
|
75
|
+
```
|
|
76
|
+
2. Check the diff of `tests/data/test_integration.json`.
|
|
77
|
+
3. Verify if the performance has improved (lower objective value) or stayed within an acceptable range. **Significant degradation is not allowed.**
|
|
78
|
+
4. Commit the updated snapshot file along with your code changes.
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
### 4. Pull Request Guidelines
|
|
82
|
+
|
|
83
|
+
1. Ensure all tests pass locally.
|
|
84
|
+
2. If you updated the regression snapshots, please include a summary of the changes in the PR description:
|
|
85
|
+
> **Regression Update**
|
|
86
|
+
> * Seed 0: `1.234` -> `0.987` (Improved)
|
|
87
|
+
> * Seed 1: `2.345` -> `2.350` (Neutral)
|
|
88
|
+
>
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
3. Use the provided Pull Request Template.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
FROM python:3.10-slim
|
|
2
|
+
|
|
3
|
+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
|
|
4
|
+
|
|
5
|
+
ENV PYTHONDONBUFFERED=1 \
|
|
6
|
+
PYTHONDONTWRITEBYTECODE=1 \
|
|
7
|
+
UV_COMPILE_BYTECODE=1 \
|
|
8
|
+
UV_LINK_MODE=copy
|
|
9
|
+
|
|
10
|
+
WORKDIR /src
|
|
11
|
+
|
|
12
|
+
COPY pyproject.toml uv.lock ./
|
|
13
|
+
|
|
14
|
+
ENV VIRTUAL_ENV=/opt/venv
|
|
15
|
+
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
|
|
16
|
+
|
|
17
|
+
RUN uv venv $VIRTUAL_ENV && \
|
|
18
|
+
uv sync --frozen --no-install-project --no-dev
|
|
19
|
+
|
|
20
|
+
COPY . .
|
saealib-0.1.0b1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 shlka
|
|
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.
|