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.
Files changed (50) hide show
  1. evograd/__init__.py +67 -0
  2. evograd/algorithms/__init__.py +138 -0
  3. evograd/algorithms/cmaes.py +1365 -0
  4. evograd/algorithms/de.py +895 -0
  5. evograd/algorithms/ga.py +532 -0
  6. evograd/algorithms/pso.py +648 -0
  7. evograd/algorithms/shade.py +1165 -0
  8. evograd/benchmarks/functions/__init__.py +229 -0
  9. evograd/benchmarks/functions/base.py +217 -0
  10. evograd/benchmarks/functions/cec2017/__init__.py +250 -0
  11. evograd/benchmarks/functions/cec2017/basic.py +413 -0
  12. evograd/benchmarks/functions/cec2017/composition.py +580 -0
  13. evograd/benchmarks/functions/cec2017/data.pkl +0 -0
  14. evograd/benchmarks/functions/cec2017/data.py +350 -0
  15. evograd/benchmarks/functions/cec2017/hybrid.py +406 -0
  16. evograd/benchmarks/functions/cec2017/simple.py +326 -0
  17. evograd/benchmarks/functions/classical.py +649 -0
  18. evograd/benchmarks/functions/smoothed_funnel.py +476 -0
  19. evograd/benchmarks/functions/transforms.py +463 -0
  20. evograd/benchmarks/run_benchmark_functions.py +1208 -0
  21. evograd/core/__init__.py +73 -0
  22. evograd/core/algorithm.py +778 -0
  23. evograd/core/maximize.py +269 -0
  24. evograd/core/minimize.py +740 -0
  25. evograd/core/problem.py +444 -0
  26. evograd/core/result.py +571 -0
  27. evograd/core/termination.py +602 -0
  28. evograd/operators/__init__.py +178 -0
  29. evograd/operators/crossover.py +1117 -0
  30. evograd/operators/mutation.py +1098 -0
  31. evograd/operators/relaxations.py +175 -0
  32. evograd/operators/repair.py +601 -0
  33. evograd/operators/sampling.py +577 -0
  34. evograd/operators/selection.py +981 -0
  35. evograd/operators/survival.py +1000 -0
  36. evograd/tests/__init__.py +11 -0
  37. evograd/tests/run_all.py +78 -0
  38. evograd/tests/test_core.py +528 -0
  39. evograd/tests/test_ga.py +572 -0
  40. evograd/tests/test_operators.py +662 -0
  41. evograd/tests/test_per_individual.py +326 -0
  42. evograd/tests/test_utils.py +328 -0
  43. evograd/utils/__init__.py +97 -0
  44. evograd/utils/callbacks.py +926 -0
  45. evograd/utils/device.py +502 -0
  46. evograd/utils/duplicates.py +421 -0
  47. evograd_diff-0.1.0.dist-info/METADATA +439 -0
  48. evograd_diff-0.1.0.dist-info/RECORD +50 -0
  49. evograd_diff-0.1.0.dist-info/WHEEL +4 -0
  50. evograd_diff-0.1.0.dist-info/licenses/LICENSE +201 -0
@@ -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
+ ]