pymoo 0.6.1.5.dev0__cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.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.

Files changed (328) hide show
  1. pymoo/__init__.py +3 -0
  2. pymoo/algorithms/__init__.py +0 -0
  3. pymoo/algorithms/base/__init__.py +0 -0
  4. pymoo/algorithms/base/bracket.py +38 -0
  5. pymoo/algorithms/base/genetic.py +109 -0
  6. pymoo/algorithms/base/line.py +62 -0
  7. pymoo/algorithms/base/local.py +39 -0
  8. pymoo/algorithms/base/meta.py +79 -0
  9. pymoo/algorithms/hyperparameters.py +89 -0
  10. pymoo/algorithms/moo/__init__.py +0 -0
  11. pymoo/algorithms/moo/age.py +310 -0
  12. pymoo/algorithms/moo/age2.py +194 -0
  13. pymoo/algorithms/moo/ctaea.py +298 -0
  14. pymoo/algorithms/moo/dnsga2.py +76 -0
  15. pymoo/algorithms/moo/kgb.py +446 -0
  16. pymoo/algorithms/moo/moead.py +183 -0
  17. pymoo/algorithms/moo/nsga2.py +113 -0
  18. pymoo/algorithms/moo/nsga3.py +358 -0
  19. pymoo/algorithms/moo/pinsga2.py +370 -0
  20. pymoo/algorithms/moo/rnsga2.py +188 -0
  21. pymoo/algorithms/moo/rnsga3.py +246 -0
  22. pymoo/algorithms/moo/rvea.py +214 -0
  23. pymoo/algorithms/moo/sms.py +195 -0
  24. pymoo/algorithms/moo/spea2.py +190 -0
  25. pymoo/algorithms/moo/unsga3.py +47 -0
  26. pymoo/algorithms/soo/__init__.py +0 -0
  27. pymoo/algorithms/soo/convex/__init__.py +0 -0
  28. pymoo/algorithms/soo/nonconvex/__init__.py +0 -0
  29. pymoo/algorithms/soo/nonconvex/brkga.py +161 -0
  30. pymoo/algorithms/soo/nonconvex/cmaes.py +554 -0
  31. pymoo/algorithms/soo/nonconvex/de.py +279 -0
  32. pymoo/algorithms/soo/nonconvex/direct.py +149 -0
  33. pymoo/algorithms/soo/nonconvex/es.py +203 -0
  34. pymoo/algorithms/soo/nonconvex/g3pcx.py +94 -0
  35. pymoo/algorithms/soo/nonconvex/ga.py +93 -0
  36. pymoo/algorithms/soo/nonconvex/ga_niching.py +223 -0
  37. pymoo/algorithms/soo/nonconvex/isres.py +74 -0
  38. pymoo/algorithms/soo/nonconvex/nelder.py +251 -0
  39. pymoo/algorithms/soo/nonconvex/optuna.py +80 -0
  40. pymoo/algorithms/soo/nonconvex/pattern.py +183 -0
  41. pymoo/algorithms/soo/nonconvex/pso.py +399 -0
  42. pymoo/algorithms/soo/nonconvex/pso_ep.py +297 -0
  43. pymoo/algorithms/soo/nonconvex/random_search.py +25 -0
  44. pymoo/algorithms/soo/nonconvex/sres.py +56 -0
  45. pymoo/algorithms/soo/univariate/__init__.py +0 -0
  46. pymoo/algorithms/soo/univariate/backtracking.py +59 -0
  47. pymoo/algorithms/soo/univariate/exp.py +46 -0
  48. pymoo/algorithms/soo/univariate/golden.py +65 -0
  49. pymoo/algorithms/soo/univariate/quadr_interp.py +81 -0
  50. pymoo/algorithms/soo/univariate/wolfe.py +163 -0
  51. pymoo/config.py +33 -0
  52. pymoo/constraints/__init__.py +3 -0
  53. pymoo/constraints/adaptive.py +62 -0
  54. pymoo/constraints/as_obj.py +56 -0
  55. pymoo/constraints/as_penalty.py +41 -0
  56. pymoo/constraints/eps.py +26 -0
  57. pymoo/constraints/from_bounds.py +36 -0
  58. pymoo/core/__init__.py +0 -0
  59. pymoo/core/algorithm.py +394 -0
  60. pymoo/core/callback.py +38 -0
  61. pymoo/core/crossover.py +77 -0
  62. pymoo/core/decision_making.py +102 -0
  63. pymoo/core/decomposition.py +76 -0
  64. pymoo/core/duplicate.py +163 -0
  65. pymoo/core/evaluator.py +116 -0
  66. pymoo/core/indicator.py +34 -0
  67. pymoo/core/individual.py +784 -0
  68. pymoo/core/infill.py +64 -0
  69. pymoo/core/initialization.py +42 -0
  70. pymoo/core/mating.py +39 -0
  71. pymoo/core/meta.py +21 -0
  72. pymoo/core/mixed.py +165 -0
  73. pymoo/core/mutation.py +44 -0
  74. pymoo/core/operator.py +40 -0
  75. pymoo/core/parameters.py +134 -0
  76. pymoo/core/plot.py +210 -0
  77. pymoo/core/population.py +180 -0
  78. pymoo/core/problem.py +460 -0
  79. pymoo/core/recorder.py +99 -0
  80. pymoo/core/repair.py +23 -0
  81. pymoo/core/replacement.py +96 -0
  82. pymoo/core/result.py +52 -0
  83. pymoo/core/sampling.py +43 -0
  84. pymoo/core/selection.py +61 -0
  85. pymoo/core/solution.py +10 -0
  86. pymoo/core/survival.py +103 -0
  87. pymoo/core/termination.py +70 -0
  88. pymoo/core/variable.py +399 -0
  89. pymoo/cython/__init__.py +0 -0
  90. pymoo/cython/calc_perpendicular_distance.cpython-313-x86_64-linux-gnu.so +0 -0
  91. pymoo/cython/calc_perpendicular_distance.pyx +67 -0
  92. pymoo/cython/decomposition.cpython-313-x86_64-linux-gnu.so +0 -0
  93. pymoo/cython/decomposition.pyx +165 -0
  94. pymoo/cython/hv.cpython-313-x86_64-linux-gnu.so +0 -0
  95. pymoo/cython/hv.pyx +18 -0
  96. pymoo/cython/info.cpython-313-x86_64-linux-gnu.so +0 -0
  97. pymoo/cython/info.pyx +5 -0
  98. pymoo/cython/mnn.cpython-313-x86_64-linux-gnu.so +0 -0
  99. pymoo/cython/mnn.pyx +273 -0
  100. pymoo/cython/non_dominated_sorting.cpython-313-x86_64-linux-gnu.so +0 -0
  101. pymoo/cython/non_dominated_sorting.pyx +645 -0
  102. pymoo/cython/pruning_cd.cpython-313-x86_64-linux-gnu.so +0 -0
  103. pymoo/cython/pruning_cd.pyx +197 -0
  104. pymoo/cython/stochastic_ranking.cpython-313-x86_64-linux-gnu.so +0 -0
  105. pymoo/cython/stochastic_ranking.pyx +49 -0
  106. pymoo/cython/utils.pxd +129 -0
  107. pymoo/cython/vendor/__init__.py +0 -0
  108. pymoo/cython/vendor/hypervolume.cpp +1621 -0
  109. pymoo/cython/vendor/hypervolume.h +63 -0
  110. pymoo/decomposition/__init__.py +0 -0
  111. pymoo/decomposition/aasf.py +24 -0
  112. pymoo/decomposition/asf.py +10 -0
  113. pymoo/decomposition/pbi.py +13 -0
  114. pymoo/decomposition/perp_dist.py +13 -0
  115. pymoo/decomposition/tchebicheff.py +11 -0
  116. pymoo/decomposition/util.py +13 -0
  117. pymoo/decomposition/weighted_sum.py +8 -0
  118. pymoo/docs.py +187 -0
  119. pymoo/experimental/__init__.py +0 -0
  120. pymoo/experimental/algorithms/__init__.py +0 -0
  121. pymoo/experimental/algorithms/gde3.py +57 -0
  122. pymoo/gradient/__init__.py +21 -0
  123. pymoo/gradient/automatic.py +57 -0
  124. pymoo/gradient/grad_autograd.py +105 -0
  125. pymoo/gradient/grad_complex.py +35 -0
  126. pymoo/gradient/grad_jax.py +51 -0
  127. pymoo/gradient/toolbox/__init__.py +6 -0
  128. pymoo/indicators/__init__.py +0 -0
  129. pymoo/indicators/distance_indicator.py +55 -0
  130. pymoo/indicators/gd.py +7 -0
  131. pymoo/indicators/gd_plus.py +7 -0
  132. pymoo/indicators/hv/__init__.py +63 -0
  133. pymoo/indicators/hv/exact.py +71 -0
  134. pymoo/indicators/hv/exact_2d.py +102 -0
  135. pymoo/indicators/hv/monte_carlo.py +74 -0
  136. pymoo/indicators/igd.py +7 -0
  137. pymoo/indicators/igd_plus.py +7 -0
  138. pymoo/indicators/kktpm.py +151 -0
  139. pymoo/indicators/migd.py +55 -0
  140. pymoo/indicators/rmetric.py +203 -0
  141. pymoo/indicators/spacing.py +52 -0
  142. pymoo/mcdm/__init__.py +0 -0
  143. pymoo/mcdm/compromise_programming.py +19 -0
  144. pymoo/mcdm/high_tradeoff.py +40 -0
  145. pymoo/mcdm/pseudo_weights.py +32 -0
  146. pymoo/operators/__init__.py +0 -0
  147. pymoo/operators/control.py +187 -0
  148. pymoo/operators/crossover/__init__.py +0 -0
  149. pymoo/operators/crossover/binx.py +45 -0
  150. pymoo/operators/crossover/dex.py +122 -0
  151. pymoo/operators/crossover/erx.py +162 -0
  152. pymoo/operators/crossover/expx.py +51 -0
  153. pymoo/operators/crossover/hux.py +37 -0
  154. pymoo/operators/crossover/nox.py +13 -0
  155. pymoo/operators/crossover/ox.py +84 -0
  156. pymoo/operators/crossover/pcx.py +82 -0
  157. pymoo/operators/crossover/pntx.py +49 -0
  158. pymoo/operators/crossover/sbx.py +125 -0
  159. pymoo/operators/crossover/spx.py +5 -0
  160. pymoo/operators/crossover/ux.py +20 -0
  161. pymoo/operators/mutation/__init__.py +0 -0
  162. pymoo/operators/mutation/bitflip.py +17 -0
  163. pymoo/operators/mutation/gauss.py +58 -0
  164. pymoo/operators/mutation/inversion.py +42 -0
  165. pymoo/operators/mutation/nom.py +7 -0
  166. pymoo/operators/mutation/pm.py +94 -0
  167. pymoo/operators/mutation/rm.py +23 -0
  168. pymoo/operators/repair/__init__.py +0 -0
  169. pymoo/operators/repair/bounce_back.py +32 -0
  170. pymoo/operators/repair/bounds_repair.py +95 -0
  171. pymoo/operators/repair/inverse_penalty.py +89 -0
  172. pymoo/operators/repair/rounding.py +18 -0
  173. pymoo/operators/repair/to_bound.py +31 -0
  174. pymoo/operators/repair/vtype.py +11 -0
  175. pymoo/operators/sampling/__init__.py +0 -0
  176. pymoo/operators/sampling/lhs.py +73 -0
  177. pymoo/operators/sampling/rnd.py +50 -0
  178. pymoo/operators/selection/__init__.py +0 -0
  179. pymoo/operators/selection/rnd.py +72 -0
  180. pymoo/operators/selection/tournament.py +76 -0
  181. pymoo/operators/survival/__init__.py +0 -0
  182. pymoo/operators/survival/rank_and_crowding/__init__.py +1 -0
  183. pymoo/operators/survival/rank_and_crowding/classes.py +209 -0
  184. pymoo/operators/survival/rank_and_crowding/metrics.py +208 -0
  185. pymoo/optimize.py +72 -0
  186. pymoo/problems/__init__.py +157 -0
  187. pymoo/problems/dyn.py +47 -0
  188. pymoo/problems/dynamic/__init__.py +0 -0
  189. pymoo/problems/dynamic/cec2015.py +108 -0
  190. pymoo/problems/dynamic/df.py +452 -0
  191. pymoo/problems/dynamic/misc.py +167 -0
  192. pymoo/problems/functional.py +48 -0
  193. pymoo/problems/many/__init__.py +5 -0
  194. pymoo/problems/many/cdtlz.py +159 -0
  195. pymoo/problems/many/dcdtlz.py +88 -0
  196. pymoo/problems/many/dtlz.py +264 -0
  197. pymoo/problems/many/wfg.py +550 -0
  198. pymoo/problems/multi/__init__.py +14 -0
  199. pymoo/problems/multi/bnh.py +34 -0
  200. pymoo/problems/multi/carside.py +48 -0
  201. pymoo/problems/multi/clutch.py +104 -0
  202. pymoo/problems/multi/csi.py +55 -0
  203. pymoo/problems/multi/ctp.py +198 -0
  204. pymoo/problems/multi/dascmop.py +213 -0
  205. pymoo/problems/multi/kursawe.py +25 -0
  206. pymoo/problems/multi/modact.py +68 -0
  207. pymoo/problems/multi/mw.py +400 -0
  208. pymoo/problems/multi/omnitest.py +48 -0
  209. pymoo/problems/multi/osy.py +32 -0
  210. pymoo/problems/multi/srn.py +28 -0
  211. pymoo/problems/multi/sympart.py +94 -0
  212. pymoo/problems/multi/tnk.py +24 -0
  213. pymoo/problems/multi/truss2d.py +83 -0
  214. pymoo/problems/multi/welded_beam.py +41 -0
  215. pymoo/problems/multi/wrm.py +36 -0
  216. pymoo/problems/multi/zdt.py +151 -0
  217. pymoo/problems/multi_to_single.py +22 -0
  218. pymoo/problems/single/__init__.py +12 -0
  219. pymoo/problems/single/ackley.py +24 -0
  220. pymoo/problems/single/cantilevered_beam.py +34 -0
  221. pymoo/problems/single/flowshop_scheduling.py +112 -0
  222. pymoo/problems/single/g.py +874 -0
  223. pymoo/problems/single/griewank.py +18 -0
  224. pymoo/problems/single/himmelblau.py +15 -0
  225. pymoo/problems/single/knapsack.py +48 -0
  226. pymoo/problems/single/mopta08.py +26 -0
  227. pymoo/problems/single/multimodal.py +20 -0
  228. pymoo/problems/single/pressure_vessel.py +30 -0
  229. pymoo/problems/single/rastrigin.py +20 -0
  230. pymoo/problems/single/rosenbrock.py +22 -0
  231. pymoo/problems/single/schwefel.py +18 -0
  232. pymoo/problems/single/simple.py +13 -0
  233. pymoo/problems/single/sphere.py +19 -0
  234. pymoo/problems/single/traveling_salesman.py +79 -0
  235. pymoo/problems/single/zakharov.py +19 -0
  236. pymoo/problems/static.py +14 -0
  237. pymoo/problems/util.py +42 -0
  238. pymoo/problems/zero_to_one.py +27 -0
  239. pymoo/termination/__init__.py +23 -0
  240. pymoo/termination/collection.py +12 -0
  241. pymoo/termination/cv.py +48 -0
  242. pymoo/termination/default.py +45 -0
  243. pymoo/termination/delta.py +64 -0
  244. pymoo/termination/fmin.py +16 -0
  245. pymoo/termination/ftol.py +144 -0
  246. pymoo/termination/indicator.py +49 -0
  247. pymoo/termination/max_eval.py +14 -0
  248. pymoo/termination/max_gen.py +15 -0
  249. pymoo/termination/max_time.py +20 -0
  250. pymoo/termination/robust.py +34 -0
  251. pymoo/termination/xtol.py +33 -0
  252. pymoo/util/__init__.py +0 -0
  253. pymoo/util/archive.py +150 -0
  254. pymoo/util/cache.py +29 -0
  255. pymoo/util/clearing.py +82 -0
  256. pymoo/util/display/__init__.py +0 -0
  257. pymoo/util/display/column.py +52 -0
  258. pymoo/util/display/display.py +34 -0
  259. pymoo/util/display/multi.py +96 -0
  260. pymoo/util/display/output.py +53 -0
  261. pymoo/util/display/progress.py +54 -0
  262. pymoo/util/display/single.py +67 -0
  263. pymoo/util/dominator.py +67 -0
  264. pymoo/util/function_loader.py +129 -0
  265. pymoo/util/hv.py +23 -0
  266. pymoo/util/matlab_engine.py +39 -0
  267. pymoo/util/misc.py +460 -0
  268. pymoo/util/mnn.py +70 -0
  269. pymoo/util/nds/__init__.py +0 -0
  270. pymoo/util/nds/dominance_degree_non_dominated_sort.py +159 -0
  271. pymoo/util/nds/efficient_non_dominated_sort.py +152 -0
  272. pymoo/util/nds/fast_non_dominated_sort.py +70 -0
  273. pymoo/util/nds/naive_non_dominated_sort.py +36 -0
  274. pymoo/util/nds/non_dominated_sorting.py +67 -0
  275. pymoo/util/nds/tree_based_non_dominated_sort.py +133 -0
  276. pymoo/util/normalization.py +312 -0
  277. pymoo/util/optimum.py +42 -0
  278. pymoo/util/plotting.py +177 -0
  279. pymoo/util/pruning_cd.py +89 -0
  280. pymoo/util/randomized_argsort.py +60 -0
  281. pymoo/util/ref_dirs/__init__.py +24 -0
  282. pymoo/util/ref_dirs/construction.py +88 -0
  283. pymoo/util/ref_dirs/das_dennis.py +52 -0
  284. pymoo/util/ref_dirs/energy.py +319 -0
  285. pymoo/util/ref_dirs/energy_layer.py +119 -0
  286. pymoo/util/ref_dirs/genetic_algorithm.py +63 -0
  287. pymoo/util/ref_dirs/incremental.py +68 -0
  288. pymoo/util/ref_dirs/misc.py +128 -0
  289. pymoo/util/ref_dirs/optimizer.py +59 -0
  290. pymoo/util/ref_dirs/performance.py +162 -0
  291. pymoo/util/ref_dirs/reduction.py +85 -0
  292. pymoo/util/ref_dirs/sample_and_map.py +24 -0
  293. pymoo/util/reference_direction.py +260 -0
  294. pymoo/util/remote.py +55 -0
  295. pymoo/util/roulette.py +27 -0
  296. pymoo/util/running_metric.py +128 -0
  297. pymoo/util/sliding_window.py +25 -0
  298. pymoo/util/stochastic_ranking.py +32 -0
  299. pymoo/util/value_functions.py +719 -0
  300. pymoo/util/vectors.py +40 -0
  301. pymoo/util/vf_dominator.py +99 -0
  302. pymoo/vendor/__init__.py +0 -0
  303. pymoo/vendor/cec2018.py +398 -0
  304. pymoo/vendor/gta.py +617 -0
  305. pymoo/vendor/hv.py +267 -0
  306. pymoo/vendor/vendor_cmaes.py +412 -0
  307. pymoo/vendor/vendor_coco.py +81 -0
  308. pymoo/vendor/vendor_scipy.py +232 -0
  309. pymoo/version.py +1 -0
  310. pymoo/visualization/__init__.py +8 -0
  311. pymoo/visualization/fitness_landscape.py +127 -0
  312. pymoo/visualization/heatmap.py +123 -0
  313. pymoo/visualization/pcp.py +120 -0
  314. pymoo/visualization/petal.py +91 -0
  315. pymoo/visualization/radar.py +108 -0
  316. pymoo/visualization/radviz.py +68 -0
  317. pymoo/visualization/scatter.py +150 -0
  318. pymoo/visualization/star_coordinate.py +75 -0
  319. pymoo/visualization/util.py +123 -0
  320. pymoo/visualization/video/__init__.py +0 -0
  321. pymoo/visualization/video/callback_video.py +82 -0
  322. pymoo/visualization/video/one_var_one_obj.py +57 -0
  323. pymoo/visualization/video/two_var_one_obj.py +62 -0
  324. pymoo-0.6.1.5.dev0.dist-info/METADATA +187 -0
  325. pymoo-0.6.1.5.dev0.dist-info/RECORD +328 -0
  326. pymoo-0.6.1.5.dev0.dist-info/WHEEL +6 -0
  327. pymoo-0.6.1.5.dev0.dist-info/licenses/LICENSE +191 -0
  328. pymoo-0.6.1.5.dev0.dist-info/top_level.txt +1 -0
pymoo/vendor/gta.py ADDED
@@ -0,0 +1,617 @@
1
+ """Dynamic Multi-objective Optimization Problems
2
+ This Library is a GTA(a and m) benchmarks from the website of the author,
3
+ and the implementation of the FDA, DIMP, DMOP, HE benchmarks of the CEC2015 competition
4
+ nt: severity of change
5
+ taut: frequency of change
6
+ tauT: maximum number of generation
7
+ tau : current generation
8
+
9
+ """
10
+ # !/bin/python
11
+
12
+ import numpy as np
13
+ from random import randint
14
+ from math import floor, fabs, sin, pi, cos, sqrt
15
+
16
+ ## Parameter configuration ##
17
+ LOWER_BOUND = [0.0] + 20 * [-1.0]
18
+ UPPER_BOUND = 21 * [1.0]
19
+ ERR_MSG = "x is outside decision boundary or dimension of x is not correct"
20
+ DELTA_STATE = 1
21
+
22
+
23
+ ## Define component functions ##
24
+ def beta_uni(x, t, g, obj_num=2):
25
+ """This function is used to calculate the unimodal beta function. Input are
26
+ the decision variable (x), time (t) and g function (g).
27
+ """
28
+ beta = [0.0] * obj_num
29
+ for i in range(obj_num - 1, len(x)):
30
+ beta[(i + 1) % obj_num] += (x[i] - g(x, t)) * (x[i] - g(x, t))
31
+
32
+ beta = [(2.0 / int(len(LOWER_BOUND) / obj_num)) * b for b in beta]
33
+ return beta
34
+
35
+
36
+ def beta_multi(x, t, g, obj_num=2):
37
+ """This function is used to calculate the multi-modal beta function. Input
38
+ are the decision variable (x), time (t) and g function (g).
39
+ """
40
+ beta = [0.0] * obj_num
41
+ for i in range(obj_num - 1, len(x)):
42
+ beta[(i + 1) % obj_num] += (x[i] - g(x, t)) * (x[i] - g(x, t)) * \
43
+ (1 + np.abs(np.sin(4 * np.pi * (x[i] - g(x, t)))))
44
+
45
+ beta = [(2.0 / int(len(LOWER_BOUND) / obj_num)) * b for b in beta]
46
+ return beta
47
+
48
+
49
+ def beta_mix(x, t, g, obj_num=2):
50
+ """This function is used to calculate the mixed unimodal and multi-modal
51
+ beta function. Input are the decision variable (x), time (t) and g function
52
+ (g).
53
+ """
54
+ beta = [0.0] * obj_num
55
+ k = int(abs(5.0 * (int(DELTA_STATE * int(t) / 5.0) % 2) - (DELTA_STATE * int(t) % 5)))
56
+
57
+ for i in range(obj_num - 1, len(x)):
58
+ temp = 1.0 + (x[i] - g(x, t)) * (x[i] - g(x, t)) - np.cos(2 * np.pi * k * (x[i] - g(x, t)))
59
+ beta[(i + 1) % obj_num] += temp
60
+ beta = [(2.0 / int(len(LOWER_BOUND) / obj_num)) * b for b in beta]
61
+ return beta
62
+
63
+
64
+ def alpha_conv(x):
65
+ """This function is used to calculate the alpha function with convex POF.
66
+ Input is decision variable (x).
67
+ """
68
+ return [x[0], 1 - np.sqrt(x[0])]
69
+
70
+
71
+ def alpha_disc(x):
72
+ """This function is used to calculate the alpha function with discrete POF.
73
+ Input is decision variable (x).
74
+ """
75
+ return [x[0], 1.5 - np.sqrt(x[0]) - 0.5 * np.sin(10 * np.pi * x[0])]
76
+
77
+
78
+ def alpha_mix(x, t):
79
+ """This function is used to calculate the alpha function with mixed
80
+ continuous POF and discrete POF.
81
+ """
82
+ k = int(abs(5.0 * (int(DELTA_STATE * int(t) / 5.0) % 2) - (DELTA_STATE * int(t) % 5)))
83
+ return [x[0], 1 - np.sqrt(x[0]) + 0.1 * k * (1 + np.sin(10 * np.pi * x[0]))]
84
+
85
+
86
+ def alpha_conf(x, t):
87
+ """This function is used to calculate the alpha function with time-varying
88
+ conflicting objective. Input are decision variable (x) and time (t).
89
+ """
90
+ k = int(abs(5.0 * (int(DELTA_STATE * int(t) / 5.0) % 2) - (DELTA_STATE * int(t) % 5)))
91
+ return [x[0], 1 - np.power(x[0], \
92
+ np.log(1 - 0.1 * k) / np.log(0.1 * k + np.finfo(float).eps))]
93
+
94
+
95
+ def alpha_conf_3obj_type1(x, t):
96
+ """This function is used to calculate the alpha unction with time-varying
97
+ conflicting objective (3-objective, type 1). Input are decision variable
98
+ (x) and time (t).
99
+ """
100
+ k = int(abs(5.0 * (int(DELTA_STATE * int(t) / 5.0) % 2) - (DELTA_STATE * int(t) % 5)))
101
+ alpha1 = fix_numerical_instability(np.cos(0.5 * x[0] * np.pi) * np.cos(0.5 * x[1] * np.pi))
102
+ alpha2 = fix_numerical_instability(np.cos(0.5 * x[0] * np.pi) * np.sin(0.5 * x[1] * np.pi))
103
+ alpha3 = fix_numerical_instability(np.sin(0.5 * x[0] * np.pi + 0.25 * (k / 5.0) * np.pi))
104
+ return [alpha1, alpha2, alpha3]
105
+
106
+
107
+ def alpha_conf_3obj_type2(x, t):
108
+ """This function is used to calculate the alpha unction with time-varying
109
+ conflicting objective (3-objective, type 2). Input are decision variable (x)
110
+ and time (t).
111
+ """
112
+ k = int(abs(5.0 * (int(DELTA_STATE * int(t) / 5.0) % 2) - (DELTA_STATE * int(t) % 5)))
113
+ k_ratio = (5.0 - k) / 5.0
114
+ alpha1 = fix_numerical_instability(np.cos(0.5 * x[0] * np.pi) * np.cos(0.5 * x[1] * np.pi * k_ratio))
115
+ alpha2 = fix_numerical_instability(np.cos(0.5 * x[0] * np.pi) * np.sin(0.5 * x[1] * np.pi * k_ratio))
116
+ alpha3 = fix_numerical_instability(np.sin(0.5 * x[0] * np.pi))
117
+ return [alpha1, alpha2, alpha3]
118
+
119
+
120
+ def g(x, t):
121
+ """This function is used to calculate the g function used in the paper.
122
+ Input are decision variable (x) and time (t).
123
+ """
124
+ return np.sin(0.5 * np.pi * (t - x[0]))
125
+
126
+
127
+ ## Utility functions ##
128
+ def check_boundary(x, upper_bound=UPPER_BOUND, lower_bound=LOWER_BOUND):
129
+ """Check the dimension of x and whether it is in the decision boundary. x is
130
+ decision variable, upper_bound and lower_bound are upperbound and lowerbound
131
+ lists of the decision space
132
+ """
133
+ if len(x) != len(upper_bound) or len(x) != len(lower_bound):
134
+ return False
135
+
136
+ output = True
137
+ for e, upp, low in zip(x, upper_bound, lower_bound):
138
+ output = output and (e >= low) and (e <= upp)
139
+ return output
140
+
141
+
142
+ def check_boundary_3obj(x, upper_bound=UPPER_BOUND, lower_bound=LOWER_BOUND):
143
+ """Check the dimension of x and whether it is in the decision boundary. x is
144
+ decision variable, upper_bound and lower_bound are upperbound and lowerbound
145
+ lists of the decision space
146
+ """
147
+ lower_bound = [0.0] + lower_bound
148
+ upper_bound = [1.0] + upper_bound
149
+ if len(x) != len(upper_bound) or len(x) != len(lower_bound):
150
+ return False
151
+
152
+ output = True
153
+ for e, upp, low in zip(x, upper_bound, lower_bound):
154
+ output = output and (e >= low) and (e <= upp)
155
+ return output
156
+
157
+
158
+ def fix_numerical_instability(x):
159
+ """Check whether x is close to zero, sqrt(0.5) or not. If it is close to
160
+ these two values, changes x to the value. Otherwise, return x.
161
+ """
162
+ if np.allclose(0.0, x):
163
+ return 0.0
164
+
165
+ if np.allclose(np.sqrt(0.5), x):
166
+ return np.sqrt(0.5)
167
+ return x
168
+
169
+
170
+ def additive(alpha, beta):
171
+ """Additive form of the benchmark problem.
172
+ """
173
+ return [a + b for a, b in zip(alpha, beta)]
174
+
175
+
176
+ # return [alpha[0] + beta[0], alpha[1] + beta[1]]
177
+
178
+
179
+ def multiplicative(alpha, beta):
180
+ """Multiplicative form of the benchmark problem.
181
+ """
182
+ return [a * (1 + b) for a, b in zip(alpha, beta)]
183
+
184
+
185
+ # return [alpha[0]*(1 + beta[0]), alpha[1]*(1 + beta[1])]
186
+
187
+
188
+ ## Benchmark functions ##
189
+ def DB1a(x, t):
190
+ """DB1a dynamic benchmark problem
191
+ """
192
+ if check_boundary(x, UPPER_BOUND, LOWER_BOUND):
193
+ alpha = alpha_conv(x)
194
+ beta = beta_uni(x, t, g)
195
+ return additive(alpha, beta)
196
+ else:
197
+ raise Exception(ERR_MSG)
198
+
199
+
200
+ def DB1m(x, t):
201
+ """DB1m dynamic benchmark problem
202
+ """
203
+ if check_boundary(x, UPPER_BOUND, LOWER_BOUND):
204
+ alpha = alpha_conv(x)
205
+ beta = beta_uni(x, t, g)
206
+ return multiplicative(alpha, beta)
207
+ else:
208
+ raise Exception(ERR_MSG)
209
+
210
+
211
+ def DB2a(x, t):
212
+ """DB2a dynamic benchmark problem
213
+ """
214
+ if check_boundary(x, UPPER_BOUND, LOWER_BOUND):
215
+ alpha = alpha_conv(x)
216
+ beta = beta_multi(x, t, g)
217
+ return additive(alpha, beta)
218
+ else:
219
+ raise Exception(ERR_MSG)
220
+
221
+
222
+ def DB2m(x, t):
223
+ """DB2m dynamic benchmark problem
224
+ """
225
+ if check_boundary(x, UPPER_BOUND, LOWER_BOUND):
226
+ alpha = alpha_conv(x)
227
+ beta = beta_multi(x, t, g)
228
+ return multiplicative(alpha, beta)
229
+ else:
230
+ raise Exception(ERR_MSG)
231
+
232
+
233
+ def DB3a(x, t):
234
+ """DB3a dynamic benchmark problem
235
+ """
236
+ if check_boundary(x, UPPER_BOUND, LOWER_BOUND):
237
+ alpha = alpha_conv(x)
238
+ beta = beta_mix(x, t, g)
239
+ return additive(alpha, beta)
240
+ else:
241
+ raise Exception(ERR_MSG)
242
+
243
+
244
+ def DB3m(x, t):
245
+ """DB3m dynamic benchmark problem
246
+ """
247
+ if check_boundary(x, UPPER_BOUND, LOWER_BOUND):
248
+ alpha = alpha_conv(x)
249
+ beta = beta_mix(x, t, g)
250
+ return multiplicative(alpha, beta)
251
+ else:
252
+ raise Exception(ERR_MSG)
253
+
254
+
255
+ def DB4a(x, t):
256
+ """DB4a dynamic benchmark problem
257
+ """
258
+ if check_boundary(x, UPPER_BOUND, LOWER_BOUND):
259
+ alpha = alpha_disc(x)
260
+ beta = beta_mix(x, t, g)
261
+ return additive(alpha, beta)
262
+ else:
263
+ raise Exception(ERR_MSG)
264
+
265
+
266
+ def DB4m(x, t):
267
+ """DB4m dynamic benchmark problem
268
+ """
269
+ if check_boundary(x, UPPER_BOUND, LOWER_BOUND):
270
+ alpha = alpha_disc(x)
271
+ beta = beta_mix(x, t, g)
272
+ return multiplicative(alpha, beta)
273
+ else:
274
+ raise Exception(ERR_MSG)
275
+
276
+
277
+ def DB5a(x, t):
278
+ """DB5a dynamic benchmark problem
279
+ """
280
+ if check_boundary(x, UPPER_BOUND, LOWER_BOUND):
281
+ alpha = alpha_mix(x, t)
282
+ beta = beta_multi(x, t, g)
283
+ return additive(alpha, beta)
284
+ else:
285
+ raise Exception(ERR_MSG)
286
+
287
+
288
+ def DB5m(x, t):
289
+ """DB5m dynamic benchmark problem
290
+ """
291
+ if check_boundary(x, UPPER_BOUND, LOWER_BOUND):
292
+ alpha = alpha_mix(x, t)
293
+ beta = beta_multi(x, t, g)
294
+ return multiplicative(alpha, beta)
295
+ else:
296
+ raise Exception(ERR_MSG)
297
+
298
+
299
+ def DB6a(x, t):
300
+ """DB6a dynamic benchmark problem
301
+ """
302
+ if check_boundary(x, UPPER_BOUND, LOWER_BOUND):
303
+ alpha = alpha_mix(x, t)
304
+ beta = beta_mix(x, t, g)
305
+ return additive(alpha, beta)
306
+ else:
307
+ raise Exception(ERR_MSG)
308
+
309
+
310
+ def DB6m(x, t):
311
+ """DB6m dynamic benchmark problem
312
+ """
313
+ if check_boundary(x, UPPER_BOUND, LOWER_BOUND):
314
+ alpha = alpha_mix(x, t)
315
+ beta = beta_mix(x, t, g)
316
+ return multiplicative(alpha, beta)
317
+ else:
318
+ raise Exception(ERR_MSG)
319
+
320
+
321
+ def DB7a(x, t):
322
+ """DB7a dynamic benchmark problem
323
+ """
324
+ if check_boundary(x, UPPER_BOUND, LOWER_BOUND):
325
+ alpha = alpha_conf(x, t)
326
+ beta = beta_multi(x, t, g)
327
+ return additive(alpha, beta)
328
+ else:
329
+ raise Exception(ERR_MSG)
330
+
331
+
332
+ def DB7m(x, t):
333
+ """DB7m dynamic benchmark problem
334
+ """
335
+ if check_boundary(x, UPPER_BOUND, LOWER_BOUND):
336
+ alpha = alpha_conf(x, t)
337
+ beta = beta_multi(x, t, g)
338
+ return multiplicative(alpha, beta)
339
+ else:
340
+ raise Exception(ERR_MSG)
341
+
342
+
343
+ def DB8a(x, t):
344
+ """DB8a dynamic benchmark problem
345
+ """
346
+ if check_boundary(x, UPPER_BOUND, LOWER_BOUND):
347
+ alpha = alpha_conf(x, t)
348
+ beta = beta_mix(x, t, g)
349
+ return additive(alpha, beta)
350
+ else:
351
+ raise Exception(ERR_MSG)
352
+
353
+
354
+ def DB8m(x, t):
355
+ """DB8m dynamic benchmark problem
356
+ """
357
+ if check_boundary(x, UPPER_BOUND, LOWER_BOUND):
358
+ alpha = alpha_conf(x, t)
359
+ beta = beta_mix(x, t, g)
360
+ return multiplicative(alpha, beta)
361
+ else:
362
+ raise Exception(ERR_MSG)
363
+
364
+
365
+ def DB9a(x, t):
366
+ """DB9a dynamic benchmark problem
367
+ """
368
+ if check_boundary_3obj(x, UPPER_BOUND, LOWER_BOUND):
369
+ alpha = alpha_conf_3obj_type1(x, t)
370
+ beta = beta_multi(x, t, g, obj_num=3)
371
+ return additive(alpha, beta)
372
+ else:
373
+ raise Exception(ERR_MSG)
374
+
375
+
376
+ def DB9m(x, t):
377
+ """DB9m dynamic benchmark problem
378
+ """
379
+ if check_boundary_3obj(x, UPPER_BOUND, LOWER_BOUND):
380
+ alpha = alpha_conf_3obj_type1(x, t)
381
+ beta = beta_multi(x, t, g, obj_num=3)
382
+ return multiplicative(alpha, beta)
383
+ else:
384
+ raise Exception(ERR_MSG)
385
+
386
+
387
+ def DB10a(x, t):
388
+ """DB10a dynamic benchmark problem
389
+ """
390
+ if check_boundary_3obj(x, UPPER_BOUND, LOWER_BOUND):
391
+ alpha = alpha_conf_3obj_type1(x, t)
392
+ beta = beta_mix(x, t, g, obj_num=3)
393
+ return additive(alpha, beta)
394
+ else:
395
+ raise Exception(ERR_MSG)
396
+
397
+
398
+ def DB10m(x, t):
399
+ """DB10m dynamic benchmark problem
400
+ """
401
+ if check_boundary_3obj(x, UPPER_BOUND, LOWER_BOUND):
402
+ alpha = alpha_conf_3obj_type1(x, t)
403
+ beta = beta_mix(x, t, g, obj_num=3)
404
+ return multiplicative(alpha, beta)
405
+ else:
406
+ raise Exception(ERR_MSG)
407
+
408
+
409
+ def DB11a(x, t):
410
+ """DB11a dynamic benchmark problem
411
+ """
412
+ if check_boundary_3obj(x, UPPER_BOUND, LOWER_BOUND):
413
+ alpha = alpha_conf_3obj_type2(x, t)
414
+ beta = beta_multi(x, t, g, obj_num=3)
415
+ return additive(alpha, beta)
416
+ else:
417
+ raise Exception(ERR_MSG)
418
+
419
+
420
+ def DB11m(x, t):
421
+ """DB11m dynamic benchmark problem
422
+ """
423
+ if check_boundary_3obj(x, UPPER_BOUND, LOWER_BOUND):
424
+ alpha = alpha_conf_3obj_type2(x, t)
425
+ beta = beta_multi(x, t, g, obj_num=3)
426
+ return multiplicative(alpha, beta)
427
+ else:
428
+ raise Exception(ERR_MSG)
429
+
430
+
431
+ def DB12a(x, t):
432
+ """DB12a dynamic benchmark problem
433
+ """
434
+ if check_boundary_3obj(x, UPPER_BOUND, LOWER_BOUND):
435
+ alpha = alpha_conf_3obj_type2(x, t)
436
+ beta = beta_mix(x, t, g, obj_num=3)
437
+ return additive(alpha, beta)
438
+ else:
439
+ raise Exception(ERR_MSG)
440
+
441
+
442
+ def DB12m(x, t):
443
+ """DB12m dynamic benchmark problem
444
+ """
445
+ if check_boundary_3obj(x, UPPER_BOUND, LOWER_BOUND):
446
+ alpha = alpha_conf_3obj_type2(x, t)
447
+ beta = beta_mix(x, t, g, obj_num=3)
448
+ return multiplicative(alpha, beta)
449
+ else:
450
+ raise Exception(ERR_MSG)
451
+
452
+
453
+ def fda2_deb(x, t):
454
+ f1 = x[0]
455
+ H = 2 * np.sin(0.5 * np.pi * (t - 1))
456
+ XII = x[1:6]
457
+ XIII = x[6:13]
458
+ g = 1 + np.sum(np.power(XII, 2))
459
+ Htemp = np.sum(np.power((XIII - H / 4), 2))
460
+ h = 1 - np.power((f1 / g), np.power(2, H + Htemp))
461
+ f2 = g * h
462
+ return [f1, f2]
463
+
464
+
465
+ def FDA4(X, t):
466
+ """FDA4 dynamic benchmark problem
467
+ """
468
+ XII = X[2:]
469
+ G = fabs(sin(0.5 * pi * t))
470
+ g = sum([pow(xi - G, 2) for xi in XII])
471
+ f1 = (1 + g) * cos(X[0] * pi / 2) * cos(X[1] * pi / 2)
472
+ f2 = (1 + g) * cos(X[0] * pi / 2) * sin(X[1] * pi / 2)
473
+ f3 = (1 + g) * sin(X[0] * pi / 2)
474
+ return [f1, f2, f3]
475
+
476
+
477
+ def FDA5(X, t):
478
+ """FDA5 dynamic benchmark problem
479
+ """
480
+ XII = X[2:]
481
+ G = fabs(sin(0.5 * pi * t))
482
+ g = G + sum([pow(xi - G, 2) for xi in XII])
483
+ F = 1 + 100 * pow(sin(0.5 * pi * t), 4)
484
+ y = lambda i: pow(X[i], F)
485
+ f1 = (1 + g) * cos(y(0) * pi / 2) * cos(y(1) * pi / 2)
486
+ f2 = (1 + g) * cos(y(0) * pi / 2) * sin(y(1) * pi / 2)
487
+ f3 = (1 + g) * sin(y(0) * pi / 2)
488
+ return [f1, f2, f3]
489
+
490
+
491
+ def DIMP2(X, t):
492
+ """DIMP2 dynamic benchmark problem
493
+ """
494
+ n = len(X)
495
+ XII = X[1:]
496
+ g = 1.0 + 2.0 * (len(XII))
497
+ for k in range(1, n):
498
+ G = sin(pow(0.5 * pi * t + 2.0 * pi * float(k + 1) / float(n + 1.0), 2))
499
+ g += pow(X[k] - G, 2) - 2.0 * cos(3.0 * pi * (X[k] - G))
500
+ f1 = X[0]
501
+ h = 1 - sqrt(f1 / g)
502
+ f2 = g * h
503
+ return [f1, f2]
504
+
505
+
506
+ def dMOP2(X, t):
507
+ """dMOP2 dynamic benchmark problem
508
+ """
509
+ XII = X[1:]
510
+ G = sin(0.5 * pi * t)
511
+ g = 1 + 9 * sum([pow(xi - G, 2) for xi in XII])
512
+ H = 0.75 * sin(0.5 * pi * t) + 1.25
513
+ f1 = X[0]
514
+ h = 1 - pow((f1 / g), H)
515
+ f2 = g * h
516
+ return [f1, f2]
517
+
518
+
519
+ def dMOP3(X, tau, nt, taut, r, rIteration):
520
+ """dMOP3 dynamic benchmark problem
521
+ """
522
+ if tau % taut == 0 and rIteration != tau:
523
+ r = randint(0, 9)
524
+ rIteration = tau
525
+
526
+ XII = X[:r] + X[r + 1:]
527
+ t = float(1) / float(nt)
528
+ t = t * floor(float(tau) / float(taut))
529
+ G = sin(0.5 * pi * t)
530
+ g = 1 + 9 * sum([pow(xi - G, 2) for xi in XII])
531
+ H = 0.75 * sin(0.5 * pi * t)
532
+ f1 = X[r]
533
+ f2 = 1 - pow((f1 / g), H)
534
+ return [f1, f2, r, rIteration]
535
+
536
+
537
+ def HE2(X, t):
538
+ """HE2 dynamic benchmark problem
539
+ """
540
+ n = 30
541
+ XII = X[1:]
542
+ H = 0.75 * sin(0.5 * pi * t) + 1.25
543
+ g = 1 + (9 / (n - 1)) * sum(XII)
544
+ f1 = X[0]
545
+ h = 1 - pow(sqrt(f1 / g), H) - pow(f1 / g, H) * sin(10 * pi * f1)
546
+ f2 = g * h
547
+ return [f1, f2]
548
+
549
+
550
+ def HE7(X, t):
551
+ """HE7 dynamic benchmark problem
552
+ """
553
+
554
+ def _f1(input1):
555
+ value = input1[0]
556
+ ssum = 0.0
557
+ index = 0
558
+ for k in range(2, len(input1), 2):
559
+ val = 6 * pi * value + k * pi / len(input1)
560
+ ssum += pow(input1[k] - (0.3 * value * value * cos(4 * val) + 0.6 * value) * cos(val), 2)
561
+ index += 1
562
+ ssum *= 2.0 / index
563
+ ssum += value
564
+ return ssum
565
+
566
+ def _g(input1):
567
+ value = input1[0]
568
+ ssum = 0.0
569
+ index = 0
570
+ for k in range(1, len(input1), 2):
571
+ val = 6 * pi * value + k * pi / len(input1)
572
+ ssum += pow(input1[k] - (0.3 * value * value * cos(4 * val) + 0.6 * value) * sin(val), 2)
573
+ index += 1
574
+ ssum *= 2.0 / index
575
+ ssum += 2.0 - sqrt(value)
576
+ return ssum
577
+
578
+ f1 = _f1(X)
579
+ g = _g(X)
580
+ H = 0.75 * sin(0.5 * pi * t) + 1.25
581
+ h = 1 - pow(f1 / g, H)
582
+ f2 = g * h
583
+ return [f1, f2]
584
+
585
+
586
+ def HE9(X, t):
587
+ """HE9 dynamic benchmark problem
588
+ """
589
+
590
+ def _f1(input1):
591
+ value = input1[0]
592
+ ssum = 0.0
593
+ index = 0
594
+ for k in range(2, len(input1), 2):
595
+ ssum += pow(input1[k] - sin(6 * pi * value + k * pi / len(input1)), 2)
596
+ index += 1
597
+ ssum *= 2.0 / index
598
+ ssum += value
599
+ return ssum
600
+
601
+ def _g(input1):
602
+ value = input1[0]
603
+ ssum = 0.0
604
+ index = 0
605
+ for k in range(1, len(input1), 2):
606
+ ssum += pow(input1[k] - sin(6 * pi * value + k * pi / len(input1)), 2)
607
+ index += 1
608
+ ssum *= 2.0 / index
609
+ ssum += 2.0 - pow(value, 2)
610
+ return ssum
611
+
612
+ f1 = _f1(X)
613
+ g = _g(X)
614
+ H = 0.75 * sin(0.5 * pi * t) + 1.25
615
+ h = 1 - pow(f1 / g, H)
616
+ f2 = g * h
617
+ return [f1, f2]