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,97 @@
1
+ """
2
+ EvoGrad utilities module.
3
+
4
+ This module provides utility functions and classes for:
5
+ - Device management (CPU/CUDA/MPS auto-detection)
6
+ - Tensor conversion and validation
7
+ - Duplicate elimination in populations
8
+ - Callbacks for monitoring optimisation
9
+ - Seeding for reproducibility
10
+
11
+ Submodules:
12
+ - device: Hardware device utilities
13
+ - duplicates: Population duplicate detection and removal
14
+ - callbacks: Optimisation monitoring and control
15
+ """
16
+
17
+ from evograd.utils.device import (
18
+ # Device detection
19
+ get_device,
20
+ default_device,
21
+ reset_default_device,
22
+ get_default_dtype,
23
+ # Tensor utilities
24
+ ensure_tensor,
25
+ ensure_bounds,
26
+ to_device,
27
+ # Reproducibility
28
+ set_seed,
29
+ # Memory and sync
30
+ sync_device,
31
+ get_memory_info,
32
+ # Context manager
33
+ DeviceContext,
34
+ # Type alias
35
+ TensorLike,
36
+ )
37
+
38
+ from evograd.utils.duplicates import (
39
+ DuplicateMethod,
40
+ DuplicateEliminator,
41
+ eliminate_duplicates,
42
+ has_duplicates,
43
+ count_duplicates,
44
+ )
45
+
46
+ from evograd.utils.callbacks import (
47
+ CallbackEvent,
48
+ CallbackState,
49
+ Callback,
50
+ HistoryCallback,
51
+ EarlyStoppingCallback,
52
+ ConvergenceCallback,
53
+ PrintCallback,
54
+ CheckpointCallback,
55
+ CompositeCallback,
56
+ CallbackList,
57
+ create_default_callbacks,
58
+ )
59
+
60
+ __all__ = [
61
+ # Device detection
62
+ "get_device",
63
+ "default_device",
64
+ "reset_default_device",
65
+ "get_default_dtype",
66
+ # Tensor utilities
67
+ "ensure_tensor",
68
+ "ensure_bounds",
69
+ "to_device",
70
+ # Reproducibility
71
+ "set_seed",
72
+ # Memory and sync
73
+ "sync_device",
74
+ "get_memory_info",
75
+ # Context manager
76
+ "DeviceContext",
77
+ # Type alias
78
+ "TensorLike",
79
+ # Duplicate elimination
80
+ "DuplicateMethod",
81
+ "DuplicateEliminator",
82
+ "eliminate_duplicates",
83
+ "has_duplicates",
84
+ "count_duplicates",
85
+ # Callbacks
86
+ "CallbackEvent",
87
+ "CallbackState",
88
+ "Callback",
89
+ "HistoryCallback",
90
+ "EarlyStoppingCallback",
91
+ "ConvergenceCallback",
92
+ "PrintCallback",
93
+ "CheckpointCallback",
94
+ "CompositeCallback",
95
+ "CallbackList",
96
+ "create_default_callbacks",
97
+ ]