pyfemtet 0.4.25__py3-none-any.whl → 0.5.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.
Potentially problematic release.
This version of pyfemtet might be problematic. Click here for more details.
- pyfemtet/__init__.py +1 -1
- pyfemtet/message/locales/ja/LC_MESSAGES/messages.mo +0 -0
- pyfemtet/message/locales/ja/LC_MESSAGES/messages.po +114 -62
- pyfemtet/message/locales/messages.pot +114 -62
- pyfemtet/message/messages.py +6 -2
- pyfemtet/opt/__init__.py +2 -2
- pyfemtet/opt/_femopt.py +27 -46
- pyfemtet/opt/_femopt_core.py +50 -33
- pyfemtet/opt/_test_utils/__init__.py +0 -0
- pyfemtet/opt/_test_utils/control_femtet.py +45 -0
- pyfemtet/opt/_test_utils/hyper_sphere.py +24 -0
- pyfemtet/opt/_test_utils/record_history.py +72 -0
- pyfemtet/opt/interface/_femtet.py +39 -1
- pyfemtet/opt/optimizer/__init__.py +12 -0
- pyfemtet/opt/{opt → optimizer}/_base.py +30 -9
- pyfemtet/opt/{opt → optimizer}/_optuna.py +15 -34
- pyfemtet/opt/optimizer/_optuna_botorchsampler_parameter_constraint_helper.py +331 -0
- pyfemtet/opt/{opt → optimizer}/_scipy.py +10 -6
- pyfemtet/opt/{opt → optimizer}/_scipy_scalar.py +24 -12
- pyfemtet/opt/{femprj_sample → samples/femprj_sample}/gal_ex58_parametric_test_result.reccsv +1 -1
- pyfemtet/opt/{femprj_sample → samples/femprj_sample}/her_ex40_parametric.py +10 -8
- pyfemtet/opt/samples/femprj_sample/her_ex40_parametric_test_result.reccsv +18 -0
- pyfemtet/opt/{femprj_sample_jp → samples/femprj_sample_jp}/her_ex40_parametric_jp.py +10 -8
- pyfemtet/opt/visualization/complex_components/main_figure_creator.py +69 -0
- pyfemtet/opt/visualization/complex_components/main_graph.py +299 -14
- pyfemtet/opt/visualization/process_monitor/pages.py +1 -1
- pyfemtet/opt/visualization/result_viewer/application.py +1 -1
- pyfemtet/opt/visualization/result_viewer/pages.py +9 -9
- {pyfemtet-0.4.25.dist-info → pyfemtet-0.5.0.dist-info}/METADATA +1 -1
- pyfemtet-0.5.0.dist-info/RECORD +112 -0
- pyfemtet/_test_util.py +0 -135
- pyfemtet/opt/femprj_sample/her_ex40_parametric_test_result.reccsv +0 -18
- pyfemtet/opt/femprj_sample/wat_ex14_parametric.Results/Ex14.pdt +0 -0
- pyfemtet/opt/femprj_sample/wat_ex14_parametric.Results/Ex14_trial1.jpg +0 -0
- pyfemtet/opt/femprj_sample/wat_ex14_parametric.Results/Ex14_trial1.pdt +0 -0
- pyfemtet/opt/femprj_sample/wat_ex14_parametric.Results/Ex14_trial10.jpg +0 -0
- pyfemtet/opt/femprj_sample/wat_ex14_parametric.Results/Ex14_trial10.pdt +0 -0
- pyfemtet/opt/femprj_sample/wat_ex14_parametric.Results/Ex14_trial11.jpg +0 -0
- pyfemtet/opt/femprj_sample/wat_ex14_parametric.Results/Ex14_trial11.pdt +0 -0
- pyfemtet/opt/femprj_sample/wat_ex14_parametric.Results/Ex14_trial12.jpg +0 -0
- pyfemtet/opt/femprj_sample/wat_ex14_parametric.Results/Ex14_trial12.pdt +0 -0
- pyfemtet/opt/femprj_sample/wat_ex14_parametric.Results/Ex14_trial13.jpg +0 -0
- pyfemtet/opt/femprj_sample/wat_ex14_parametric.Results/Ex14_trial13.pdt +0 -0
- pyfemtet/opt/femprj_sample/wat_ex14_parametric.Results/Ex14_trial14.jpg +0 -0
- pyfemtet/opt/femprj_sample/wat_ex14_parametric.Results/Ex14_trial14.pdt +0 -0
- pyfemtet/opt/femprj_sample/wat_ex14_parametric.Results/Ex14_trial15.jpg +0 -0
- pyfemtet/opt/femprj_sample/wat_ex14_parametric.Results/Ex14_trial15.pdt +0 -0
- pyfemtet/opt/femprj_sample/wat_ex14_parametric.Results/Ex14_trial2.jpg +0 -0
- pyfemtet/opt/femprj_sample/wat_ex14_parametric.Results/Ex14_trial2.pdt +0 -0
- pyfemtet/opt/femprj_sample/wat_ex14_parametric.Results/Ex14_trial3.jpg +0 -0
- pyfemtet/opt/femprj_sample/wat_ex14_parametric.Results/Ex14_trial3.pdt +0 -0
- pyfemtet/opt/femprj_sample/wat_ex14_parametric.Results/Ex14_trial4.jpg +0 -0
- pyfemtet/opt/femprj_sample/wat_ex14_parametric.Results/Ex14_trial4.pdt +0 -0
- pyfemtet/opt/femprj_sample/wat_ex14_parametric.Results/Ex14_trial5.jpg +0 -0
- pyfemtet/opt/femprj_sample/wat_ex14_parametric.Results/Ex14_trial5.pdt +0 -0
- pyfemtet/opt/femprj_sample/wat_ex14_parametric.Results/Ex14_trial6.jpg +0 -0
- pyfemtet/opt/femprj_sample/wat_ex14_parametric.Results/Ex14_trial6.pdt +0 -0
- pyfemtet/opt/femprj_sample/wat_ex14_parametric.Results/Ex14_trial7.jpg +0 -0
- pyfemtet/opt/femprj_sample/wat_ex14_parametric.Results/Ex14_trial7.pdt +0 -0
- pyfemtet/opt/femprj_sample/wat_ex14_parametric.Results/Ex14_trial8.jpg +0 -0
- pyfemtet/opt/femprj_sample/wat_ex14_parametric.Results/Ex14_trial8.pdt +0 -0
- pyfemtet/opt/femprj_sample/wat_ex14_parametric.Results/Ex14_trial9.jpg +0 -0
- pyfemtet/opt/femprj_sample/wat_ex14_parametric.Results/Ex14_trial9.pdt +0 -0
- pyfemtet/opt/opt/__init__.py +0 -12
- pyfemtet/opt/opt/_optuna_botorch_helper.py +0 -209
- pyfemtet-0.4.25.dist-info/RECORD +0 -140
- /pyfemtet/opt/{femprj_sample → samples/femprj_sample}/.gitignore +0 -0
- /pyfemtet/opt/{femprj_sample → samples/femprj_sample}/ParametricIF - True.femprj +0 -0
- /pyfemtet/opt/{femprj_sample → samples/femprj_sample}/ParametricIF.femprj +0 -0
- /pyfemtet/opt/{femprj_sample → samples/femprj_sample}/ParametricIF.py +0 -0
- /pyfemtet/opt/{femprj_sample → samples/femprj_sample}/ParametricIF_test_result.reccsv +0 -0
- /pyfemtet/opt/{femprj_sample → samples/femprj_sample}/cad_ex01_NX.femprj +0 -0
- /pyfemtet/opt/{femprj_sample → samples/femprj_sample}/cad_ex01_NX.prt +0 -0
- /pyfemtet/opt/{femprj_sample → samples/femprj_sample}/cad_ex01_NX.py +0 -0
- /pyfemtet/opt/{femprj_sample → samples/femprj_sample}/cad_ex01_NX_test_result.reccsv +0 -0
- /pyfemtet/opt/{femprj_sample → samples/femprj_sample}/cad_ex01_SW.SLDPRT +0 -0
- /pyfemtet/opt/{femprj_sample → samples/femprj_sample}/cad_ex01_SW.femprj +0 -0
- /pyfemtet/opt/{femprj_sample → samples/femprj_sample}/cad_ex01_SW.py +0 -0
- /pyfemtet/opt/{femprj_sample → samples/femprj_sample}/cad_ex01_SW_test_result.reccsv +0 -0
- /pyfemtet/opt/{femprj_sample → samples/femprj_sample}/gal_ex58_parametric.femprj +0 -0
- /pyfemtet/opt/{femprj_sample → samples/femprj_sample}/gal_ex58_parametric.py +0 -0
- /pyfemtet/opt/{femprj_sample → samples/femprj_sample}/gau_ex08_parametric.femprj +0 -0
- /pyfemtet/opt/{femprj_sample → samples/femprj_sample}/gau_ex08_parametric.py +0 -0
- /pyfemtet/opt/{femprj_sample → samples/femprj_sample}/gau_ex08_parametric_test_result.reccsv +0 -0
- /pyfemtet/opt/{femprj_sample → samples/femprj_sample}/her_ex40_parametric.femprj +0 -0
- /pyfemtet/opt/{femprj_sample → samples/femprj_sample}/paswat_ex1_parametric.femprj +0 -0
- /pyfemtet/opt/{femprj_sample → samples/femprj_sample}/paswat_ex1_parametric.py +0 -0
- /pyfemtet/opt/{femprj_sample → samples/femprj_sample}/paswat_ex1_parametric_parallel.py +0 -0
- /pyfemtet/opt/{femprj_sample → samples/femprj_sample}/paswat_ex1_parametric_test_result.reccsv +0 -0
- /pyfemtet/opt/{femprj_sample → samples/femprj_sample}/wat_ex14_parametric.femprj +0 -0
- /pyfemtet/opt/{femprj_sample → samples/femprj_sample}/wat_ex14_parametric.py +0 -0
- /pyfemtet/opt/{femprj_sample → samples/femprj_sample}/wat_ex14_parametric_parallel.py +0 -0
- /pyfemtet/opt/{femprj_sample → samples/femprj_sample}/wat_ex14_parametric_test_result.reccsv +0 -0
- /pyfemtet/opt/{femprj_sample_jp → samples/femprj_sample_jp}/ParametricIF_jp.femprj +0 -0
- /pyfemtet/opt/{femprj_sample_jp → samples/femprj_sample_jp}/ParametricIF_jp.py +0 -0
- /pyfemtet/opt/{femprj_sample_jp → samples/femprj_sample_jp}/cad_ex01_NX_jp.femprj +0 -0
- /pyfemtet/opt/{femprj_sample_jp → samples/femprj_sample_jp}/cad_ex01_NX_jp.py +0 -0
- /pyfemtet/opt/{femprj_sample_jp → samples/femprj_sample_jp}/cad_ex01_SW_jp.femprj +0 -0
- /pyfemtet/opt/{femprj_sample_jp → samples/femprj_sample_jp}/cad_ex01_SW_jp.py +0 -0
- /pyfemtet/opt/{femprj_sample_jp → samples/femprj_sample_jp}/gal_ex58_parametric_jp.femprj +0 -0
- /pyfemtet/opt/{femprj_sample_jp → samples/femprj_sample_jp}/gal_ex58_parametric_jp.py +0 -0
- /pyfemtet/opt/{femprj_sample_jp → samples/femprj_sample_jp}/gau_ex08_parametric_jp.femprj +0 -0
- /pyfemtet/opt/{femprj_sample_jp → samples/femprj_sample_jp}/gau_ex08_parametric_jp.py +0 -0
- /pyfemtet/opt/{femprj_sample_jp → samples/femprj_sample_jp}/her_ex40_parametric_jp.femprj +0 -0
- /pyfemtet/opt/{femprj_sample_jp → samples/femprj_sample_jp}/paswat_ex1_parametric_jp.femprj +0 -0
- /pyfemtet/opt/{femprj_sample_jp → samples/femprj_sample_jp}/paswat_ex1_parametric_jp.py +0 -0
- /pyfemtet/opt/{femprj_sample_jp → samples/femprj_sample_jp}/paswat_ex1_parametric_parallel_jp.py +0 -0
- /pyfemtet/opt/{femprj_sample_jp → samples/femprj_sample_jp}/wat_ex14_parametric_jp.femprj +0 -0
- /pyfemtet/opt/{femprj_sample_jp → samples/femprj_sample_jp}/wat_ex14_parametric_jp.py +0 -0
- /pyfemtet/opt/{femprj_sample_jp → samples/femprj_sample_jp}/wat_ex14_parametric_parallel_jp.py +0 -0
- {pyfemtet-0.4.25.dist-info → pyfemtet-0.5.0.dist-info}/LICENSE +0 -0
- {pyfemtet-0.4.25.dist-info → pyfemtet-0.5.0.dist-info}/WHEEL +0 -0
- {pyfemtet-0.4.25.dist-info → pyfemtet-0.5.0.dist-info}/entry_points.txt +0 -0
|
@@ -8,7 +8,7 @@ msgid ""
|
|
|
8
8
|
msgstr ""
|
|
9
9
|
"Project-Id-Version: PROJECT VERSION\n"
|
|
10
10
|
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
|
11
|
-
"POT-Creation-Date: 2024-08-
|
|
11
|
+
"POT-Creation-Date: 2024-08-31 04:27+0900\n"
|
|
12
12
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
|
13
13
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
|
14
14
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
|
@@ -197,251 +197,303 @@ msgstr ""
|
|
|
197
197
|
msgid "Optimization has been interrupted. Note that you cannot acquire the OptimizationResult in case of `trust-constr`, `TNC`, `SLSQP` or `COBYLA`."
|
|
198
198
|
msgstr ""
|
|
199
199
|
|
|
200
|
-
#: pyfemtet/message/messages.py:
|
|
201
|
-
msgid "
|
|
200
|
+
#: pyfemtet/message/messages.py:92
|
|
201
|
+
msgid "You can use parameter constraint only with BoTorchSampler."
|
|
202
202
|
msgstr ""
|
|
203
203
|
|
|
204
204
|
#: pyfemtet/message/messages.py:96
|
|
205
|
-
msgid "
|
|
205
|
+
msgid "Connect to Femtet"
|
|
206
206
|
msgstr ""
|
|
207
207
|
|
|
208
208
|
#: pyfemtet/message/messages.py:97
|
|
209
|
-
msgid "
|
|
209
|
+
msgid "Analysis model name described in csv does not exist in project."
|
|
210
210
|
msgstr ""
|
|
211
211
|
|
|
212
212
|
#: pyfemtet/message/messages.py:98
|
|
213
|
-
msgid "
|
|
213
|
+
msgid "History csv is not read yet. Open your project manually."
|
|
214
214
|
msgstr ""
|
|
215
215
|
|
|
216
216
|
#: pyfemtet/message/messages.py:99
|
|
217
|
-
msgid "
|
|
217
|
+
msgid "Cannot read project data from csv. Open your project manually."
|
|
218
218
|
msgstr ""
|
|
219
219
|
|
|
220
220
|
#: pyfemtet/message/messages.py:100
|
|
221
|
+
msgid ".femprj file described in csv is not found. Open your project manually."
|
|
222
|
+
msgstr ""
|
|
223
|
+
|
|
224
|
+
#: pyfemtet/message/messages.py:101
|
|
221
225
|
msgid "Analysis model name is not specified. Open your model in the project manually."
|
|
222
226
|
msgstr ""
|
|
223
227
|
|
|
224
|
-
#: pyfemtet/message/messages.py:
|
|
228
|
+
#: pyfemtet/message/messages.py:103
|
|
225
229
|
msgid "Constraint"
|
|
226
230
|
msgstr ""
|
|
227
231
|
|
|
228
|
-
#: pyfemtet/message/messages.py:
|
|
232
|
+
#: pyfemtet/message/messages.py:104
|
|
229
233
|
msgid "feasible"
|
|
230
234
|
msgstr ""
|
|
231
235
|
|
|
232
|
-
#: pyfemtet/message/messages.py:
|
|
236
|
+
#: pyfemtet/message/messages.py:105
|
|
233
237
|
msgid "infeasible"
|
|
234
238
|
msgstr ""
|
|
235
239
|
|
|
236
|
-
#: pyfemtet/message/messages.py:
|
|
240
|
+
#: pyfemtet/message/messages.py:106
|
|
237
241
|
msgid "Optimality"
|
|
238
242
|
msgstr ""
|
|
239
243
|
|
|
240
|
-
#: pyfemtet/message/messages.py:
|
|
244
|
+
#: pyfemtet/message/messages.py:107
|
|
241
245
|
msgid "non dominated"
|
|
242
246
|
msgstr ""
|
|
243
247
|
|
|
244
|
-
#: pyfemtet/message/messages.py:
|
|
248
|
+
#: pyfemtet/message/messages.py:108
|
|
245
249
|
msgid "dominated"
|
|
246
250
|
msgstr ""
|
|
247
251
|
|
|
248
|
-
#: pyfemtet/message/messages.py:
|
|
252
|
+
#: pyfemtet/message/messages.py:109
|
|
249
253
|
msgid "Hypervolume Plot"
|
|
250
254
|
msgstr ""
|
|
251
255
|
|
|
252
|
-
#: pyfemtet/message/messages.py:
|
|
256
|
+
#: pyfemtet/message/messages.py:110
|
|
253
257
|
msgid "Objective Plot"
|
|
254
258
|
msgstr ""
|
|
255
259
|
|
|
256
|
-
#: pyfemtet/message/messages.py:
|
|
260
|
+
#: pyfemtet/message/messages.py:111
|
|
257
261
|
msgid "Multi Objective Pair Plot"
|
|
258
262
|
msgstr ""
|
|
259
263
|
|
|
260
|
-
#: pyfemtet/message/messages.py:
|
|
264
|
+
#: pyfemtet/message/messages.py:112
|
|
261
265
|
msgid "trial number"
|
|
262
266
|
msgstr ""
|
|
263
267
|
|
|
264
|
-
#: pyfemtet/message/messages.py:
|
|
268
|
+
#: pyfemtet/message/messages.py:114
|
|
265
269
|
msgid "Objectives"
|
|
266
270
|
msgstr ""
|
|
267
271
|
|
|
268
272
|
#: pyfemtet/message/messages.py:115
|
|
273
|
+
msgid "Objectives (all)"
|
|
274
|
+
msgstr ""
|
|
275
|
+
|
|
276
|
+
#: pyfemtet/message/messages.py:117
|
|
269
277
|
msgid "Prediction Model"
|
|
270
278
|
msgstr ""
|
|
271
279
|
|
|
272
|
-
#: pyfemtet/message/messages.py:
|
|
280
|
+
#: pyfemtet/message/messages.py:118
|
|
273
281
|
msgid " Recalculate Model"
|
|
274
282
|
msgstr ""
|
|
275
283
|
|
|
276
|
-
#: pyfemtet/message/messages.py:
|
|
284
|
+
#: pyfemtet/message/messages.py:119
|
|
277
285
|
msgid " Redraw graph"
|
|
278
286
|
msgstr ""
|
|
279
287
|
|
|
280
|
-
#: pyfemtet/message/messages.py:
|
|
288
|
+
#: pyfemtet/message/messages.py:120
|
|
281
289
|
msgid "Parameter"
|
|
282
290
|
msgstr ""
|
|
283
291
|
|
|
284
|
-
#: pyfemtet/message/messages.py:
|
|
292
|
+
#: pyfemtet/message/messages.py:121
|
|
285
293
|
msgid "Parameter2"
|
|
286
294
|
msgstr ""
|
|
287
295
|
|
|
288
|
-
#: pyfemtet/message/messages.py:
|
|
296
|
+
#: pyfemtet/message/messages.py:122
|
|
289
297
|
msgid "Objective"
|
|
290
298
|
msgstr ""
|
|
291
299
|
|
|
292
|
-
#: pyfemtet/message/messages.py:
|
|
300
|
+
#: pyfemtet/message/messages.py:123
|
|
293
301
|
msgid "No history selected."
|
|
294
302
|
msgstr ""
|
|
295
303
|
|
|
296
|
-
#: pyfemtet/message/messages.py:
|
|
304
|
+
#: pyfemtet/message/messages.py:124
|
|
297
305
|
msgid "No FEM result (yet)."
|
|
298
306
|
msgstr ""
|
|
299
307
|
|
|
300
|
-
#: pyfemtet/message/messages.py:
|
|
308
|
+
#: pyfemtet/message/messages.py:125
|
|
301
309
|
msgid "Prediction model is not calculated yet."
|
|
302
310
|
msgstr ""
|
|
303
311
|
|
|
304
|
-
#: pyfemtet/message/messages.py:
|
|
312
|
+
#: pyfemtet/message/messages.py:126
|
|
305
313
|
msgid "Cannot select same parameter"
|
|
306
314
|
msgstr ""
|
|
307
315
|
|
|
308
|
-
#: pyfemtet/message/messages.py:
|
|
316
|
+
#: pyfemtet/message/messages.py:127
|
|
317
|
+
msgid "3D graph (two or more parameters required)"
|
|
318
|
+
msgstr ""
|
|
319
|
+
|
|
320
|
+
#: pyfemtet/message/messages.py:129
|
|
309
321
|
msgid "Prediction Model of Objective"
|
|
310
322
|
msgstr ""
|
|
311
323
|
|
|
312
|
-
#: pyfemtet/message/messages.py:
|
|
324
|
+
#: pyfemtet/message/messages.py:130
|
|
313
325
|
msgid "prediction model"
|
|
314
326
|
msgstr ""
|
|
315
327
|
|
|
316
|
-
#: pyfemtet/message/messages.py:
|
|
328
|
+
#: pyfemtet/message/messages.py:131
|
|
317
329
|
msgid "std. dev. of model"
|
|
318
330
|
msgstr ""
|
|
319
331
|
|
|
320
|
-
#: pyfemtet/message/messages.py:
|
|
332
|
+
#: pyfemtet/message/messages.py:133
|
|
321
333
|
msgid "Progress"
|
|
322
334
|
msgstr ""
|
|
323
335
|
|
|
324
|
-
#: pyfemtet/message/messages.py:
|
|
336
|
+
#: pyfemtet/message/messages.py:134
|
|
325
337
|
msgid "Prediction"
|
|
326
338
|
msgstr ""
|
|
327
339
|
|
|
328
|
-
#: pyfemtet/message/messages.py:
|
|
340
|
+
#: pyfemtet/message/messages.py:135
|
|
329
341
|
msgid "Workers"
|
|
330
342
|
msgstr ""
|
|
331
343
|
|
|
332
|
-
#: pyfemtet/message/messages.py:
|
|
344
|
+
#: pyfemtet/message/messages.py:136
|
|
345
|
+
msgid "Details"
|
|
346
|
+
msgstr ""
|
|
347
|
+
|
|
348
|
+
#: pyfemtet/message/messages.py:138
|
|
333
349
|
msgid "Optimization status will be shown here."
|
|
334
350
|
msgstr ""
|
|
335
351
|
|
|
336
|
-
#: pyfemtet/message/messages.py:
|
|
352
|
+
#: pyfemtet/message/messages.py:139
|
|
337
353
|
msgid "Auto-update graph"
|
|
338
354
|
msgstr ""
|
|
339
355
|
|
|
340
|
-
#: pyfemtet/message/messages.py:
|
|
356
|
+
#: pyfemtet/message/messages.py:140
|
|
341
357
|
msgid "Interrupt Optimization"
|
|
342
358
|
msgstr ""
|
|
343
359
|
|
|
344
|
-
#: pyfemtet/message/messages.py:
|
|
360
|
+
#: pyfemtet/message/messages.py:142
|
|
345
361
|
msgid "Result"
|
|
346
362
|
msgstr ""
|
|
347
363
|
|
|
348
|
-
#: pyfemtet/message/messages.py:
|
|
364
|
+
#: pyfemtet/message/messages.py:144
|
|
349
365
|
msgid "Open Result in Femtet"
|
|
350
366
|
msgstr ""
|
|
351
367
|
|
|
352
|
-
#: pyfemtet/message/messages.py:
|
|
368
|
+
#: pyfemtet/message/messages.py:145
|
|
353
369
|
msgid "Reconstruct Model"
|
|
354
370
|
msgstr ""
|
|
355
371
|
|
|
356
|
-
#: pyfemtet/message/messages.py:
|
|
372
|
+
#: pyfemtet/message/messages.py:146
|
|
357
373
|
msgid "Drag and drop or select csv file"
|
|
358
374
|
msgstr ""
|
|
359
375
|
|
|
360
|
-
#: pyfemtet/message/messages.py:
|
|
376
|
+
#: pyfemtet/message/messages.py:147
|
|
361
377
|
msgid "Connection to Femtet is not established. Launch Femtet and Open a project."
|
|
362
378
|
msgstr ""
|
|
363
379
|
|
|
364
|
-
#: pyfemtet/message/messages.py:
|
|
380
|
+
#: pyfemtet/message/messages.py:148
|
|
365
381
|
msgid "No result plot is selected."
|
|
366
382
|
msgstr ""
|
|
367
383
|
|
|
368
|
-
#: pyfemtet/message/messages.py:
|
|
384
|
+
#: pyfemtet/message/messages.py:149
|
|
369
385
|
msgid "The femprj file path in the history csv is not found or valid."
|
|
370
386
|
msgstr ""
|
|
371
387
|
|
|
372
|
-
#: pyfemtet/message/messages.py:
|
|
388
|
+
#: pyfemtet/message/messages.py:150
|
|
373
389
|
msgid "The model name in the history csv is not found."
|
|
374
390
|
msgstr ""
|
|
375
391
|
|
|
376
|
-
#: pyfemtet/message/messages.py:
|
|
392
|
+
#: pyfemtet/message/messages.py:151
|
|
377
393
|
msgid ".pdt file is not found. Please check the .Results folder. Note that .pdt file save mode depends on the `save_pdt` argument of FemtetInterface in optimization script(default to `all`)."
|
|
378
394
|
msgstr ""
|
|
379
395
|
|
|
380
|
-
#: pyfemtet/message/messages.py:
|
|
396
|
+
#: pyfemtet/message/messages.py:156
|
|
381
397
|
msgid "Failed to open "
|
|
382
398
|
msgstr ""
|
|
383
399
|
|
|
384
|
-
#: pyfemtet/message/messages.py:
|
|
400
|
+
#: pyfemtet/message/messages.py:157
|
|
385
401
|
msgid "Specified model is not in current project. Please check opened project. For example, not \"analysis model only\" but your .femprj file."
|
|
386
402
|
msgstr ""
|
|
387
403
|
|
|
388
|
-
#: pyfemtet/message/messages.py:
|
|
404
|
+
#: pyfemtet/message/messages.py:160
|
|
389
405
|
msgid ".femprj file path of the history csv is invalid. Please certify matching between csv and opening .femprj file."
|
|
390
406
|
msgstr ""
|
|
391
407
|
|
|
392
|
-
#: pyfemtet/message/messages.py:
|
|
408
|
+
#: pyfemtet/message/messages.py:161
|
|
393
409
|
msgid "Analysis model name of the history csv is invalid. Please certify matching between csv and opening analysis model."
|
|
394
410
|
msgstr ""
|
|
395
411
|
|
|
396
|
-
#: pyfemtet/message/messages.py:
|
|
412
|
+
#: pyfemtet/message/messages.py:162
|
|
397
413
|
msgid "Analysis model name of the history csv and opened in Femtet is inconsistent. Please certify matching between csv and opening analysis model."
|
|
398
414
|
msgstr ""
|
|
399
415
|
|
|
400
|
-
#: pyfemtet/message/messages.py:
|
|
416
|
+
#: pyfemtet/message/messages.py:163
|
|
401
417
|
msgid "tutorial mode"
|
|
402
418
|
msgstr ""
|
|
403
419
|
|
|
404
|
-
#: pyfemtet/message/messages.py:
|
|
420
|
+
#: pyfemtet/message/messages.py:164
|
|
405
421
|
msgid "Load Sample CSV"
|
|
406
422
|
msgstr ""
|
|
407
423
|
|
|
408
|
-
#: pyfemtet/message/messages.py:
|
|
424
|
+
#: pyfemtet/message/messages.py:165
|
|
409
425
|
msgid "Load CSV"
|
|
410
426
|
msgstr ""
|
|
411
427
|
|
|
412
|
-
#: pyfemtet/message/messages.py:
|
|
428
|
+
#: pyfemtet/message/messages.py:166
|
|
413
429
|
msgid "Open your optimization result. Then connecting to femtet will start automatically. Note that in tutorial mode, this button loads the ready-made sample csv and open sample femprj."
|
|
414
430
|
msgstr ""
|
|
415
431
|
|
|
416
|
-
#: pyfemtet/message/messages.py:
|
|
432
|
+
#: pyfemtet/message/messages.py:168
|
|
417
433
|
msgid "Main Graph"
|
|
418
434
|
msgstr ""
|
|
419
435
|
|
|
420
|
-
#: pyfemtet/message/messages.py:
|
|
436
|
+
#: pyfemtet/message/messages.py:169
|
|
421
437
|
msgid "Here the optimization history is shown. Each plot represents single FEM result. You can pick a result to open the corresponding result in Femtet. "
|
|
422
438
|
msgstr ""
|
|
423
439
|
|
|
424
|
-
#: pyfemtet/message/messages.py:
|
|
440
|
+
#: pyfemtet/message/messages.py:172
|
|
425
441
|
msgid "Open Result"
|
|
426
442
|
msgstr ""
|
|
427
443
|
|
|
428
|
-
#: pyfemtet/message/messages.py:
|
|
444
|
+
#: pyfemtet/message/messages.py:173
|
|
429
445
|
msgid "After pick a point in the main graph, This button shows the corresponding FEM result in Femtet."
|
|
430
446
|
msgstr ""
|
|
431
447
|
|
|
432
|
-
#: pyfemtet/message/messages.py:
|
|
448
|
+
#: pyfemtet/message/messages.py:175
|
|
433
449
|
msgid "Re-connect to Femtet."
|
|
434
450
|
msgstr ""
|
|
435
451
|
|
|
436
|
-
#: pyfemtet/message/messages.py:
|
|
452
|
+
#: pyfemtet/message/messages.py:176
|
|
437
453
|
msgid "Sample csv is not found. Please consider to re-install pyfemtet by `py -m pip install pyfemtet -U --force-reinstall`"
|
|
438
454
|
msgstr ""
|
|
439
455
|
|
|
440
|
-
#: pyfemtet/message/messages.py:
|
|
456
|
+
#: pyfemtet/message/messages.py:177
|
|
441
457
|
msgid "Sample femprj file is not found. Please consider to re-install pyfemtet by `py -m pip install pyfemtet -U --force-reinstall`"
|
|
442
458
|
msgstr ""
|
|
443
459
|
|
|
444
|
-
#: pyfemtet/message/messages.py:
|
|
460
|
+
#: pyfemtet/message/messages.py:178
|
|
445
461
|
msgid "Sample femprj result folder is not found. Please consider to re-install pyfemtet by `py -m pip install pyfemtet -U --force-reinstall`"
|
|
446
462
|
msgstr ""
|
|
447
463
|
|
|
464
|
+
#: pyfemtet/message/messages.py:180
|
|
465
|
+
msgid "Loading data..."
|
|
466
|
+
msgstr ""
|
|
467
|
+
|
|
468
|
+
#: pyfemtet/message/messages.py:181
|
|
469
|
+
msgid "Plots of objectives versus trials"
|
|
470
|
+
msgstr ""
|
|
471
|
+
|
|
472
|
+
#: pyfemtet/message/messages.py:182
|
|
473
|
+
msgid "The vertical axis is the objective, and the horizontal axis is the number of trials."
|
|
474
|
+
msgstr ""
|
|
475
|
+
|
|
476
|
+
#: pyfemtet/message/messages.py:183
|
|
477
|
+
msgid "Parallel coordinate plots"
|
|
478
|
+
msgstr ""
|
|
479
|
+
|
|
480
|
+
#: pyfemtet/message/messages.py:184
|
|
481
|
+
msgid "The vertical axis is an objective or parameters, and one polyline indicates one result."
|
|
482
|
+
msgstr ""
|
|
483
|
+
|
|
484
|
+
#: pyfemtet/message/messages.py:185
|
|
485
|
+
msgid "The heatmap of objectives"
|
|
486
|
+
msgstr ""
|
|
487
|
+
|
|
488
|
+
#: pyfemtet/message/messages.py:186
|
|
489
|
+
msgid "The axes are parameters, and the color shows objective value."
|
|
490
|
+
msgstr ""
|
|
491
|
+
|
|
492
|
+
#: pyfemtet/message/messages.py:187
|
|
493
|
+
msgid "The response of an objective versus one parameter"
|
|
494
|
+
msgstr ""
|
|
495
|
+
|
|
496
|
+
#: pyfemtet/message/messages.py:188
|
|
497
|
+
msgid "The vertical axis is objective, and the horizontal axis is parameter."
|
|
498
|
+
msgstr ""
|
|
499
|
+
|
pyfemtet/message/messages.py
CHANGED
|
@@ -82,7 +82,7 @@ class Message:
|
|
|
82
82
|
ERR_JPG_NOT_FOUND = _('Screenshot (.jpg) is not found.')
|
|
83
83
|
ERR_UPDATE_SOLIDWORKS_MODEL_FAILED = _('Failed to update model in solidworks.')
|
|
84
84
|
|
|
85
|
-
# ===== pyfemtet.opt.
|
|
85
|
+
# ===== pyfemtet.opt.optimizer =====
|
|
86
86
|
ERR_NOT_IMPLEMENTED = _('The following features are not supported by the specified optimization method. ')
|
|
87
87
|
ERR_INCONSISTENT_PARAMETER = _('The parameter set does not match the one added with add_init_parameter.')
|
|
88
88
|
INFO_EXCEPTION_DURING_FEM_ANALYSIS = _('An exception has occurred during FEM update. Current parameters are: ')
|
|
@@ -90,6 +90,9 @@ class Message:
|
|
|
90
90
|
ERR_FEM_FAILED_AND_CANNOT_CONTINUE = _('Current parameter set cannot update FEM and this optimization method cannot skip current parameter set. The optimization process will be terminated.')
|
|
91
91
|
WARN_INTERRUPTED_IN_SCIPY = _('Optimization has been interrupted. Note that you cannot acquire the OptimizationResult in case of `trust-constr`, `TNC`, `SLSQP` or `COBYLA`.')
|
|
92
92
|
ERR_PARAMETER_CONSTRAINT_ONLY_BOTORCH = _('You can use parameter constraint only with BoTorchSampler.')
|
|
93
|
+
WARN_SCIPY_DOESNT_NEED_SEED = _('Scipy is deterministic, so whether you set a seed or not will not change the results.')
|
|
94
|
+
START_CANDIDATE_WITH_PARAMETER_CONSTRAINT = _('Start to candidate new parameter set with constraints. This process may take a long time.')
|
|
95
|
+
WARN_UPDATE_FEM_PARAMETER_TOOK_A_LONG_TIME = _('Updating FEM parameter during evaluating constraints take a long time. Please consider not to use FEM variables in constraint functions and set `update_fem` to False.')
|
|
93
96
|
|
|
94
97
|
# ===== pyfemtet.opt.visualization =====
|
|
95
98
|
# control_femtet.py
|
|
@@ -111,7 +114,8 @@ class Message:
|
|
|
111
114
|
GRAPH_TITLE_MULTI_OBJECTIVE = _('Multi Objective Pair Plot')
|
|
112
115
|
GRAPH_AXIS_LABEL_TRIAL = _('trial number')
|
|
113
116
|
# main_graph.py
|
|
114
|
-
|
|
117
|
+
TAB_LABEL_OBJECTIVE_PLOT = _('Objectives')
|
|
118
|
+
TAB_LABEL_OBJECTIVE_SCATTERPLOT = _('Objectives (all)')
|
|
115
119
|
# pm_graph.py
|
|
116
120
|
TAB_LABEL_PREDICTION_MODEL = _('Prediction Model')
|
|
117
121
|
LABEL_OF_CREATE_PREDICTION_MODEL_BUTTON = _(' Recalculate Model')
|
pyfemtet/opt/__init__.py
CHANGED
|
@@ -4,8 +4,8 @@ from pyfemtet.opt.interface import FemtetInterface
|
|
|
4
4
|
from pyfemtet.opt.interface import FemtetWithNXInterface
|
|
5
5
|
from pyfemtet.opt.interface import FemtetWithSolidworksInterface
|
|
6
6
|
|
|
7
|
-
from pyfemtet.opt.
|
|
8
|
-
from pyfemtet.opt.
|
|
7
|
+
from pyfemtet.opt.optimizer import OptunaOptimizer, ScipyOptimizer, ScipyScalarOptimizer
|
|
8
|
+
from pyfemtet.opt.optimizer import AbstractOptimizer
|
|
9
9
|
|
|
10
10
|
from pyfemtet.opt._femopt import FEMOpt
|
|
11
11
|
|
pyfemtet/opt/_femopt.py
CHANGED
|
@@ -16,11 +16,12 @@ from dask.distributed import LocalCluster, Client
|
|
|
16
16
|
|
|
17
17
|
# pyfemtet relative
|
|
18
18
|
from pyfemtet.opt.interface import FEMInterface, FemtetInterface
|
|
19
|
-
from pyfemtet.opt.
|
|
19
|
+
from pyfemtet.opt.optimizer import AbstractOptimizer, OptunaOptimizer
|
|
20
20
|
from pyfemtet.opt.visualization.process_monitor.application import main as process_monitor_main
|
|
21
21
|
from pyfemtet.opt._femopt_core import (
|
|
22
22
|
_check_bound,
|
|
23
23
|
_is_access_gogh,
|
|
24
|
+
_is_access_femtet,
|
|
24
25
|
Objective,
|
|
25
26
|
Constraint,
|
|
26
27
|
History,
|
|
@@ -98,9 +99,9 @@ class FEMOpt:
|
|
|
98
99
|
self.fem = fem
|
|
99
100
|
|
|
100
101
|
if opt is None:
|
|
101
|
-
self.opt = OptunaOptimizer()
|
|
102
|
+
self.opt: AbstractOptimizer = OptunaOptimizer()
|
|
102
103
|
else:
|
|
103
|
-
self.opt = opt
|
|
104
|
+
self.opt: AbstractOptimizer = opt
|
|
104
105
|
|
|
105
106
|
# メンバーの宣言
|
|
106
107
|
self.client = None
|
|
@@ -260,6 +261,7 @@ class FEMOpt:
|
|
|
260
261
|
strict: bool = True,
|
|
261
262
|
args: tuple or None = None,
|
|
262
263
|
kwargs: dict or None = None,
|
|
264
|
+
using_fem: bool = None,
|
|
263
265
|
):
|
|
264
266
|
"""Adds a constraint to the optimization problem.
|
|
265
267
|
|
|
@@ -271,6 +273,7 @@ class FEMOpt:
|
|
|
271
273
|
strict (bool, optional): Flag indicating if it is a strict constraint. Defaults to True.
|
|
272
274
|
args (tuple or None, optional): Additional arguments for the constraint function. Defaults to None.
|
|
273
275
|
kwargs (dict): Additional arguments for the constraint function. Defaults to None.
|
|
276
|
+
using_fem (bool, optional): Using FEM or not in the constraint function. It may make the processing time in strict constraints in BoTorchSampler. Defaults to None. If None, PyFemtet checks the access to Femtet and estimate using Femtet or not automatically.
|
|
274
277
|
|
|
275
278
|
Note:
|
|
276
279
|
If the FEMInterface is FemtetInterface, the 1st argument of fun should be Femtet (IPyDispatch) object.
|
|
@@ -298,55 +301,33 @@ class FEMOpt:
|
|
|
298
301
|
else:
|
|
299
302
|
i += 1
|
|
300
303
|
name = candidate
|
|
304
|
+
if using_fem is None:
|
|
305
|
+
# 自動推定機能は Femtet 特有の処理とする
|
|
306
|
+
if isinstance(self.fem, FemtetInterface):
|
|
307
|
+
using_fem = _is_access_femtet(fun)
|
|
308
|
+
else:
|
|
309
|
+
using_fem = False
|
|
301
310
|
|
|
302
311
|
# strict constraint の場合、solve 前に評価したいので Gogh へのアクセスを禁ずる
|
|
303
|
-
if strict:
|
|
312
|
+
if strict and isinstance(self.fem, FemtetInterface):
|
|
304
313
|
if _is_access_gogh(fun):
|
|
305
314
|
message = Msg.ERR_CONTAIN_GOGH_ACCESS_IN_STRICT_CONSTRAINT
|
|
306
315
|
raise Exception(message)
|
|
307
316
|
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
lower_bound (Optional[float], optional): Lower bound of return value. Defaults to None.
|
|
323
|
-
upper_bound (Optional[float], optional): Upper bound of return value. Defaults to None.
|
|
324
|
-
"""
|
|
325
|
-
|
|
326
|
-
# candidate default name
|
|
327
|
-
if name is None:
|
|
328
|
-
prefix = Constraint.default_name
|
|
329
|
-
i = 0
|
|
330
|
-
while True:
|
|
331
|
-
candidate = f'{prefix}_{str(int(i))}'
|
|
332
|
-
is_existing = candidate in list(self.opt.constraints.keys())
|
|
333
|
-
if not is_existing:
|
|
334
|
-
break
|
|
335
|
-
else:
|
|
336
|
-
i += 1
|
|
337
|
-
name = candidate
|
|
338
|
-
|
|
339
|
-
# assert at least 1 bound exist
|
|
340
|
-
assert lower_bound is not None or upper_bound is not None, Msg.ERR_NO_BOUNDS
|
|
341
|
-
|
|
342
|
-
from pyfemtet.opt._femopt_core import ParameterConstraint
|
|
343
|
-
self.opt.constraints[name] = ParameterConstraint(fun, name, lower_bound, upper_bound, self.opt)
|
|
344
|
-
if hasattr(self.opt, 'add_parameter_constraints'):
|
|
345
|
-
prm_args = [p.name for p in inspect.signature(fun).parameters.values()]
|
|
346
|
-
if lower_bound is not None:
|
|
347
|
-
self.opt.add_parameter_constraints(lambda *args, **kwargs: fun(*args, **kwargs) - lower_bound, prm_args=prm_args)
|
|
348
|
-
if upper_bound is not None:
|
|
349
|
-
self.opt.add_parameter_constraints(lambda *args, **kwargs: upper_bound - fun(*args, **kwargs), prm_args=prm_args)
|
|
317
|
+
# strict constraint かつ BoTorchSampler の場合、
|
|
318
|
+
# 最適化実行時に monkey patch を実行するフラグを立てる。
|
|
319
|
+
# ただし using_fem が True ならば非常に低速なので警告を出す。
|
|
320
|
+
if strict and isinstance(self.opt, OptunaOptimizer):
|
|
321
|
+
self.opt: OptunaOptimizer
|
|
322
|
+
from optuna_integration import BoTorchSampler
|
|
323
|
+
if issubclass(self.opt.sampler_class, BoTorchSampler):
|
|
324
|
+
# パッチ実行フラグ
|
|
325
|
+
self.opt._do_monkey_patch = True
|
|
326
|
+
# 警告
|
|
327
|
+
if using_fem:
|
|
328
|
+
logger.warning(Msg.WARN_UPDATE_FEM_PARAMETER_TOOK_A_LONG_TIME)
|
|
329
|
+
|
|
330
|
+
self.opt.constraints[name] = Constraint(fun, name, lower_bound, upper_bound, strict, args, kwargs, using_fem)
|
|
350
331
|
|
|
351
332
|
def get_parameter(self, format='dict'):
|
|
352
333
|
raise DeprecationWarning('FEMOpt.get_parameter() was deprecated. Use Femopt.opt.get_parameter() instead.')
|
pyfemtet/opt/_femopt_core.py
CHANGED
|
@@ -132,34 +132,68 @@ def _check_bound(lb, ub, name=None):
|
|
|
132
132
|
raise ValueError(message)
|
|
133
133
|
|
|
134
134
|
|
|
135
|
-
def
|
|
135
|
+
def _get_scope_indent(source: str) -> int:
|
|
136
|
+
SPACES = [' ', '\t']
|
|
137
|
+
indent = 0
|
|
138
|
+
while True:
|
|
139
|
+
if source[indent] not in SPACES:
|
|
140
|
+
break
|
|
141
|
+
else:
|
|
142
|
+
indent += 1
|
|
143
|
+
return indent
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
def _remove_indent(source: str, indent: int) -> str: # returns source
|
|
147
|
+
lines = source.splitlines()
|
|
148
|
+
edited_lines = [l[indent:] for l in lines]
|
|
149
|
+
edited_source = '\n'.join(edited_lines)
|
|
150
|
+
return edited_source
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
def _check_accsess_femtet_objects(fun, target: str = None):
|
|
154
|
+
if target is None:
|
|
155
|
+
target = ''
|
|
136
156
|
|
|
137
157
|
# 関数fのソースコードを取得
|
|
138
158
|
source = inspect.getsource(fun)
|
|
139
159
|
|
|
140
160
|
# ソースコードを抽象構文木(AST)に変換
|
|
141
|
-
|
|
161
|
+
try:
|
|
162
|
+
# instanceメソッドなどの場合を想定してインデントを削除
|
|
163
|
+
source = _remove_indent(source, _get_scope_indent(source))
|
|
164
|
+
tree = ast.parse(source)
|
|
165
|
+
except:
|
|
166
|
+
return False # パースに失敗するからと言ってエラーにするまででもない
|
|
142
167
|
|
|
143
168
|
# 関数定義を見つける
|
|
144
169
|
for node in ast.walk(tree):
|
|
145
170
|
if isinstance(node, ast.FunctionDef):
|
|
146
|
-
#
|
|
147
|
-
first_arg_name =
|
|
171
|
+
# Femtet という名前の引数を取得
|
|
172
|
+
first_arg_name = 'Femtet'
|
|
148
173
|
|
|
149
174
|
# 関数内の全ての属性アクセスをチェック
|
|
150
175
|
for sub_node in ast.walk(node):
|
|
151
176
|
if isinstance(sub_node, ast.Attribute):
|
|
152
|
-
#
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
):
|
|
177
|
+
# Femtet に対してアクセスがあるかチェック
|
|
178
|
+
conditions = [isinstance(sub_node.value, ast.Name)]
|
|
179
|
+
conditions.append(sub_node.value.id == first_arg_name) # Femtet にアクセスしている
|
|
180
|
+
if target == 'Gogh':
|
|
181
|
+
conditions.append(sub_node.attr == 'Gogh') # Femtet.Gogh にアクセスしている
|
|
182
|
+
if all(conditions):
|
|
158
183
|
return True
|
|
184
|
+
|
|
159
185
|
# ここまできてもなければアクセスしてない
|
|
160
186
|
return False
|
|
161
187
|
|
|
162
188
|
|
|
189
|
+
def _is_access_gogh(fun):
|
|
190
|
+
return _check_accsess_femtet_objects(fun, target='Gogh')
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
def _is_access_femtet(fun):
|
|
194
|
+
return _check_accsess_femtet_objects(fun)
|
|
195
|
+
|
|
196
|
+
|
|
163
197
|
def is_feasible(value, lb, ub):
|
|
164
198
|
"""
|
|
165
199
|
Check if a value is within the specified lower bound and upper bound.
|
|
@@ -173,11 +207,11 @@ def is_feasible(value, lb, ub):
|
|
|
173
207
|
bool: True if the value satisfies the bounds; False otherwise.
|
|
174
208
|
"""
|
|
175
209
|
if lb is None and ub is not None:
|
|
176
|
-
return value
|
|
210
|
+
return value <= ub
|
|
177
211
|
elif lb is not None and ub is None:
|
|
178
|
-
return lb
|
|
212
|
+
return lb <= value
|
|
179
213
|
elif lb is not None and ub is not None:
|
|
180
|
-
return lb
|
|
214
|
+
return lb <= value <= ub
|
|
181
215
|
else:
|
|
182
216
|
return True
|
|
183
217
|
|
|
@@ -313,7 +347,7 @@ class Constraint(Function):
|
|
|
313
347
|
|
|
314
348
|
default_name = 'cns'
|
|
315
349
|
|
|
316
|
-
def __init__(self, fun, name, lb, ub, strict, args, kwargs):
|
|
350
|
+
def __init__(self, fun, name, lb, ub, strict, args, kwargs, using_fem):
|
|
317
351
|
"""Initializes a Constraint instance.
|
|
318
352
|
|
|
319
353
|
Args:
|
|
@@ -324,6 +358,7 @@ class Constraint(Function):
|
|
|
324
358
|
strict (bool): Whether to enforce strict inequality for the bounds.
|
|
325
359
|
args: Additional arguments for the constraint function.
|
|
326
360
|
kwargs: Additional keyword arguments for the constraint function.
|
|
361
|
+
using_fem: Update fem or not before run calc().
|
|
327
362
|
|
|
328
363
|
Raises:
|
|
329
364
|
ValueError: If the lower bound is greater than or equal to the upper bound.
|
|
@@ -334,28 +369,10 @@ class Constraint(Function):
|
|
|
334
369
|
self.lb = lb
|
|
335
370
|
self.ub = ub
|
|
336
371
|
self.strict = strict
|
|
372
|
+
self.using_fem = using_fem
|
|
337
373
|
super().__init__(fun, name, args, kwargs)
|
|
338
374
|
|
|
339
375
|
|
|
340
|
-
# from pyfemtet.opt.opt import AbstractOptimizer
|
|
341
|
-
class ParameterConstraint(Constraint):
|
|
342
|
-
"""Variable のみを引数とする constraint 関数"""
|
|
343
|
-
|
|
344
|
-
def __init__(self, fun, name, lb, ub, opt: 'AbstractOptimizer'):
|
|
345
|
-
super().__init__(fun, name, lb, ub, strict=True, args=None, kwargs=None)
|
|
346
|
-
self.opt = opt
|
|
347
|
-
self.prm_args = [arg.name for arg in inspect.signature(self.fun).parameters.values()]
|
|
348
|
-
|
|
349
|
-
def calc(self, _):
|
|
350
|
-
# variables 全体から fun に対する引数を作成する
|
|
351
|
-
kwargs: dict = self.opt.get_parameter('dict')
|
|
352
|
-
keys = list(kwargs.keys())
|
|
353
|
-
for k in keys:
|
|
354
|
-
if k not in self.prm_args:
|
|
355
|
-
kwargs.pop(k)
|
|
356
|
-
return float(self.fun(**kwargs))
|
|
357
|
-
|
|
358
|
-
|
|
359
376
|
class _HistoryDfCore:
|
|
360
377
|
"""Class for managing a DataFrame object in a distributed manner."""
|
|
361
378
|
|
|
File without changes
|