evograd-diff 0.1.0__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.
- evograd/__init__.py +67 -0
- evograd/algorithms/__init__.py +138 -0
- evograd/algorithms/cmaes.py +1365 -0
- evograd/algorithms/de.py +895 -0
- evograd/algorithms/ga.py +532 -0
- evograd/algorithms/pso.py +648 -0
- evograd/algorithms/shade.py +1165 -0
- evograd/benchmarks/functions/__init__.py +229 -0
- evograd/benchmarks/functions/base.py +217 -0
- evograd/benchmarks/functions/cec2017/__init__.py +250 -0
- evograd/benchmarks/functions/cec2017/basic.py +413 -0
- evograd/benchmarks/functions/cec2017/composition.py +580 -0
- evograd/benchmarks/functions/cec2017/data.pkl +0 -0
- evograd/benchmarks/functions/cec2017/data.py +350 -0
- evograd/benchmarks/functions/cec2017/hybrid.py +406 -0
- evograd/benchmarks/functions/cec2017/simple.py +326 -0
- evograd/benchmarks/functions/classical.py +649 -0
- evograd/benchmarks/functions/smoothed_funnel.py +476 -0
- evograd/benchmarks/functions/transforms.py +463 -0
- evograd/benchmarks/run_benchmark_functions.py +1208 -0
- evograd/core/__init__.py +73 -0
- evograd/core/algorithm.py +778 -0
- evograd/core/maximize.py +269 -0
- evograd/core/minimize.py +740 -0
- evograd/core/problem.py +444 -0
- evograd/core/result.py +571 -0
- evograd/core/termination.py +602 -0
- evograd/operators/__init__.py +178 -0
- evograd/operators/crossover.py +1117 -0
- evograd/operators/mutation.py +1098 -0
- evograd/operators/relaxations.py +175 -0
- evograd/operators/repair.py +601 -0
- evograd/operators/sampling.py +577 -0
- evograd/operators/selection.py +981 -0
- evograd/operators/survival.py +1000 -0
- evograd/tests/__init__.py +11 -0
- evograd/tests/run_all.py +78 -0
- evograd/tests/test_core.py +528 -0
- evograd/tests/test_ga.py +572 -0
- evograd/tests/test_operators.py +662 -0
- evograd/tests/test_per_individual.py +326 -0
- evograd/tests/test_utils.py +328 -0
- evograd/utils/__init__.py +97 -0
- evograd/utils/callbacks.py +926 -0
- evograd/utils/device.py +502 -0
- evograd/utils/duplicates.py +421 -0
- evograd_diff-0.1.0.dist-info/METADATA +439 -0
- evograd_diff-0.1.0.dist-info/RECORD +50 -0
- evograd_diff-0.1.0.dist-info/WHEEL +4 -0
- evograd_diff-0.1.0.dist-info/licenses/LICENSE +201 -0
evograd/core/__init__.py
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"""
|
|
2
|
+
EvoGrad core module.
|
|
3
|
+
|
|
4
|
+
This module provides the foundational classes for building
|
|
5
|
+
population-based optimisation algorithms:
|
|
6
|
+
|
|
7
|
+
- Algorithm: Abstract base class for all algorithms
|
|
8
|
+
- AlgorithmState: Container for algorithm state
|
|
9
|
+
- Problem: Objective function + bounds + constraints
|
|
10
|
+
- Result: Container for optimisation results
|
|
11
|
+
- Termination: Termination criteria (MaxEvaluations, etc.)
|
|
12
|
+
- minimize/maximize: Main entry points for optimisation
|
|
13
|
+
|
|
14
|
+
Example:
|
|
15
|
+
>>> from evograd.core.problem import Problem
|
|
16
|
+
>>> from evograd.core.minimize import minimize
|
|
17
|
+
>>> from evograd.core.termination import MaxEvaluations
|
|
18
|
+
>>> from evograd.algorithms import GA
|
|
19
|
+
>>>
|
|
20
|
+
>>> problem = Problem(
|
|
21
|
+
... objective=lambda x: (x**2).sum(dim=-1),
|
|
22
|
+
... n_var=10,
|
|
23
|
+
... xl=-5.0,
|
|
24
|
+
... xu=5.0,
|
|
25
|
+
... )
|
|
26
|
+
>>>
|
|
27
|
+
>>> algorithm = GA(pop_size=100)
|
|
28
|
+
>>> result = minimize(problem, algorithm, termination=MaxEvaluations(10000))
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
from evograd.core.algorithm import (
|
|
32
|
+
Algorithm,
|
|
33
|
+
AlgorithmState,
|
|
34
|
+
)
|
|
35
|
+
from evograd.core.problem import Problem
|
|
36
|
+
from evograd.core.result import Result, ResultBuilder
|
|
37
|
+
from evograd.core.termination import (
|
|
38
|
+
Termination,
|
|
39
|
+
MaxEvaluations,
|
|
40
|
+
MaxGenerations,
|
|
41
|
+
TargetReached,
|
|
42
|
+
ToleranceReached,
|
|
43
|
+
TimeLimit,
|
|
44
|
+
NoTermination,
|
|
45
|
+
TerminationCollection,
|
|
46
|
+
default_termination,
|
|
47
|
+
)
|
|
48
|
+
from evograd.core.minimize import minimize
|
|
49
|
+
from evograd.core.maximize import maximize
|
|
50
|
+
|
|
51
|
+
__all__ = [
|
|
52
|
+
# Algorithm
|
|
53
|
+
"Algorithm",
|
|
54
|
+
"AlgorithmState",
|
|
55
|
+
# Problem
|
|
56
|
+
"Problem",
|
|
57
|
+
# Result
|
|
58
|
+
"Result",
|
|
59
|
+
"ResultBuilder",
|
|
60
|
+
# Termination
|
|
61
|
+
"Termination",
|
|
62
|
+
"MaxEvaluations",
|
|
63
|
+
"MaxGenerations",
|
|
64
|
+
"TargetReached",
|
|
65
|
+
"ToleranceReached",
|
|
66
|
+
"TimeLimit",
|
|
67
|
+
"NoTermination",
|
|
68
|
+
"TerminationCollection",
|
|
69
|
+
"default_termination",
|
|
70
|
+
# Optimization functions
|
|
71
|
+
"minimize",
|
|
72
|
+
"maximize",
|
|
73
|
+
]
|