pymoo 0.6.1.3__cp311-cp311-win_amd64.whl → 0.6.1.5.dev0__cp311-cp311-win_amd64.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 (65) hide show
  1. pymoo/algorithms/moo/age.py +13 -7
  2. pymoo/algorithms/moo/age2.py +49 -19
  3. pymoo/algorithms/moo/ctaea.py +2 -2
  4. pymoo/algorithms/moo/kgb.py +9 -9
  5. pymoo/algorithms/moo/nsga3.py +2 -2
  6. pymoo/algorithms/moo/pinsga2.py +370 -0
  7. pymoo/algorithms/moo/rnsga3.py +2 -2
  8. pymoo/algorithms/soo/nonconvex/es.py +3 -2
  9. pymoo/config.py +1 -1
  10. pymoo/core/algorithm.py +1 -1
  11. pymoo/core/individual.py +8 -7
  12. pymoo/core/replacement.py +5 -5
  13. pymoo/core/survival.py +1 -1
  14. pymoo/core/variable.py +9 -9
  15. pymoo/cython/calc_perpendicular_distance.cp311-win_amd64.pyd +0 -0
  16. pymoo/cython/calc_perpendicular_distance.cpp +27467 -0
  17. pymoo/cython/calc_perpendicular_distance.pyx +67 -0
  18. pymoo/cython/decomposition.cp311-win_amd64.pyd +0 -0
  19. pymoo/cython/decomposition.cpp +28877 -0
  20. pymoo/cython/decomposition.pyx +165 -0
  21. pymoo/cython/hv.cp311-win_amd64.pyd +0 -0
  22. pymoo/cython/hv.cpp +27559 -0
  23. pymoo/cython/hv.pyx +18 -0
  24. pymoo/cython/info.cp311-win_amd64.pyd +0 -0
  25. pymoo/cython/info.cpp +6653 -0
  26. pymoo/cython/info.pyx +5 -0
  27. pymoo/cython/mnn.cp311-win_amd64.pyd +0 -0
  28. pymoo/cython/mnn.cpp +30117 -0
  29. pymoo/cython/mnn.pyx +273 -0
  30. pymoo/cython/non_dominated_sorting.cp311-win_amd64.pyd +0 -0
  31. pymoo/cython/non_dominated_sorting.cpp +35256 -0
  32. pymoo/cython/non_dominated_sorting.pyx +645 -0
  33. pymoo/cython/pruning_cd.cp311-win_amd64.pyd +0 -0
  34. pymoo/cython/pruning_cd.cpp +29277 -0
  35. pymoo/cython/pruning_cd.pyx +197 -0
  36. pymoo/cython/stochastic_ranking.cp311-win_amd64.pyd +0 -0
  37. pymoo/cython/stochastic_ranking.cpp +27872 -0
  38. pymoo/cython/stochastic_ranking.pyx +49 -0
  39. pymoo/cython/vendor/hypervolume.cpp +1621 -0
  40. pymoo/docs.py +1 -1
  41. pymoo/operators/crossover/ox.py +1 -1
  42. pymoo/operators/selection/rnd.py +2 -2
  43. pymoo/operators/selection/tournament.py +5 -5
  44. pymoo/optimize.py +2 -2
  45. pymoo/problems/dynamic/df.py +4 -4
  46. pymoo/problems/single/traveling_salesman.py +1 -1
  47. pymoo/util/misc.py +2 -2
  48. pymoo/util/mnn.py +2 -2
  49. pymoo/util/nds/fast_non_dominated_sort.py +5 -3
  50. pymoo/util/nds/non_dominated_sorting.py +2 -2
  51. pymoo/util/normalization.py +5 -8
  52. pymoo/util/ref_dirs/energy.py +4 -2
  53. pymoo/util/ref_dirs/reduction.py +1 -1
  54. pymoo/util/reference_direction.py +3 -2
  55. pymoo/util/value_functions.py +719 -0
  56. pymoo/util/vf_dominator.py +99 -0
  57. pymoo/version.py +1 -1
  58. pymoo/visualization/heatmap.py +3 -3
  59. pymoo/visualization/pcp.py +1 -1
  60. pymoo/visualization/radar.py +1 -1
  61. {pymoo-0.6.1.3.dist-info → pymoo-0.6.1.5.dev0.dist-info}/METADATA +12 -13
  62. {pymoo-0.6.1.3.dist-info → pymoo-0.6.1.5.dev0.dist-info}/RECORD +65 -45
  63. {pymoo-0.6.1.3.dist-info → pymoo-0.6.1.5.dev0.dist-info}/WHEEL +1 -1
  64. {pymoo-0.6.1.3.dist-info → pymoo-0.6.1.5.dev0.dist-info/licenses}/LICENSE +0 -0
  65. {pymoo-0.6.1.3.dist-info → pymoo-0.6.1.5.dev0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,165 @@
1
+ # distutils: language = c++
2
+ # cython: language_level=2, boundscheck=False, wraparound=False, cdivision=True
3
+
4
+
5
+ import numpy as np
6
+ from libcpp.vector cimport vector
7
+
8
+
9
+ # -----------------------------------------------------------
10
+ # INTERFACE
11
+ # -----------------------------------------------------------
12
+
13
+ def calc_perpendicular_distance(double[:,:] P, double[:,:] L):
14
+ return np.array(c_calc_perpendicular_distance(P, L))
15
+
16
+
17
+ def pbi(double[:,:] F, double[:,:] weights, double[:] ideal_point, double theta, double eps=1e-10):
18
+ return np.array(c_pbi(F, weights, ideal_point, theta, eps), dtype=np.float64)
19
+
20
+
21
+ def calc_distance_to_weights(F, weights, utopian_point=None):
22
+
23
+ if utopian_point is None:
24
+ utopian_point = np.zeros(F.shape[1])
25
+
26
+ norm = np.linalg.norm(weights, axis=1)
27
+
28
+ d1, d2 = np.zeros(F.shape[0]), np.zeros(F.shape[0])
29
+
30
+ F = F - utopian_point
31
+ c_d1(d1, F, weights, norm)
32
+ c_d2(d2, F, weights, d1, norm)
33
+
34
+ return d1, d2
35
+
36
+
37
+ # -----------------------------------------------------------
38
+ # IMPLEMENTATION
39
+ # -----------------------------------------------------------
40
+
41
+ cdef extern from "math.h":
42
+ double sqrt(double m)
43
+ double pow(double base, double exponent)
44
+
45
+
46
+
47
+
48
+ cdef double c_norm(double[:] v):
49
+ cdef:
50
+ double val
51
+ int i
52
+
53
+ val = 0
54
+ for i in range(v.shape[0]):
55
+ val += pow(v[i], 2)
56
+ val = sqrt(val)
57
+ return val
58
+
59
+
60
+ cdef double[:,:] c_calc_perpendicular_distance(double[:,:] P, double[:,:] L):
61
+ cdef :
62
+ int s_L, s_P, n_dim, i, j, k
63
+ double[:,:] M
64
+ vector[double] N
65
+ double norm, dot, perp_dist, norm_scalar_proj
66
+
67
+ s_L = L.shape[0]
68
+ s_P = P.shape[0]
69
+ n_dim = L.shape[1]
70
+
71
+ M = np.zeros((s_P, s_L), dtype=np.float64)
72
+
73
+ for i in range(s_L):
74
+
75
+ norm = c_norm(L[i, :])
76
+
77
+ N = vector[double](n_dim)
78
+ for k in range(n_dim):
79
+ N[k] = L[i, k] / norm
80
+
81
+ for j in range(s_P):
82
+
83
+ dot = 0
84
+ for k in range(n_dim):
85
+ dot += L[i, k] * P[j, k]
86
+ norm_scalar_proj = dot / norm
87
+
88
+ perp_dist = 0
89
+ for k in range(n_dim):
90
+ perp_dist += pow(norm_scalar_proj * N[k] - P[j, k], 2)
91
+ perp_dist = sqrt(perp_dist)
92
+
93
+ M[j, i] = perp_dist
94
+
95
+ return M
96
+
97
+
98
+
99
+ cdef vector[double] c_pbi(double[:,:] F, double[:,:] weights, double[:] ideal_point, double theta, double eps):
100
+ cdef:
101
+ double d1, d2, f_max, norm
102
+ int i, j, n_dim
103
+ vector[double] pbi
104
+
105
+ n_points = F.shape[0]
106
+ n_obj = F.shape[1]
107
+ pbi = vector[double](n_points)
108
+
109
+ for i in range(n_points):
110
+
111
+ norm = c_norm(weights[i,:])
112
+
113
+ d1 = 0
114
+ for j in range(n_obj):
115
+ d1 += (F[i,j] - ideal_point[j] + eps) * weights[i,j]
116
+ d1 = d1 / norm
117
+
118
+ d2 = 0
119
+ for j in range(n_obj):
120
+ d2 += pow(F[i,j] - ideal_point[j] + eps - (d1 * weights[i,j] / norm), 2.0)
121
+ d2 = sqrt(d2)
122
+
123
+ pbi[i] = d1 + theta * d2
124
+
125
+ return pbi
126
+
127
+
128
+
129
+
130
+ cdef void c_d1(double[:] d1, double[:,:] F, double[:,:] weights, double[:] norm):
131
+ cdef:
132
+ double val
133
+ int i, j
134
+
135
+ n_points = F.shape[0]
136
+ n_obj = F.shape[1]
137
+
138
+ for i in range(n_points):
139
+
140
+ val = 0
141
+ for j in range(n_obj):
142
+ val += F[i,j] * weights[i,j]
143
+ d1[i] = val / norm[i]
144
+
145
+
146
+
147
+
148
+ cdef void c_d2(double[:] d2, double[:,:] F, double[:,:] weights, double[:] d1, double[:] norm):
149
+ cdef:
150
+ double val
151
+ int i, j
152
+
153
+ n_points = F.shape[0]
154
+ n_obj = F.shape[1]
155
+
156
+ for i in range(n_points):
157
+
158
+ val = 0
159
+ for j in range(n_obj):
160
+ val += pow(F[i,j] - (d1[i] * weights[i,j] / norm[i]), 2.0)
161
+ d2[i] = sqrt(val)
162
+
163
+
164
+
165
+
Binary file