desdeo 1.2__py3-none-any.whl → 2.0.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 (122) hide show
  1. desdeo/__init__.py +8 -8
  2. desdeo/api/README.md +73 -0
  3. desdeo/api/__init__.py +15 -0
  4. desdeo/api/app.py +40 -0
  5. desdeo/api/config.py +69 -0
  6. desdeo/api/config.toml +53 -0
  7. desdeo/api/db.py +25 -0
  8. desdeo/api/db_init.py +79 -0
  9. desdeo/api/db_models.py +164 -0
  10. desdeo/api/malaga_db_init.py +27 -0
  11. desdeo/api/models/__init__.py +66 -0
  12. desdeo/api/models/archive.py +34 -0
  13. desdeo/api/models/preference.py +90 -0
  14. desdeo/api/models/problem.py +507 -0
  15. desdeo/api/models/reference_point_method.py +18 -0
  16. desdeo/api/models/session.py +46 -0
  17. desdeo/api/models/state.py +96 -0
  18. desdeo/api/models/user.py +51 -0
  19. desdeo/api/routers/_NAUTILUS.py +245 -0
  20. desdeo/api/routers/_NAUTILUS_navigator.py +233 -0
  21. desdeo/api/routers/_NIMBUS.py +762 -0
  22. desdeo/api/routers/__init__.py +5 -0
  23. desdeo/api/routers/problem.py +110 -0
  24. desdeo/api/routers/reference_point_method.py +117 -0
  25. desdeo/api/routers/session.py +76 -0
  26. desdeo/api/routers/test.py +16 -0
  27. desdeo/api/routers/user_authentication.py +366 -0
  28. desdeo/api/schema.py +94 -0
  29. desdeo/api/tests/__init__.py +0 -0
  30. desdeo/api/tests/conftest.py +59 -0
  31. desdeo/api/tests/test_models.py +701 -0
  32. desdeo/api/tests/test_routes.py +216 -0
  33. desdeo/api/utils/database.py +274 -0
  34. desdeo/api/utils/logger.py +29 -0
  35. desdeo/core.py +27 -0
  36. desdeo/emo/__init__.py +29 -0
  37. desdeo/emo/hooks/archivers.py +172 -0
  38. desdeo/emo/methods/EAs.py +418 -0
  39. desdeo/emo/methods/__init__.py +0 -0
  40. desdeo/emo/methods/bases.py +59 -0
  41. desdeo/emo/operators/__init__.py +1 -0
  42. desdeo/emo/operators/crossover.py +780 -0
  43. desdeo/emo/operators/evaluator.py +118 -0
  44. desdeo/emo/operators/generator.py +356 -0
  45. desdeo/emo/operators/mutation.py +1053 -0
  46. desdeo/emo/operators/selection.py +1036 -0
  47. desdeo/emo/operators/termination.py +178 -0
  48. desdeo/explanations/__init__.py +6 -0
  49. desdeo/explanations/explainer.py +100 -0
  50. desdeo/explanations/utils.py +90 -0
  51. desdeo/mcdm/__init__.py +19 -0
  52. desdeo/mcdm/nautili.py +345 -0
  53. desdeo/mcdm/nautilus.py +477 -0
  54. desdeo/mcdm/nautilus_navigator.py +655 -0
  55. desdeo/mcdm/nimbus.py +417 -0
  56. desdeo/mcdm/pareto_navigator.py +269 -0
  57. desdeo/mcdm/reference_point_method.py +116 -0
  58. desdeo/problem/__init__.py +79 -0
  59. desdeo/problem/evaluator.py +561 -0
  60. desdeo/problem/gurobipy_evaluator.py +562 -0
  61. desdeo/problem/infix_parser.py +341 -0
  62. desdeo/problem/json_parser.py +944 -0
  63. desdeo/problem/pyomo_evaluator.py +468 -0
  64. desdeo/problem/schema.py +1808 -0
  65. desdeo/problem/simulator_evaluator.py +298 -0
  66. desdeo/problem/sympy_evaluator.py +244 -0
  67. desdeo/problem/testproblems/__init__.py +73 -0
  68. desdeo/problem/testproblems/binh_and_korn_problem.py +88 -0
  69. desdeo/problem/testproblems/dtlz2_problem.py +102 -0
  70. desdeo/problem/testproblems/forest_problem.py +275 -0
  71. desdeo/problem/testproblems/knapsack_problem.py +163 -0
  72. desdeo/problem/testproblems/mcwb_problem.py +831 -0
  73. desdeo/problem/testproblems/mixed_variable_dimenrions_problem.py +83 -0
  74. desdeo/problem/testproblems/momip_problem.py +172 -0
  75. desdeo/problem/testproblems/nimbus_problem.py +143 -0
  76. desdeo/problem/testproblems/pareto_navigator_problem.py +89 -0
  77. desdeo/problem/testproblems/re_problem.py +492 -0
  78. desdeo/problem/testproblems/river_pollution_problem.py +434 -0
  79. desdeo/problem/testproblems/rocket_injector_design_problem.py +140 -0
  80. desdeo/problem/testproblems/simple_problem.py +351 -0
  81. desdeo/problem/testproblems/simulator_problem.py +92 -0
  82. desdeo/problem/testproblems/spanish_sustainability_problem.py +945 -0
  83. desdeo/problem/testproblems/zdt_problem.py +271 -0
  84. desdeo/problem/utils.py +245 -0
  85. desdeo/tools/GenerateReferencePoints.py +181 -0
  86. desdeo/tools/__init__.py +102 -0
  87. desdeo/tools/generics.py +145 -0
  88. desdeo/tools/gurobipy_solver_interfaces.py +258 -0
  89. desdeo/tools/indicators_binary.py +11 -0
  90. desdeo/tools/indicators_unary.py +375 -0
  91. desdeo/tools/interaction_schema.py +38 -0
  92. desdeo/tools/intersection.py +54 -0
  93. desdeo/tools/iterative_pareto_representer.py +99 -0
  94. desdeo/tools/message.py +234 -0
  95. desdeo/tools/ng_solver_interfaces.py +199 -0
  96. desdeo/tools/non_dominated_sorting.py +133 -0
  97. desdeo/tools/patterns.py +281 -0
  98. desdeo/tools/proximal_solver.py +99 -0
  99. desdeo/tools/pyomo_solver_interfaces.py +464 -0
  100. desdeo/tools/reference_vectors.py +462 -0
  101. desdeo/tools/scalarization.py +3138 -0
  102. desdeo/tools/scipy_solver_interfaces.py +454 -0
  103. desdeo/tools/score_bands.py +464 -0
  104. desdeo/tools/utils.py +320 -0
  105. desdeo/utopia_stuff/__init__.py +0 -0
  106. desdeo/utopia_stuff/data/1.json +15 -0
  107. desdeo/utopia_stuff/data/2.json +13 -0
  108. desdeo/utopia_stuff/data/3.json +15 -0
  109. desdeo/utopia_stuff/data/4.json +17 -0
  110. desdeo/utopia_stuff/data/5.json +15 -0
  111. desdeo/utopia_stuff/from_json.py +40 -0
  112. desdeo/utopia_stuff/reinit_user.py +38 -0
  113. desdeo/utopia_stuff/utopia_db_init.py +212 -0
  114. desdeo/utopia_stuff/utopia_problem.py +403 -0
  115. desdeo/utopia_stuff/utopia_problem_old.py +415 -0
  116. desdeo/utopia_stuff/utopia_reference_solutions.py +79 -0
  117. desdeo-2.0.0.dist-info/LICENSE +21 -0
  118. desdeo-2.0.0.dist-info/METADATA +168 -0
  119. desdeo-2.0.0.dist-info/RECORD +120 -0
  120. {desdeo-1.2.dist-info → desdeo-2.0.0.dist-info}/WHEEL +1 -1
  121. desdeo-1.2.dist-info/METADATA +0 -16
  122. desdeo-1.2.dist-info/RECORD +0 -4
@@ -0,0 +1,831 @@
1
+ """Defined multiobjective optimization problems for cantilever welded beams...
2
+
3
+ This script defines multiobjective optimization problems for cantilever welded beams
4
+ using various cross-section types. The problems aim to minimize the total cost of
5
+ weld and beam construction while ensuring the structural integrity of the beam
6
+ by considering constraints related to stress and deflection.
7
+
8
+ Each problem represents a specific configuration of a cantilever beam, and includes:
9
+ - Variables (e.g., dimensions of the beam and weld),
10
+ - Constants (e.g., material properties),
11
+ - Extra functions (e.g., derived calculations for area, moment of inertia),
12
+ - Objectives (e.g., minimizing cost and deflection),
13
+ - Constraints (e.g., shear stress, buckling, and geometric constraints).
14
+ """
15
+
16
+ from desdeo.problem.schema import (
17
+ Constant,
18
+ Constraint,
19
+ ConstraintTypeEnum,
20
+ ExtraFunction,
21
+ Objective,
22
+ Problem,
23
+ Variable,
24
+ VariableTypeEnum,
25
+ )
26
+
27
+ CONSTANTS = [
28
+ Constant(name="P", symbol="P", value=30000), # Load [N]
29
+ Constant(name="L", symbol="L", value=0.5), # Beam length [m]
30
+ Constant(name="E", symbol="E", value=200e9), # Young's modulus [Pa]
31
+ Constant(name="tau_max", symbol="tau_max", value=95e6), # Max shear stress [Pa]
32
+ Constant(name="sigma_max", symbol="sigma_max", value=200e6), # Max normal stress [Pa]
33
+ Constant(name="C_w", symbol="C_w", value=209600), # Welding cost factor [$/m^3]
34
+ Constant(name="steel_cost", symbol="C_s", value=0.7), # Price of HRC steel [$/kg]
35
+ Constant(name="steel_density", symbol="rho_s", value=7850), # Steel density [kg/m^3]
36
+ Constant(name="C_b", symbol="C_b", value=0.7 * 7850), # Beam material cost factor [$/m^3]
37
+ Constant(name="K", symbol="K", value=2), # Cantilever beam coefficient
38
+ Constant(name="pi", symbol="pi", value=3.141592653589793),
39
+ Constant(name="delta_t", symbol="delta_t", value=0.05 - 0.005),
40
+ ]
41
+
42
+ EXTRAFUNCTION = [
43
+ ExtraFunction(name="weld_cost", symbol="W_c", func="C_w * x_1**2 * x_2"), # Weld cost
44
+ ExtraFunction(name="beam_cost", symbol="B_c", func="C_b * A * (L + x_2)"), # Beam cost
45
+ ExtraFunction(
46
+ name="polar_moment", symbol="J", func="2 * ((2**(1/2))/2 * x_1 * x_2 * (x_2**2 / 12 + ((x_1 + x_3) / 2) ** 2))"
47
+ ), # J calculation
48
+ ExtraFunction(name="effective_radius", symbol="R", func="((x_2**2 / 4) + ((x_3 + x_1) / 2) ** 2) ** (1/2)"),
49
+ # R calculation
50
+ ExtraFunction(name="bending_moment", symbol="M", func="P * (L + x_2 / 2)"), # M calculation
51
+ ExtraFunction(name="primary_shear_stress", symbol="tau_1", func="P / ((2**(1/2)) * x_1 * x_2)"),
52
+ # tau_1 calculation
53
+ ExtraFunction(name="torsional_stress", symbol="tau_2", func="M * R / J"), # tau_2 calculation
54
+ ExtraFunction(name="cos_theta", symbol="c_theta", func="x_2 / (2 * R)"),
55
+ ExtraFunction(
56
+ name="combined_shear", symbol="tau", func="(tau_1**2 + (2 * tau_1 * tau_2 * c_theta) + tau_2**2) ** (1/2)"
57
+ ),
58
+ # Combined shear stress
59
+ ExtraFunction(name="bending_stress", symbol="sigma_x", func="P * L * x_3 / (2 * I_x)"), # sigma_x calculation
60
+ ExtraFunction(name="critical_buckling", symbol="P_c", func="(pi**2 * E * I_x) / (K * L)**2"), # P_c calculation
61
+ ]
62
+
63
+ OBJECTIVES = [
64
+ Objective(name="f_1", symbol="f_1", func="W_c + B_c", maximize=False), # Minimize total cost
65
+ Objective(name="f_2", symbol="f_2", func="P * L**3 / (3 * E * I_x)", maximize=False), # Minimize beam deflection
66
+ ]
67
+
68
+ CONSTRAINTS = [
69
+ Constraint(
70
+ name="g_1", symbol="g_1", cons_type=ConstraintTypeEnum.LTE, func="(1 / tau_max) * (tau - tau_max)"
71
+ ), # Shear stress
72
+ Constraint(
73
+ name="g_2", symbol="g_2", cons_type=ConstraintTypeEnum.LTE, func="(1 / sigma_max) * (sigma_x - sigma_max)"
74
+ ), # Normal stress
75
+ Constraint(
76
+ name="g_3", symbol="g_3", cons_type=ConstraintTypeEnum.LTE, func="(1 / P) * (P - P_c)"
77
+ ), # Buckling constraint
78
+ ]
79
+
80
+
81
+ def mcwb_solid_rectangular_problem() -> Problem:
82
+ r"""Defines the multiobjective cantilever welded beam (MCWB) optimization problem.
83
+
84
+ The objective functions and constraints for the MCWB design problem are defined as follows:
85
+
86
+ Objectives:
87
+ 1. Minimize the total cost, \( f_1 = W_c + B_c \), where \( W_c \) is the weld cost and \( B_c \) is the beam cost.
88
+ 2. Minimize the deflection of the beam, \( f_2 = \frac{P L^3}{3 E I_x} \), where \( P \) is the applied load,
89
+ \( L \) is the beam length, \( E \) is the Young's modulus, and \( I_x \) is the moment of inertia.
90
+
91
+ Constraints:
92
+ 1. Shear stress constraint: \( \tau \leq \tau_{max} \), where \( \tau \) is the combined shear stress
93
+ and \( \tau_{max} \) is the maximum shear stress.
94
+ 2. Normal stress constraint: \( \sigma_x \leq \sigma_{max} \), where \( \sigma_x \) is the bending stress and
95
+ \( \sigma_{max} \) is the maximum allowable normal stress.
96
+ 3. Buckling constraint: \( P \leq P_c \), where \( P_c \) is the critical buckling load.
97
+ 4. Weld height constraint: \( x_1 \leq x_4 \), ensuring that the weld height \( x_1 \) is less than or equal to
98
+ the flange thickness \( x_4 \).
99
+
100
+ Where:
101
+ - \( x_1 \) is the weld height.
102
+ - \( x_2 \) is the weld length.
103
+ - \( x_3 \) is the beam height.
104
+ - \( x_4 \) is the beam width.
105
+
106
+ The parameters are defined as:
107
+ - \( P = 30000 \, \text{N} \) (load),
108
+ - \( L = 0.5 \, \text{m} \) (beam length),
109
+ - \( E = 200 \times 10^9 \, \text{Pa} \) (Young's modulus),
110
+ - \( \tau_{max} = 95 \times 10^6 \, \text{Pa} \) (max shear stress),
111
+ - \( \sigma_{max} = 200 \times 10^6 \, \text{Pa} \) (max normal stress),
112
+ - \( C_w = 209600 \, \text{\$/m}^3 \) (welding cost factor),
113
+ - \( C_s = 0.7 \, \text{\$/kg} \) (price of HRC steel),
114
+ - \( \rho_s = 7850 \, \text{kg/m}^3 \) (steel density),
115
+ - \( C_b = 0.7 \times 7850 \, \text{\$/m}^3 \) (beam material cost factor),
116
+ - \( K = 2 \) (cantilever beam coefficient),
117
+ - \( \pi = 3.141592653589793 \) (constant for calculations),
118
+ - \( \delta_t = 0.045 \) (tolerance factor for calculations).
119
+
120
+ Returns:
121
+ Problem: An instance of the multiobjective cantilever welded beam optimization problem.
122
+ """
123
+ # Variables
124
+ variables = [
125
+ Variable(
126
+ name="x_1", symbol="x_1", variable_type=VariableTypeEnum.real, lowerbound=0.005, upperbound=0.15
127
+ ), # height of weld
128
+ Variable(
129
+ name="x_2", symbol="x_2", variable_type=VariableTypeEnum.real, lowerbound=0.01, upperbound=0.3
130
+ ), # length of weld
131
+ Variable(
132
+ name="x_3", symbol="x_3", variable_type=VariableTypeEnum.real, lowerbound=0.01, upperbound=0.3
133
+ ), # height of beam
134
+ Variable(
135
+ name="x_4", symbol="x_4", variable_type=VariableTypeEnum.real, lowerbound=0.01, upperbound=0.15
136
+ ), # width of beam
137
+ ]
138
+
139
+ # Constants
140
+ constants = CONSTANTS
141
+
142
+ # Extra Functions (Intermediate Calculations)
143
+ extra_functions = [
144
+ ExtraFunction(name="cross_section_area", symbol="A", func="x_3 * x_4"), # A = h * b
145
+ ExtraFunction(name="moment_of_inertia", symbol="I_x", func="(x_4 * x_3**3) / 12"), # I_x = (b * h³) / 12
146
+ *EXTRAFUNCTION,
147
+ ]
148
+
149
+ # Objectives (minimize cost, minimize deflection)
150
+ objectives = OBJECTIVES
151
+
152
+ # NO DUMMY CONSTRAINTS
153
+ # Constraints
154
+ constraints = [
155
+ *CONSTRAINTS,
156
+ Constraint(
157
+ name="g_4",
158
+ symbol="g_4",
159
+ cons_type=ConstraintTypeEnum.LTE,
160
+ func="(x_1 - x_4) / (0.25 - 0.005)", # Ensures x_1 <= x_4 (weld height <= flange thickness)
161
+ ),
162
+ ]
163
+
164
+ return Problem(
165
+ name="MCWB Solid Rectangular",
166
+ description="Multiobjective optimization of a welded beam using a solid rectangular cross-section.",
167
+ constants=constants,
168
+ variables=variables,
169
+ extra_funcs=extra_functions,
170
+ objectives=objectives,
171
+ constraints=constraints,
172
+ )
173
+
174
+
175
+ def mcwb_hollow_rectangular_problem() -> Problem:
176
+ r"""Defines the multiobjective cantilever welded beam (MCWB) optimization problem...
177
+
178
+ Defines the multiobjective cantilever welded beam (MCWB) optimization problem using a
179
+ hollow rectangular cross-section.
180
+
181
+ The objective functions and constraints for the MCWB design problem are defined as follows:
182
+
183
+ Objectives:
184
+ 1. Minimize the total cost, \( f_1 = W_c + B_c \), where \( W_c \) is the weld cost and \( B_c \) is the beam cost.
185
+ 2. Minimize the deflection of the beam, \( f_2 = \frac{P L^3}{3 E I_x} \), where \( P \) is the applied load,
186
+ \( L \) is the beam length, \( E \) is the Young's modulus, and \( I_x \) is the moment of inertia.
187
+
188
+ Constraints:
189
+ 1. Shear stress constraint: \( \tau \leq \tau_{max} \), where \( \tau \) is the combined shear stress and
190
+ \( \tau_{max} \) is the maximum shear stress.
191
+ 2. Normal stress constraint: \( \sigma_x \leq \sigma_{max} \), where \( \sigma_x \) is the bending stress and
192
+ \( \sigma_{max} \) is the maximum allowable normal stress.
193
+ 3. Buckling constraint: \( P \leq P_c \), where \( P_c \) is the critical buckling load.
194
+ 4. Weld height constraint: \( x_1 \leq x_4 \), ensuring that the weld height \( x_1 \) is less than or equal to
195
+ the flange thickness \( x_4 \).
196
+ 5. Wall thickness constraint: \( t \geq h \), where \( t \) is the wall thickness and \( h \) is the outer height.
197
+
198
+ Where:
199
+ - \( x_1 \) is the weld height.
200
+ - \( x_2 \) is the weld length.
201
+ - \( x_3 \) is the outer height of the beam.
202
+ - \( x_4 \) is the outer width of the beam.
203
+ - \( x_5 \) is the wall thickness of the hollow beam.
204
+
205
+ The parameters are defined as:
206
+ - \( P = 30000 \, \text{N} \) (load),
207
+ - \( L = 0.5 \, \text{m} \) (beam length),
208
+ - \( E = 200 \times 10^9 \, \text{Pa} \) (Young's modulus),
209
+ - \( \tau_{max} = 95 \times 10^6 \, \text{Pa} \) (max shear stress),
210
+ - \( \sigma_{max} = 200 \times 10^6 \, \text{Pa} \) (max normal stress),
211
+ - \( C_w = 209600 \, \text{\$/m}^3 \) (welding cost factor),
212
+ - \( C_s = 0.7 \, \text{\$/kg} \) (price of HRC steel),
213
+ - \( \rho_s = 7850 \, \text{kg/m}^3 \) (steel density),
214
+ - \( C_b = 0.7 \times 7850 \, \text{\$/m}^3 \) (beam material cost factor),
215
+ - \( K = 2 \) (cantilever beam coefficient),
216
+ - \( \pi = 3.141592653589793 \) (constant for calculations),
217
+ - \( \delta_t = 0.045 \) (tolerance factor for calculations).
218
+
219
+ Returns:
220
+ Problem: An instance of the multiobjective cantilever welded beam optimization problem using
221
+ a hollow rectangular cross-section.
222
+ """
223
+ # Constants
224
+ constants = CONSTANTS
225
+
226
+ # Variables
227
+ variables = [
228
+ Variable(
229
+ name="x_1", symbol="x_1", variable_type=VariableTypeEnum.real, lowerbound=0.005, upperbound=0.15
230
+ ), # weld height
231
+ Variable(
232
+ name="x_2", symbol="x_2", variable_type=VariableTypeEnum.real, lowerbound=0.01, upperbound=0.3
233
+ ), # weld length
234
+ Variable(
235
+ name="x_3", symbol="x_3", variable_type=VariableTypeEnum.real, lowerbound=0.01, upperbound=0.3
236
+ ), # outer height
237
+ Variable(
238
+ name="x_4", symbol="x_4", variable_type=VariableTypeEnum.real, lowerbound=0.01, upperbound=0.15
239
+ ), # outer width
240
+ Variable(
241
+ name="x_5", symbol="x_5", variable_type=VariableTypeEnum.real, lowerbound=0.01, upperbound=0.03
242
+ ), # wall thickness
243
+ ]
244
+
245
+ # Extra Functions
246
+ extra_functions = [
247
+ ExtraFunction(name="cross_section_area", symbol="A", func="(x_4 * x_3) - ((x_4 - 2*x_5) * (x_3 - 2*x_5))"),
248
+ ExtraFunction(
249
+ name="moment_of_inertia", symbol="I_x", func="((x_4 * x_3**3)/12) - (((x_4 - 2*x_5) * (x_3 - 2*x_5)**3)/12)"
250
+ ),
251
+ *EXTRAFUNCTION,
252
+ ]
253
+
254
+ # Objectives
255
+ objectives = OBJECTIVES
256
+
257
+ # Constraints
258
+ constraints = [
259
+ *CONSTRAINTS,
260
+ Constraint(name="g_4", symbol="g_4", cons_type=ConstraintTypeEnum.LTE, func="(x_1 - x_4) / (0.25 - 0.005)"),
261
+ Constraint(
262
+ name="g_5",
263
+ symbol="g_5",
264
+ cons_type=ConstraintTypeEnum.LTE,
265
+ func="(x_4 - x_3) / (0.25 - 0.005)", # Ensures t >= h
266
+ ),
267
+ ]
268
+
269
+ return Problem(
270
+ name="MCWB Hollow Rectangular",
271
+ description="Multiobjective optimization of a welded beam with hollow rectangular cross-section.",
272
+ constants=constants,
273
+ variables=variables,
274
+ extra_funcs=extra_functions,
275
+ objectives=objectives,
276
+ constraints=constraints,
277
+ )
278
+
279
+
280
+ def mcwb_equilateral_tbeam_problem() -> Problem:
281
+ r"""Defines the multiobjective cantilever welded beam (MCWB) optimization problem...
282
+
283
+ Defines the multiobjective cantilever welded beam (MCWB) optimization problem using an equilateral
284
+ T-beam cross-section.
285
+
286
+ The objective functions and constraints for the MCWB design problem are defined as follows:
287
+
288
+ Objectives:
289
+ 1. Minimize the total cost, \( f_1 = W_c + B_c \), where \( W_c \) is the weld cost and \( B_c \) is the beam cost.
290
+ 2. Minimize the deflection of the beam, \( f_2 = \frac{P L^3}{3 E I_x} \), where \( P \) is the applied load,
291
+ \( L \) is the beam length, \( E \) is the Young's modulus, and \( I_x \) is the moment of inertia.
292
+
293
+ Constraints:
294
+ 1. Shear stress constraint: \( \tau \leq \tau_{max} \), where \( \tau \) is the combined shear stress and
295
+ \( \tau_{max} \) is the maximum shear stress.
296
+ 2. Normal stress constraint: \( \sigma_x \leq \sigma_{max} \), where \( \sigma_x \) is the bending stress and
297
+ \( \sigma_{max} \) is the maximum allowable normal stress.
298
+ 3. Buckling constraint: \( P \leq P_c \), where \( P_c \) is the critical buckling load.
299
+ 4. Weld height constraint: \( x_1 \leq x_4 \), ensuring that the weld height \( x_1 \) is less than or equal
300
+ to the flange/web thickness \( x_4 \).
301
+ 5. Flange thickness constraint: \( x_4 \geq x_3 \), ensuring that the flange thickness \( x_4 \) is greater
302
+ than or equal to the beam height \( x_3 \).
303
+
304
+ Where:
305
+ - \( x_1 \) is the weld height.
306
+ - \( x_2 \) is the weld length.
307
+ - \( x_3 \) is the beam height.
308
+ - \( x_4 \) is the beam thickness (flange/web thickness).
309
+
310
+ The parameters are defined as:
311
+ - \( P = 30000 \, \text{N} \) (load),
312
+ - \( L = 0.5 \, \text{m} \) (beam length),
313
+ - \( E = 200 \times 10^9 \, \text{Pa} \) (Young's modulus),
314
+ - \( \tau_{max} = 95 \times 10^6 \, \text{Pa} \) (max shear stress),
315
+ - \( \sigma_{max} = 200 \times 10^6 \, \text{Pa} \) (max normal stress),
316
+ - \( C_w = 209600 \, \text{\$/m}^3 \) (welding cost factor),
317
+ - \( C_s = 0.7 \, \text{\$/kg} \) (price of HRC steel),
318
+ - \( \rho_s = 7850 \, \text{kg/m}^3 \) (steel density),
319
+ - \( C_b = 0.7 \times 7850 \, \text{\$/m}^3 \) (beam material cost factor),
320
+ - \( K = 2 \) (cantilever beam coefficient),
321
+ - \( \pi = 3.141592653589793 \) (constant for calculations),
322
+ - \( \delta_t = 0.045 \) (tolerance factor for calculations).
323
+
324
+ Returns:
325
+ Problem: An instance of the multiobjective cantilever welded beam optimization problem
326
+ using an equilateral T-beam cross-section.
327
+ """
328
+ # Variables
329
+ variables = [
330
+ Variable(
331
+ name="x_1", symbol="x_1", variable_type=VariableTypeEnum.real, lowerbound=0.005, upperbound=0.25
332
+ ), # weld height
333
+ Variable(
334
+ name="x_2", symbol="x_2", variable_type=VariableTypeEnum.real, lowerbound=0.01, upperbound=0.3
335
+ ), # weld length
336
+ Variable(
337
+ name="x_3", symbol="x_3", variable_type=VariableTypeEnum.real, lowerbound=0.01, upperbound=0.25
338
+ ), # beam height
339
+ Variable(
340
+ name="x_4", symbol="x_4", variable_type=VariableTypeEnum.real, lowerbound=0.005, upperbound=0.25
341
+ ), # beam thickness (flange/web thickness)
342
+ ]
343
+
344
+ # Constants
345
+ constants = CONSTANTS
346
+
347
+ # Extra Functions (Intermediate Calculations)
348
+ extra_functions = [
349
+ ExtraFunction(
350
+ name="cross_section_area",
351
+ symbol="A",
352
+ func="x_4 * x_3 + (x_3 - x_4) * x_4", # t * h + (h - t) * t
353
+ ),
354
+ ExtraFunction(
355
+ name="moment_of_inertia", symbol="I_x", func="(x_4 * x_3 ** 3) / 12 + ((x_3 - x_4) * x_4 ** 3) / 12"
356
+ ),
357
+ *EXTRAFUNCTION,
358
+ ]
359
+
360
+ # Objectives (minimize cost, minimize deflection)
361
+ objectives = OBJECTIVES
362
+
363
+ # Constraints
364
+ constraints = [
365
+ *CONSTRAINTS,
366
+ Constraint(
367
+ name="g_4",
368
+ symbol="g_4",
369
+ cons_type=ConstraintTypeEnum.LTE,
370
+ func="(x_1 - x_4) / (0.25 - 0.005)", # weld height <= flange thickness
371
+ ),
372
+ Constraint(
373
+ name="g_5",
374
+ symbol="g_5",
375
+ cons_type=ConstraintTypeEnum.LTE,
376
+ func="(x_4 - x_3) / (0.25 - 0.005)", # flange thickness >= beam height
377
+ ),
378
+ ]
379
+
380
+ return Problem(
381
+ name="MCWB Equilateral T-Beam",
382
+ description="Multiobjective optimization of a welded T-beam with an equilateral cross-section.",
383
+ constants=constants,
384
+ variables=variables,
385
+ extra_funcs=extra_functions,
386
+ objectives=objectives,
387
+ constraints=constraints,
388
+ )
389
+
390
+
391
+ def mcwb_square_channel_problem() -> Problem:
392
+ r"""Defines the multiobjective cantilever welded beam (MCWB) optimization problem...
393
+
394
+ Defines the multiobjective cantilever welded beam (MCWB) optimization problem using a square channel cross-section.
395
+
396
+ The objective functions and constraints for the MCWB design problem are defined as follows:
397
+
398
+ Objectives:
399
+ 1. Minimize the total cost, \( f_1 = W_c + B_c \), where \( W_c \) is the weld cost and \( B_c \) is the beam cost.
400
+ 2. Minimize the deflection of the beam, \( f_2 = \frac{P L^3}{3 E I_x} \), where \( P \) is the applied load,
401
+ \( L \) is the beam length, \( E \) is the Young's modulus, and \( I_x \) is the moment of inertia.
402
+
403
+ Constraints:
404
+ 1. Weld height constraint: \( x_1 \leq x_4 \), ensuring that the weld height \( x_1 \) is less than or equal to
405
+ the flange thickness \( x_4 \).
406
+ 2. Beam width constraint: \( x_4 \geq x_3 \), ensuring that the beam width \( x_4 \) is greater than or equal to the
407
+ beam height \( x_3 \).
408
+ 3. Web thickness constraint: \( x_6 \geq \frac{x_3}{2} \), ensuring that the web thickness \( x_6 \) is greater
409
+ than or equal to half the beam height \( x_3 \).
410
+ 4. Flange thickness constraint: \( x_5 \geq x_4 \), ensuring that the flange thickness \( x_5 \) is greater than
411
+ or equal to the beam width \( x_4 \).
412
+
413
+ Where:
414
+ - \( x_1 \) is the weld height.
415
+ - \( x_2 \) is the weld length.
416
+ - \( x_3 \) is the beam height.
417
+ - \( x_4 \) is the beam width.
418
+ - \( x_5 \) is the flange thickness.
419
+ - \( x_6 \) is the web thickness.
420
+
421
+ The parameters are defined as:
422
+ - \( P = 30000 \, \text{N} \) (load),
423
+ - \( L = 0.5 \, \text{m} \) (beam length),
424
+ - \( E = 200 \times 10^9 \, \text{Pa} \) (Young's modulus),
425
+ - \( \tau_{max} = 95 \times 10^6 \, \text{Pa} \) (max shear stress),
426
+ - \( \sigma_{max} = 200 \times 10^6 \, \text{Pa} \) (max normal stress),
427
+ - \( C_w = 209600 \, \text{\$/m}^3 \) (welding cost factor),
428
+ - \( C_s = 0.7 \, \text{\$/kg} \) (price of HRC steel),
429
+ - \( \rho_s = 7850 \, \text{kg/m}^3 \) (steel density),
430
+ - \( C_b = 0.7 \times 7850 \, \text{\$/m}^3 \) (beam material cost factor),
431
+ - \( K = 2 \) (cantilever beam coefficient),
432
+ - \( \pi = 3.141592653589793 \) (constant for calculations),
433
+ - \( \delta_t = 0.045 \) (tolerance factor for calculations).
434
+
435
+ Returns:
436
+ Problem: An instance of the multiobjective cantilever welded beam optimization problem
437
+ using a square channel cross-section.
438
+ """
439
+ # Variables
440
+ variables = [
441
+ Variable(
442
+ name="x_1", symbol="x_1", variable_type=VariableTypeEnum.real, lowerbound=0.0005, upperbound=0.15
443
+ ), # weld height (a)
444
+ Variable(
445
+ name="x_2", symbol="x_2", variable_type=VariableTypeEnum.real, lowerbound=0.01, upperbound=0.3
446
+ ), # weld length (l)
447
+ Variable(
448
+ name="x_3", symbol="x_3", variable_type=VariableTypeEnum.real, lowerbound=0.01, upperbound=0.25
449
+ ), # beam height (h)
450
+ Variable(
451
+ name="x_4", symbol="x_4", variable_type=VariableTypeEnum.real, lowerbound=0.01, upperbound=0.15
452
+ ), # beam width (b)
453
+ Variable(
454
+ name="x_5", symbol="x_5", variable_type=VariableTypeEnum.real, lowerbound=0.0075, upperbound=0.03
455
+ ), # flange thickness (t)
456
+ Variable(
457
+ name="x_6", symbol="x_6", variable_type=VariableTypeEnum.real, lowerbound=0.0075, upperbound=0.03
458
+ ), # web thickness (u)
459
+ ]
460
+
461
+ # Constants
462
+ constants = CONSTANTS
463
+
464
+ # Extra Functions (Intermediate Calculations)
465
+ extra_functions = [
466
+ ExtraFunction(name="cross_section_area", symbol="A", func="(x_3 * x_4) - ((x_4 - x_5) * (x_3 - 2 * x_6))"),
467
+ ExtraFunction(
468
+ name="moment_of_inertia",
469
+ symbol="I_x",
470
+ func="(x_4 * x_3 ** 3) / 12 - ((x_4 - x_5) * (x_3 - 2 * x_6) ** 3) / 12",
471
+ ),
472
+ *EXTRAFUNCTION,
473
+ ]
474
+
475
+ # Objectives (minimize cost, minimize deflection, etc.)
476
+ objectives = OBJECTIVES
477
+
478
+ # Constraints
479
+ constraints = [
480
+ *CONSTRAINTS,
481
+ # Weld height constraint (g_4)
482
+ Constraint(
483
+ name="g_4",
484
+ symbol="g_4",
485
+ cons_type=ConstraintTypeEnum.LTE,
486
+ func="(x_1 - x_4) / (0.15 - 0.0075)", # weld height <= flange thickness
487
+ ),
488
+ # Beam width >= weld height (g_5)
489
+ Constraint(
490
+ name="g_5",
491
+ symbol="g_5",
492
+ cons_type=ConstraintTypeEnum.LTE,
493
+ func="(x_4 - x_3) / (0.25 - 0.0075)", # beam width >= beam height
494
+ ),
495
+ # Cross-section geometric constraints (g_6 and g_7)
496
+ Constraint(
497
+ name="g_6",
498
+ symbol="g_6",
499
+ cons_type=ConstraintTypeEnum.LTE,
500
+ func="(x_6 - x_3 / 2) / (0.03 - 0.0075)",
501
+ # web thickness must be greater than half the beam height (normalized)
502
+ ),
503
+ Constraint(
504
+ name="g_7",
505
+ symbol="g_7",
506
+ cons_type=ConstraintTypeEnum.LTE,
507
+ func="(x_5 - x_4) / (0.03 - 0.0075)", # flange thickness >= beam width
508
+ ),
509
+ ]
510
+
511
+ return Problem(
512
+ name="MCWB Square Channel",
513
+ description=(
514
+ "Multiobjective optimization of a welded square channel beam with constraints on geometry "
515
+ "and load-bearing capacity."
516
+ ),
517
+ constants=constants,
518
+ variables=variables,
519
+ extra_funcs=extra_functions,
520
+ objectives=objectives,
521
+ constraints=constraints,
522
+ )
523
+
524
+
525
+ def mcwb_tapered_channel_problem() -> Problem:
526
+ r"""Defines the multiobjective cantilever welded beam (MCWB) optimization problem...
527
+
528
+ Defines the multiobjective cantilever welded beam (MCWB) optimization problem
529
+ using a tapered channel cross-section.
530
+
531
+ The objective functions and constraints for the MCWB design problem are defined as follows:
532
+
533
+ Objectives:
534
+ 1. Minimize the total cost, \( f_1 = W_c + B_c \), where \( W_c \) is the weld cost and \( B_c \) is the beam cost.
535
+ 2. Minimize the deflection of the beam, \( f_2 = \frac{P L^3}{3 E I_x} \), where \( P \) is the applied load,
536
+ \( L \) is the beam length, \( E \) is the Young's modulus, and \( I_x \) is the moment of inertia.
537
+
538
+ Constraints:
539
+ 1. Weld height constraint: \( x_1 \leq x_5 \), ensuring that the weld height \( x_1 \) is less than or equal to the
540
+ outer flange thickness \( x_5 \).
541
+ 2. Beam width constraint: \( x_4 \geq x_3 \), ensuring that the beam width \( x_4 \) is greater than or equal to the
542
+ beam height \( x_3 \).
543
+ 3. Inner flange height constraint: \( x_6 \geq \frac{x_3}{2} \), ensuring that the inner flange height \( x_6 \) is
544
+ greater than or equal to half the beam height \( x_3 \).
545
+ 4. Web thickness constraint: \( x_7 \leq x_4 \), ensuring that the web thickness \( x_7 \) is less than or equal to
546
+ the beam width \( x_4 \).
547
+ 5. Outer flange thickness constraint: \( x_5 \leq x_6 \), ensuring that the outer flange thickness \( x_5 \) is less
548
+ than or equal to the inner flange thickness \( x_6 \).
549
+
550
+ Where:
551
+ - \( x_1 \) is the weld height.
552
+ - \( x_2 \) is the weld length.
553
+ - \( x_3 \) is the beam height.
554
+ - \( x_4 \) is the beam width.
555
+ - \( x_5 \) is the outer flange thickness.
556
+ - \( x_6 \) is the inner flange thickness.
557
+ - \( x_7 \) is the web thickness.
558
+
559
+ The parameters are defined as:
560
+ - \( P = 30000 \, \text{N} \) (load),
561
+ - \( L = 0.5 \, \text{m} \) (beam length),
562
+ - \( E = 200 \times 10^9 \, \text{Pa} \) (Young's modulus),
563
+ - \( \tau_{max} = 95 \times 10^6 \, \text{Pa} \) (max shear stress),
564
+ - \( \sigma_{max} = 200 \times 10^6 \, \text{Pa} \) (max normal stress),
565
+ - \( C_w = 209600 \, \text{\$/m}^3 \) (welding cost factor),
566
+ - \( C_s = 0.7 \, \text{\$/kg} \) (price of HRC steel),
567
+ - \( \rho_s = 7850 \, \text{kg/m}^3 \) (steel density),
568
+ - \( C_b = 0.7 \times 7850 \, \text{\$/m}^3 \) (beam material cost factor),
569
+ - \( K = 2 \) (cantilever beam coefficient),
570
+ - \( \pi = 3.141592653589793 \) (constant for calculations),
571
+ - \( \delta_t = 0.045 \) (tolerance factor for calculations).
572
+
573
+ Returns:
574
+ Problem: An instance of the multiobjective cantilever welded beam optimization problem
575
+ using a tapered channel cross-section.
576
+ """
577
+ # Variables
578
+ variables = [
579
+ Variable(
580
+ name="x_1", symbol="x_1", variable_type=VariableTypeEnum.real, lowerbound=0.005, upperbound=0.15
581
+ ), # weld height (a)
582
+ Variable(
583
+ name="x_2", symbol="x_2", variable_type=VariableTypeEnum.real, lowerbound=0.01, upperbound=0.3
584
+ ), # weld length (l)
585
+ Variable(
586
+ name="x_3", symbol="x_3", variable_type=VariableTypeEnum.real, lowerbound=0.01, upperbound=0.2
587
+ ), # beam height (h)
588
+ Variable(
589
+ name="x_4", symbol="x_4", variable_type=VariableTypeEnum.real, lowerbound=0.01, upperbound=0.15
590
+ ), # beam width (b)
591
+ Variable(
592
+ name="x_5", symbol="x_5", variable_type=VariableTypeEnum.real, lowerbound=0.01, upperbound=0.03
593
+ ), # flange thickness outer (u)
594
+ Variable(
595
+ name="x_6", symbol="x_6", variable_type=VariableTypeEnum.real, lowerbound=0.01, upperbound=2 * 0.03
596
+ ), # flange thickness inner (v)
597
+ Variable(
598
+ name="x_7", symbol="x_7", variable_type=VariableTypeEnum.real, lowerbound=0.01, upperbound=0.03
599
+ ), # web thickness (t)
600
+ ]
601
+
602
+ # Constants
603
+ constants = CONSTANTS
604
+
605
+ # Extra Functions (Intermediate Calculations)
606
+ extra_functions = [
607
+ # b_inner: the inner width of the flange (b - t)
608
+ ExtraFunction(name="b_inner", symbol="b_inner", func="x_4 - x_5"),
609
+ # A_web: area of the web (h * t)
610
+ ExtraFunction(name="A_web", symbol="A_web", func="x_3 * x_5"),
611
+ # A_flange: area of the flange (b_inner * (u + v))
612
+ ExtraFunction(name="A_flange", symbol="A_flange", func="b_inner * (x_6 + x_7)"),
613
+ # Total cross-sectional area (A = A_web + A_flange)
614
+ ExtraFunction(name="cross_section_area", symbol="A", func="A_web + A_flange"),
615
+ # Moment of inertia for the outer rectangle (Ix_rectangle)
616
+ ExtraFunction(name="Ix_rectangle", symbol="Ix_rectangle", func="(x_4 * x_3 ** 3) / 12"),
617
+ ExtraFunction(name="flange_to_flange_outer", symbol="flange_to_flange_outer", func="x_3 - 2 * x_6"),
618
+ ExtraFunction(name="flange_to_flange_inner", symbol="flange_to_flange_inner", func="x_3 - 2 * x_7"),
619
+ ExtraFunction(
620
+ name="slope_flange",
621
+ symbol="slope_flange",
622
+ func="(flange_to_flange_outer - flange_to_flange_inner) / 2 * (x_4 - x_5)",
623
+ ),
624
+ # Moment of inertia for the outer flange (Ix_flange_outer)
625
+ ExtraFunction(
626
+ name="Ix_flange_outer", symbol="Ix_flange_outer", func="(flange_to_flange_outer ** 4 / 8 * slope_flange)"
627
+ ),
628
+ # Moment of inertia for the inner flange (Ix_flange_inner)
629
+ ExtraFunction(
630
+ name="Ix_flange_inner",
631
+ symbol="Ix_flange_inner",
632
+ func="(flange_to_flange_inner) ** 4 / 8 * slope_flange / 12",
633
+ ),
634
+ ExtraFunction(name="Ix_flange", symbol="Ix_flange", func="Ix_flange_outer - Ix_flange_inner"),
635
+ # Total moment of inertia: Ix = Ix_rectangle + Ix_flange_outer - Ix_flange_inner
636
+ ExtraFunction(name="moment_of_inertia", symbol="I_x", func="Ix_rectangle + Ix_flange"),
637
+ *EXTRAFUNCTION,
638
+ ]
639
+
640
+ # Objectives (minimize cost, minimize deflection, etc.)
641
+ objectives = OBJECTIVES
642
+
643
+ # Constraints
644
+ constraints = [
645
+ *CONSTRAINTS,
646
+ # Weld height constraint (g_4) - weld height should be less than or equal to flange thickness
647
+ Constraint(
648
+ name="g_4",
649
+ symbol="g_4",
650
+ cons_type=ConstraintTypeEnum.LTE,
651
+ func="(x_1 - x_5) / (0.03 - 0.01)", # Weld height should be <= outer flange thickness
652
+ ),
653
+ # Beam width constraint (g_5) - beam width should be greater than or equal to beam height
654
+ Constraint(
655
+ name="g_5",
656
+ symbol="g_5",
657
+ cons_type=ConstraintTypeEnum.LTE,
658
+ func="(x_4 - x_3) / (0.2 - 0.01)", # Beam width should be >= beam height
659
+ ),
660
+ # Cross-section geometric constraints (g_6 and g_7)
661
+ # Inner flange height must be greater than or equal to half the beam height
662
+ Constraint(
663
+ name="g_6",
664
+ symbol="g_6",
665
+ cons_type=ConstraintTypeEnum.LTE,
666
+ func="(x_6 - x_3 / 2) / (0.03 - 0.01)", # Inner flange thickness must be greater than half the beam height
667
+ ),
668
+ # Web thickness constraint: web thickness should be less than the beam width
669
+ Constraint(
670
+ name="g_7",
671
+ symbol="g_7",
672
+ cons_type=ConstraintTypeEnum.LTE,
673
+ func="(x_7 - x_4) / (0.03 - 0.01)", # Web thickness should be <= beam width
674
+ ),
675
+ # Outer flange thickness constraint: outer flange thickness must be less than or equal to inner flange thickness
676
+ Constraint(
677
+ name="g_8",
678
+ symbol="g_8",
679
+ cons_type=ConstraintTypeEnum.LTE,
680
+ func="(x_5 - x_6) / (0.03 - 0.01)", # Outer flange thickness <= inner flange thickness
681
+ ),
682
+ ]
683
+
684
+ return Problem(
685
+ name="MCWB Tapered Channel",
686
+ description=(
687
+ "Multiobjective optimization of a welded tapered channel beam with constraints on geometry "
688
+ "and load-bearing capacity."
689
+ ),
690
+ constants=constants,
691
+ variables=variables,
692
+ extra_funcs=extra_functions,
693
+ objectives=objectives,
694
+ constraints=constraints,
695
+ )
696
+
697
+
698
+ def mcwb_ragsdell1976_problem() -> Problem:
699
+ r"""Defines the multiobjective cantilever welded beam (MCWB) optimization problem...
700
+
701
+ Defines the multiobjective cantilever welded beam (MCWB) optimization problem
702
+ based on the framework proposed by Ragsdell (1976).
703
+
704
+ This problem involves optimizing the design of a welded cantilever beam
705
+ considering welding costs, material costs, and stress constraints. The goal
706
+ is to minimize both the total cost and the deflection of the beam, while
707
+ adhering to the given constraints on material properties, geometry, and
708
+ loading conditions.
709
+
710
+ Objectives:
711
+ 1. Minimize the total cost, \( f_1 = W_c + B_c \), where:
712
+ - \( W_c \) is the weld cost, calculated as the sum of welding labor cost and material cost.
713
+ - \( B_c \) is the beam material cost, based on the beam's dimensions and the cost of the steel used.
714
+ 2. Minimize the deflection of the beam, \( f_2 = \frac{P L^3}{3 E I_x} \), where:
715
+ - \( P \) is the applied load.
716
+ - \( L \) is the beam length.
717
+ - \( E \) is the Young's modulus.
718
+ - \( I_x \) is the moment of inertia of the beam's cross-section.
719
+
720
+ Constraints:
721
+ 1. **Weld height constraint**: \( x_1 \leq x_4 \), ensuring that the weld height \( x_1 \) is less than or equal
722
+ to the beam width \( x_4 \) (flange thickness).
723
+ 2. The problem also considers the material constraints on maximum shear stress and normal stress, but these
724
+ are not explicitly listed as constraints in this setup.
725
+
726
+ Where:
727
+ - \( x_1 \) is the height of the weld.
728
+ - \( x_2 \) is the length of the weld.
729
+ - \( x_3 \) is the height of the beam.
730
+ - \( x_4 \) is the width of the beam.
731
+
732
+ Constants:
733
+ - \( P = 30000 \, \text{N} \) (load),
734
+ - \( L = 0.5 \, \text{m} \) (beam length),
735
+ - \( E = 200 \times 10^9 \, \text{Pa} \) (Young's modulus),
736
+ - \( \tau_{\text{max}} = 95 \times 10^6 \, \text{Pa} \) (maximum shear stress),
737
+ - \( \sigma_{\text{max}} = 200 \times 10^6 \, \text{Pa} \) (maximum normal stress),
738
+ - \( C_{\text{wl}} = 1 \, \text{\$/in} \) (welding labor cost),
739
+ - \( C_{\text{wm}} = 0.10471 \, \text{\$/in} \) (welding material cost),
740
+ - \( C_{\text{w}} = 1 \times 0.10471 \, \text{\$/in} \) (total welding cost),
741
+ - \( C_s = 0.7 \, \text{\$/kg} \) (steel price),
742
+ - \( \rho_s = 7850 \, \text{kg/m}^3 \) (steel density),
743
+ - \( C_b = 0.04811 \, \text{\$/in} \) (beam material cost),
744
+ - \( K = 2 \) (cantilever beam coefficient),
745
+ - \( \pi = 3.141592653589793 \) (constant),
746
+ - \( \delta_t = 0.05 - 0.005 \) (tolerance factor).
747
+
748
+ Intermediate Functions:
749
+ 1. **Cross-sectional area**: \( A = x_3 \times x_4 \).
750
+ 2. **Moment of inertia**: \( I_x = \frac{x_4 \times x_3^3}{12} \), representing the beam's resistance to bending.
751
+
752
+ Returns:
753
+ Problem: An instance of the multiobjective cantilever welded beam optimization problem
754
+ based on Ragsdell's method (1976).
755
+ """
756
+ # Variables (decision variables: weld height, weld length, beam height, beam width)
757
+ variables = [
758
+ Variable(
759
+ name="x_1", symbol="x_1", variable_type=VariableTypeEnum.real, lowerbound=0.125, upperbound=5
760
+ ), # height of weld [in]
761
+ Variable(
762
+ name="x_2", symbol="x_2", variable_type=VariableTypeEnum.real, lowerbound=0.1, upperbound=10
763
+ ), # length of weld [in]
764
+ Variable(
765
+ name="x_3", symbol="x_3", variable_type=VariableTypeEnum.real, lowerbound=0.1, upperbound=10
766
+ ), # height of beam [in]
767
+ Variable(
768
+ name="x_4", symbol="x_4", variable_type=VariableTypeEnum.real, lowerbound=0.1, upperbound=5
769
+ ), # width of beam [in]
770
+ ]
771
+
772
+ constants = [
773
+ Constant(name="P", symbol="P", value=30000), # Load [N]
774
+ Constant(name="L", symbol="L", value=0.5), # Beam length [m]
775
+ Constant(name="E", symbol="E", value=200e9), # Young's modulus [Pa]
776
+ Constant(name="tau_max", symbol="tau_max", value=95e6), # Max shear stress [Pa]
777
+ Constant(name="sigma_max", symbol="sigma_max", value=200e6), # Max normal stress [Pa]
778
+ Constant(name="C_wl", symbol="C_wl", value=1), # Welding labor cost [$/in]
779
+ Constant(name="C_wm", symbol="C_wm", value=0.10471), # Welding material cost [$/in]
780
+ Constant(name="C_w", symbol="C_w", value=1 * 0.10471), # Total welding cost [$/in]
781
+ Constant(name="steel_cost", symbol="C_s", value=0.7), # Price of HRC steel [$/kg]
782
+ Constant(name="steel_density", symbol="rho_s", value=7850), # Steel density [kg/m^3]
783
+ Constant(name="C_b", symbol="C_b", value=0.04811), # Beam material cost [$/in]
784
+ Constant(name="K", symbol="K", value=2), # Cantilever beam coefficient
785
+ Constant(name="pi", symbol="pi", value=3.141592653589793),
786
+ Constant(name="delta_t", symbol="delta_t", value=0.05 - 0.005),
787
+ ]
788
+
789
+ # Extra Functions (Intermediate Calculations)
790
+ extra_functions = [
791
+ ExtraFunction(name="cross_section_area", symbol="A", func="x_3 * x_4"), # A = h * b
792
+ ExtraFunction(name="moment_of_inertia", symbol="I_x", func="(x_4 * x_3**3) / 12"),
793
+ # I_x = (b * h³) / 12
794
+ *EXTRAFUNCTION,
795
+ ]
796
+
797
+ # Objectives (minimize cost, minimize deflection)
798
+ objectives = OBJECTIVES
799
+
800
+ # NO DUMMY CONSTRAINTS
801
+ # Constraints
802
+ extra_functions = [
803
+ ExtraFunction(name="cross_section_area", symbol="A", func="x_3 * x_4"), # A = h * b
804
+ ExtraFunction(name="moment_of_inertia", symbol="I_x", func="(x_4 * x_3**3) / 12"),
805
+ # I_x = (b * h³) / 12
806
+ *EXTRAFUNCTION,
807
+ ]
808
+
809
+ # Constraints
810
+ constraints = [
811
+ *CONSTRAINTS,
812
+ Constraint(
813
+ name="g_4",
814
+ symbol="g_4",
815
+ cons_type=ConstraintTypeEnum.LTE,
816
+ func="(x_1 - x_4) / (0.25 - 0.005)", # Ensures x_1 <= x_4 (weld height <= flange thickness)
817
+ ),
818
+ ]
819
+
820
+ return Problem(
821
+ name="MCWB Ragsdell1976",
822
+ description=(
823
+ "Optimization of a welded beam based on Ragsdell's method (1976), "
824
+ "considering welding and material costs and stress constraints."
825
+ ),
826
+ constants=constants,
827
+ variables=variables,
828
+ extra_funcs=extra_functions,
829
+ objectives=objectives,
830
+ constraints=constraints,
831
+ )