pymoo 0.6.1.2__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.
- pymoo/algorithms/moo/age.py +13 -7
- pymoo/algorithms/moo/age2.py +49 -19
- pymoo/algorithms/moo/ctaea.py +2 -2
- pymoo/algorithms/moo/kgb.py +9 -9
- pymoo/algorithms/moo/nsga2.py +0 -4
- pymoo/algorithms/moo/nsga3.py +2 -2
- pymoo/algorithms/moo/pinsga2.py +370 -0
- pymoo/algorithms/moo/rnsga3.py +2 -2
- pymoo/algorithms/soo/nonconvex/es.py +3 -2
- pymoo/config.py +1 -1
- pymoo/core/algorithm.py +1 -1
- pymoo/core/individual.py +8 -7
- pymoo/core/replacement.py +5 -5
- pymoo/core/survival.py +1 -1
- pymoo/core/variable.py +9 -9
- pymoo/cython/calc_perpendicular_distance.cp311-win_amd64.pyd +0 -0
- pymoo/cython/calc_perpendicular_distance.cpp +27467 -0
- pymoo/cython/calc_perpendicular_distance.pyx +67 -0
- pymoo/cython/decomposition.cp311-win_amd64.pyd +0 -0
- pymoo/cython/decomposition.cpp +28877 -0
- pymoo/cython/decomposition.pyx +165 -0
- pymoo/cython/hv.cp311-win_amd64.pyd +0 -0
- pymoo/cython/hv.cpp +27559 -0
- pymoo/cython/hv.pyx +18 -0
- pymoo/cython/info.cp311-win_amd64.pyd +0 -0
- pymoo/cython/info.cpp +6653 -0
- pymoo/cython/info.pyx +5 -0
- pymoo/cython/mnn.cp311-win_amd64.pyd +0 -0
- pymoo/cython/mnn.cpp +30117 -0
- pymoo/cython/mnn.pyx +273 -0
- pymoo/cython/non_dominated_sorting.cp311-win_amd64.pyd +0 -0
- pymoo/cython/non_dominated_sorting.cpp +35256 -0
- pymoo/cython/non_dominated_sorting.pyx +645 -0
- pymoo/cython/pruning_cd.cp311-win_amd64.pyd +0 -0
- pymoo/cython/pruning_cd.cpp +29277 -0
- pymoo/cython/pruning_cd.pyx +197 -0
- pymoo/cython/stochastic_ranking.cp311-win_amd64.pyd +0 -0
- pymoo/cython/stochastic_ranking.cpp +27872 -0
- pymoo/cython/stochastic_ranking.pyx +49 -0
- pymoo/cython/vendor/hypervolume.cpp +1621 -0
- pymoo/docs.py +1 -1
- pymoo/gradient/grad_autograd.py +2 -2
- pymoo/operators/crossover/ox.py +1 -1
- pymoo/operators/selection/rnd.py +2 -2
- pymoo/operators/selection/tournament.py +5 -5
- pymoo/optimize.py +2 -2
- pymoo/problems/dynamic/df.py +4 -4
- pymoo/problems/single/traveling_salesman.py +1 -1
- pymoo/util/misc.py +2 -2
- pymoo/util/mnn.py +2 -2
- pymoo/util/nds/fast_non_dominated_sort.py +5 -3
- pymoo/util/nds/non_dominated_sorting.py +2 -2
- pymoo/util/normalization.py +5 -8
- pymoo/util/ref_dirs/energy.py +4 -2
- pymoo/util/ref_dirs/reduction.py +1 -1
- pymoo/util/reference_direction.py +3 -2
- pymoo/util/value_functions.py +719 -0
- pymoo/util/vf_dominator.py +99 -0
- pymoo/version.py +1 -1
- pymoo/visualization/heatmap.py +3 -3
- pymoo/visualization/pcp.py +1 -1
- pymoo/visualization/radar.py +1 -1
- {pymoo-0.6.1.2.dist-info → pymoo-0.6.1.5.dev0.dist-info}/METADATA +13 -14
- {pymoo-0.6.1.2.dist-info → pymoo-0.6.1.5.dev0.dist-info}/RECORD +67 -47
- {pymoo-0.6.1.2.dist-info → pymoo-0.6.1.5.dev0.dist-info}/WHEEL +1 -1
- {pymoo-0.6.1.2.dist-info → pymoo-0.6.1.5.dev0.dist-info/licenses}/LICENSE +0 -0
- {pymoo-0.6.1.2.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
|