pymoo 0.6.1.3__cp39-cp39-macosx_11_0_arm64.whl → 0.6.1.5.dev0__cp39-cp39-macosx_11_0_arm64.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.
Potentially problematic release.
This version of pymoo might be problematic. Click here for more details.
- 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/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.cpython-39-darwin.so +0 -0
- pymoo/cython/calc_perpendicular_distance.pyx +67 -0
- pymoo/cython/decomposition.cpython-39-darwin.so +0 -0
- pymoo/cython/decomposition.pyx +165 -0
- pymoo/cython/hv.cpython-39-darwin.so +0 -0
- pymoo/cython/hv.pyx +18 -0
- pymoo/cython/info.cpython-39-darwin.so +0 -0
- pymoo/cython/info.pyx +5 -0
- pymoo/cython/mnn.cpython-39-darwin.so +0 -0
- pymoo/cython/mnn.pyx +273 -0
- pymoo/cython/non_dominated_sorting.cpython-39-darwin.so +0 -0
- pymoo/cython/non_dominated_sorting.pyx +645 -0
- pymoo/cython/pruning_cd.cpython-39-darwin.so +0 -0
- pymoo/cython/pruning_cd.pyx +197 -0
- pymoo/cython/stochastic_ranking.cpython-39-darwin.so +0 -0
- pymoo/cython/stochastic_ranking.pyx +49 -0
- pymoo/cython/vendor/hypervolume.cpp +1621 -0
- pymoo/docs.py +1 -1
- 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.3.dist-info → pymoo-0.6.1.5.dev0.dist-info}/METADATA +12 -13
- {pymoo-0.6.1.3.dist-info → pymoo-0.6.1.5.dev0.dist-info}/RECORD +328 -316
- {pymoo-0.6.1.3.dist-info → pymoo-0.6.1.5.dev0.dist-info}/WHEEL +2 -1
- {pymoo-0.6.1.3.dist-info → pymoo-0.6.1.5.dev0.dist-info/licenses}/LICENSE +0 -0
- {pymoo-0.6.1.3.dist-info → pymoo-0.6.1.5.dev0.dist-info}/top_level.txt +0 -0
pymoo/docs.py
CHANGED
|
@@ -87,7 +87,7 @@ algorithms = {
|
|
|
87
87
|
|
|
88
88
|
visualization = {
|
|
89
89
|
"figsize": """tuple
|
|
90
|
-
The figure size. Default (figsize=(8, 6)). For some plots changing the size might have side
|
|
90
|
+
The figure size. Default (figsize=(8, 6)). For some plots changing the size might have side effects for position.
|
|
91
91
|
""",
|
|
92
92
|
|
|
93
93
|
"title": """str or tuple
|
pymoo/operators/crossover/ox.py
CHANGED
|
@@ -36,7 +36,7 @@ def ox(receiver, donor, seq=None, shift=False):
|
|
|
36
36
|
assert len(donor) == len(receiver)
|
|
37
37
|
|
|
38
38
|
# the sequence which shall be use for the crossover
|
|
39
|
-
seq = seq if not None else random_sequence(len(receiver))
|
|
39
|
+
seq = seq if seq is not None else random_sequence(len(receiver))
|
|
40
40
|
start, end = seq
|
|
41
41
|
|
|
42
42
|
# the donation and a set of it to allow a quick lookup
|
pymoo/operators/selection/rnd.py
CHANGED
|
@@ -3,7 +3,7 @@ import math
|
|
|
3
3
|
import numpy as np
|
|
4
4
|
|
|
5
5
|
from pymoo.core.selection import Selection
|
|
6
|
-
from pymoo.util.misc import
|
|
6
|
+
from pymoo.util.misc import random_permutations
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
class RandomSelection(Selection):
|
|
@@ -16,7 +16,7 @@ class RandomSelection(Selection):
|
|
|
16
16
|
n_perms = math.ceil(n_random / len(pop))
|
|
17
17
|
|
|
18
18
|
# get random permutations and reshape them
|
|
19
|
-
P =
|
|
19
|
+
P = random_permutations(n_perms, len(pop))[:n_random]
|
|
20
20
|
|
|
21
21
|
return np.reshape(P, (n_select, n_parents))
|
|
22
22
|
|
|
@@ -3,12 +3,12 @@ import math
|
|
|
3
3
|
import numpy as np
|
|
4
4
|
|
|
5
5
|
from pymoo.core.selection import Selection
|
|
6
|
-
from pymoo.util.misc import
|
|
6
|
+
from pymoo.util.misc import random_permutations
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
class TournamentSelection(Selection):
|
|
10
10
|
"""
|
|
11
|
-
The Tournament selection is used to
|
|
11
|
+
The Tournament selection is used to simulate a tournament between individuals. The pressure balances
|
|
12
12
|
greedy the genetic algorithm will be.
|
|
13
13
|
"""
|
|
14
14
|
|
|
@@ -19,10 +19,10 @@ class TournamentSelection(Selection):
|
|
|
19
19
|
----------
|
|
20
20
|
func_comp: func
|
|
21
21
|
The function to compare two individuals. It has the shape: comp(pop, indices) and returns the winner.
|
|
22
|
-
If the function is None it is assumed the population is sorted by a
|
|
22
|
+
If the function is None it is assumed the population is sorted by a criterion and only indices are compared.
|
|
23
23
|
|
|
24
24
|
pressure: int
|
|
25
|
-
The selection pressure to
|
|
25
|
+
The selection pressure to be applied. Default it is a binary tournament.
|
|
26
26
|
"""
|
|
27
27
|
|
|
28
28
|
super().__init__(**kwargs)
|
|
@@ -42,7 +42,7 @@ class TournamentSelection(Selection):
|
|
|
42
42
|
n_perms = math.ceil(n_random / len(pop))
|
|
43
43
|
|
|
44
44
|
# get random permutations and reshape them
|
|
45
|
-
P =
|
|
45
|
+
P = random_permutations(n_perms, len(pop))[:n_random]
|
|
46
46
|
P = np.reshape(P, (n_select * n_parents, self.pressure))
|
|
47
47
|
|
|
48
48
|
# compare using tournament function
|
pymoo/optimize.py
CHANGED
|
@@ -8,7 +8,7 @@ def minimize(problem, algorithm, termination=None, copy_algorithm=True, copy_ter
|
|
|
8
8
|
|
|
9
9
|
This is used as a convenience function to execute several algorithms with default settings which turned
|
|
10
10
|
out to work for a test single. However, evolutionary computations utilizes the idea of customizing a
|
|
11
|
-
meta-algorithm. Customizing the algorithm using the object
|
|
11
|
+
meta-algorithm. Customizing the algorithm using the object-oriented interface is recommended to improve the
|
|
12
12
|
convergence.
|
|
13
13
|
|
|
14
14
|
Parameters
|
|
@@ -48,7 +48,7 @@ def minimize(problem, algorithm, termination=None, copy_algorithm=True, copy_ter
|
|
|
48
48
|
|
|
49
49
|
"""
|
|
50
50
|
|
|
51
|
-
# create a copy of the algorithm object to ensure no side
|
|
51
|
+
# create a copy of the algorithm object to ensure no side effects
|
|
52
52
|
if copy_algorithm:
|
|
53
53
|
algorithm = copy.deepcopy(algorithm)
|
|
54
54
|
|
pymoo/problems/dynamic/df.py
CHANGED
|
@@ -318,10 +318,10 @@ class DF11(DF):
|
|
|
318
318
|
y1 = np.pi * G / 6 + (np.pi / 2 - np.pi * G / 3) * x1
|
|
319
319
|
y2 = np.pi * G / 6 + (np.pi / 2 - np.pi * G / 3) * x2
|
|
320
320
|
|
|
321
|
-
f1 = np.sin(y1)
|
|
322
|
-
f2 =
|
|
323
|
-
f3 =
|
|
324
|
-
|
|
321
|
+
f1 = (1 + G) * np.sin(y1)
|
|
322
|
+
f2 = (1 + G) * np.sin(y2) * np.cos(y1) # Correct element-wise multiplication
|
|
323
|
+
f3 = (1 + G) * np.cos(y2) * np.cos(y1) # Correct element-wise multiplication
|
|
324
|
+
|
|
325
325
|
return get_PF(np.array([f1, f2, f3]), False)
|
|
326
326
|
|
|
327
327
|
|
|
@@ -14,7 +14,7 @@ class TravelingSalesman(ElementwiseProblem):
|
|
|
14
14
|
Parameters
|
|
15
15
|
----------
|
|
16
16
|
cities : numpy.array
|
|
17
|
-
The cities with 2-dimensional coordinates provided by a matrix where
|
|
17
|
+
The cities with 2-dimensional coordinates provided by a matrix where city is represented by a row.
|
|
18
18
|
|
|
19
19
|
"""
|
|
20
20
|
n_cities, _ = cities.shape
|
pymoo/util/misc.py
CHANGED
|
@@ -58,7 +58,7 @@ def parameter_less_constraints(F, CV, F_max=None):
|
|
|
58
58
|
return F
|
|
59
59
|
|
|
60
60
|
|
|
61
|
-
def
|
|
61
|
+
def random_permutations(n, l, concat=True):
|
|
62
62
|
P = []
|
|
63
63
|
for i in range(n):
|
|
64
64
|
P.append(np.random.permutation(l))
|
|
@@ -360,7 +360,7 @@ def intersect(a, b):
|
|
|
360
360
|
|
|
361
361
|
|
|
362
362
|
def has_feasible(pop):
|
|
363
|
-
return np.any(pop.get("
|
|
363
|
+
return np.any(pop.get("FEAS"))
|
|
364
364
|
|
|
365
365
|
|
|
366
366
|
def to_numpy(a):
|
pymoo/util/mnn.py
CHANGED
|
@@ -40,7 +40,7 @@ def calc_mnn_base(X, n_remove=0, twonn=False):
|
|
|
40
40
|
|
|
41
41
|
D = squareform(pdist(X, metric="sqeuclidean"))
|
|
42
42
|
Dnn = np.partition(D, range(1, M+1), axis=1)[:, 1:M+1]
|
|
43
|
-
d = np.
|
|
43
|
+
d = np.prod(Dnn, axis=1)
|
|
44
44
|
d[extremes] = np.inf
|
|
45
45
|
|
|
46
46
|
n_removed = 0
|
|
@@ -63,7 +63,7 @@ def calc_mnn_base(X, n_remove=0, twonn=False):
|
|
|
63
63
|
|
|
64
64
|
D[:, k] = np.inf
|
|
65
65
|
Dnn[H] = np.partition(D[H], range(1, M+1), axis=1)[:, 1:M+1]
|
|
66
|
-
d[H] = np.
|
|
66
|
+
d[H] = np.prod(Dnn[H], axis=1)
|
|
67
67
|
d[extremes] = np.inf
|
|
68
68
|
|
|
69
69
|
return d
|
|
@@ -3,8 +3,11 @@ import numpy as np
|
|
|
3
3
|
from pymoo.util.dominator import Dominator
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
def fast_non_dominated_sort(F, **kwargs):
|
|
7
|
-
|
|
6
|
+
def fast_non_dominated_sort(F, dominator=Dominator(), **kwargs):
|
|
7
|
+
if "dominator" in kwargs:
|
|
8
|
+
M = Dominator.calc_domination_matrix(F)
|
|
9
|
+
else:
|
|
10
|
+
M = dominator.calc_domination_matrix(F)
|
|
8
11
|
|
|
9
12
|
# calculate the dominance matrix
|
|
10
13
|
n = M.shape[0]
|
|
@@ -65,4 +68,3 @@ def fast_non_dominated_sort(F, **kwargs):
|
|
|
65
68
|
current_front = next_front
|
|
66
69
|
|
|
67
70
|
return fronts
|
|
68
|
-
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import numpy as np
|
|
2
|
-
|
|
2
|
+
import sys
|
|
3
3
|
from pymoo.util.dominator import Dominator
|
|
4
4
|
from pymoo.util.function_loader import load_function
|
|
5
5
|
|
|
@@ -53,7 +53,7 @@ class NonDominatedSorting:
|
|
|
53
53
|
|
|
54
54
|
def rank_from_fronts(fronts, n):
|
|
55
55
|
# create the rank array and set values
|
|
56
|
-
rank = np.full(n,
|
|
56
|
+
rank = np.full(n, sys.maxsize, dtype=int)
|
|
57
57
|
for i, front in enumerate(fronts):
|
|
58
58
|
rank[front] = i
|
|
59
59
|
|
pymoo/util/normalization.py
CHANGED
|
@@ -66,7 +66,7 @@ class ZeroToOneNormalization(Normalization):
|
|
|
66
66
|
# now create all the masks that are necessary
|
|
67
67
|
self.xl_only, self.xu_only = np.logical_and(~xl_nan, xu_nan), np.logical_and(xl_nan, ~xu_nan)
|
|
68
68
|
self.both_nan = np.logical_and(np.isnan(xl), np.isnan(xu))
|
|
69
|
-
self.neither_nan = ~
|
|
69
|
+
self.neither_nan = np.logical_and(~np.isnan(xl), ~np.isnan(xu))
|
|
70
70
|
|
|
71
71
|
# if neither is nan than xu must be greater or equal than xl
|
|
72
72
|
any_nan = np.logical_or(np.isnan(xl), np.isnan(xu))
|
|
@@ -76,18 +76,15 @@ class ZeroToOneNormalization(Normalization):
|
|
|
76
76
|
if X is None or (self.xl is None and self.xu is None):
|
|
77
77
|
return X
|
|
78
78
|
|
|
79
|
-
xl, xu, xl_only, xu_only = self.xl, self.xu, self.xl_only, self.xu_only
|
|
80
|
-
both_nan, neither_nan = self.both_nan, self.neither_nan
|
|
81
|
-
|
|
82
79
|
# simple copy the input
|
|
83
80
|
N = np.copy(X)
|
|
84
81
|
|
|
85
82
|
# normalize between zero and one if neither of them is nan
|
|
86
|
-
N[...,
|
|
83
|
+
N[..., self.neither_nan] = (X[..., self.neither_nan] - self.xl[self.neither_nan]) / (self.xu[self.neither_nan] - self.xl[self.neither_nan])
|
|
87
84
|
|
|
88
|
-
N[..., xl_only] = X[..., xl_only] - xl[xl_only]
|
|
85
|
+
N[..., self.xl_only] = X[..., self.xl_only] - self.xl[self.xl_only]
|
|
89
86
|
|
|
90
|
-
N[..., xu_only] = 1.0 - (xu[xu_only] - X[..., xu_only])
|
|
87
|
+
N[..., self.xu_only] = 1.0 - (self.xu[self.xu_only] - X[..., self.xu_only])
|
|
91
88
|
|
|
92
89
|
return N
|
|
93
90
|
|
|
@@ -305,7 +302,7 @@ class ObjectiveSpaceNormalization:
|
|
|
305
302
|
self._worst = None
|
|
306
303
|
|
|
307
304
|
def update(self, pop):
|
|
308
|
-
F, feas = pop.get("F", "
|
|
305
|
+
F, feas = pop.get("F", "FEAS")
|
|
309
306
|
self._infeas_ideal = find_ideal(F, current=self._infeas_ideal)
|
|
310
307
|
|
|
311
308
|
if np.any(feas):
|
pymoo/util/ref_dirs/energy.py
CHANGED
|
@@ -156,12 +156,14 @@ class RieszEnergyReferenceDirectionFactory(ReferenceDirectionFactory):
|
|
|
156
156
|
X = ReductionBasedReferenceDirectionFactory(self.n_dim,
|
|
157
157
|
self.n_points,
|
|
158
158
|
kmeans=True,
|
|
159
|
-
lexsort=False
|
|
159
|
+
lexsort=False,
|
|
160
|
+
seed=self.seed) \
|
|
160
161
|
.do()
|
|
161
162
|
|
|
162
163
|
elif self.sampling == "construction":
|
|
163
164
|
X = ConstructionBasedReferenceDirectionFactory(self.n_dim,
|
|
164
|
-
self.n_points
|
|
165
|
+
self.n_points,
|
|
166
|
+
seed=self.seed) \
|
|
165
167
|
.do()
|
|
166
168
|
else:
|
|
167
169
|
raise Exception("Unknown sampling method. Either reduction or construction.")
|
pymoo/util/ref_dirs/reduction.py
CHANGED
|
@@ -62,7 +62,7 @@ class ReductionBasedReferenceDirectionFactory(ReferenceDirectionFactory):
|
|
|
62
62
|
self.n_points = n_points
|
|
63
63
|
|
|
64
64
|
def _do(self):
|
|
65
|
-
rnd = sample_on_unit_simplex(self.n_sample_points, self.n_dim, unit_simplex_mapping=self.sampling)
|
|
65
|
+
rnd = sample_on_unit_simplex(self.n_sample_points, self.n_dim, seed=self.seed, unit_simplex_mapping=self.sampling)
|
|
66
66
|
|
|
67
67
|
def h(n):
|
|
68
68
|
return get_partition_closest_to_points(n, self.n_dim)
|
|
@@ -174,12 +174,13 @@ class MultiLayerReferenceDirectionFactory:
|
|
|
174
174
|
# Util
|
|
175
175
|
# =========================================================================================================
|
|
176
176
|
|
|
177
|
-
def get_rng(seed
|
|
177
|
+
def get_rng(seed=None):
|
|
178
178
|
if seed is None or type(seed) == int:
|
|
179
179
|
rng = np.random.default_rng(seed)
|
|
180
180
|
return rng
|
|
181
181
|
|
|
182
|
-
|
|
182
|
+
|
|
183
|
+
def sample_on_unit_simplex(n_points, n_dim, unit_simplex_mapping="kraemer", seed=None):
|
|
183
184
|
if unit_simplex_mapping == "sum":
|
|
184
185
|
rnd = map_onto_unit_simplex(get_rng(seed).random((n_points, n_dim)), "sum")
|
|
185
186
|
|