pydmoo 0.0.10__py3-none-any.whl → 0.0.11__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.
@@ -0,0 +1,98 @@
1
+ import numpy as np
2
+
3
+
4
+ def matrix_conditional_update(x_curr, lb, ub, x_prev):
5
+ """
6
+ Vectorized conditional matrix update with bounded interpolation.
7
+
8
+ Parameters
9
+ ----------
10
+ x_curr : ndarray, shape (N, n)
11
+ Observation matrix.
12
+ lb : ndarray, shape (1, n) or (n,)
13
+ Lower bounds for each dimension.
14
+ ub : ndarray, shape (1, n) or (n,)
15
+ Upper bounds for each dimension.
16
+ x_prev : ndarray, shape (N, n)
17
+ Previous state matrix.
18
+
19
+ Returns
20
+ -------
21
+ ndarray, shape (N, n)
22
+ Updated matrix where:
23
+ - Values within bounds remain unchanged
24
+ - Values below bounds become 0.5*(a + x_prev)
25
+ - Values above bounds become 0.5*(b + x_prev)
26
+
27
+ Notes
28
+ -----
29
+ Uses NumPy broadcasting for efficient vectorized operations.
30
+ """
31
+ lb = np.reshape(lb, (1, -1))
32
+ ub = np.reshape(ub, (1, -1))
33
+ x_new = np.zeros_like(x_curr)
34
+
35
+ mask = (x_curr >= lb) & (x_curr <= ub)
36
+ x_new[mask] = x_curr[mask]
37
+
38
+ mask = x_curr < lb
39
+ x_new[mask] = 0.5 * (lb + x_prev)[mask]
40
+
41
+ mask = x_curr > ub
42
+ x_new[mask] = 0.5 * (ub + x_prev)[mask]
43
+
44
+ return x_new
45
+
46
+
47
+ def clip_and_randomize(x, lb, ub):
48
+ """
49
+ Clip values to bounds with random replacement for out-of-bounds values.
50
+
51
+ Parameters
52
+ ----------
53
+ x : ndarray, shape (N, n)
54
+ Input matrix.
55
+ lb : ndarray, shape (1, n) or (n,)
56
+ Lower bounds.
57
+ ub : ndarray, shape (1, n) or (n,)
58
+ Upper bounds.
59
+
60
+ Returns
61
+ -------
62
+ ndarray, shape (N, n)
63
+ Matrix where out-of-bounds values are replaced with uniform random
64
+ values within [lb, ub] for each dimension.
65
+
66
+ See Also
67
+ --------
68
+ numpy.random.uniform : Used for random value generation.
69
+ """
70
+ out_of_bounds = (x < lb) | (x > ub)
71
+ random_samples = np.random.uniform(low=lb, high=ub, size=x.shape)
72
+ return np.where(out_of_bounds, random_samples, x)
73
+
74
+
75
+ def clip_by_numpy(x, lb, ub):
76
+ """
77
+ Clip values to interval [lb, ub].
78
+
79
+ Parameters
80
+ ----------
81
+ x : ndarray
82
+ Array containing elements to clip.
83
+ lb : ndarray or scalar
84
+ Minimum value.
85
+ ub : ndarray or scalar
86
+ Maximum value.
87
+
88
+ Returns
89
+ -------
90
+ ndarray
91
+ Clipped array where:
92
+ x_clipped = max(lb, min(ub, x))
93
+
94
+ Notes
95
+ -----
96
+ This is a wrapper around numpy.clip() with identical behavior.
97
+ """
98
+ return np.clip(x, lb, ub)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pydmoo
3
- Version: 0.0.10
3
+ Version: 0.0.11
4
4
  Summary: pydmoo
5
5
  Project-URL: Homepage, https://github.com/dynoptimization/pydmoo
6
6
  Project-URL: Repository, https://github.com/dynoptimization/pydmoo
@@ -35,10 +35,12 @@ Requires-Dist: statsmodels>=0.14.5
35
35
  Requires-Dist: tabulate>=0.9.0
36
36
  Description-Content-Type: text/markdown
37
37
 
38
- # pydmoo
38
+ # Dynamic Multi-Objective Optimization in Python
39
+
40
+ [![License](https://img.shields.io/badge/license-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0.en.html)
41
+ ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pydmoo)
42
+ [![PyPI](https://img.shields.io/pypi/v/pydmoo)](https://pypi.org/project/pydmoo/)
39
43
 
40
44
  ## Dynamic Multi-Objective Optimization Problems (DMOPs)
41
45
 
42
46
  ## Dynamic Multi-Objective Optimization Algorithms (DMOAs)
43
-
44
- ## Dynamic Multi-Objective Optimization Benchmarks (DMOBs)
@@ -1,8 +1,9 @@
1
1
  pydmoo/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  pydmoo/response/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  pydmoo/response/ar_model.py,sha256=EmT46fEAcHJe7GrmKN9OVBv-x_nF-fZpJcPTX09FSGw,2676
4
+ pydmoo/response/bounds.py,sha256=XvYYXeEbMWGbG_APd-GtjtL1R47wWgBhqB-eWOIyirQ,2396
4
5
  pydmoo/response/tca_model.py,sha256=hfGdJUs01lYzkCvleJ0ScAsVVIoc-EmftBu_ej_ksBg,5405
5
- pydmoo-0.0.10.dist-info/METADATA,sha256=uVRMyWa6-iu5V4stQW6o62NVpzd2RgtVNNP1BwMZ5Bg,1686
6
- pydmoo-0.0.10.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
7
- pydmoo-0.0.10.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
8
- pydmoo-0.0.10.dist-info/RECORD,,
6
+ pydmoo-0.0.11.dist-info/METADATA,sha256=ojXOfSIKhoOi4aDBz7DuWpCFMvqj8xyxultz1xFII-g,1933
7
+ pydmoo-0.0.11.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
8
+ pydmoo-0.0.11.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
9
+ pydmoo-0.0.11.dist-info/RECORD,,