pyMachDM 0.1.0__py3-none-any.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.
Files changed (84) hide show
  1. pymachdm/ANN_weights/1.Weld_Beam_MachineDM.joblib +0 -0
  2. pymachdm/ANN_weights/10.DTLZ7_MachineDM.joblib +0 -0
  3. pymachdm/ANN_weights/11.DTLZ7_MachineDM.joblib +0 -0
  4. pymachdm/ANN_weights/12.MW8_MachineDM.joblib +0 -0
  5. pymachdm/ANN_weights/13.MW8_MachineDM.joblib +0 -0
  6. pymachdm/ANN_weights/14.WAVY_3Obj_MachineDM.joblib +0 -0
  7. pymachdm/ANN_weights/15.FLOW_3Obj_MachineDM.joblib +0 -0
  8. pymachdm/ANN_weights/16.DPF4_MachineDM.joblib +0 -0
  9. pymachdm/ANN_weights/17.DPF4_MachineDM.joblib +0 -0
  10. pymachdm/ANN_weights/18.River_MachineDM.joblib +0 -0
  11. pymachdm/ANN_weights/19.River_MachineDM.joblib +0 -0
  12. pymachdm/ANN_weights/2.OSY_2Obj_MachineDM.joblib +0 -0
  13. pymachdm/ANN_weights/20.C2DTLZ2_MachineDM.joblib +0 -0
  14. pymachdm/ANN_weights/21.C2DTLZ2_MachineDM.joblib +0 -0
  15. pymachdm/ANN_weights/22.Knee_5Obj_MachineDM.joblib +0 -0
  16. pymachdm/ANN_weights/23.WATER_MachineDM.joblib +0 -0
  17. pymachdm/ANN_weights/24.WATER_MachineDM.joblib +0 -0
  18. pymachdm/ANN_weights/25.Clutch_MachineDM.joblib +0 -0
  19. pymachdm/ANN_weights/26.Clutch_MachineDM.joblib +0 -0
  20. pymachdm/ANN_weights/27.NIMBUS_MachineDM.joblib +0 -0
  21. pymachdm/ANN_weights/28.NIMBUS_MachineDM.joblib +0 -0
  22. pymachdm/ANN_weights/29.DTLZ2_8Obj_MachineDM.joblib +0 -0
  23. pymachdm/ANN_weights/3.ZDT2_2Obj_MachineDM.joblib +0 -0
  24. pymachdm/ANN_weights/30.GAA_10Obj_MachineDM.joblib +0 -0
  25. pymachdm/ANN_weights/4.Crash_MachineDM.joblib +0 -0
  26. pymachdm/ANN_weights/4.ZDT3_2Obj_MachineDM.joblib +0 -0
  27. pymachdm/ANN_weights/4a.ZDT3_2Obj_MachineDM.joblib +0 -0
  28. pymachdm/ANN_weights/5.WAVY_2Obj_MachineDM.joblib +0 -0
  29. pymachdm/ANN_weights/6.WAVY_2Obj_MachineDM.joblib +0 -0
  30. pymachdm/ANN_weights/7.Carside_MachineDM.joblib +0 -0
  31. pymachdm/ANN_weights/8.Carside_MachineDM.joblib +0 -0
  32. pymachdm/ANN_weights/9.FLOWER_3Obj_MachineDM.joblib +0 -0
  33. pymachdm/__init__.py +71 -0
  34. pymachdm/ann/__init__.py +16 -0
  35. pymachdm/ann/multioutput_class.py +115 -0
  36. pymachdm/ann/multioutput_reg.py +110 -0
  37. pymachdm/imcdm_methods/__init__.py +25 -0
  38. pymachdm/imcdm_methods/guess_start.py +46 -0
  39. pymachdm/imcdm_methods/guess_sub.py +49 -0
  40. pymachdm/imcdm_methods/mod_guess_start.py +47 -0
  41. pymachdm/imcdm_methods/mod_guess_sub.py +47 -0
  42. pymachdm/imcdm_methods/nimbus_inter.py +64 -0
  43. pymachdm/imcdm_methods/nimbus_start.py +48 -0
  44. pymachdm/imcdm_methods/nimbus_sub.py +56 -0
  45. pymachdm/imcdm_methods/stem_start.py +47 -0
  46. pymachdm/imcdm_methods/stem_sub.py +51 -0
  47. pymachdm/imcdm_methods/stom_start.py +46 -0
  48. pymachdm/imcdm_methods/stom_sub.py +47 -0
  49. pymachdm/machdm_imcdm/__init__.py +4 -0
  50. pymachdm/machdm_imcdm/machdm_all.py +771 -0
  51. pymachdm/machdm_imcdm/machine_dm.py +124 -0
  52. pymachdm/pareto/__init__.py +3 -0
  53. pymachdm/pareto/pareto_analyser.py +162 -0
  54. pymachdm/plots/__init__.py +7 -0
  55. pymachdm/plots/plot_2d_scatter.py +57 -0
  56. pymachdm/plots/plot_3d_scatter.py +91 -0
  57. pymachdm/plots/plot_pcp.py +93 -0
  58. pymachdm/plots/plot_radviz.py +496 -0
  59. pymachdm/plots/plot_tsne.py +369 -0
  60. pymachdm/problems/__init__.py +4 -0
  61. pymachdm/problems/problem_factory.py +879 -0
  62. pymachdm/problems/symbolic_problem_factory.py +696 -0
  63. pymachdm/run_machdm.py +232 -0
  64. pymachdm/soo_aasf/__init__.py +7 -0
  65. pymachdm/soo_aasf/guess_asf.py +99 -0
  66. pymachdm/soo_aasf/mod_guess_asf.py +112 -0
  67. pymachdm/soo_aasf/nimbus_asf.py +104 -0
  68. pymachdm/soo_aasf/stem_asf.py +99 -0
  69. pymachdm/soo_aasf/stom_asf.py +81 -0
  70. pymachdm/utils/__init__.py +21 -0
  71. pymachdm/utils/auto_tradeoff_stom.py +34 -0
  72. pymachdm/utils/compute_lambda.py +71 -0
  73. pymachdm/utils/compute_lambda_with_g.py +85 -0
  74. pymachdm/utils/cos_sim.py +8 -0
  75. pymachdm/utils/generate_ref_dirs.py +6 -0
  76. pymachdm/utils/predict_best.py +45 -0
  77. pymachdm/utils/predict_best2.py +62 -0
  78. pymachdm/utils/predict_prob.py +67 -0
  79. pymachdm/utils/predict_rank.py +47 -0
  80. pymachdm-0.1.0.dist-info/LICENSE +21 -0
  81. pymachdm-0.1.0.dist-info/METADATA +223 -0
  82. pymachdm-0.1.0.dist-info/RECORD +84 -0
  83. pymachdm-0.1.0.dist-info/WHEEL +5 -0
  84. pymachdm-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,696 @@
1
+ import sympy as sp
2
+ import math as ma
3
+
4
+ # ============================================================
5
+ # ========== Symbolic Problem Definitions ====================
6
+ # ============================================================
7
+
8
+ # =======================================
9
+ # ========= OSY 2-Objective =============
10
+ # =======================================
11
+ class Symbolic_OSY_2Obj:
12
+
13
+ def __init__(self):
14
+ self.n_var = 6
15
+ self.n_obj = 2
16
+
17
+ def evaluate_symbolic(self, x):
18
+
19
+ f1 = -(25*(x[0]-2)**2 + (x[1]-2)**2 + (x[2]-1)**2 + (x[3]-4)**2 + (x[4]-1)**2)
20
+ f2 = x[0]**2 + x[1]**2 + x[2]**2 + x[3]**2 + x[4]**2 + x[5]**2
21
+
22
+ g1 = (x[0] + x[1] -2)/2
23
+ g2 = (6 - x[0] - x[1])/6
24
+ g3 = (2- x[1] + x[0])/2
25
+ g4 = (2- x[0] + 3*x[1])/2
26
+ g5 = (4- (x[2]-3)**2 - x[3])/4
27
+ g6 = ((x[4]-3)**2 + x[5] - 4)/4
28
+
29
+ return [f1, f2]
30
+
31
+ # =======================================
32
+ # ======== WAVY 2-Objective =============
33
+ # =======================================
34
+ class Symbolic_WAVY_2Obj:
35
+
36
+ def __init__(self):
37
+ self.n_var = 5
38
+ self.n_obj = 2
39
+
40
+ def evaluate_symbolic(self, x):
41
+
42
+ g = 10*((x[1]-0.5)**2 + (x[2]-0.5)**2 + (x[3]-0.5)**2 + (x[4]-0.5)**2)
43
+ f1 = (1+g)*x[0]
44
+ f2 = (1+g)*(1- (x[0]**0.5 + 0.115*sp.sin(1.75*ma.pi*x[0])))
45
+
46
+ return [f1, f2]
47
+
48
+ # =======================================
49
+ # ======== ZDT2 2-Objective =============
50
+ # =======================================
51
+
52
+ class Symbolic_ZDT2_POW:
53
+
54
+ def __init__(self):
55
+ self.n_var = 5
56
+ self.n_obj = 2
57
+
58
+ def evaluate_symbolic(self, x):
59
+ # f1 is simply the first decision variable
60
+ f1 = x[0]
61
+
62
+ g = 1.0 + (9.0/4.0) * (x[1]+x[2]+x[3]+x[4])
63
+
64
+ # h function defines the non-convex (concave) shape
65
+ h = 1.0 - (f1 / g)**6
66
+
67
+ f2 = g * h
68
+
69
+ return [f1, f2]
70
+
71
+ # ---------- ZDT3 2-Objective ----------
72
+ class Symbolic_ZDT3_Problem:
73
+ def __init__(self):
74
+ self.n_var = 5
75
+ self.n_obj = 2
76
+
77
+ def evaluate_symbolic(self, x):
78
+
79
+ f1 = x[0] # Objective 1
80
+ g = 1 + 9*(x[1]+x[2]+x[3]+x[4])/4
81
+ h = 1 - (f1/(0.001+g))**0.5 - (f1/(0.001+g))*sp.sin(10*sp.pi*f1)
82
+ f2 = g*h # Objective 2
83
+
84
+ return [f1, f2]
85
+
86
+ class Symbolic_Welded_Beam:
87
+
88
+ def __init__(self):
89
+ self.n_var = 4
90
+ self.n_obj = 2
91
+
92
+ def evaluate_symbolic(self, x):
93
+
94
+ h=x[0]; b=x[1]; l=x[2]; t=x[3]
95
+ f1 = 1.10471 * h**2 * l + 0.04811 * t * b * (14 + l)
96
+ f2 = (2.1952 / (t**3 * b))
97
+
98
+ sigma = 504000 / (t**2 * b)
99
+ Pc = 64746.022 * (1 - 0.0282346 * t) * t * b**3
100
+ tau1 = 6000 / (sp.sqrt(2) * h * l)
101
+ tau2 = (6000*(14+0.5*l)*sp.sqrt(0.25*(l**2+(h + t)**2)))/(2*(0.707*h*l*((l**2/12)+0.25*(h+t)**2)))
102
+ tau = sp.sqrt(tau1**2 + tau2**2 + (l * tau1 * tau2) / sp.sqrt(0.25 * (l**2 + (h + t)**2)))
103
+
104
+ g1 = 13600 - tau
105
+ g2 = 30000 - sigma
106
+ g3 = b - h
107
+ g4 = Pc - 6000
108
+
109
+ return [f1, f2]
110
+
111
+ # ---------- Knee 2-Objective ----------
112
+ class Symbolic_Knee_Problem:
113
+ def __init__(self):
114
+ self.n_var = 5
115
+ self.n_obj = 2
116
+
117
+ def evaluate_symbolic(self, x):
118
+ K = 5
119
+ r = 5 + 10 * (x[0] - 0.5)**2 + sp.cos(2 * K * sp.pi * x[0]) / K
120
+ g = 1 + (9/4) * (x[1] + x[2] + x[3] + x[4])
121
+ f1 = g * r * sp.sin(sp.pi * x[0] / 2)
122
+ f2 = g * r * sp.cos(sp.pi * x[0] / 2)
123
+ return [f1, f2]
124
+
125
+
126
+ # ---------- Knee 3-Objective ----------
127
+ class Symbolic_Knee_Problem_3D:
128
+ def __init__(self):
129
+ self.n_var = 5
130
+ self.n_obj = 3
131
+
132
+ def evaluate_symbolic(self, x):
133
+ K = 2
134
+ r1 = 5 + 10*(x[0]-0.5)**2 + 2*sp.cos(2*K*sp.pi*x[0])/K
135
+ r2 = 5 + 10*(x[1]-0.5)**2 + 2*sp.cos(2*K*sp.pi*x[1])/K
136
+ r = 0.5*(r1 + r2)
137
+ g = 1 + (9/4)*(x[2] + x[3] + x[4])
138
+
139
+ f1 = g*r*sp.sin(sp.pi*x[0]/2)*sp.sin(sp.pi*x[1]/2)
140
+ f2 = g*r*sp.sin(sp.pi*x[0]/2)*sp.cos(sp.pi*x[1]/2)
141
+ f3 = g*r*sp.cos(sp.pi*x[0]/2)
142
+ return [f1, f2, f3]
143
+
144
+
145
+ # =======================================
146
+ # ======== WAVY 3-Objective =============
147
+ # =======================================
148
+ class Symbolic_WAVY_3Obj:
149
+
150
+ def __init__(self):
151
+ self.n_var = 5
152
+ self.n_obj = 3
153
+
154
+ def evaluate_symbolic(self, x):
155
+
156
+ g = 10*((x[2]-0.5)**2 + (x[3]-0.5)**2 + (x[4]-0.5)**2)
157
+ f1 = (1+g)*x[0]
158
+ f2 = (1+g)*x[1]
159
+ f3 = (1+g)*(2- (x[0]**0.5 + 0.115*sp.sin(1.75*3.14*x[0])) - (x[1]**0.5 + 0.115*sp.sin(1.75*3.14*x[1])))
160
+
161
+ return [f1, f2, f3]
162
+
163
+
164
+ # =======================================
165
+ # ======== FLOWER 3-Objective =============
166
+ # =======================================
167
+
168
+ class Symbolic_FLOWER_3Obj:
169
+
170
+ def __init__(self):
171
+ self.n_var = 2
172
+ self.n_obj = 3
173
+
174
+ def evaluate_symbolic(self, x):
175
+
176
+ g = 2.718**(x[1]*(x[1]-5)) - 6*(sp.sin(2*x[1]))/5 - 2*x[1] - 1
177
+ f1 = g*sp.sin(x[0])/10
178
+ f2 = g*sp.cos(x[0])/10
179
+ f3 = (x[1]**2)/20
180
+
181
+ return [f1, f2, f3]
182
+
183
+ # =======================================
184
+ # ======== FLOW 3-Objective =============
185
+ # =======================================
186
+
187
+ class Symbolic_FLOW_3Obj:
188
+
189
+ def __init__(self):
190
+ self.n_var = 5
191
+ self.n_obj = 3
192
+
193
+ def evaluate_symbolic(self, x):
194
+
195
+ g = 10*((x[2]-0.5)**2 + (x[3]-0.5)**2 + (x[4]-0.5)**2)
196
+
197
+ f1 = x[0]
198
+ f2 = x[1]
199
+ f3 = (1 + g)*(1- (x[0] + x[1]) - 0.15*sp.sin(2*3.14*(x[0] + x[1])))
200
+ g1 = x[0] + x[1] - 1
201
+
202
+ return [f1, f2, f3]
203
+
204
+
205
+ # ---------- DTLZ1 3-Objective ----------
206
+ class Symbolic_DTLZ1_3Obj:
207
+ def __init__(self):
208
+ self.n_var = 5
209
+ self.n_obj = 3
210
+
211
+ def evaluate_symbolic(self, x):
212
+ M = self.n_obj
213
+ x_m = x[M-1:]
214
+ k = len(x_m)
215
+ g = 100 * (k + sp.Add(*[(xi - 0.5)**2 - sp.cos(20 * sp.pi * xi) for xi in x_m]))
216
+
217
+ f = []
218
+ for m in range(1, M+1):
219
+ prod1 = 1 if M-m == 0 else sp.Mul(*[x[i] for i in range(M-m)], evaluate=False)
220
+ prod2 = 1 if m == 1 else (1 - x[M-m])
221
+ f.append(0.5 * (1 + g) * prod1 * prod2)
222
+ return f
223
+
224
+
225
+ # ======================================
226
+ # =========== MW-8 3-Objective =========
227
+ # ======================================
228
+ class Symbolic_MW8_Problem:
229
+ def __init__(self):
230
+ self.n_var = 15
231
+ self.n_obj = 3
232
+
233
+ def evaluate_symbolic(self, x):
234
+
235
+ # Distance function
236
+ z = [1 - sp.exp(-10.0 * (xi - 0.5)**2) for xi in x[2:]]
237
+
238
+ g = 1 + sum(0.1 * zi**2 + 1.5 - 1.5 * sp.cos(2 * sp.pi * zi) for zi in z)
239
+
240
+ # Objectives
241
+ f1 = g * sp.cos(sp.pi * x[0] / 2) * sp.cos(sp.pi * x[1] / 2)
242
+ f2 = g * sp.cos(sp.pi * x[0] / 2) * sp.sin(sp.pi * x[1] / 2)
243
+ f3 = g * sp.sin(sp.pi * x[0] / 2)
244
+
245
+ return [f1, f2, f3]
246
+
247
+
248
+ # ---------- Crashworthiness 3-Objective ----------
249
+ class Symbolic_Crash_Worth:
250
+ def __init__(self):
251
+ self.n_var = 5
252
+ self.n_obj = 3
253
+
254
+ def evaluate_symbolic(self, x):
255
+ f1 = 1640.2823 + 2.3573285*x[0] + 2.3220035*x[1] + 4.5688768*x[2] + 7.7213633*x[3] + 4.4559504*x[4]
256
+ f2 = (6.5856 + 1.15*x[0] - 1.0427*x[1] + 0.9738*x[2] + 0.8364*x[3]
257
+ - 0.3695*x[0]*x[3] + 0.0861*x[0]*x[4] + 0.3628*x[1]*x[3]
258
+ - 0.1106*x[0]**2 - 0.3437*x[2]**2 + 0.1764*x[3]**2)
259
+ f3 = (-0.0551 + 0.0181*x[0] + 0.1024*x[1] + 0.0421*x[2]
260
+ - 0.0073*x[0]*x[1] + 0.024*x[1]*x[2] - 0.0118*x[1]*x[3]
261
+ - 0.0204*x[2]*x[3] - 0.008*x[2]*x[4] - 0.0241*x[1]**2 + 0.0109*x[3]**2)
262
+ return [f1, f2, f3]
263
+
264
+
265
+ # ---------- Carside Impact 3-Objective ----------
266
+ class Symbolic_Car_Side:
267
+ def __init__(self):
268
+ self.n_var = 7
269
+ self.n_obj = 3
270
+ self.n_constr = 10
271
+
272
+ def evaluate_symbolic(self, x):
273
+ # Objective functions
274
+ f1 = 1.98 + 4.9*x[0] + 6.67*x[1] + 6.98*x[2] + 4.01*x[3] + 1.78*x[4] + 1e-5*x[5] + 2.73*x[6]
275
+ f2 = 4.72 - 0.5*x[3] - 0.19*x[1]*x[2]
276
+ V_MBP = 10.58 - 0.674*x[0]*x[1] - 0.67275*x[1]
277
+ V_FD = 16.45 - 0.489*x[2]*x[6] - 0.843*x[4]*x[5]
278
+ f3 = 0.5 * V_MBP * V_FD
279
+
280
+ # Constraint functions
281
+ g1 = 1 - 1.16 + 0.3717*x[1]*x[3] + 0.0092928*x[2]
282
+ g2 = 0.32 - 0.261 + 0.0159*x[0]*x[1] + 0.06486*x[0] + 0.019*x[1]*x[6] - 0.0144*x[2]*x[4] - 0.0154464*x[5]
283
+ g3 = 0.32 - 0.214 - 0.00817*x[4] + 0.045195*x[0] + 0.0135168*x[0] - 0.03099*x[1]*x[5] + 0.018*x[1]*x[6] - 0.007176*x[2] - 0.023232*x[2] + 0.00364*x[4]*x[5] + 0.018*x[1]**2
284
+ g4 = 0.32 - 0.74 + 0.61*x[1] + 0.031296*x[2] + 0.031872*x[6] - 0.227*x[1]**2
285
+ g5 = 32 - 28.98 - 3.818*x[2] + 4.2*x[0]*x[1] - 1.27296*x[5] + 2.68065*x[6]
286
+ g6 = 32 - 33.86 - 2.95*x[2] + 5.057*x[0]*x[1] + 3.795*x[1] + 3.4431*x[6] - 1.45728
287
+ g7 = 32 - 46.36 + 9.9*x[1] + 4.4505*x[0]
288
+ g8 = 4 - (4.72 - 0.5*x[3] - 0.19*x[1]*x[2])
289
+ g9 = 9.9 - (10.58 - 0.674*x[0]*x[1] - 0.67275*x[1])
290
+ g10 = 15.7 - (16.45 - 0.489*x[2]*x[6] - 0.843*x[4]*x[5])
291
+
292
+ # Set the objectives and constraints in the output dictionary
293
+ return [f1, f2, f3]
294
+ # out["G"] = [-g1, -g2, -g3, -g4, -g5, -g6, -g7, -g8, -g9, -g10]
295
+
296
+
297
+ # ---------- C2-DTLZ-2 3-Objective ----------
298
+ class Symbolic_C2DTLZ2:
299
+ def __init__(self):
300
+ self.n_var = 10
301
+ self.n_obj = 3
302
+ self.n_constr = 1
303
+
304
+ def evaluate_symbolic(self, x):
305
+ G = sum((xi - 0.5)**2 for xi in x[2:10])
306
+ f1 = (1 + G) * sp.cos(sp.pi * x[0]/2) * sp.cos(sp.pi * x[1]/2)
307
+ f2 = (1 + G) * sp.cos(sp.pi * x[0]/2) * sp.sin(sp.pi * x[1]/2)
308
+ f3 = (1 + G) * sp.sin(sp.pi * x[0]/2)
309
+
310
+ g1 = sp.Min(
311
+ (f1-1)**2 + f2**2 + f3**2 - 0.4**2,
312
+ f1**2 + (f2-1)**2 + f3**2 - 0.4**2,
313
+ f1**2 + f2**2 + (f3-1)**2 - 0.4**2,
314
+ (f1-1/sp.sqrt(3))**2 + (f2-1/sp.sqrt(3))**2 + (f3-1/sp.sqrt(3))**2 - 0.16
315
+ )
316
+
317
+ return [f1, f2, f3]
318
+
319
+ # ---------- DTLZ7 3-Objective ----------
320
+ class Symbolic_DTLZ7:
321
+
322
+ def __init__(self):
323
+ self.n_var = 5
324
+ self.n_obj = 3
325
+
326
+ def evaluate_symbolic(self, x):
327
+
328
+ # f1 and f2
329
+ f1 = x[0]
330
+ f2 = x[1]
331
+
332
+ # g(x3...x5)
333
+ g = 1 + (9.0 / (5 - 2)) * (x[2] + x[3] + x[4])
334
+
335
+ # h term
336
+ h = 3 - (f1 / (1 + g)) * (1 + sp.sin(3 * sp.pi * f1)) - (f2 / (1 + g)) * (1 + sp.sin(3 * sp.pi * f2))
337
+
338
+ f3 = (1 + g) * h
339
+
340
+ return [f1, f2, f3]
341
+
342
+ # ---------- DPF4 4-Objective ----------
343
+ class Symbolic_DPF4:
344
+
345
+ def __init__(self):
346
+ self.n_obj = 4
347
+ self.n_var = 2
348
+ self.n_constr = 1
349
+
350
+ def evaluate_symbolic(self, x):
351
+ f1 = ((x[0]-50)**2 + (x[1]-50)**2)**0.5
352
+ f2 = ((x[0]-50)**2 + (x[1]-150)**2)**0.5
353
+ f3 = ((x[0]-150)**2 + (x[1]-50)**2)**0.5
354
+ f4 = ((x[0]-150)**2 + (x[1]-150)**2)**0.5
355
+ g1 = ((x[0]-100)**2 + (x[1]-100)**2)/400-1
356
+ g2 = 1-((x[0]-100)**2 + (x[1]-100)**2)/3025
357
+ return [f1, f2, f3, f4]
358
+
359
+
360
+ # ---------- C2-DTLZ-2 5-Objective ----------
361
+ class Symbolic_C2DTLZ2_5Obj:
362
+ def __init__(self):
363
+ self.n_obj = 5
364
+ self.n_var = 10
365
+ self.n_constr = 1
366
+ def evaluate_symbolic(self, x):
367
+ M = self.n_obj
368
+ G = sum((xi - 0.5)**2 for xi in x[M-1:self.n_var])
369
+ F = []
370
+ for i in range(M):
371
+ val = (1 + G)
372
+ for j in range(M - i - 1):
373
+ val *= sp.cos(sp.pi * x[j] / 2)
374
+ if i > 0:
375
+ val *= sp.sin(sp.pi * x[M - i - 1] / 2)
376
+ F.append(val)
377
+ f1, f2, f3, f4, f5 = F
378
+ # C2 constraint
379
+ g1 = sp.Min(
380
+ (f1-1)**2 + f2**2 + f3**2 + f4**2 + f5**2 - 0.4**2,
381
+ f1**2 + (f2-1)**2 + f3**2 + f4**2 + f5**2 - 0.4**2,
382
+ f1**2 + f2**2 + (f3-1)**2 + f4**2 + f5**2 - 0.4**2,
383
+ f1**2 + f2**2 + f3**2 + (f4-1)**2 + f5**2 - 0.4**2,
384
+ f1**2 + f2**2 + f3**2 + f4**2 + (f5-1)**2 - 0.4**2,
385
+ (f1-1/sp.sqrt(5))**2 + (f2-1/sp.sqrt(5))**2 +
386
+ (f3-1/sp.sqrt(5))**2 + (f4-1/sp.sqrt(5))**2 +
387
+ (f5-1/sp.sqrt(5))**2 - 0.16
388
+ )
389
+
390
+ return F
391
+
392
+ # ---------- KNEE 5-Objective ----------
393
+ class Symbolic_Knee_5Obj:
394
+ def __init__(self):
395
+ self.n_var = 8
396
+ self.n_obj = 5
397
+
398
+ def evaluate_symbolic(self, x):
399
+ K = 2
400
+ # Knee-inducing radius terms
401
+ r1 = 5 + 10 * (x[0] - 0.5)** 2 + 2*sp.cos(2 * K * sp.pi * x[0]) / K
402
+ r2 = 5 + 10 * (x[1] - 0.5)** 2 + 2*sp.cos(2 * K * sp.pi * x[1]) / K
403
+ r = 0.5 * (r1 + r2)
404
+ # Distance term
405
+ g = 1 + (9 / 6) * (x[4] + x[5] + x[6] + x[7])
406
+ # Objectives (5D hyperspherical knee)
407
+ f1 = g*r*sp.sin(sp.pi * x[0] / 2) * sp.sin(sp.pi * x[1] / 2) * sp.sin(sp.pi * x[2] / 2) * sp.sin(sp.pi * x[3] / 2)
408
+ f2 = g*r*sp.sin(sp.pi * x[0] / 2) * sp.sin(sp.pi * x[1] / 2) * sp.sin(sp.pi * x[2] / 2) * sp.cos(sp.pi * x[3] / 2)
409
+ f3 = g*r*sp.sin(sp.pi * x[0] / 2) * sp.sin(sp.pi * x[1] / 2) * sp.cos(sp.pi * x[2] / 2)
410
+ f4 = g*r*sp.sin(sp.pi * x[0] / 2) * sp.cos(sp.pi * x[1] / 2)
411
+ f5 = g*r*sp.cos(sp.pi * x[0] / 2)
412
+ return [f1, f2, f3, f4, f5]
413
+
414
+
415
+ # =============================================
416
+ # ======== Clutch Brake 6-Objective ===========
417
+ # =============================================
418
+
419
+ class Symbolic_Clutch:
420
+ def __init__(self):
421
+ self.n_var = 5
422
+ self.n_obj = 5
423
+
424
+ def evaluate_symbolic(self, x):
425
+ x1 = x[0]; x2 = x[1]; x3 = x[2]; x4 = x[3]; x5 = x[4];
426
+ Jz = 55; rho = 0.0000078; Mf = 3; n = 250; mu = 0.5; Pmax = 10; Vmax= 2000; Tmax= 15; s = 1.5; Fmax = 1000;
427
+
428
+ omega = 3.14*n/30; Mh = (2/3)*(mu)*x4*x5*(x2**3 - x1**3)/(x2**2 - x1**2)
429
+ Rsr = (2/3)*(x2**3 - x1**3)/(x2**2 - x1**2)
430
+ S = 3.14*(x2**2 - x1**2); F = Mh/Rsr; Prz = x4/S; Vsr = 3.14*Rsr*n/30
431
+
432
+
433
+ f1 = 3.14*(x2**2 - x1**2)*x3*(x5 + 1)*rho
434
+ f2 = Jz*omega/(Mh+Mf)
435
+ f3 = x5
436
+ f4 = x2
437
+ f5 = x4
438
+
439
+ return [f1, f2, f3, f4, f5]
440
+
441
+
442
+ # ---------- NIMBUS 6-Objective ----------
443
+ class Symbolic_NIMBUS_Bench:
444
+ def __init__(self):
445
+ self.n_var = 2
446
+ self.n_obj = 6
447
+
448
+ def evaluate_symbolic(self, x):
449
+ f1 = -(x[0]*x[1])
450
+ f2 = (x[0]-4)**2 + x[1]**2
451
+ f3 = -(x[0]+x[1])
452
+ f4 = x[0]-x[1]
453
+ f5 = 50*x[0]**4 + 10*x[1]**4
454
+ f6 = 30*(x[0]-5)**4 + 100*(x[1]-3)**4
455
+ return [f1, f2, f3, f4, f5, f6]
456
+
457
+
458
+ # ---------- River 4-Objective ----------
459
+ class Symbolic_River:
460
+ def __init__(self):
461
+ self.n_var = 2
462
+ self.n_obj = 4
463
+
464
+ def evaluate_symbolic(self, x):
465
+ f1 = -(4.07 + 2.27*x[0])
466
+ f2 = -(2.60 + 0.03*x[0] + 0.02*x[1] + 0.01/(1.39-x[0]**2) + 0.30/(1.39-x[1]**2))
467
+ f3 = -8.21 + 0.71/(1.09-x[0]**2)
468
+ f4 = -0.96 + 0.96/(1.09-x[1]**2)
469
+ return [f1, f2, f3, f4]
470
+
471
+ # ======================================
472
+ # ======== WATER 5-Objective ===========
473
+ # ======================================
474
+
475
+ class Symbolic_WATER:
476
+ def __init__(self):
477
+ self.n_var = 3
478
+ self.n_obj = 5
479
+ self.n_constr = 7
480
+
481
+ def evaluate_symbolic(self, x):
482
+ x1, x2, x3 = x
483
+
484
+ # Objective functions
485
+ f1 = 106780.37 * (x2 + x3) + 61704.67
486
+ f2 = 3000 * x1
487
+ f3 = (305700 * 2289 * x2) / ((0.06 * 2289)**0.65)
488
+ f4 = 250 * 2289 * (2.71828**(-39.75 * x2 + 9.9 * x3 + 2.74))
489
+ f5 = 25 * ((1.39 / (x1 * x2)) + 4940 * x3 - 80)
490
+
491
+ # Constraints
492
+ g1 = 1 - (0.00139 / (x1 * x2) - 4.94 * x3 + 0.08)
493
+ g2 = 1 - (0.000306 / (x1 * x2) - 1.082 * x3 + 0.0986)
494
+ g3 = 50000 - (12.307 / (x1 * x2) - 49408.24 * x3 - 4051.02)
495
+ g4 = 16000 - (2.098 / (x1 * x2) - 8046.33 * x3 + 696.71)
496
+ g5 = 10000 - (2.138 / (x1 * x2) - 7883.39 * x3 + 705.04)
497
+ g6 = 2000 - 0.417 * (x1 * x2) - 1721.26 * x3 + 136.54
498
+ g7 = 550 - 0.164 * (x1 * x2) - 631.13 * x3 + 54.48
499
+
500
+ # Set objective and constraint values
501
+ return [f1, f2, f3, f4, f5]
502
+ # out["G"] = np.array([-g1, -g2, -g3, -g4, -g5, -g6, -g7])
503
+
504
+
505
+ # =======================================
506
+ # ======== DTLZ-2 8-Objective ===========
507
+ # =======================================
508
+
509
+ class Symbolic_DTLZ2_8obj:
510
+ def __init__(self):
511
+ self.n_var = 10
512
+ self.n_obj = 8
513
+
514
+ def evaluate_symbolic(self, x):
515
+ a = (1 + (x[7]-0.5)**2 + (x[8]-0.5)**2 + (x[9]-0.5)**2)
516
+ f = []
517
+ f1 = a*sp.cos((11*x[0])/7)*sp.cos((11*x[1])/7)*sp.cos((11*x[2])/7)*sp.cos((11*x[3])/7)*sp.cos((11*x[4])/7)*sp.cos((11*x[5])/7)*sp.cos((11*x[6])/7)
518
+ f2 = a*sp.cos((11*x[0])/7)*sp.cos((11*x[1])/7)*sp.cos((11*x[2])/7)*sp.cos((11*x[3])/7)*sp.cos((11*x[4])/7)*sp.cos((11*x[5])/7)*sp.sin((11*x[6])/7)
519
+ f3 = a*sp.cos((11*x[0])/7)*sp.cos((11*x[1])/7)*sp.cos((11*x[2])/7)*sp.cos((11*x[3])/7)*sp.cos((11*x[4])/7)*sp.sin((11*x[5])/7)
520
+ f4 = a*sp.cos((11*x[0])/7)*sp.cos((11*x[1])/7)*sp.cos((11*x[2])/7)*sp.cos((11*x[3])/7)*sp.sin((11*x[4])/7)
521
+ f5 = a*sp.cos((11*x[0])/7)*sp.cos((11*x[1])/7)*sp.cos((11*x[2])/7)*sp.sin((11*x[3])/7)
522
+ f6 = a*sp.cos((11*x[0])/7)*sp.cos((11*x[1])/7)*sp.sin((11*x[2])/7)
523
+ f7 = a*sp.cos((11*x[0])/7)*sp.sin((11*x[1])/7)
524
+ f8 = a*sp.sin((11*x[0])/7)
525
+
526
+ return [f1, f2, f3, f4, f5, f6, f7, f8]
527
+
528
+ # ========================================
529
+ # ======== DTLZ-2 15-Objective ===========
530
+ # ========================================
531
+
532
+ class Symbolic_DTLZ2_15Obj:
533
+ def __init__(self):
534
+ self.n_obj = 15
535
+ self.n_var = 24
536
+ self.n_constr = 1
537
+ def evaluate_symbolic(self, x):
538
+ M = self.n_obj
539
+ G = sum((xi - 0.5)**2 for xi in x[M-1:self.n_var])
540
+ F = []
541
+ for i in range(M):
542
+ val = (1 + G)
543
+ for j in range(M - i - 1):
544
+ val *= sp.cos(sp.pi * x[j] / 2)
545
+ if i > 0:
546
+ val *= sp.sin(sp.pi * x[M - i - 1] / 2)
547
+ F.append(val)
548
+ f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15 = F
549
+
550
+ return F
551
+
552
+
553
+ # ======================================
554
+ # ======== C2-DTLZ-2 15-Objective ======
555
+ # ======================================
556
+ class Symbolic_C2DTLZ2_15Obj:
557
+ def __init__(self):
558
+ self.n_obj = 15
559
+ self.n_var = 24
560
+ self.n_constr = 1
561
+ def evaluate_symbolic(self, x):
562
+ M = self.n_obj
563
+ G = sum((xi - 0.5)**2 for xi in x[M-1:self.n_var])
564
+ F = []
565
+ for i in range(M):
566
+ val = (1 + G)
567
+ for j in range(M - i - 1):
568
+ val *= sp.cos(sp.pi * x[j] / 2)
569
+ if i > 0:
570
+ val *= sp.sin(sp.pi * x[M - i - 1] / 2)
571
+ F.append(val)
572
+ f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15 = F
573
+
574
+ return F
575
+
576
+
577
+ # ============================================================
578
+ # ========== Symbolic Problem Factory ========================
579
+ # ============================================================
580
+
581
+ def get_symbolic_problem(name: str):
582
+ name = name.lower()
583
+
584
+ if name == "sym_knee_example":
585
+ return Symbolic_Knee_Problem()
586
+
587
+ elif name == "sym_zdt2_pow":
588
+ return Symbolic_ZDT2_POW()
589
+
590
+ elif name == "sym_osy_2obj":
591
+ return Symbolic_OSY_2Obj()
592
+
593
+ elif name == "sym_wavy_2obj_1":
594
+ return Symbolic_WAVY_2Obj()
595
+
596
+ elif name == "sym_wavy_2obj_2":
597
+ return Symbolic_WAVY_2Obj()
598
+
599
+ elif name == "sym_wavy_3obj":
600
+ return Symbolic_WAVY_3Obj()
601
+
602
+ elif name == "sym_flower_3obj":
603
+ return Symbolic_FLOWER_3Obj()
604
+
605
+ elif name == "sym_flow_3obj":
606
+ return Symbolic_FLOW_3Obj()
607
+
608
+ elif name == "sym_welded_beam":
609
+ return Symbolic_Welded_Beam()
610
+
611
+ elif name == "sym_zdt3_example":
612
+ return Symbolic_ZDT3_Problem()
613
+
614
+ elif name == "sym_knee_example_3d":
615
+ return Symbolic_Knee_Problem_3D()
616
+
617
+ elif name == "sym_zdt3_example":
618
+ return Symbolic_ZDT3_Problem()
619
+
620
+ elif name == "sym_dtlz1_3d":
621
+ return Symbolic_DTLZ1_3Obj()
622
+
623
+ elif name == "sym_mw8_1":
624
+ return Symbolic_MW8_Problem()
625
+
626
+ elif name == "sym_mw8_2":
627
+ return Symbolic_MW8_Problem()
628
+
629
+ elif name == "sym_crash":
630
+ return Symbolic_Crash_Worth()
631
+
632
+ elif name == "sym_carside_1":
633
+ return Symbolic_Car_Side()
634
+
635
+ elif name == "sym_carside_2":
636
+ return Symbolic_Car_Side()
637
+
638
+ elif name == "sym_c2dtlz2":
639
+ return Symbolic_C2DTLZ2()
640
+
641
+ elif name == "sym_dtlz7_1":
642
+ return Symbolic_DTLZ7()
643
+
644
+ elif name == "sym_dtlz7_2":
645
+ return Symbolic_DTLZ7()
646
+
647
+ elif name == "sym_dpf4_ex1":
648
+ return Symbolic_DPF4()
649
+
650
+ elif name == "sym_dpf4_ex2":
651
+ return Symbolic_DPF4()
652
+
653
+ elif name == "sym_c2dtlz2_5obj_ex1":
654
+ return Symbolic_C2DTLZ2_5Obj()
655
+
656
+ elif name == "sym_c2dtlz2_5obj_ex2":
657
+ return Symbolic_C2DTLZ2_5Obj()
658
+
659
+ elif name == "sym_knee_5obj":
660
+ return Symbolic_Knee_5Obj()
661
+
662
+ elif name == "sym_nimbus_bench1":
663
+ return Symbolic_NIMBUS_Bench()
664
+
665
+ elif name == "sym_nimbus_bench2":
666
+ return Symbolic_NIMBUS_Bench()
667
+
668
+ elif name == "sym_river_ex1":
669
+ return Symbolic_River()
670
+
671
+ elif name == "sym_river_ex2":
672
+ return Symbolic_River()
673
+
674
+ elif name == "sym_water_ex1":
675
+ return Symbolic_WATER()
676
+
677
+ elif name == "sym_water_ex2":
678
+ return Symbolic_WATER()
679
+
680
+ elif name == "sym_clutch_ex1":
681
+ return Symbolic_Clutch()
682
+
683
+ elif name == "sym_clutch_ex2":
684
+ return Symbolic_Clutch()
685
+
686
+ elif name == "sym_dtlz2_8obj":
687
+ return Symbolic_DTLZ2_8obj()
688
+
689
+ elif name == "sym_dtlz2_15obj":
690
+ return Symbolic_DTLZ2_15Obj()
691
+
692
+ elif name == "sym_c2dtlz2_15obj":
693
+ return Symbolic_C2DTLZ2_15Obj()
694
+
695
+ else:
696
+ raise ValueError(f"Unknown symbolic problem name: {name}")