pymoo 0.6.1.5.dev0__cp310-cp310-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/__init__.py +3 -0
- pymoo/algorithms/__init__.py +0 -0
- pymoo/algorithms/base/__init__.py +0 -0
- pymoo/algorithms/base/bracket.py +38 -0
- pymoo/algorithms/base/genetic.py +109 -0
- pymoo/algorithms/base/line.py +62 -0
- pymoo/algorithms/base/local.py +39 -0
- pymoo/algorithms/base/meta.py +79 -0
- pymoo/algorithms/hyperparameters.py +89 -0
- pymoo/algorithms/moo/__init__.py +0 -0
- pymoo/algorithms/moo/age.py +310 -0
- pymoo/algorithms/moo/age2.py +194 -0
- pymoo/algorithms/moo/ctaea.py +298 -0
- pymoo/algorithms/moo/dnsga2.py +76 -0
- pymoo/algorithms/moo/kgb.py +446 -0
- pymoo/algorithms/moo/moead.py +183 -0
- pymoo/algorithms/moo/nsga2.py +113 -0
- pymoo/algorithms/moo/nsga3.py +358 -0
- pymoo/algorithms/moo/pinsga2.py +370 -0
- pymoo/algorithms/moo/rnsga2.py +188 -0
- pymoo/algorithms/moo/rnsga3.py +246 -0
- pymoo/algorithms/moo/rvea.py +214 -0
- pymoo/algorithms/moo/sms.py +195 -0
- pymoo/algorithms/moo/spea2.py +190 -0
- pymoo/algorithms/moo/unsga3.py +47 -0
- pymoo/algorithms/soo/__init__.py +0 -0
- pymoo/algorithms/soo/convex/__init__.py +0 -0
- pymoo/algorithms/soo/nonconvex/__init__.py +0 -0
- pymoo/algorithms/soo/nonconvex/brkga.py +161 -0
- pymoo/algorithms/soo/nonconvex/cmaes.py +554 -0
- pymoo/algorithms/soo/nonconvex/de.py +279 -0
- pymoo/algorithms/soo/nonconvex/direct.py +149 -0
- pymoo/algorithms/soo/nonconvex/es.py +203 -0
- pymoo/algorithms/soo/nonconvex/g3pcx.py +94 -0
- pymoo/algorithms/soo/nonconvex/ga.py +93 -0
- pymoo/algorithms/soo/nonconvex/ga_niching.py +223 -0
- pymoo/algorithms/soo/nonconvex/isres.py +74 -0
- pymoo/algorithms/soo/nonconvex/nelder.py +251 -0
- pymoo/algorithms/soo/nonconvex/optuna.py +80 -0
- pymoo/algorithms/soo/nonconvex/pattern.py +183 -0
- pymoo/algorithms/soo/nonconvex/pso.py +399 -0
- pymoo/algorithms/soo/nonconvex/pso_ep.py +297 -0
- pymoo/algorithms/soo/nonconvex/random_search.py +25 -0
- pymoo/algorithms/soo/nonconvex/sres.py +56 -0
- pymoo/algorithms/soo/univariate/__init__.py +0 -0
- pymoo/algorithms/soo/univariate/backtracking.py +59 -0
- pymoo/algorithms/soo/univariate/exp.py +46 -0
- pymoo/algorithms/soo/univariate/golden.py +65 -0
- pymoo/algorithms/soo/univariate/quadr_interp.py +81 -0
- pymoo/algorithms/soo/univariate/wolfe.py +163 -0
- pymoo/config.py +33 -0
- pymoo/constraints/__init__.py +3 -0
- pymoo/constraints/adaptive.py +62 -0
- pymoo/constraints/as_obj.py +56 -0
- pymoo/constraints/as_penalty.py +41 -0
- pymoo/constraints/eps.py +26 -0
- pymoo/constraints/from_bounds.py +36 -0
- pymoo/core/__init__.py +0 -0
- pymoo/core/algorithm.py +394 -0
- pymoo/core/callback.py +38 -0
- pymoo/core/crossover.py +77 -0
- pymoo/core/decision_making.py +102 -0
- pymoo/core/decomposition.py +76 -0
- pymoo/core/duplicate.py +163 -0
- pymoo/core/evaluator.py +116 -0
- pymoo/core/indicator.py +34 -0
- pymoo/core/individual.py +784 -0
- pymoo/core/infill.py +64 -0
- pymoo/core/initialization.py +42 -0
- pymoo/core/mating.py +39 -0
- pymoo/core/meta.py +21 -0
- pymoo/core/mixed.py +165 -0
- pymoo/core/mutation.py +44 -0
- pymoo/core/operator.py +40 -0
- pymoo/core/parameters.py +134 -0
- pymoo/core/plot.py +210 -0
- pymoo/core/population.py +180 -0
- pymoo/core/problem.py +460 -0
- pymoo/core/recorder.py +99 -0
- pymoo/core/repair.py +23 -0
- pymoo/core/replacement.py +96 -0
- pymoo/core/result.py +52 -0
- pymoo/core/sampling.py +43 -0
- pymoo/core/selection.py +61 -0
- pymoo/core/solution.py +10 -0
- pymoo/core/survival.py +103 -0
- pymoo/core/termination.py +70 -0
- pymoo/core/variable.py +399 -0
- pymoo/cython/__init__.py +0 -0
- pymoo/cython/calc_perpendicular_distance.cpython-310-darwin.so +0 -0
- pymoo/cython/calc_perpendicular_distance.pyx +67 -0
- pymoo/cython/decomposition.cpython-310-darwin.so +0 -0
- pymoo/cython/decomposition.pyx +165 -0
- pymoo/cython/hv.cpython-310-darwin.so +0 -0
- pymoo/cython/hv.pyx +18 -0
- pymoo/cython/info.cpython-310-darwin.so +0 -0
- pymoo/cython/info.pyx +5 -0
- pymoo/cython/mnn.cpython-310-darwin.so +0 -0
- pymoo/cython/mnn.pyx +273 -0
- pymoo/cython/non_dominated_sorting.cpython-310-darwin.so +0 -0
- pymoo/cython/non_dominated_sorting.pyx +645 -0
- pymoo/cython/pruning_cd.cpython-310-darwin.so +0 -0
- pymoo/cython/pruning_cd.pyx +197 -0
- pymoo/cython/stochastic_ranking.cpython-310-darwin.so +0 -0
- pymoo/cython/stochastic_ranking.pyx +49 -0
- pymoo/cython/utils.pxd +129 -0
- pymoo/cython/vendor/__init__.py +0 -0
- pymoo/cython/vendor/hypervolume.cpp +1621 -0
- pymoo/cython/vendor/hypervolume.h +63 -0
- pymoo/decomposition/__init__.py +0 -0
- pymoo/decomposition/aasf.py +24 -0
- pymoo/decomposition/asf.py +10 -0
- pymoo/decomposition/pbi.py +13 -0
- pymoo/decomposition/perp_dist.py +13 -0
- pymoo/decomposition/tchebicheff.py +11 -0
- pymoo/decomposition/util.py +13 -0
- pymoo/decomposition/weighted_sum.py +8 -0
- pymoo/docs.py +187 -0
- pymoo/experimental/__init__.py +0 -0
- pymoo/experimental/algorithms/__init__.py +0 -0
- pymoo/experimental/algorithms/gde3.py +57 -0
- pymoo/gradient/__init__.py +21 -0
- pymoo/gradient/automatic.py +57 -0
- pymoo/gradient/grad_autograd.py +105 -0
- pymoo/gradient/grad_complex.py +35 -0
- pymoo/gradient/grad_jax.py +51 -0
- pymoo/gradient/toolbox/__init__.py +6 -0
- pymoo/indicators/__init__.py +0 -0
- pymoo/indicators/distance_indicator.py +55 -0
- pymoo/indicators/gd.py +7 -0
- pymoo/indicators/gd_plus.py +7 -0
- pymoo/indicators/hv/__init__.py +63 -0
- pymoo/indicators/hv/exact.py +71 -0
- pymoo/indicators/hv/exact_2d.py +102 -0
- pymoo/indicators/hv/monte_carlo.py +74 -0
- pymoo/indicators/igd.py +7 -0
- pymoo/indicators/igd_plus.py +7 -0
- pymoo/indicators/kktpm.py +151 -0
- pymoo/indicators/migd.py +55 -0
- pymoo/indicators/rmetric.py +203 -0
- pymoo/indicators/spacing.py +52 -0
- pymoo/mcdm/__init__.py +0 -0
- pymoo/mcdm/compromise_programming.py +19 -0
- pymoo/mcdm/high_tradeoff.py +40 -0
- pymoo/mcdm/pseudo_weights.py +32 -0
- pymoo/operators/__init__.py +0 -0
- pymoo/operators/control.py +187 -0
- pymoo/operators/crossover/__init__.py +0 -0
- pymoo/operators/crossover/binx.py +45 -0
- pymoo/operators/crossover/dex.py +122 -0
- pymoo/operators/crossover/erx.py +162 -0
- pymoo/operators/crossover/expx.py +51 -0
- pymoo/operators/crossover/hux.py +37 -0
- pymoo/operators/crossover/nox.py +13 -0
- pymoo/operators/crossover/ox.py +84 -0
- pymoo/operators/crossover/pcx.py +82 -0
- pymoo/operators/crossover/pntx.py +49 -0
- pymoo/operators/crossover/sbx.py +125 -0
- pymoo/operators/crossover/spx.py +5 -0
- pymoo/operators/crossover/ux.py +20 -0
- pymoo/operators/mutation/__init__.py +0 -0
- pymoo/operators/mutation/bitflip.py +17 -0
- pymoo/operators/mutation/gauss.py +58 -0
- pymoo/operators/mutation/inversion.py +42 -0
- pymoo/operators/mutation/nom.py +7 -0
- pymoo/operators/mutation/pm.py +94 -0
- pymoo/operators/mutation/rm.py +23 -0
- pymoo/operators/repair/__init__.py +0 -0
- pymoo/operators/repair/bounce_back.py +32 -0
- pymoo/operators/repair/bounds_repair.py +95 -0
- pymoo/operators/repair/inverse_penalty.py +89 -0
- pymoo/operators/repair/rounding.py +18 -0
- pymoo/operators/repair/to_bound.py +31 -0
- pymoo/operators/repair/vtype.py +11 -0
- pymoo/operators/sampling/__init__.py +0 -0
- pymoo/operators/sampling/lhs.py +73 -0
- pymoo/operators/sampling/rnd.py +50 -0
- pymoo/operators/selection/__init__.py +0 -0
- pymoo/operators/selection/rnd.py +72 -0
- pymoo/operators/selection/tournament.py +76 -0
- pymoo/operators/survival/__init__.py +0 -0
- pymoo/operators/survival/rank_and_crowding/__init__.py +1 -0
- pymoo/operators/survival/rank_and_crowding/classes.py +209 -0
- pymoo/operators/survival/rank_and_crowding/metrics.py +208 -0
- pymoo/optimize.py +72 -0
- pymoo/problems/__init__.py +157 -0
- pymoo/problems/dyn.py +47 -0
- pymoo/problems/dynamic/__init__.py +0 -0
- pymoo/problems/dynamic/cec2015.py +108 -0
- pymoo/problems/dynamic/df.py +452 -0
- pymoo/problems/dynamic/misc.py +167 -0
- pymoo/problems/functional.py +48 -0
- pymoo/problems/many/__init__.py +5 -0
- pymoo/problems/many/cdtlz.py +159 -0
- pymoo/problems/many/dcdtlz.py +88 -0
- pymoo/problems/many/dtlz.py +264 -0
- pymoo/problems/many/wfg.py +550 -0
- pymoo/problems/multi/__init__.py +14 -0
- pymoo/problems/multi/bnh.py +34 -0
- pymoo/problems/multi/carside.py +48 -0
- pymoo/problems/multi/clutch.py +104 -0
- pymoo/problems/multi/csi.py +55 -0
- pymoo/problems/multi/ctp.py +198 -0
- pymoo/problems/multi/dascmop.py +213 -0
- pymoo/problems/multi/kursawe.py +25 -0
- pymoo/problems/multi/modact.py +68 -0
- pymoo/problems/multi/mw.py +400 -0
- pymoo/problems/multi/omnitest.py +48 -0
- pymoo/problems/multi/osy.py +32 -0
- pymoo/problems/multi/srn.py +28 -0
- pymoo/problems/multi/sympart.py +94 -0
- pymoo/problems/multi/tnk.py +24 -0
- pymoo/problems/multi/truss2d.py +83 -0
- pymoo/problems/multi/welded_beam.py +41 -0
- pymoo/problems/multi/wrm.py +36 -0
- pymoo/problems/multi/zdt.py +151 -0
- pymoo/problems/multi_to_single.py +22 -0
- pymoo/problems/single/__init__.py +12 -0
- pymoo/problems/single/ackley.py +24 -0
- pymoo/problems/single/cantilevered_beam.py +34 -0
- pymoo/problems/single/flowshop_scheduling.py +112 -0
- pymoo/problems/single/g.py +874 -0
- pymoo/problems/single/griewank.py +18 -0
- pymoo/problems/single/himmelblau.py +15 -0
- pymoo/problems/single/knapsack.py +48 -0
- pymoo/problems/single/mopta08.py +26 -0
- pymoo/problems/single/multimodal.py +20 -0
- pymoo/problems/single/pressure_vessel.py +30 -0
- pymoo/problems/single/rastrigin.py +20 -0
- pymoo/problems/single/rosenbrock.py +22 -0
- pymoo/problems/single/schwefel.py +18 -0
- pymoo/problems/single/simple.py +13 -0
- pymoo/problems/single/sphere.py +19 -0
- pymoo/problems/single/traveling_salesman.py +79 -0
- pymoo/problems/single/zakharov.py +19 -0
- pymoo/problems/static.py +14 -0
- pymoo/problems/util.py +42 -0
- pymoo/problems/zero_to_one.py +27 -0
- pymoo/termination/__init__.py +23 -0
- pymoo/termination/collection.py +12 -0
- pymoo/termination/cv.py +48 -0
- pymoo/termination/default.py +45 -0
- pymoo/termination/delta.py +64 -0
- pymoo/termination/fmin.py +16 -0
- pymoo/termination/ftol.py +144 -0
- pymoo/termination/indicator.py +49 -0
- pymoo/termination/max_eval.py +14 -0
- pymoo/termination/max_gen.py +15 -0
- pymoo/termination/max_time.py +20 -0
- pymoo/termination/robust.py +34 -0
- pymoo/termination/xtol.py +33 -0
- pymoo/util/__init__.py +0 -0
- pymoo/util/archive.py +150 -0
- pymoo/util/cache.py +29 -0
- pymoo/util/clearing.py +82 -0
- pymoo/util/display/__init__.py +0 -0
- pymoo/util/display/column.py +52 -0
- pymoo/util/display/display.py +34 -0
- pymoo/util/display/multi.py +96 -0
- pymoo/util/display/output.py +53 -0
- pymoo/util/display/progress.py +54 -0
- pymoo/util/display/single.py +67 -0
- pymoo/util/dominator.py +67 -0
- pymoo/util/function_loader.py +129 -0
- pymoo/util/hv.py +23 -0
- pymoo/util/matlab_engine.py +39 -0
- pymoo/util/misc.py +460 -0
- pymoo/util/mnn.py +70 -0
- pymoo/util/nds/__init__.py +0 -0
- pymoo/util/nds/dominance_degree_non_dominated_sort.py +159 -0
- pymoo/util/nds/efficient_non_dominated_sort.py +152 -0
- pymoo/util/nds/fast_non_dominated_sort.py +70 -0
- pymoo/util/nds/naive_non_dominated_sort.py +36 -0
- pymoo/util/nds/non_dominated_sorting.py +67 -0
- pymoo/util/nds/tree_based_non_dominated_sort.py +133 -0
- pymoo/util/normalization.py +312 -0
- pymoo/util/optimum.py +42 -0
- pymoo/util/plotting.py +177 -0
- pymoo/util/pruning_cd.py +89 -0
- pymoo/util/randomized_argsort.py +60 -0
- pymoo/util/ref_dirs/__init__.py +24 -0
- pymoo/util/ref_dirs/construction.py +88 -0
- pymoo/util/ref_dirs/das_dennis.py +52 -0
- pymoo/util/ref_dirs/energy.py +319 -0
- pymoo/util/ref_dirs/energy_layer.py +119 -0
- pymoo/util/ref_dirs/genetic_algorithm.py +63 -0
- pymoo/util/ref_dirs/incremental.py +68 -0
- pymoo/util/ref_dirs/misc.py +128 -0
- pymoo/util/ref_dirs/optimizer.py +59 -0
- pymoo/util/ref_dirs/performance.py +162 -0
- pymoo/util/ref_dirs/reduction.py +85 -0
- pymoo/util/ref_dirs/sample_and_map.py +24 -0
- pymoo/util/reference_direction.py +260 -0
- pymoo/util/remote.py +55 -0
- pymoo/util/roulette.py +27 -0
- pymoo/util/running_metric.py +128 -0
- pymoo/util/sliding_window.py +25 -0
- pymoo/util/stochastic_ranking.py +32 -0
- pymoo/util/value_functions.py +719 -0
- pymoo/util/vectors.py +40 -0
- pymoo/util/vf_dominator.py +99 -0
- pymoo/vendor/__init__.py +0 -0
- pymoo/vendor/cec2018.py +398 -0
- pymoo/vendor/gta.py +617 -0
- pymoo/vendor/hv.py +267 -0
- pymoo/vendor/vendor_cmaes.py +412 -0
- pymoo/vendor/vendor_coco.py +81 -0
- pymoo/vendor/vendor_scipy.py +232 -0
- pymoo/version.py +1 -0
- pymoo/visualization/__init__.py +8 -0
- pymoo/visualization/fitness_landscape.py +127 -0
- pymoo/visualization/heatmap.py +123 -0
- pymoo/visualization/pcp.py +120 -0
- pymoo/visualization/petal.py +91 -0
- pymoo/visualization/radar.py +108 -0
- pymoo/visualization/radviz.py +68 -0
- pymoo/visualization/scatter.py +150 -0
- pymoo/visualization/star_coordinate.py +75 -0
- pymoo/visualization/util.py +123 -0
- pymoo/visualization/video/__init__.py +0 -0
- pymoo/visualization/video/callback_video.py +82 -0
- pymoo/visualization/video/one_var_one_obj.py +57 -0
- pymoo/visualization/video/two_var_one_obj.py +62 -0
- pymoo-0.6.1.5.dev0.dist-info/METADATA +187 -0
- pymoo-0.6.1.5.dev0.dist-info/RECORD +328 -0
- pymoo-0.6.1.5.dev0.dist-info/WHEEL +6 -0
- pymoo-0.6.1.5.dev0.dist-info/licenses/LICENSE +191 -0
- pymoo-0.6.1.5.dev0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,400 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
|
|
3
|
+
from pymoo.core.problem import Problem
|
|
4
|
+
# Based on the C++ implementation by the Ma and Wang
|
|
5
|
+
# http://www.escience.cn/people/yongwang1/index.html
|
|
6
|
+
from pymoo.problems.many import get_ref_dirs
|
|
7
|
+
from pymoo.util.remote import Remote
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class MW(Problem):
|
|
11
|
+
def __init__(self, n_var, n_obj, n_ieq_constr, **kwargs):
|
|
12
|
+
if 'xl' not in kwargs:
|
|
13
|
+
kwargs['xl'] = 0
|
|
14
|
+
if 'xu' not in kwargs:
|
|
15
|
+
kwargs['xu'] = 1
|
|
16
|
+
super().__init__(n_var=n_var,
|
|
17
|
+
n_obj=n_obj,
|
|
18
|
+
n_ieq_constr=n_ieq_constr,
|
|
19
|
+
vtype=float, **kwargs)
|
|
20
|
+
|
|
21
|
+
@staticmethod
|
|
22
|
+
def LA1(A, B, C, D, theta):
|
|
23
|
+
return A * np.power(np.sin(B * np.pi * np.power(theta, C)), D)
|
|
24
|
+
|
|
25
|
+
@staticmethod
|
|
26
|
+
def LA2(A, B, C, D, theta):
|
|
27
|
+
return A * np.power(np.sin(B * np.power(theta, C)), D)
|
|
28
|
+
|
|
29
|
+
@staticmethod
|
|
30
|
+
def LA3(A, B, C, D, theta):
|
|
31
|
+
return A * np.power(np.cos(B * np.power(theta, C)), D)
|
|
32
|
+
|
|
33
|
+
def g1(self, X):
|
|
34
|
+
d = self.n_var
|
|
35
|
+
n = d - self.n_obj
|
|
36
|
+
|
|
37
|
+
z = np.power(X[:, self.n_obj - 1:], n)
|
|
38
|
+
i = np.arange(self.n_obj - 1, d)
|
|
39
|
+
|
|
40
|
+
exp = 1 - np.exp(-10.0 * (z - 0.5 - i / (2 * d)) * (z - 0.5 - i / (2 * d)))
|
|
41
|
+
distance = 1 + exp.sum(axis=1)
|
|
42
|
+
return distance
|
|
43
|
+
|
|
44
|
+
def g2(self, X):
|
|
45
|
+
d = self.n_var
|
|
46
|
+
n = d
|
|
47
|
+
|
|
48
|
+
i = np.arange(self.n_obj - 1, d)
|
|
49
|
+
z = 1 - np.exp(-10.0 * (X[:, self.n_obj - 1:] - i / n) * (X[:, self.n_obj - 1:] - i / n))
|
|
50
|
+
contrib = (0.1 / (n)) * z * z + 1.5 - 1.5 * np.cos(2 * np.pi * z)
|
|
51
|
+
distance = 1 + contrib.sum(axis=1)
|
|
52
|
+
return distance
|
|
53
|
+
|
|
54
|
+
def g3(self, X):
|
|
55
|
+
contrib = 2.0 * np.power(
|
|
56
|
+
X[:, self.n_obj - 1:] + (X[:, self.n_obj - 2:-1] - 0.5) * (X[:, self.n_obj - 2:-1] - 0.5) - 1.0, 2.0)
|
|
57
|
+
distance = 1 + contrib.sum(axis=1)
|
|
58
|
+
return distance
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class MW1(MW):
|
|
62
|
+
def __init__(self, n_var=15, **kwargs):
|
|
63
|
+
super().__init__(n_var, 2, 1)
|
|
64
|
+
|
|
65
|
+
def _evaluate(self, X, out, *args, **kwargs):
|
|
66
|
+
g = self.g1(X)
|
|
67
|
+
f0 = X[:, 0]
|
|
68
|
+
f1 = g * (1 - 0.85 * f0 / g)
|
|
69
|
+
|
|
70
|
+
g0 = f0 + f1 - 1 - self.LA1(0.5, 2.0, 1.0, 8.0, np.sqrt(2.0) * f1 - np.sqrt(2.0) * f0)
|
|
71
|
+
out["F"] = np.column_stack([f0, f1])
|
|
72
|
+
out["G"] = g0.reshape((-1, 1))
|
|
73
|
+
|
|
74
|
+
def _calc_pareto_front(self, ref_dirs=None):
|
|
75
|
+
if ref_dirs is None:
|
|
76
|
+
F = np.zeros((100, 2))
|
|
77
|
+
F[:, 0] = np.linspace(0, 1, 100)
|
|
78
|
+
else:
|
|
79
|
+
F = ref_dirs
|
|
80
|
+
F[:, 1] = 1 - 0.85 * F[:, 0]
|
|
81
|
+
l = np.sqrt(2) * F[:, 1] - np.sqrt(2) * F[:, 0]
|
|
82
|
+
c = 1 - F[:, 0] - F[:, 1] + 0.5 * np.sin(2 * np.pi * l) ** 8
|
|
83
|
+
F = F[c >= 0]
|
|
84
|
+
return F
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
class MW2(MW):
|
|
88
|
+
def __init__(self, n_var=15, **kwargs):
|
|
89
|
+
super().__init__(n_var, 2, 1)
|
|
90
|
+
|
|
91
|
+
def _evaluate(self, X, out, *args, **kwargs):
|
|
92
|
+
g = self.g2(X)
|
|
93
|
+
f0 = X[:, 0]
|
|
94
|
+
f1 = g * (1 - f0 / g)
|
|
95
|
+
|
|
96
|
+
g0 = f0 + f1 - 1 - self.LA1(0.5, 3.0, 1.0, 8.0, np.sqrt(2.0) * f1 - np.sqrt(2.0) * f0)
|
|
97
|
+
out["F"] = np.column_stack([f0, f1])
|
|
98
|
+
out["G"] = g0.reshape((-1, 1))
|
|
99
|
+
|
|
100
|
+
def _calc_pareto_front(self, ref_dirs=None):
|
|
101
|
+
if ref_dirs is None:
|
|
102
|
+
F = np.zeros((100, 2))
|
|
103
|
+
F[:, 0] = np.linspace(0, 1, 100)
|
|
104
|
+
else:
|
|
105
|
+
F = ref_dirs
|
|
106
|
+
F[:, 1] = 1 - F[:, 0]
|
|
107
|
+
return F
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
class MW3(MW):
|
|
111
|
+
def __init__(self, n_var=15, **kwargs):
|
|
112
|
+
super().__init__(n_var, 2, 2)
|
|
113
|
+
|
|
114
|
+
def _evaluate(self, X, out, *args, **kwargs):
|
|
115
|
+
g = self.g3(X)
|
|
116
|
+
f0 = X[:, 0]
|
|
117
|
+
f1 = g * (1 - f0 / g)
|
|
118
|
+
|
|
119
|
+
g0 = f0 + f1 - 1.05 - self.LA1(0.45, 0.75, 1.0, 6.0, np.sqrt(2.0) * f1 - np.sqrt(2.0) * f0)
|
|
120
|
+
g1 = 0.85 - f0 - f1 + self.LA1(0.3, 0.75, 1.0, 2.0, np.sqrt(2.0) * f1 - np.sqrt(2.0) * f0)
|
|
121
|
+
out["F"] = np.column_stack([f0, f1])
|
|
122
|
+
out["G"] = np.column_stack([g0, g1])
|
|
123
|
+
|
|
124
|
+
def _calc_pareto_front(self, ref_dirs=None):
|
|
125
|
+
if ref_dirs is None:
|
|
126
|
+
F = np.zeros((100, 2))
|
|
127
|
+
F[:, 0] = np.linspace(0, 1, 100)
|
|
128
|
+
else:
|
|
129
|
+
F = ref_dirs
|
|
130
|
+
F[:, 1] = 1 - F[:, 0]
|
|
131
|
+
invalid = (0.85 - F[:, 0] - F[:, 1] + 0.3 * np.sin(0.75 * np.pi * np.sqrt(2) * (F[:, 1] - F[:, 0])) ** 2) > 0
|
|
132
|
+
while invalid.any():
|
|
133
|
+
F[invalid, :] *= 1.001
|
|
134
|
+
invalid = (0.85 - F[:, 0] - F[:, 1] + 0.3 * np.sin(
|
|
135
|
+
0.75 * np.pi * np.sqrt(2) * (F[:, 1] - F[:, 0])) ** 2) > 0
|
|
136
|
+
return F
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
class MW4(MW):
|
|
140
|
+
def __init__(self, n_var=None, n_obj=3, **kwargs):
|
|
141
|
+
if n_var is None:
|
|
142
|
+
n_var = n_obj + 12
|
|
143
|
+
super().__init__(n_var, n_obj, 1)
|
|
144
|
+
|
|
145
|
+
def _evaluate(self, X, out, *args, **kwargs):
|
|
146
|
+
g = self.g1(X)
|
|
147
|
+
f = g.reshape((-1, 1)) * np.ones((X.shape[0], self.n_obj))
|
|
148
|
+
f[:, 1:] *= X[:, (self.n_obj - 2)::-1]
|
|
149
|
+
f[:, 0:-1] *= np.flip(np.cumprod(1 - X[:, :(self.n_obj - 1)], axis=1), axis=1)
|
|
150
|
+
|
|
151
|
+
g0 = f.sum(axis=1) - 1 - self.LA1(0.4, 2.5, 1.0, 8.0, f[:, -1] - f[:, :-1].sum(axis=1))
|
|
152
|
+
out["F"] = f
|
|
153
|
+
out["G"] = g0.reshape((-1, 1))
|
|
154
|
+
|
|
155
|
+
def _calc_pareto_front(self, ref_dirs=None):
|
|
156
|
+
if ref_dirs is None:
|
|
157
|
+
ref_dirs = get_ref_dirs(self.n_obj)
|
|
158
|
+
F = ref_dirs
|
|
159
|
+
l = F[:, -1] - np.sum(F[:, :-1], axis=1)
|
|
160
|
+
c = (1 + 0.4 * np.sin(2.5 * np.pi * l) ** 8) - np.sum(F, axis=1)
|
|
161
|
+
return F[c >= 0]
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
class MW5(MW):
|
|
165
|
+
def __init__(self, n_var=15, **kwargs):
|
|
166
|
+
super().__init__(n_var, 2, 3)
|
|
167
|
+
|
|
168
|
+
def _evaluate(self, X, out, *args, **kwargs):
|
|
169
|
+
g = self.g1(X)
|
|
170
|
+
f0 = g * X[:, 0]
|
|
171
|
+
f1 = g * np.sqrt(1.0 - np.power(f0 / g, 2.0))
|
|
172
|
+
|
|
173
|
+
with np.errstate(divide='ignore'):
|
|
174
|
+
atan = np.arctan(f1 / f0)
|
|
175
|
+
|
|
176
|
+
g0 = f0 ** 2 + f1 ** 2 - np.power(1.7 - self.LA2(0.2, 2.0, 1.0, 1.0, atan), 2.0)
|
|
177
|
+
t = 0.5 * np.pi - 2 * np.abs(atan - 0.25 * np.pi)
|
|
178
|
+
g1 = np.power(1 + self.LA2(0.5, 6.0, 3.0, 1.0, t), 2.0) - f0 ** 2 - f1 ** 2
|
|
179
|
+
g2 = np.power(1 - self.LA2(0.45, 6.0, 3.0, 1.0, t), 2.0) - f0 ** 2 - f1 ** 2
|
|
180
|
+
out["F"] = np.column_stack([f0, f1])
|
|
181
|
+
out["G"] = np.column_stack([g0, g1, g2])
|
|
182
|
+
|
|
183
|
+
def _calc_pareto_front(self, **kwargs):
|
|
184
|
+
return Remote.get_instance().load("pymoo", "pf", "MW", "MW5.pf")
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
class MW6(MW):
|
|
188
|
+
def __init__(self, n_var=15, **kwargs):
|
|
189
|
+
super().__init__(n_var, 2, 1, xl=0.0, xu=1.1)
|
|
190
|
+
|
|
191
|
+
def _evaluate(self, X, out, *args, **kwargs):
|
|
192
|
+
g = self.g2(X)
|
|
193
|
+
f0 = g * X[:, 0]
|
|
194
|
+
f1 = g * np.sqrt(1.1 * 1.1 - np.power(f0 / g, 2.0))
|
|
195
|
+
|
|
196
|
+
with np.errstate(divide='ignore'):
|
|
197
|
+
atan = np.arctan(f1 / f0)
|
|
198
|
+
|
|
199
|
+
g0 = f0 ** 2 / np.power(1.0 + self.LA3(0.15, 6.0, 4.0, 10.0, atan), 2.0) + f1 ** 2 / np.power(
|
|
200
|
+
1.0 + self.LA3(0.75, 6.0, 4.0, 10.0, atan), 2.0) - 1
|
|
201
|
+
out["F"] = np.column_stack([f0, f1])
|
|
202
|
+
out["G"] = g0.reshape((-1, 1))
|
|
203
|
+
|
|
204
|
+
def _calc_pareto_front(self, ref_dirs=None):
|
|
205
|
+
if ref_dirs is None:
|
|
206
|
+
F = np.zeros((100, 2))
|
|
207
|
+
F[:, 0] = np.linspace(0, 1, 100)
|
|
208
|
+
else:
|
|
209
|
+
F = ref_dirs
|
|
210
|
+
F[:, 1] = 1 - F[:, 0]
|
|
211
|
+
F = F / np.sqrt(np.sum(F ** 2, axis=1) / 1.21).reshape((-1, 1))
|
|
212
|
+
l = np.cos(6 * np.arctan(F[:, 1] / F[:, 0]) ** 4) ** 10
|
|
213
|
+
c = 1 - (F[:, 0] / (1 + 0.15 * l)) ** 2 - (F[:, 1] / (1 + 0.75 * l)) ** 2
|
|
214
|
+
return F[c >= 0]
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
class MW7(MW):
|
|
218
|
+
def __init__(self, n_var=15, **kwargs):
|
|
219
|
+
super().__init__(n_var, 2, 2)
|
|
220
|
+
|
|
221
|
+
def _evaluate(self, X, out, *args, **kwargs):
|
|
222
|
+
g = self.g3(X)
|
|
223
|
+
f0 = g * X[:, 0]
|
|
224
|
+
f1 = g * np.sqrt(1 - np.power(f0 / g, 2))
|
|
225
|
+
|
|
226
|
+
with np.errstate(divide='ignore'):
|
|
227
|
+
atan = np.arctan(f1 / f0)
|
|
228
|
+
|
|
229
|
+
g0 = f0 ** 2 + f1 ** 2 - np.power(1.2 + np.abs(self.LA2(0.4, 4.0, 1.0, 16.0, atan)), 2.0)
|
|
230
|
+
g1 = np.power(1.15 - self.LA2(0.2, 4.0, 1.0, 8.0, atan), 2.0) - f0 ** 2 - f1 ** 2
|
|
231
|
+
out["F"] = np.column_stack([f0, f1])
|
|
232
|
+
out["G"] = np.column_stack([g0, g1])
|
|
233
|
+
|
|
234
|
+
def _calc_pareto_front(self, **kwargs):
|
|
235
|
+
return Remote.get_instance().load("pymoo", "pf", "MW", "MW7.pf")
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
class MW8(MW):
|
|
239
|
+
def __init__(self, n_var=None, n_obj=3, **kwargs):
|
|
240
|
+
if n_var is None:
|
|
241
|
+
n_var = n_obj + 12
|
|
242
|
+
super().__init__(n_var, n_obj, 1)
|
|
243
|
+
|
|
244
|
+
def _evaluate(self, X, out, *args, **kwargs):
|
|
245
|
+
g = self.g2(X)
|
|
246
|
+
f = g.reshape((-1, 1)) * np.ones((X.shape[0], self.n_obj))
|
|
247
|
+
f[:, 1:] *= np.sin(0.5 * np.pi * X[:, (self.n_obj - 2)::-1])
|
|
248
|
+
cos = np.cos(0.5 * np.pi * X[:, :(self.n_obj - 1)])
|
|
249
|
+
f[:, 0:-1] *= np.flip(np.cumprod(cos, axis=1), axis=1)
|
|
250
|
+
|
|
251
|
+
f_squared = (f ** 2).sum(axis=1)
|
|
252
|
+
g0 = f_squared - (1.25 - self.LA2(0.5, 6.0, 1.0, 2.0, np.arcsin(f[:, -1] / np.sqrt(f_squared)))) * (
|
|
253
|
+
1.25 - self.LA2(0.5, 6.0, 1.0, 2.0, np.arcsin(f[:, -1] / np.sqrt(f_squared))))
|
|
254
|
+
out["F"] = f
|
|
255
|
+
out["G"] = g0.reshape((-1, 1))
|
|
256
|
+
|
|
257
|
+
def _calc_pareto_front(self, ref_dirs=None):
|
|
258
|
+
if ref_dirs is None:
|
|
259
|
+
ref_dirs = get_ref_dirs(self.n_obj)
|
|
260
|
+
|
|
261
|
+
F = ref_dirs
|
|
262
|
+
F = F / np.sqrt(np.sum(F ** 2, axis=1)).reshape((-1, 1))
|
|
263
|
+
c = (1.25 - 0.5 * np.sin(6 * np.arcsin(F[:, -1])) ** 2) ** 2 - np.sum(F ** 2, axis=1)
|
|
264
|
+
return F[c >= 0]
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
class MW9(MW):
|
|
268
|
+
def __init__(self, n_var=15, **kwargs):
|
|
269
|
+
super().__init__(n_var, 2, 1)
|
|
270
|
+
|
|
271
|
+
def _evaluate(self, X, out, *args, **kwargs):
|
|
272
|
+
g = self.g1(X)
|
|
273
|
+
f0 = g * X[:, 0]
|
|
274
|
+
f1 = g * (1.0 - np.power(f0 / g, 0.6))
|
|
275
|
+
|
|
276
|
+
t1 = (1 - 0.64 * f0 * f0 - f1) * (1 - 0.36 * f0 * f0 - f1)
|
|
277
|
+
t2 = (1.35 * 1.35 - (f0 + 0.35) * (f0 + 0.35) - f1) * (1.15 * 1.15 - (f0 + 0.15) * (f0 + 0.15) - f1)
|
|
278
|
+
g0 = np.minimum(t1, t2)
|
|
279
|
+
out["F"] = np.column_stack([f0, f1])
|
|
280
|
+
out["G"] = g0.reshape((-1, 1))
|
|
281
|
+
|
|
282
|
+
def _calc_pareto_front(self, **kwargs):
|
|
283
|
+
return Remote.get_instance().load("pymoo", "pf", "MW", "MW9.pf")
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
class MW10(MW):
|
|
287
|
+
def __init__(self, n_var=15, **kwargs):
|
|
288
|
+
super().__init__(n_var, 2, 3)
|
|
289
|
+
|
|
290
|
+
def _evaluate(self, X, out, *args, **kwargs):
|
|
291
|
+
g = self.g2(X)
|
|
292
|
+
f0 = g * np.power(X[:, 0], self.n_var)
|
|
293
|
+
f1 = g * (1.0 - np.power(f0 / g, 2.0))
|
|
294
|
+
|
|
295
|
+
g0 = -1.0 * (2.0 - 4.0 * f0 * f0 - f1) * (2.0 - 8.0 * f0 * f0 - f1)
|
|
296
|
+
g1 = (2.0 - 2.0 * f0 * f0 - f1) * (2.0 - 16.0 * f0 * f0 - f1)
|
|
297
|
+
g2 = (1.0 - f0 * f0 - f1) * (1.2 - 1.2 * f0 * f0 - f1)
|
|
298
|
+
out["F"] = np.column_stack([f0, f1])
|
|
299
|
+
out["G"] = np.column_stack([g0, g1, g2])
|
|
300
|
+
|
|
301
|
+
def _calc_pareto_front(self, **kwargs):
|
|
302
|
+
return Remote.get_instance().load("pymoo", "pf", "MW", "MW10.pf")
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
class MW11(MW):
|
|
306
|
+
def __init__(self, n_var=15, **kwargs):
|
|
307
|
+
super().__init__(n_var, 2, 4, xl=0.0, xu=np.sqrt(2))
|
|
308
|
+
|
|
309
|
+
def _evaluate(self, X, out, *args, **kwargs):
|
|
310
|
+
g = self.g3(X)
|
|
311
|
+
f0 = g * X[:, 0]
|
|
312
|
+
f1 = g * np.sqrt(2.0 - np.power(f0 / g, 2.0))
|
|
313
|
+
|
|
314
|
+
g0 = -1.0 * (3.0 - f0 * f0 - f1) * (3.0 - 2.0 * f0 * f0 - f1)
|
|
315
|
+
g1 = (3.0 - 0.625 * f0 * f0 - f1) * (3.0 - 7.0 * f0 * f0 - f1)
|
|
316
|
+
g2 = -1.0 * (1.62 - 0.18 * f0 * f0 - f1) * (1.125 - 0.125 * f0 * f0 - f1)
|
|
317
|
+
g3 = (2.07 - 0.23 * f0 * f0 - f1) * (0.63 - 0.07 * f0 * f0 - f1)
|
|
318
|
+
out["F"] = np.column_stack([f0, f1])
|
|
319
|
+
out["G"] = np.column_stack([g0, g1, g2, g3])
|
|
320
|
+
|
|
321
|
+
def _calc_pareto_front(self, **kwargs):
|
|
322
|
+
return Remote.get_instance().load("pymoo", "pf", "MW", "MW11.pf")
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
class MW12(MW):
|
|
326
|
+
def __init__(self, n_var=15, **kwargs):
|
|
327
|
+
super().__init__(n_var, 2, 2)
|
|
328
|
+
|
|
329
|
+
def _evaluate(self, X, out, *args, **kwargs):
|
|
330
|
+
g = self.g1(X)
|
|
331
|
+
f0 = g * X[:, 0]
|
|
332
|
+
f1 = g * (0.85 - 0.8 * (f0 / g) - 0.08 * np.abs(np.sin(3.2 * np.pi * (f0 / g))))
|
|
333
|
+
|
|
334
|
+
g0 = -1.0 * (1 - 0.625 * f0 - f1 + 0.08 * np.sin(2 * np.pi * (f1 - f0 / 1.6))) * (
|
|
335
|
+
1.4 - 0.875 * f0 - f1 + 0.08 * np.sin(2 * np.pi * (f1 / 1.4 - f0 / 1.6)))
|
|
336
|
+
g1 = (1 - 0.8 * f0 - f1 + 0.08 * np.sin(2 * np.pi * (f1 - f0 / 1.5))) * (
|
|
337
|
+
1.8 - 1.125 * f0 - f1 + 0.08 * np.sin(2 * np.pi * (f1 / 1.8 - f0 / 1.6)))
|
|
338
|
+
out["F"] = np.column_stack([f0, f1])
|
|
339
|
+
out["G"] = np.column_stack([g0, g1])
|
|
340
|
+
|
|
341
|
+
def _calc_pareto_front(self, ref_dirs=None):
|
|
342
|
+
if ref_dirs is None:
|
|
343
|
+
F = np.zeros((100, 2))
|
|
344
|
+
F[:, 0] = np.linspace(0, 1, 100)
|
|
345
|
+
else:
|
|
346
|
+
F = ref_dirs
|
|
347
|
+
F[:, 1] = 0.85 - 0.8 * F[:, 0] - 0.08 * np.abs(np.sin(3.2 * np.pi * F[:, 0]))
|
|
348
|
+
|
|
349
|
+
invalid = (1 - 0.8 * F[:, 0] - F[:, 1] + 0.08 * np.sin(2 * np.pi * (F[:, 1] - F[:, 0] / 1.5))) * (
|
|
350
|
+
1.8 - 1.125 * F[:, 0] - F[:, 1] + 0.08 * np.sin(2 * np.pi * (F[:, 1] / 1.8 - F[:, 0] / 1.6))) > 0
|
|
351
|
+
while invalid.any():
|
|
352
|
+
F[invalid, :] *= 1.001
|
|
353
|
+
invalid = (1 - 0.8 * F[:, 0] - F[:, 1] + 0.08 * np.sin(2 * np.pi * (F[:, 1] - F[:, 0] / 1.5))) * (
|
|
354
|
+
1.8 - 1.125 * F[:, 0] - F[:, 1] + 0.08 * np.sin(
|
|
355
|
+
2 * np.pi * (F[:, 1] / 1.8 - F[:, 0] / 1.6))) > 0
|
|
356
|
+
return F
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
class MW13(MW):
|
|
360
|
+
def __init__(self, n_var=15, **kwargs):
|
|
361
|
+
super().__init__(n_var, 2, 2, xu=1.5)
|
|
362
|
+
|
|
363
|
+
def _evaluate(self, X, out, *args, **kwargs):
|
|
364
|
+
g = self.g2(X)
|
|
365
|
+
f0 = g * X[:, 0]
|
|
366
|
+
f1 = g * (5.0 - np.exp(f0 / g) - np.abs(0.5 * np.sin(3 * np.pi * f0 / g)))
|
|
367
|
+
|
|
368
|
+
g0 = -1.0 * (5.0 - (1 + f0 + 0.5 * f0 * f0) - 0.5 * np.sin(3 * np.pi * f0) - f1) * (
|
|
369
|
+
5.0 - (1 + 0.7 * f0) - 0.5 * np.sin(3 * np.pi * f0) - f1)
|
|
370
|
+
g1 = (5.0 - np.exp(f0) - 0.5 * np.sin(3 * np.pi * f0) - f1) * (
|
|
371
|
+
5.0 - (1 + 0.4 * f0) - 0.5 * np.sin(3 * np.pi * f0) - f1)
|
|
372
|
+
out["F"] = np.column_stack([f0, f1])
|
|
373
|
+
out["G"] = np.column_stack([g0, g1])
|
|
374
|
+
|
|
375
|
+
def _calc_pareto_front(self, **kwargs):
|
|
376
|
+
return Remote.get_instance().load("pymoo", "pf", "MW", "MW13.pf")
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
class MW14(MW):
|
|
380
|
+
def __init__(self, n_var=None, n_obj=3, **kwargs):
|
|
381
|
+
if n_var is None:
|
|
382
|
+
n_var = n_obj + 12
|
|
383
|
+
super().__init__(n_var, n_obj, 1, xu=1.5)
|
|
384
|
+
|
|
385
|
+
def _evaluate(self, X, out, *args, **kwargs):
|
|
386
|
+
g = self.g3(X)
|
|
387
|
+
f = np.zeros((X.shape[0], self.n_obj))
|
|
388
|
+
f[:, :-1] = X[:, :(self.n_obj - 1)]
|
|
389
|
+
LA1 = self.LA1(1.5, 1.1, 2.0, 1.0, f[:, :-1])
|
|
390
|
+
inter = (6 - np.exp(f[:, :-1]) - LA1).sum(axis=1)
|
|
391
|
+
f[:, -1] = g / (self.n_obj - 1) * inter
|
|
392
|
+
|
|
393
|
+
alpha = 6.1 - 1 - f[:, :-1] - 0.5 * f[:, :-1] * f[:, :-1] - LA1
|
|
394
|
+
g0 = f[:, -1] - 1 / (self.n_obj - 1) * alpha.sum(axis=1)
|
|
395
|
+
out["F"] = f
|
|
396
|
+
out["G"] = g0.reshape((-1, 1))
|
|
397
|
+
|
|
398
|
+
def _calc_pareto_front(self, **kwargs):
|
|
399
|
+
if self.n_obj == 3:
|
|
400
|
+
return Remote.get_instance().load("pymoo", "pf", "MW", "MW14.pf")
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import pymoo.gradient.toolbox as anp
|
|
2
|
+
import numpy as np
|
|
3
|
+
|
|
4
|
+
from pymoo.core.problem import Problem
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class OmniTest(Problem):
|
|
8
|
+
"""
|
|
9
|
+
The Omni-test problem proposed by Deb in [1].
|
|
10
|
+
|
|
11
|
+
Parameters
|
|
12
|
+
----------
|
|
13
|
+
n_var: number of decision variables
|
|
14
|
+
|
|
15
|
+
References
|
|
16
|
+
----------
|
|
17
|
+
[1] Deb, K., Tiwari, S. "Omni-optimizer: A generic evolutionary algorithm for single and multi-objective optimization"
|
|
18
|
+
"""
|
|
19
|
+
def __init__(self, n_var=2):
|
|
20
|
+
assert (n_var >= 2), "The dimension of the decision space should at least be 2!"
|
|
21
|
+
super().__init__(
|
|
22
|
+
n_var=n_var, n_obj=2, vtype=float, xl=np.full(n_var, 0), xu=np.full(n_var, 6)
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
def _evaluate(self, X, out, *args, **kwargs):
|
|
26
|
+
F1 = anp.sum(anp.sin(anp.pi * X), axis=1)
|
|
27
|
+
F2 = anp.sum(anp.cos(anp.pi * X), axis=1)
|
|
28
|
+
out["F"] = anp.vstack((F1, F2)).T
|
|
29
|
+
|
|
30
|
+
def _calc_pareto_set(self, n_pareto_points=500):
|
|
31
|
+
# The Omni-test problem has 3^D Pareto subsets
|
|
32
|
+
num_ps = int(3 ** self.n_var)
|
|
33
|
+
h = int(n_pareto_points / num_ps)
|
|
34
|
+
PS = np.zeros((num_ps * h, self.n_var))
|
|
35
|
+
|
|
36
|
+
candidates = np.array([np.linspace(2 * m + 1, 2 * m + 3 / 2, h) for m in range(3)])
|
|
37
|
+
# generate combination indices
|
|
38
|
+
candidates_indices = [[0, 1, 2] for _ in range(self.n_var)]
|
|
39
|
+
a = np.meshgrid(*candidates_indices)
|
|
40
|
+
combination_indices = np.array(a).T.reshape(-1, self.n_var)
|
|
41
|
+
# generate 3^D combinations
|
|
42
|
+
for i in range(num_ps):
|
|
43
|
+
PS[i * h:i * h + h, :] = candidates[combination_indices[i]].T
|
|
44
|
+
return PS
|
|
45
|
+
|
|
46
|
+
def _calc_pareto_front(self, n_pareto_points=500):
|
|
47
|
+
PS = self._calc_pareto_set(n_pareto_points)
|
|
48
|
+
return self.evaluate(PS, return_values_of=["F"])
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import pymoo.gradient.toolbox as anp
|
|
2
|
+
import numpy as np
|
|
3
|
+
|
|
4
|
+
from pymoo.core.problem import Problem
|
|
5
|
+
from pymoo.util.remote import Remote
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class OSY(Problem):
|
|
9
|
+
def __init__(self):
|
|
10
|
+
super().__init__(n_var=6, n_obj=2, n_ieq_constr=6, vtype=float)
|
|
11
|
+
self.xl = np.array([0.0, 0.0, 1.0, 0.0, 1.0, 0.0])
|
|
12
|
+
self.xu = np.array([10.0, 10.0, 5.0, 6.0, 5.0, 10.0])
|
|
13
|
+
|
|
14
|
+
def _evaluate(self, x, out, *args, **kwargs):
|
|
15
|
+
f1 = - (25 * (x[:, 0] - 2) ** 2 + (x[:, 1] - 2) ** 2 + (x[:, 2] - 1) ** 2 + (x[:, 3] - 4) ** 2 + (
|
|
16
|
+
x[:, 4] - 1) ** 2)
|
|
17
|
+
f2 = anp.sum(anp.square(x), axis=1)
|
|
18
|
+
|
|
19
|
+
g1 = (x[:, 0] + x[:, 1] - 2.0) / 2.0
|
|
20
|
+
g2 = (6.0 - x[:, 0] - x[:, 1]) / 6.0
|
|
21
|
+
g3 = (2.0 - x[:, 1] + x[:, 0]) / 2.0
|
|
22
|
+
g4 = (2.0 - x[:, 0] + 3.0 * x[:, 1]) / 2.0
|
|
23
|
+
g5 = (4.0 - (x[:, 2] - 3.0) ** 2 - x[:, 3]) / 4.0
|
|
24
|
+
g6 = ((x[:, 4] - 3.0) ** 2 + x[:, 5] - 4.0) / 4.0
|
|
25
|
+
|
|
26
|
+
out["F"] = anp.column_stack([f1, f2])
|
|
27
|
+
|
|
28
|
+
out["G"] = anp.column_stack([g1, g2, g3, g4, g5, g6])
|
|
29
|
+
out["G"] = - out["G"]
|
|
30
|
+
|
|
31
|
+
def _calc_pareto_front(self):
|
|
32
|
+
return Remote.get_instance().load("pymoo", "pf", "osy.pf")
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import pymoo.gradient.toolbox as anp
|
|
2
|
+
import numpy as np
|
|
3
|
+
|
|
4
|
+
from pymoo.core.problem import Problem
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class SRN(Problem):
|
|
8
|
+
def __init__(self):
|
|
9
|
+
super().__init__(n_var=2, n_obj=2, n_ieq_constr=2, xl=-20, xu=+20, vtype=float)
|
|
10
|
+
|
|
11
|
+
def _evaluate(self, x, out, *args, **kwargs):
|
|
12
|
+
f1 = 2 + (x[:, 0] - 2) ** 2 + (x[:, 1] - 1) ** 2
|
|
13
|
+
f2 = 9 * x[:, 0] - (x[:, 1] - 1) ** 2
|
|
14
|
+
|
|
15
|
+
g1 = x[:, 0] ** 2 + x[:, 1] ** 2 - 225
|
|
16
|
+
g2 = x[:, 0] - 3 * x[:, 1] + 10
|
|
17
|
+
|
|
18
|
+
out["F"] = anp.column_stack([f1, f2])
|
|
19
|
+
out["G"] = anp.column_stack([g1, g2])
|
|
20
|
+
|
|
21
|
+
def _calc_pareto_front(self, *args, n_points=100, **kwargs):
|
|
22
|
+
ps = self.pareto_set(n_points=n_points)
|
|
23
|
+
return self.evaluate(ps, return_values_of=["F"])
|
|
24
|
+
|
|
25
|
+
def _calc_pareto_set(self, *args, n_points=100, **kwargs):
|
|
26
|
+
x1 = np.full(n_points, -2.5)
|
|
27
|
+
x2 = np.linspace(2.5, 14.7902, n_points)
|
|
28
|
+
return np.column_stack([x1, x2])
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import pymoo.gradient.toolbox as anp
|
|
2
|
+
import numpy as np
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
from pymoo.core.problem import Problem
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class SYMPARTRotated(Problem):
|
|
9
|
+
"""
|
|
10
|
+
The SYM-PART test problem proposed in [1].
|
|
11
|
+
|
|
12
|
+
Parameters:
|
|
13
|
+
-----------
|
|
14
|
+
length: the length of each line (i.e., each Pareto subsets), default is 1.
|
|
15
|
+
v_dist: vertical distance between the centers of two adjacent lines, default is 10.
|
|
16
|
+
h_dist: horizontal distance between the centers of two adjacent lines, default is 10.
|
|
17
|
+
angle: the angle to rotate the equivalent Pareto subsets counterclockwisely.
|
|
18
|
+
When set to a negative value, Pareto subsets are rotated clockwisely.
|
|
19
|
+
|
|
20
|
+
References:
|
|
21
|
+
----------
|
|
22
|
+
[1] G. Rudolph, B. Naujoks, and M. Preuss, “Capabilities of EMOA to detect and preserve equivalent Pareto subsets”
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
def __init__(self, length=1, v_dist=10, h_dist=10, angle=np.pi / 4):
|
|
26
|
+
self.a = length
|
|
27
|
+
self.b = v_dist
|
|
28
|
+
self.c = h_dist
|
|
29
|
+
self.w = angle
|
|
30
|
+
|
|
31
|
+
# Calculate the inverted rotation matrix, store for fitness evaluation
|
|
32
|
+
self.IRM = np.array([
|
|
33
|
+
[np.cos(self.w), np.sin(self.w)],
|
|
34
|
+
[-np.sin(self.w), np.cos(self.w)]])
|
|
35
|
+
|
|
36
|
+
r = max(self.b, self.c)
|
|
37
|
+
xl = np.full(2, -10 * r)
|
|
38
|
+
xu = np.full(2, 10 * r)
|
|
39
|
+
|
|
40
|
+
super().__init__(n_var=2, n_obj=2, vtype=float, xl=xl, xu=xu)
|
|
41
|
+
|
|
42
|
+
def _evaluate(self, X, out, *args, **kwargs):
|
|
43
|
+
if self.w == 0:
|
|
44
|
+
X1 = X[:, 0]
|
|
45
|
+
X2 = X[:, 1]
|
|
46
|
+
else:
|
|
47
|
+
# If rotated, we rotate it back by applying the inverted rotation matrix to X
|
|
48
|
+
Y = anp.array([anp.matmul(self.IRM, x) for x in X])
|
|
49
|
+
X1 = Y[:, 0]
|
|
50
|
+
X2 = Y[:, 1]
|
|
51
|
+
|
|
52
|
+
a, b, c = self.a, self.b, self.c
|
|
53
|
+
t1_hat = anp.sign(X1) * anp.ceil((anp.abs(X1) - a - c / 2) / (2 * a + c))
|
|
54
|
+
t2_hat = anp.sign(X2) * anp.ceil((anp.abs(X2) - b / 2) / b)
|
|
55
|
+
one = anp.ones(len(X))
|
|
56
|
+
t1 = anp.sign(t1_hat) * anp.min(anp.vstack((anp.abs(t1_hat), one)), axis=0)
|
|
57
|
+
t2 = anp.sign(t2_hat) * anp.min(anp.vstack((anp.abs(t2_hat), one)), axis=0)
|
|
58
|
+
|
|
59
|
+
p1 = X1 - t1 * c
|
|
60
|
+
p2 = X2 - t2 * b
|
|
61
|
+
|
|
62
|
+
f1 = (p1 + a) ** 2 + p2 ** 2
|
|
63
|
+
f2 = (p1 - a) ** 2 + p2 ** 2
|
|
64
|
+
out["F"] = anp.vstack((f1, f2)).T
|
|
65
|
+
|
|
66
|
+
def _calc_pareto_set(self, n_pareto_points=500):
|
|
67
|
+
# The SYM-PART test problem has 9 equivalent Pareto subsets.
|
|
68
|
+
h = int(n_pareto_points / 9)
|
|
69
|
+
PS = np.zeros((h * 9, self.n_var))
|
|
70
|
+
cnt = 0
|
|
71
|
+
for row in [-1, 0, 1]:
|
|
72
|
+
for col in [1, 0, -1]:
|
|
73
|
+
X1 = np.linspace(row * self.c - self.a, row * self.c + self.a, h)
|
|
74
|
+
X2 = np.tile(col * self.b, h)
|
|
75
|
+
PS[cnt * h:cnt * h + h, :] = np.vstack((X1, X2)).T
|
|
76
|
+
cnt = cnt + 1
|
|
77
|
+
if self.w != 0:
|
|
78
|
+
# If rotated, we apply the rotation matrix to PS
|
|
79
|
+
# Calculate the rotation matrix
|
|
80
|
+
RM = np.array([
|
|
81
|
+
[np.cos(self.w), -np.sin(self.w)],
|
|
82
|
+
[np.sin(self.w), np.cos(self.w)]
|
|
83
|
+
])
|
|
84
|
+
PS = np.array([np.matmul(RM, x) for x in PS])
|
|
85
|
+
return PS
|
|
86
|
+
|
|
87
|
+
def _calc_pareto_front(self, n_pareto_points=500):
|
|
88
|
+
PS = self.pareto_set(n_pareto_points)
|
|
89
|
+
return self.evaluate(PS, return_values_of=["F"])
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
class SYMPART(SYMPARTRotated):
|
|
93
|
+
def __init__(self, length=1, v_dist=10, h_dist=10):
|
|
94
|
+
super().__init__(length, v_dist, h_dist, 0)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import pymoo.gradient.toolbox as anp
|
|
2
|
+
import numpy as np
|
|
3
|
+
|
|
4
|
+
from pymoo.core.problem import Problem
|
|
5
|
+
from pymoo.util.remote import Remote
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class TNK(Problem):
|
|
9
|
+
def __init__(self):
|
|
10
|
+
super().__init__(n_var=2, n_obj=2, n_ieq_constr=2, vtype=float)
|
|
11
|
+
self.xl = np.array([0, 1e-30])
|
|
12
|
+
self.xu = np.array([np.pi, np.pi])
|
|
13
|
+
|
|
14
|
+
def _evaluate(self, x, out, *args, **kwargs):
|
|
15
|
+
f1 = x[:, 0]
|
|
16
|
+
f2 = x[:, 1]
|
|
17
|
+
g1 = -(anp.square(x[:, 0]) + anp.square(x[:, 1]) - 1.0 - 0.1 * anp.cos(16.0 * anp.arctan(x[:, 0] / x[:, 1])))
|
|
18
|
+
g2 = 2 * (anp.square(x[:, 0] - 0.5) + anp.square(x[:, 1] - 0.5)) - 1
|
|
19
|
+
|
|
20
|
+
out["F"] = anp.column_stack([f1, f2])
|
|
21
|
+
out["G"] = anp.column_stack([g1, g2])
|
|
22
|
+
|
|
23
|
+
def _calc_pareto_front(self, *args, **kwargs):
|
|
24
|
+
return Remote.get_instance().load("pymoo", "pf", "tnk.pf")
|