pymoo 0.6.1.6__cp312-cp312-macosx_10_13_universal2.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/__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 +110 -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 +91 -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/cmopso.py +239 -0
- pymoo/algorithms/moo/ctaea.py +305 -0
- pymoo/algorithms/moo/dnsga2.py +80 -0
- pymoo/algorithms/moo/kgb.py +450 -0
- pymoo/algorithms/moo/moead.py +183 -0
- pymoo/algorithms/moo/mopso_cd.py +309 -0
- pymoo/algorithms/moo/nsga2.py +113 -0
- pymoo/algorithms/moo/nsga3.py +361 -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 +196 -0
- pymoo/algorithms/moo/spea2.py +191 -0
- pymoo/algorithms/moo/unsga3.py +49 -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 +162 -0
- pymoo/algorithms/soo/nonconvex/cmaes.py +556 -0
- pymoo/algorithms/soo/nonconvex/de.py +283 -0
- pymoo/algorithms/soo/nonconvex/direct.py +148 -0
- pymoo/algorithms/soo/nonconvex/es.py +213 -0
- pymoo/algorithms/soo/nonconvex/g3pcx.py +94 -0
- pymoo/algorithms/soo/nonconvex/ga.py +95 -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/nrbo.py +191 -0
- pymoo/algorithms/soo/nonconvex/optuna.py +80 -0
- pymoo/algorithms/soo/nonconvex/pattern.py +185 -0
- pymoo/algorithms/soo/nonconvex/pso.py +337 -0
- pymoo/algorithms/soo/nonconvex/pso_ep.py +307 -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/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 +66 -0
- pymoo/constraints/as_obj.py +56 -0
- pymoo/constraints/as_penalty.py +41 -0
- pymoo/constraints/eps.py +34 -0
- pymoo/constraints/from_bounds.py +36 -0
- pymoo/core/__init__.py +0 -0
- pymoo/core/algorithm.py +408 -0
- pymoo/core/callback.py +38 -0
- pymoo/core/crossover.py +79 -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 +65 -0
- pymoo/core/initialization.py +44 -0
- pymoo/core/mating.py +39 -0
- pymoo/core/meta.py +21 -0
- pymoo/core/mixed.py +164 -0
- pymoo/core/mutation.py +44 -0
- pymoo/core/operator.py +46 -0
- pymoo/core/parameters.py +134 -0
- pymoo/core/plot.py +208 -0
- pymoo/core/population.py +180 -0
- pymoo/core/problem.py +373 -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 +45 -0
- pymoo/core/selection.py +61 -0
- pymoo/core/solution.py +10 -0
- pymoo/core/survival.py +107 -0
- pymoo/core/termination.py +70 -0
- pymoo/core/variable.py +415 -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/functions/__init__.py +135 -0
- pymoo/functions/compiled/__init__.py +0 -0
- pymoo/functions/compiled/calc_perpendicular_distance.cpp +27464 -0
- pymoo/functions/compiled/calc_perpendicular_distance.cpython-312-darwin.so +0 -0
- pymoo/functions/compiled/decomposition.cpp +28853 -0
- pymoo/functions/compiled/decomposition.cpython-312-darwin.so +0 -0
- pymoo/functions/compiled/info.cpp +7058 -0
- pymoo/functions/compiled/info.cpython-312-darwin.so +0 -0
- pymoo/functions/compiled/mnn.cpp +30095 -0
- pymoo/functions/compiled/mnn.cpython-312-darwin.so +0 -0
- pymoo/functions/compiled/non_dominated_sorting.cpp +35692 -0
- pymoo/functions/compiled/non_dominated_sorting.cpython-312-darwin.so +0 -0
- pymoo/functions/compiled/pruning_cd.cpp +29248 -0
- pymoo/functions/compiled/pruning_cd.cpython-312-darwin.so +0 -0
- pymoo/functions/compiled/stochastic_ranking.cpp +28042 -0
- pymoo/functions/compiled/stochastic_ranking.cpython-312-darwin.so +0 -0
- pymoo/functions/standard/__init__.py +1 -0
- pymoo/functions/standard/calc_perpendicular_distance.py +20 -0
- pymoo/functions/standard/decomposition.py +18 -0
- pymoo/functions/standard/hv.py +5 -0
- pymoo/functions/standard/mnn.py +78 -0
- pymoo/functions/standard/non_dominated_sorting.py +474 -0
- pymoo/functions/standard/pruning_cd.py +93 -0
- pymoo/functions/standard/stochastic_ranking.py +42 -0
- pymoo/gradient/__init__.py +24 -0
- pymoo/gradient/automatic.py +85 -0
- pymoo/gradient/grad_autograd.py +105 -0
- pymoo/gradient/grad_complex.py +35 -0
- pymoo/gradient/grad_jax.py +51 -0
- pymoo/gradient/numpy.py +22 -0
- pymoo/gradient/toolbox/__init__.py +19 -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 +59 -0
- pymoo/indicators/hv/approximate.py +105 -0
- pymoo/indicators/hv/exact.py +68 -0
- pymoo/indicators/hv/exact_2d.py +102 -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 +190 -0
- pymoo/operators/crossover/__init__.py +0 -0
- pymoo/operators/crossover/binx.py +47 -0
- pymoo/operators/crossover/dex.py +125 -0
- pymoo/operators/crossover/erx.py +164 -0
- pymoo/operators/crossover/expx.py +53 -0
- pymoo/operators/crossover/hux.py +37 -0
- pymoo/operators/crossover/nox.py +25 -0
- pymoo/operators/crossover/ox.py +88 -0
- pymoo/operators/crossover/pcx.py +84 -0
- pymoo/operators/crossover/pntx.py +49 -0
- pymoo/operators/crossover/sbx.py +137 -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 +60 -0
- pymoo/operators/mutation/inversion.py +42 -0
- pymoo/operators/mutation/nom.py +7 -0
- pymoo/operators/mutation/pm.py +96 -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 +97 -0
- pymoo/operators/repair/inverse_penalty.py +91 -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 +76 -0
- pymoo/operators/sampling/rnd.py +52 -0
- pymoo/operators/selection/__init__.py +0 -0
- pymoo/operators/selection/rnd.py +75 -0
- pymoo/operators/selection/tournament.py +78 -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 +212 -0
- pymoo/operators/survival/rank_and_crowding/metrics.py +208 -0
- pymoo/optimize.py +72 -0
- pymoo/parallelization/__init__.py +15 -0
- pymoo/parallelization/dask.py +25 -0
- pymoo/parallelization/joblib.py +28 -0
- pymoo/parallelization/ray.py +31 -0
- pymoo/parallelization/starmap.py +24 -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 +451 -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 +553 -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 +113 -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 +49 -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 +33 -0
- pymoo/util/archive.py +152 -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 +100 -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/hv.py +21 -0
- pymoo/util/matlab_engine.py +39 -0
- pymoo/util/misc.py +447 -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/find_non_dominated.py +54 -0
- pymoo/util/nds/naive_non_dominated_sort.py +36 -0
- pymoo/util/nds/non_dominated_sorting.py +94 -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/randomized_argsort.py +63 -0
- pymoo/util/ref_dirs/__init__.py +24 -0
- pymoo/util/ref_dirs/construction.py +89 -0
- pymoo/util/ref_dirs/das_dennis.py +52 -0
- pymoo/util/ref_dirs/energy.py +317 -0
- pymoo/util/ref_dirs/energy_layer.py +119 -0
- pymoo/util/ref_dirs/genetic_algorithm.py +64 -0
- pymoo/util/ref_dirs/incremental.py +69 -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 +258 -0
- pymoo/util/remote.py +55 -0
- pymoo/util/roulette.py +29 -0
- pymoo/util/running_metric.py +128 -0
- pymoo/util/sliding_window.py +25 -0
- pymoo/util/value_functions.py +720 -0
- pymoo/util/vectors.py +40 -0
- pymoo/util/vf_dominator.py +102 -0
- pymoo/vendor/__init__.py +0 -0
- pymoo/vendor/cec2018.py +398 -0
- pymoo/vendor/gta.py +617 -0
- pymoo/vendor/vendor_cmaes.py +421 -0
- pymoo/vendor/vendor_coco.py +81 -0
- pymoo/vendor/vendor_scipy.py +232 -0
- pymoo/version.py +1 -0
- pymoo/visualization/__init__.py +21 -0
- pymoo/visualization/app/__init__.py +0 -0
- pymoo/visualization/app/pso.py +61 -0
- pymoo/visualization/fitness_landscape.py +128 -0
- pymoo/visualization/heatmap.py +123 -0
- pymoo/visualization/matplotlib.py +61 -0
- pymoo/visualization/pcp.py +121 -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 +296 -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.6.dist-info/METADATA +209 -0
- pymoo-0.6.1.6.dist-info/RECORD +337 -0
- pymoo-0.6.1.6.dist-info/WHEEL +6 -0
- pymoo-0.6.1.6.dist-info/licenses/LICENSE +191 -0
- pymoo-0.6.1.6.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import pymoo.gradient.toolbox as anp
|
|
2
|
+
import numpy as np
|
|
3
|
+
|
|
4
|
+
from pymoo.problems.many.dtlz import DTLZ1, DTLZ2, DTLZ3, DTLZ4, get_ref_dirs
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class C1DTLZ1(DTLZ1):
|
|
8
|
+
|
|
9
|
+
def __init__(self, n_var=12, n_obj=3, **kwargs):
|
|
10
|
+
super().__init__(n_var=n_var, n_obj=n_obj, n_ieq_constr=1, **kwargs)
|
|
11
|
+
|
|
12
|
+
def _evaluate(self, X, out, *args, **kwargs):
|
|
13
|
+
super()._evaluate(X, out, *args, **kwargs)
|
|
14
|
+
out["G"] = constraint_c1_linear(out["F"])
|
|
15
|
+
|
|
16
|
+
def _calc_pareto_front(self, ref_dirs=None, *args, **kwargs):
|
|
17
|
+
if ref_dirs is None:
|
|
18
|
+
ref_dirs = get_ref_dirs(self.n_obj)
|
|
19
|
+
return super()._calc_pareto_front(ref_dirs, *args, **kwargs)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class C1DTLZ3(DTLZ3):
|
|
23
|
+
|
|
24
|
+
def __init__(self, n_var=12, n_obj=3, r=None, **kwargs):
|
|
25
|
+
super().__init__(n_var=n_var, n_obj=n_obj, n_ieq_constr=1, **kwargs)
|
|
26
|
+
|
|
27
|
+
if r is None:
|
|
28
|
+
if self.n_obj < 5:
|
|
29
|
+
r = 9.0
|
|
30
|
+
elif 5 <= self.n_obj <= 12:
|
|
31
|
+
r = 12.5
|
|
32
|
+
else:
|
|
33
|
+
r = 15.0
|
|
34
|
+
|
|
35
|
+
self.r = r
|
|
36
|
+
|
|
37
|
+
def _evaluate(self, X, out, *args, **kwargs):
|
|
38
|
+
super()._evaluate(X, out, *args, **kwargs)
|
|
39
|
+
out["G"] = constraint_c1_spherical(out["F"], self.r)
|
|
40
|
+
|
|
41
|
+
def _calc_pareto_front(self, ref_dirs=None, *args, **kwargs):
|
|
42
|
+
if ref_dirs is None:
|
|
43
|
+
ref_dirs = get_ref_dirs(self.n_obj)
|
|
44
|
+
return super()._calc_pareto_front(ref_dirs, *args, **kwargs)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
class C2DTLZ2(DTLZ2):
|
|
48
|
+
|
|
49
|
+
def __init__(self, n_var=12, n_obj=3, r=None, **kwargs):
|
|
50
|
+
super().__init__(n_var=n_var, n_obj=n_obj, n_ieq_constr=1, **kwargs)
|
|
51
|
+
|
|
52
|
+
if r is None:
|
|
53
|
+
if n_obj == 2:
|
|
54
|
+
r = 0.2
|
|
55
|
+
elif n_obj == 3:
|
|
56
|
+
r = 0.4
|
|
57
|
+
else:
|
|
58
|
+
r = 0.5
|
|
59
|
+
|
|
60
|
+
self.r = r
|
|
61
|
+
|
|
62
|
+
def _evaluate(self, X, out, *args, **kwargs):
|
|
63
|
+
super()._evaluate(X, out, *args, **kwargs)
|
|
64
|
+
out["G"] = constraint_c2(out["F"], self.r)
|
|
65
|
+
|
|
66
|
+
def _calc_pareto_front(self, ref_dirs=None, *args, **kwargs):
|
|
67
|
+
if ref_dirs is None:
|
|
68
|
+
ref_dirs = get_ref_dirs(self.n_obj)
|
|
69
|
+
F = super()._calc_pareto_front(ref_dirs, *args, **kwargs)
|
|
70
|
+
G = constraint_c2(F, r=self.r)
|
|
71
|
+
G[G <= 0] = 0
|
|
72
|
+
return F[G <= 0]
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
class C3DTLZ1(DTLZ1):
|
|
76
|
+
|
|
77
|
+
def __init__(self, n_var=12, n_obj=3, **kwargs):
|
|
78
|
+
super().__init__(n_var=n_var, n_obj=n_obj, n_ieq_constr=n_obj, **kwargs)
|
|
79
|
+
|
|
80
|
+
def _evaluate(self, X, out, *args, **kwargs):
|
|
81
|
+
super()._evaluate(X, out, *args, **kwargs)
|
|
82
|
+
out["G"] = constraint_c3_linear(out["F"])
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
class C3DTLZ4(DTLZ4):
|
|
86
|
+
|
|
87
|
+
def __init__(self, n_var=7, n_obj=3, **kwargs):
|
|
88
|
+
super().__init__(n_var=n_var, n_obj=n_obj, n_ieq_constr=n_obj, **kwargs)
|
|
89
|
+
|
|
90
|
+
def _evaluate(self, X, out, *args, **kwargs):
|
|
91
|
+
super()._evaluate(X, out, *args, **kwargs)
|
|
92
|
+
out["G"] = constraint_c3_spherical(out["F"])
|
|
93
|
+
|
|
94
|
+
def _calc_pareto_front(self, ref_dirs=None, *args, **kwargs):
|
|
95
|
+
if ref_dirs is None:
|
|
96
|
+
ref_dirs = get_ref_dirs(self.n_obj)
|
|
97
|
+
F = super()._calc_pareto_front(ref_dirs, *args, **kwargs)
|
|
98
|
+
a = np.sqrt(np.sum(F ** 2, 1) - 3 / 4 * np.max(F ** 2, axis=1))
|
|
99
|
+
a = np.expand_dims(a, axis=1)
|
|
100
|
+
a = np.tile(a, [1, ref_dirs.shape[1]])
|
|
101
|
+
F = F / a
|
|
102
|
+
|
|
103
|
+
return F
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def constraint_c1_linear(f):
|
|
107
|
+
g = - (1 - f[:, -1] / 0.6 - anp.sum(f[:, :-1] / 0.5, axis=1))
|
|
108
|
+
return g
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
def constraint_c1_spherical(f, r):
|
|
112
|
+
radius = anp.sum(f ** 2, axis=1)
|
|
113
|
+
g = - (radius - 16) * (radius - r ** 2)
|
|
114
|
+
|
|
115
|
+
return g
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def constraint_c2(f, r):
|
|
119
|
+
n_obj = f.shape[1]
|
|
120
|
+
|
|
121
|
+
v1 = anp.full(f.shape[0], anp.inf)
|
|
122
|
+
|
|
123
|
+
for i in range(n_obj):
|
|
124
|
+
temp = (f[:, i] - 1) ** 2 + (anp.sum(f ** 2, axis=1) - f[:, i] ** 2) - r ** 2
|
|
125
|
+
v1 = anp.minimum(temp.flatten(), v1)
|
|
126
|
+
|
|
127
|
+
a = 1 / anp.sqrt(n_obj)
|
|
128
|
+
v2 = anp.sum((f - a) ** 2, axis=1) - r ** 2
|
|
129
|
+
g = anp.minimum(v1, v2.flatten())
|
|
130
|
+
|
|
131
|
+
return g
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def constraint_c3_linear(f): # M lines
|
|
135
|
+
n_obj = f.shape[1]
|
|
136
|
+
g = []
|
|
137
|
+
|
|
138
|
+
for i in range(n_obj):
|
|
139
|
+
_g = 1 - f[:, i] / 0.5 - (anp.sum(f, axis=1) - f[:, i])
|
|
140
|
+
g.append(_g)
|
|
141
|
+
|
|
142
|
+
return anp.column_stack(g)
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
def constraint_c3_spherical(f): # M ellipse
|
|
146
|
+
n_obj = f.shape[1]
|
|
147
|
+
g = []
|
|
148
|
+
|
|
149
|
+
for i in range(n_obj):
|
|
150
|
+
_g = 1 - f[:, i] ** 2 / 4 - (anp.sum(f ** 2, axis=1) - f[:, i] ** 2)
|
|
151
|
+
g.append(_g)
|
|
152
|
+
return anp.column_stack(g)
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
def constraint_c4_cylindrical(f, r): # cylindrical
|
|
156
|
+
l = anp.mean(f, axis=1)
|
|
157
|
+
l = anp.expand_dims(l, axis=1)
|
|
158
|
+
g = -anp.sum(anp.power(f - l, 2), axis=1) + anp.power(r, 2)
|
|
159
|
+
return g
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import pymoo.gradient.toolbox as anp
|
|
2
|
+
|
|
3
|
+
from pymoo.problems.many.dtlz import DTLZ1, DTLZ3
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def constraint_dc1(X, a=5, b=0.95):
|
|
7
|
+
G = b - anp.cos(a * anp.pi * X[:, 0])
|
|
8
|
+
return G
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def constraints_dc2(gx, a=3, b=0.9):
|
|
12
|
+
G = anp.column_stack([
|
|
13
|
+
b - anp.cos(gx / 100 * anp.pi * a),
|
|
14
|
+
b - anp.exp (-gx / 100)
|
|
15
|
+
])
|
|
16
|
+
return G
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def constraints_dc3(X, gx, a=5, b=0.5):
|
|
20
|
+
Ggx = b - anp.cos(a * anp.pi * gx)
|
|
21
|
+
Gx = b - anp.cos(a * anp.pi * X)
|
|
22
|
+
return anp.column_stack([Ggx, Gx])
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class DC1DTLZ1(DTLZ1):
|
|
26
|
+
def __init__(self, n_var=12, n_obj=3, **kwargs):
|
|
27
|
+
super().__init__(n_var, n_obj, **kwargs)
|
|
28
|
+
self.n_ieq_constr = 1
|
|
29
|
+
|
|
30
|
+
def _evaluate(self, x, out, *args, **kwargs):
|
|
31
|
+
super()._evaluate(x, out, *args, **kwargs)
|
|
32
|
+
out["G"] = constraint_dc1(x)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class DC1DTLZ3(DTLZ3):
|
|
36
|
+
def __init__(self, n_var=12, n_obj=3, **kwargs):
|
|
37
|
+
super().__init__(n_var, n_obj, **kwargs)
|
|
38
|
+
self.n_ieq_constr = 1
|
|
39
|
+
|
|
40
|
+
def _evaluate(self, x, out, *args, **kwargs):
|
|
41
|
+
super()._evaluate(x, out, *args, **kwargs)
|
|
42
|
+
out["G"] = constraint_dc1(x)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class DC2DTLZ1(DTLZ1):
|
|
46
|
+
def __init__(self, n_var=12, n_obj=3, **kwargs):
|
|
47
|
+
super().__init__(n_var, n_obj, **kwargs)
|
|
48
|
+
self.n_ieq_constr = 2
|
|
49
|
+
|
|
50
|
+
def _evaluate(self, x, out, *args, **kwargs):
|
|
51
|
+
X_, X_M = x[:, :self.n_obj - 1], x[:, self.n_obj - 1:]
|
|
52
|
+
g = self.g1(X_M)
|
|
53
|
+
out["F"] = self.obj_func(X_, g)
|
|
54
|
+
out["G"] = constraints_dc2(g)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class DC2DTLZ3(DTLZ3):
|
|
58
|
+
def __init__(self, n_var=12, n_obj=3, **kwargs):
|
|
59
|
+
super().__init__(n_var, n_obj, **kwargs)
|
|
60
|
+
self.n_ieq_constr = 2
|
|
61
|
+
|
|
62
|
+
def _evaluate(self, x, out, *args, **kwargs):
|
|
63
|
+
X_, X_M = x[:, :self.n_obj - 1], x[:, self.n_obj - 1:]
|
|
64
|
+
g = self.g1(X_M)
|
|
65
|
+
out["F"] = self.obj_func(X_, g, alpha=1)
|
|
66
|
+
out["G"] = constraints_dc2(g)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class DC3DTLZ1(DTLZ1):
|
|
70
|
+
def __init__(self, n_var=12, n_obj=3, **kwargs):
|
|
71
|
+
super().__init__(n_var, n_obj, n_ieq_constr=n_obj, **kwargs)
|
|
72
|
+
|
|
73
|
+
def _evaluate(self, x, out, *args, **kwargs):
|
|
74
|
+
X_, X_M = x[:, :self.n_obj - 1], x[:, self.n_obj - 1:]
|
|
75
|
+
g = self.g1(X_M)
|
|
76
|
+
out["F"] = self.obj_func(X_, g)
|
|
77
|
+
out["G"] = constraints_dc3(X_, g)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
class DC3DTLZ3(DTLZ3):
|
|
81
|
+
def __init__(self, n_var=12, n_obj=3, **kwargs):
|
|
82
|
+
super().__init__(n_var, n_obj, n_ieq_constr=n_obj, **kwargs)
|
|
83
|
+
|
|
84
|
+
def _evaluate(self, x, out, *args, **kwargs):
|
|
85
|
+
X_, X_M = x[:, :self.n_obj - 1], x[:, self.n_obj - 1:]
|
|
86
|
+
g = self.g1(X_M)
|
|
87
|
+
out["F"] = self.obj_func(X_, g, alpha=1)
|
|
88
|
+
out["G"] = constraints_dc3(X_, g)
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import pymoo.gradient.toolbox as anp
|
|
2
|
+
import numpy as np
|
|
3
|
+
|
|
4
|
+
from pymoo.core.problem import Problem
|
|
5
|
+
from pymoo.util.reference_direction import UniformReferenceDirectionFactory
|
|
6
|
+
from pymoo.util.remote import Remote
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class DTLZ(Problem):
|
|
10
|
+
def __init__(self, n_var, n_obj, k=None, **kwargs):
|
|
11
|
+
|
|
12
|
+
if n_var:
|
|
13
|
+
self.k = n_var - n_obj + 1
|
|
14
|
+
elif k:
|
|
15
|
+
self.k = k
|
|
16
|
+
n_var = k + n_obj - 1
|
|
17
|
+
else:
|
|
18
|
+
raise Exception("Either provide number of variables or k!")
|
|
19
|
+
|
|
20
|
+
super().__init__(n_var=n_var, n_obj=n_obj, xl=0, xu=1, vtype=float, **kwargs)
|
|
21
|
+
|
|
22
|
+
def g1(self, X_M):
|
|
23
|
+
return 100 * (self.k + anp.sum(anp.square(X_M - 0.5) - anp.cos(20 * anp.pi * (X_M - 0.5)), axis=1))
|
|
24
|
+
|
|
25
|
+
def g2(self, X_M):
|
|
26
|
+
return anp.sum(anp.square(X_M - 0.5), axis=1)
|
|
27
|
+
|
|
28
|
+
def obj_func(self, X_, g, alpha=1):
|
|
29
|
+
f = []
|
|
30
|
+
|
|
31
|
+
for i in range(0, self.n_obj):
|
|
32
|
+
_f = (1 + g)
|
|
33
|
+
_f *= anp.prod(anp.cos(anp.power(X_[:, :X_.shape[1] - i], alpha) * anp.pi / 2.0), axis=1)
|
|
34
|
+
if i > 0:
|
|
35
|
+
_f *= anp.sin(anp.power(X_[:, X_.shape[1] - i], alpha) * anp.pi / 2.0)
|
|
36
|
+
|
|
37
|
+
f.append(_f)
|
|
38
|
+
|
|
39
|
+
f = anp.column_stack(f)
|
|
40
|
+
return f
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class DTLZ1(DTLZ):
|
|
44
|
+
def __init__(self, n_var=7, n_obj=3, **kwargs):
|
|
45
|
+
super().__init__(n_var=n_var, n_obj=n_obj, **kwargs)
|
|
46
|
+
|
|
47
|
+
def _calc_pareto_front(self, ref_dirs=None):
|
|
48
|
+
if ref_dirs is None:
|
|
49
|
+
ref_dirs = get_ref_dirs(self.n_obj)
|
|
50
|
+
return 0.5 * ref_dirs
|
|
51
|
+
|
|
52
|
+
def obj_func(self, X_, g):
|
|
53
|
+
f = []
|
|
54
|
+
|
|
55
|
+
for i in range(0, self.n_obj):
|
|
56
|
+
_f = 0.5 * (1 + g)
|
|
57
|
+
_f *= anp.prod(X_[:, :X_.shape[1] - i], axis=1)
|
|
58
|
+
if i > 0:
|
|
59
|
+
_f *= 1 - X_[:, X_.shape[1] - i]
|
|
60
|
+
f.append(_f)
|
|
61
|
+
|
|
62
|
+
return anp.column_stack(f)
|
|
63
|
+
|
|
64
|
+
def _evaluate(self, x, out, *args, **kwargs):
|
|
65
|
+
X_, X_M = x[:, :self.n_obj - 1], x[:, self.n_obj - 1:]
|
|
66
|
+
g = self.g1(X_M)
|
|
67
|
+
out["F"] = self.obj_func(X_, g)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
class DTLZ2(DTLZ):
|
|
71
|
+
def __init__(self, n_var=10, n_obj=3, **kwargs):
|
|
72
|
+
super().__init__(n_var=n_var, n_obj=n_obj, **kwargs)
|
|
73
|
+
|
|
74
|
+
def _calc_pareto_front(self, ref_dirs=None):
|
|
75
|
+
if ref_dirs is None:
|
|
76
|
+
ref_dirs = get_ref_dirs(self.n_obj)
|
|
77
|
+
return generic_sphere(ref_dirs)
|
|
78
|
+
|
|
79
|
+
def _evaluate(self, x, out, *args, **kwargs):
|
|
80
|
+
X_, X_M = x[:, :self.n_obj - 1], x[:, self.n_obj - 1:]
|
|
81
|
+
g = self.g2(X_M)
|
|
82
|
+
out["F"] = self.obj_func(X_, g, alpha=1)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
class DTLZ3(DTLZ):
|
|
86
|
+
def __init__(self, n_var=10, n_obj=3, **kwargs):
|
|
87
|
+
super().__init__(n_var=n_var, n_obj=n_obj, **kwargs)
|
|
88
|
+
|
|
89
|
+
def _calc_pareto_front(self, ref_dirs=None):
|
|
90
|
+
if ref_dirs is None:
|
|
91
|
+
ref_dirs = get_ref_dirs(self.n_obj)
|
|
92
|
+
return generic_sphere(ref_dirs)
|
|
93
|
+
|
|
94
|
+
def _evaluate(self, x, out, *args, **kwargs):
|
|
95
|
+
X_, X_M = x[:, :self.n_obj - 1], x[:, self.n_obj - 1:]
|
|
96
|
+
g = self.g1(X_M)
|
|
97
|
+
out["F"] = self.obj_func(X_, g, alpha=1)
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
class DTLZ4(DTLZ):
|
|
101
|
+
def __init__(self, n_var=10, n_obj=3, alpha=100, d=100, **kwargs):
|
|
102
|
+
super().__init__(n_var=n_var, n_obj=n_obj, **kwargs)
|
|
103
|
+
self.alpha = alpha
|
|
104
|
+
self.d = d
|
|
105
|
+
|
|
106
|
+
def _calc_pareto_front(self, ref_dirs=None):
|
|
107
|
+
if ref_dirs is None:
|
|
108
|
+
ref_dirs = get_ref_dirs(self.n_obj)
|
|
109
|
+
return generic_sphere(ref_dirs)
|
|
110
|
+
|
|
111
|
+
def _evaluate(self, x, out, *args, **kwargs):
|
|
112
|
+
X_, X_M = x[:, :self.n_obj - 1], x[:, self.n_obj - 1:]
|
|
113
|
+
g = self.g2(X_M)
|
|
114
|
+
out["F"] = self.obj_func(X_, g, alpha=self.alpha)
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
class DTLZ5(DTLZ):
|
|
118
|
+
def __init__(self, n_var=10, n_obj=3, **kwargs):
|
|
119
|
+
super().__init__(n_var=n_var, n_obj=n_obj, **kwargs)
|
|
120
|
+
|
|
121
|
+
def _calc_pareto_front(self):
|
|
122
|
+
if self.n_obj == 3:
|
|
123
|
+
return Remote.get_instance().load("pymoo", "pf", "dtlz5-3d.pf")
|
|
124
|
+
else:
|
|
125
|
+
raise Exception("Not implemented yet.")
|
|
126
|
+
|
|
127
|
+
def _evaluate(self, x, out, *args, **kwargs):
|
|
128
|
+
X_, X_M = x[:, :self.n_obj - 1], x[:, self.n_obj - 1:]
|
|
129
|
+
g = self.g2(X_M)
|
|
130
|
+
|
|
131
|
+
theta = 1 / (2 * (1 + g[:, None])) * (1 + 2 * g[:, None] * X_)
|
|
132
|
+
theta = anp.column_stack([x[:, 0], theta[:, 1:]])
|
|
133
|
+
|
|
134
|
+
out["F"] = self.obj_func(theta, g)
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
class DTLZ6(DTLZ):
|
|
138
|
+
def __init__(self, n_var=10, n_obj=3, **kwargs):
|
|
139
|
+
super().__init__(n_var=n_var, n_obj=n_obj, **kwargs)
|
|
140
|
+
|
|
141
|
+
def _calc_pareto_front(self):
|
|
142
|
+
if self.n_obj == 3:
|
|
143
|
+
return Remote.get_instance().load("pymoo", "pf", "dtlz6-3d.pf")
|
|
144
|
+
else:
|
|
145
|
+
raise Exception("Not implemented yet.")
|
|
146
|
+
|
|
147
|
+
def _evaluate(self, x, out, *args, **kwargs):
|
|
148
|
+
X_, X_M = x[:, :self.n_obj - 1], x[:, self.n_obj - 1:]
|
|
149
|
+
g = anp.sum(anp.power(X_M, 0.1), axis=1)
|
|
150
|
+
|
|
151
|
+
theta = 1 / (2 * (1 + g[:, None])) * (1 + 2 * g[:, None] * X_)
|
|
152
|
+
theta = anp.column_stack([x[:, 0], theta[:, 1:]])
|
|
153
|
+
|
|
154
|
+
out["F"] = self.obj_func(theta, g)
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
class DTLZ7(DTLZ):
|
|
158
|
+
def __init__(self, n_var=10, n_obj=3, **kwargs):
|
|
159
|
+
super().__init__(n_var=n_var, n_obj=n_obj, **kwargs)
|
|
160
|
+
|
|
161
|
+
def _calc_pareto_front(self):
|
|
162
|
+
if self.n_obj == 3:
|
|
163
|
+
return Remote.get_instance().load("pymoo", "pf", "dtlz7-3d.pf")
|
|
164
|
+
else:
|
|
165
|
+
raise Exception("Not implemented yet.")
|
|
166
|
+
|
|
167
|
+
def _evaluate(self, x, out, *args, **kwargs):
|
|
168
|
+
f = []
|
|
169
|
+
for i in range(0, self.n_obj - 1):
|
|
170
|
+
f.append(x[:, i])
|
|
171
|
+
f = anp.column_stack(f)
|
|
172
|
+
|
|
173
|
+
g = 1 + 9 / self.k * anp.sum(x[:, -self.k:], axis=1)
|
|
174
|
+
h = self.n_obj - anp.sum(f / (1 + g[:, None]) * (1 + anp.sin(3 * anp.pi * f)), axis=1)
|
|
175
|
+
|
|
176
|
+
out["F"] = anp.column_stack([f, (1 + g) * h])
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
class InvertedDTLZ1(DTLZ1):
|
|
180
|
+
|
|
181
|
+
def _calc_pareto_front(self):
|
|
182
|
+
raise Exception("Not implemented yet.")
|
|
183
|
+
|
|
184
|
+
def _evaluate(self, x, out, *args, **kwargs):
|
|
185
|
+
X_, X_M = x[:, :self.n_obj - 1], x[:, self.n_obj - 1:]
|
|
186
|
+
g = self.g1(X_M)
|
|
187
|
+
|
|
188
|
+
super()._evaluate(x, out, *args, **kwargs)
|
|
189
|
+
out["F"] = 0.5 * (1 + g[:, None]) - out["F"]
|
|
190
|
+
|
|
191
|
+
def _calc_pareto_front(self, *args, **kwargs):
|
|
192
|
+
return self.problem.pareto_front(*args, **kwargs)
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
class ScaledProblem(Problem):
|
|
196
|
+
|
|
197
|
+
def __init__(self, problem, scale_factor):
|
|
198
|
+
super().__init__(n_var=problem.n_var, n_obj=problem.n_obj, n_ieq_constr=problem.n_ieq_constr,
|
|
199
|
+
n_eq_constr=problem.n_eq_constr, xl=problem.xl, xu=problem.xu, vtype=problem.vtype)
|
|
200
|
+
self.problem = problem
|
|
201
|
+
self.scale_factor = scale_factor
|
|
202
|
+
|
|
203
|
+
@staticmethod
|
|
204
|
+
def get_scale(n, scale_factor):
|
|
205
|
+
return np.power(np.full(n, scale_factor), np.arange(n))
|
|
206
|
+
|
|
207
|
+
def _evaluate(self, X, out, *args, **kwargs):
|
|
208
|
+
self.problem._evaluate(X, out, *args, **kwargs)
|
|
209
|
+
out["F"] = out["F"] * ScaledProblem.get_scale(self.n_obj, self.scale_factor)
|
|
210
|
+
|
|
211
|
+
def _calc_pareto_front(self, *args, **kwargs):
|
|
212
|
+
return self.problem.pareto_front(*args, **kwargs) * ScaledProblem.get_scale(self.n_obj, self.scale_factor)
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
class ConvexProblem(Problem):
|
|
216
|
+
|
|
217
|
+
def __init__(self, problem):
|
|
218
|
+
super().__init__(problem.n_var, problem.n_obj, problem.n_ieq_constr, problem.n_eq_constr, problem.xl, problem.xu)
|
|
219
|
+
self.problem = problem
|
|
220
|
+
|
|
221
|
+
def get_power(self, n):
|
|
222
|
+
p = np.full(n, 4.0)
|
|
223
|
+
p[-1] = 2.0
|
|
224
|
+
return p
|
|
225
|
+
|
|
226
|
+
def _evaluate(self, X, out, *args, **kwargs):
|
|
227
|
+
self.problem._evaluate(X, out, **kwargs)
|
|
228
|
+
out["F"] = anp.power(out["F"], self.get_power(self.n_obj))
|
|
229
|
+
|
|
230
|
+
def _calc_pareto_front(self, ref_dirs, *args, **kwargs):
|
|
231
|
+
F = self.problem.pareto_front(ref_dirs)
|
|
232
|
+
return np.power(F, self.get_power(self.n_obj))
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
class ScaledDTLZ1(ScaledProblem):
|
|
236
|
+
|
|
237
|
+
def __init__(self, n_var=7, n_obj=3, scale_factor=10, **kwargs):
|
|
238
|
+
super().__init__(DTLZ1(n_var=n_var, n_obj=n_obj, **kwargs), scale_factor=scale_factor)
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
class ConvexDTLZ2(ConvexProblem):
|
|
242
|
+
|
|
243
|
+
def __init__(self, n_var=10, n_obj=3, **kwargs):
|
|
244
|
+
super().__init__(DTLZ2(n_var=n_var, n_obj=n_obj, **kwargs))
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
class ConvexDTLZ4(ConvexProblem):
|
|
248
|
+
|
|
249
|
+
def __init__(self, n_var=10, n_obj=3, **kwargs):
|
|
250
|
+
super().__init__(DTLZ4(n_var=n_var, n_obj=n_obj, **kwargs))
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
def generic_sphere(ref_dirs):
|
|
254
|
+
return ref_dirs / np.tile(np.linalg.norm(ref_dirs, axis=1)[:, None], (1, ref_dirs.shape[1]))
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
def get_ref_dirs(n_obj):
|
|
258
|
+
if n_obj == 2:
|
|
259
|
+
ref_dirs = UniformReferenceDirectionFactory(2, n_points=100).do()
|
|
260
|
+
elif n_obj == 3:
|
|
261
|
+
ref_dirs = UniformReferenceDirectionFactory(3, n_partitions=15).do()
|
|
262
|
+
else:
|
|
263
|
+
raise Exception("Please provide reference directions for more than 3 objectives!")
|
|
264
|
+
return ref_dirs
|