pyfemtet 0.9.5__py3-none-any.whl → 1.0.0b0__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.

Files changed (272) hide show
  1. pyfemtet/__init__.py +6 -1
  2. pyfemtet/_i18n/1. make_pot_and_update_po.bat +8 -0
  3. pyfemtet/_i18n/2. build_mo.bat +5 -0
  4. pyfemtet/_i18n/__init__.py +4 -0
  5. pyfemtet/_i18n/babel.cfg +2 -0
  6. pyfemtet/_i18n/i18n.py +37 -0
  7. pyfemtet/_i18n/locales/ja/LC_MESSAGES/messages.mo +0 -0
  8. pyfemtet/_i18n/locales/ja/LC_MESSAGES/messages.po +1020 -0
  9. pyfemtet/_i18n/locales/messages.pot +987 -0
  10. pyfemtet/{_message → _i18n}/messages.py +128 -41
  11. pyfemtet/_util/closing.py +19 -0
  12. pyfemtet/_util/dask_util.py +89 -7
  13. pyfemtet/_util/df_util.py +29 -0
  14. pyfemtet/_util/excel_macro_util.py +8 -3
  15. pyfemtet/_util/excel_parse_util.py +43 -23
  16. pyfemtet/_util/femtet_access_inspection.py +120 -0
  17. pyfemtet/{_femtet_config_util/autosave.py → _util/femtet_autosave.py} +7 -0
  18. pyfemtet/_util/femtet_exit.py +105 -0
  19. pyfemtet/_util/femtet_version.py +20 -0
  20. pyfemtet/_util/helper.py +94 -0
  21. pyfemtet/_util/process_util.py +107 -0
  22. pyfemtet/_util/str_enum.py +44 -0
  23. pyfemtet/core.py +15 -47
  24. pyfemtet/dispatch_extensions/__init__.py +8 -11
  25. pyfemtet/dispatch_extensions/_impl.py +42 -198
  26. pyfemtet/logger/__init__.py +8 -1
  27. pyfemtet/logger/_impl.py +5 -6
  28. pyfemtet/opt/__init__.py +3 -17
  29. pyfemtet/opt/exceptions.py +45 -0
  30. pyfemtet/opt/femopt.py +608 -0
  31. pyfemtet/opt/history/__init__.py +11 -0
  32. pyfemtet/opt/history/_history.py +1404 -0
  33. pyfemtet/opt/history/_hypervolume.py +169 -0
  34. pyfemtet/opt/history/_optimality.py +79 -0
  35. pyfemtet/opt/interface/__init__.py +17 -24
  36. pyfemtet/opt/interface/_base_interface.py +222 -0
  37. pyfemtet/opt/interface/_excel_interface/__init__.py +3 -0
  38. pyfemtet/opt/interface/_excel_interface/debug-excel-interface.xlsm +0 -0
  39. pyfemtet/opt/interface/_excel_interface/excel_interface.py +999 -0
  40. pyfemtet/opt/interface/_femtet_interface/__init__.py +3 -0
  41. pyfemtet/opt/interface/{_femtet_parametric.py → _femtet_interface/_femtet_parametric.py} +20 -12
  42. pyfemtet/opt/interface/{_femtet.py → _femtet_interface/femtet_interface.py} +505 -349
  43. pyfemtet/opt/interface/_femtet_with_nx_interface/__init__.py +5 -0
  44. pyfemtet/opt/interface/_femtet_with_nx_interface/femtet_with_nx_interface.py +230 -0
  45. pyfemtet/opt/interface/_femtet_with_nx_interface/model1.prt +0 -0
  46. pyfemtet/opt/interface/_femtet_with_nx_interface/model1.x_t +98 -0
  47. pyfemtet/opt/interface/{_femtet_with_nx → _femtet_with_nx_interface}/update_model.py +1 -3
  48. pyfemtet/opt/interface/_femtet_with_solidworks/__init__.py +5 -0
  49. pyfemtet/opt/interface/_femtet_with_solidworks/femtet_with_solidworks_interface.py +122 -0
  50. pyfemtet/opt/interface/_solidworks_interface/__init__.py +5 -0
  51. pyfemtet/opt/interface/_solidworks_interface/solidworks_interface.py +206 -0
  52. pyfemtet/opt/interface/_surrogate_model_interface/__init__.py +8 -0
  53. pyfemtet/opt/interface/_surrogate_model_interface/base_surrogate_interface.py +150 -0
  54. pyfemtet/opt/interface/_surrogate_model_interface/botorch_interface.py +298 -0
  55. pyfemtet/opt/interface/_surrogate_model_interface/debug-pof-botorch.reccsv +18 -0
  56. pyfemtet/opt/interface/_with_excel_settings/__init__.py +61 -0
  57. pyfemtet/opt/interface/_with_excel_settings/with_excel_settings.py +134 -0
  58. pyfemtet/opt/meta_script/YAML_Generator.xlsm +0 -0
  59. pyfemtet/opt/meta_script/__main__.py +58 -36
  60. pyfemtet/opt/optimizer/__init__.py +7 -9
  61. pyfemtet/opt/optimizer/_base_optimizer.py +885 -0
  62. pyfemtet/opt/optimizer/optuna_optimizer/__init__.py +9 -0
  63. pyfemtet/opt/optimizer/optuna_optimizer/_optuna_attribute.py +73 -0
  64. pyfemtet/opt/optimizer/optuna_optimizer/_optuna_optimizer.py +678 -0
  65. pyfemtet/opt/optimizer/optuna_optimizer/_pof_botorch/__init__.py +7 -0
  66. pyfemtet/opt/optimizer/optuna_optimizer/_pof_botorch/debug-pof-botorch.reccsv +18 -0
  67. pyfemtet/opt/optimizer/optuna_optimizer/_pof_botorch/enable_nonlinear_constraint.py +244 -0
  68. pyfemtet/opt/optimizer/optuna_optimizer/_pof_botorch/pof_botorch_sampler.py +1249 -0
  69. pyfemtet/opt/optimizer/optuna_optimizer/wat_ex14_parametric_jp.femprj +0 -0
  70. pyfemtet/opt/optimizer/scipy_optimizer/__init__.py +1 -0
  71. pyfemtet/opt/optimizer/scipy_optimizer/_scipy_optimizer.py +364 -0
  72. pyfemtet/opt/prediction/__init__.py +7 -0
  73. pyfemtet/opt/prediction/_botorch_utils.py +133 -0
  74. pyfemtet/opt/prediction/_gpytorch_modules_extension.py +142 -0
  75. pyfemtet/opt/prediction/_helper.py +155 -0
  76. pyfemtet/opt/prediction/_model.py +118 -0
  77. pyfemtet/opt/problem/problem.py +304 -0
  78. pyfemtet/opt/problem/variable_manager/__init__.py +20 -0
  79. pyfemtet/opt/problem/variable_manager/_string_as_expression.py +115 -0
  80. pyfemtet/opt/problem/variable_manager/_variable_manager.py +295 -0
  81. pyfemtet/opt/visualization/history_viewer/__main__.py +5 -0
  82. pyfemtet/opt/visualization/{_base.py → history_viewer/_base_application.py} +18 -13
  83. pyfemtet/opt/visualization/history_viewer/_common_pages.py +150 -0
  84. pyfemtet/opt/visualization/{_complex_components → history_viewer/_complex_components}/alert_region.py +10 -5
  85. pyfemtet/opt/visualization/{_complex_components → history_viewer/_complex_components}/control_femtet.py +16 -13
  86. pyfemtet/opt/visualization/{_complex_components → history_viewer/_complex_components}/main_graph.py +117 -47
  87. pyfemtet/opt/visualization/{_complex_components → history_viewer/_complex_components}/pm_graph.py +159 -138
  88. pyfemtet/opt/visualization/history_viewer/_process_monitor/_application.py +173 -0
  89. pyfemtet/opt/visualization/history_viewer/_process_monitor/_pages.py +291 -0
  90. pyfemtet/opt/visualization/{_wrapped_components → history_viewer/_wrapped_components}/dbc.py +1 -1
  91. pyfemtet/opt/visualization/{_wrapped_components → history_viewer/_wrapped_components}/dcc.py +1 -1
  92. pyfemtet/opt/visualization/{_wrapped_components → history_viewer/_wrapped_components}/html.py +1 -1
  93. pyfemtet/opt/visualization/history_viewer/result_viewer/__main__.py +5 -0
  94. pyfemtet/opt/visualization/{result_viewer/application.py → history_viewer/result_viewer/_application.py} +6 -6
  95. pyfemtet/opt/visualization/{result_viewer/pages.py → history_viewer/result_viewer/_pages.py} +106 -82
  96. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08.csv +18 -0
  97. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08.db +0 -0
  98. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8.jpg +0 -0
  99. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8.log +45 -0
  100. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8.pdt +0 -0
  101. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_1.jpg +0 -0
  102. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_1.pdt +0 -0
  103. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_10.jpg +0 -0
  104. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_10.pdt +0 -0
  105. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_11.jpg +0 -0
  106. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_11.pdt +0 -0
  107. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_12.jpg +0 -0
  108. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_12.pdt +0 -0
  109. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_13.jpg +0 -0
  110. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_13.pdt +0 -0
  111. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_14.jpg +0 -0
  112. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_14.pdt +0 -0
  113. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_15.jpg +0 -0
  114. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_15.pdt +0 -0
  115. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_16.jpg +0 -0
  116. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_16.pdt +0 -0
  117. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_17.jpg +0 -0
  118. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_17.pdt +0 -0
  119. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_18.jpg +0 -0
  120. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_18.pdt +0 -0
  121. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_19.jpg +0 -0
  122. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_19.pdt +0 -0
  123. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_2.jpg +0 -0
  124. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_2.pdt +0 -0
  125. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_20.jpg +0 -0
  126. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_20.pdt +0 -0
  127. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_3.jpg +0 -0
  128. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_3.pdt +0 -0
  129. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.bgr +0 -0
  130. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.bnd +0 -0
  131. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.btr +0 -0
  132. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.jpg +0 -0
  133. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.mtl +0 -0
  134. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.pdt +0 -0
  135. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.prm +0 -0
  136. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_5.jpg +0 -0
  137. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_5.pdt +0 -0
  138. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_6.jpg +0 -0
  139. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_6.pdt +0 -0
  140. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_7.jpg +0 -0
  141. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_7.pdt +0 -0
  142. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_8.jpg +0 -0
  143. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_8.pdt +0 -0
  144. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_9.jpg +0 -0
  145. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_9.pdt +0 -0
  146. pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.femprj +0 -0
  147. pyfemtet/opt/visualization/plotter/main_figure_creator.py +536 -0
  148. pyfemtet/opt/visualization/plotter/pm_graph_creator.py +359 -0
  149. pyfemtet/opt/worker_status.py +120 -0
  150. {pyfemtet-0.9.5.dist-info → pyfemtet-1.0.0b0.dist-info}/METADATA +23 -24
  151. pyfemtet-1.0.0b0.dist-info/RECORD +172 -0
  152. pyfemtet-1.0.0b0.dist-info/entry_points.txt +3 -0
  153. pyfemtet/_femtet_config_util/exit.py +0 -59
  154. pyfemtet/_message/1. make_pot.bat +0 -11
  155. pyfemtet/_message/2. make_mo.bat +0 -6
  156. pyfemtet/_message/__init__.py +0 -5
  157. pyfemtet/_message/babel.cfg +0 -2
  158. pyfemtet/_message/locales/ja/LC_MESSAGES/messages.mo +0 -0
  159. pyfemtet/_message/locales/ja/LC_MESSAGES/messages.po +0 -570
  160. pyfemtet/_message/locales/messages.pot +0 -551
  161. pyfemtet/_warning.py +0 -87
  162. pyfemtet/brep/_impl.py +0 -18
  163. pyfemtet/opt/_femopt.py +0 -1007
  164. pyfemtet/opt/_femopt_core.py +0 -1169
  165. pyfemtet/opt/_test_utils/control_femtet.py +0 -39
  166. pyfemtet/opt/_test_utils/hyper_sphere.py +0 -24
  167. pyfemtet/opt/_test_utils/record_history.py +0 -130
  168. pyfemtet/opt/advanced_samples/excel_ui/(ref) original_project.femprj +0 -0
  169. pyfemtet/opt/advanced_samples/excel_ui/femtet-macro.xlsm +0 -0
  170. pyfemtet/opt/advanced_samples/excel_ui/pyfemtet-core.py +0 -291
  171. pyfemtet/opt/advanced_samples/excel_ui/test-pyfemtet-core.cmd +0 -22
  172. pyfemtet/opt/advanced_samples/restart/gal_ex13_parametric.femprj +0 -0
  173. pyfemtet/opt/advanced_samples/restart/gal_ex13_parametric_restart.py +0 -99
  174. pyfemtet/opt/advanced_samples/restart/gal_ex13_parametric_restart_jp.py +0 -102
  175. pyfemtet/opt/advanced_samples/surrogate_model/gal_ex13_create_training_data.py +0 -60
  176. pyfemtet/opt/advanced_samples/surrogate_model/gal_ex13_create_training_data_jp.py +0 -57
  177. pyfemtet/opt/advanced_samples/surrogate_model/gal_ex13_optimize_with_surrogate.py +0 -100
  178. pyfemtet/opt/advanced_samples/surrogate_model/gal_ex13_optimize_with_surrogate_jp.py +0 -90
  179. pyfemtet/opt/advanced_samples/surrogate_model/gal_ex13_parametric.femprj +0 -0
  180. pyfemtet/opt/interface/_base.py +0 -101
  181. pyfemtet/opt/interface/_excel_interface.py +0 -984
  182. pyfemtet/opt/interface/_femtet_excel.py +0 -141
  183. pyfemtet/opt/interface/_femtet_with_nx/__init__.py +0 -3
  184. pyfemtet/opt/interface/_femtet_with_nx/_interface.py +0 -178
  185. pyfemtet/opt/interface/_femtet_with_sldworks.py +0 -298
  186. pyfemtet/opt/interface/_surrogate/__init__.py +0 -5
  187. pyfemtet/opt/interface/_surrogate/_base.py +0 -129
  188. pyfemtet/opt/interface/_surrogate/_chaospy.py +0 -71
  189. pyfemtet/opt/interface/_surrogate/_singletaskgp.py +0 -71
  190. pyfemtet/opt/interface/_surrogate_excel.py +0 -102
  191. pyfemtet/opt/optimizer/_base.py +0 -376
  192. pyfemtet/opt/optimizer/_optuna/_botorch_patch/enable_nonlinear_constraint.py +0 -220
  193. pyfemtet/opt/optimizer/_optuna/_optuna.py +0 -434
  194. pyfemtet/opt/optimizer/_optuna/_pof_botorch.py +0 -1914
  195. pyfemtet/opt/optimizer/_scipy.py +0 -159
  196. pyfemtet/opt/optimizer/_scipy_scalar.py +0 -127
  197. pyfemtet/opt/optimizer/parameter.py +0 -113
  198. pyfemtet/opt/prediction/_base.py +0 -61
  199. pyfemtet/opt/prediction/single_task_gp.py +0 -119
  200. pyfemtet/opt/samples/femprj_sample/ParametricIF.femprj +0 -0
  201. pyfemtet/opt/samples/femprj_sample/ParametricIF.py +0 -29
  202. pyfemtet/opt/samples/femprj_sample/ParametricIF_test_result.reccsv +0 -13
  203. pyfemtet/opt/samples/femprj_sample/cad_ex01_NX.femprj +0 -0
  204. pyfemtet/opt/samples/femprj_sample/cad_ex01_NX.prt +0 -0
  205. pyfemtet/opt/samples/femprj_sample/cad_ex01_NX.py +0 -135
  206. pyfemtet/opt/samples/femprj_sample/cad_ex01_NX_test_result.reccsv +0 -23
  207. pyfemtet/opt/samples/femprj_sample/cad_ex01_SW.SLDPRT +0 -0
  208. pyfemtet/opt/samples/femprj_sample/cad_ex01_SW.femprj +0 -0
  209. pyfemtet/opt/samples/femprj_sample/cad_ex01_SW.py +0 -131
  210. pyfemtet/opt/samples/femprj_sample/cad_ex01_SW_test_result.reccsv +0 -23
  211. pyfemtet/opt/samples/femprj_sample/constrained_pipe.femprj +0 -0
  212. pyfemtet/opt/samples/femprj_sample/constrained_pipe.py +0 -96
  213. pyfemtet/opt/samples/femprj_sample/constrained_pipe_test_result.reccsv +0 -13
  214. pyfemtet/opt/samples/femprj_sample/gal_ex58_parametric.femprj +0 -0
  215. pyfemtet/opt/samples/femprj_sample/gal_ex58_parametric.py +0 -74
  216. pyfemtet/opt/samples/femprj_sample/gal_ex58_parametric_test_result.reccsv +0 -13
  217. pyfemtet/opt/samples/femprj_sample/gau_ex08_parametric.femprj +0 -0
  218. pyfemtet/opt/samples/femprj_sample/gau_ex08_parametric.py +0 -58
  219. pyfemtet/opt/samples/femprj_sample/gau_ex08_parametric_test_result.reccsv +0 -23
  220. pyfemtet/opt/samples/femprj_sample/gau_ex12_parametric.femprj +0 -0
  221. pyfemtet/opt/samples/femprj_sample/gau_ex12_parametric.py +0 -52
  222. pyfemtet/opt/samples/femprj_sample/her_ex40_parametric.femprj +0 -0
  223. pyfemtet/opt/samples/femprj_sample/her_ex40_parametric.py +0 -138
  224. pyfemtet/opt/samples/femprj_sample/her_ex40_parametric_test_result.reccsv +0 -18
  225. pyfemtet/opt/samples/femprj_sample/paswat_ex1_parametric.femprj +0 -0
  226. pyfemtet/opt/samples/femprj_sample/paswat_ex1_parametric.py +0 -60
  227. pyfemtet/opt/samples/femprj_sample/paswat_ex1_parametric_parallel.py +0 -61
  228. pyfemtet/opt/samples/femprj_sample/paswat_ex1_parametric_test_result.reccsv +0 -18
  229. pyfemtet/opt/samples/femprj_sample/wat_ex14_parametric.femprj +0 -0
  230. pyfemtet/opt/samples/femprj_sample/wat_ex14_parametric.py +0 -58
  231. pyfemtet/opt/samples/femprj_sample/wat_ex14_parametric_parallel.py +0 -58
  232. pyfemtet/opt/samples/femprj_sample/wat_ex14_parametric_test_result.reccsv +0 -18
  233. pyfemtet/opt/samples/femprj_sample_jp/ParametricIF_jp.femprj +0 -0
  234. pyfemtet/opt/samples/femprj_sample_jp/ParametricIF_jp.py +0 -29
  235. pyfemtet/opt/samples/femprj_sample_jp/cad_ex01_NX_jp.femprj +0 -0
  236. pyfemtet/opt/samples/femprj_sample_jp/cad_ex01_NX_jp.py +0 -129
  237. pyfemtet/opt/samples/femprj_sample_jp/cad_ex01_SW_jp.femprj +0 -0
  238. pyfemtet/opt/samples/femprj_sample_jp/cad_ex01_SW_jp.py +0 -125
  239. pyfemtet/opt/samples/femprj_sample_jp/constrained_pipe_jp.py +0 -93
  240. pyfemtet/opt/samples/femprj_sample_jp/gal_ex58_parametric_jp.femprj +0 -0
  241. pyfemtet/opt/samples/femprj_sample_jp/gal_ex58_parametric_jp.py +0 -70
  242. pyfemtet/opt/samples/femprj_sample_jp/gau_ex08_parametric_jp.femprj +0 -0
  243. pyfemtet/opt/samples/femprj_sample_jp/gau_ex08_parametric_jp.py +0 -57
  244. pyfemtet/opt/samples/femprj_sample_jp/gau_ex12_parametric_jp.py +0 -52
  245. pyfemtet/opt/samples/femprj_sample_jp/her_ex40_parametric_jp.femprj +0 -0
  246. pyfemtet/opt/samples/femprj_sample_jp/her_ex40_parametric_jp.py +0 -138
  247. pyfemtet/opt/samples/femprj_sample_jp/paswat_ex1_parametric_jp.femprj +0 -0
  248. pyfemtet/opt/samples/femprj_sample_jp/paswat_ex1_parametric_jp.py +0 -58
  249. pyfemtet/opt/samples/femprj_sample_jp/paswat_ex1_parametric_parallel_jp.py +0 -59
  250. pyfemtet/opt/samples/femprj_sample_jp/wat_ex14_parametric_jp.py +0 -56
  251. pyfemtet/opt/samples/femprj_sample_jp/wat_ex14_parametric_parallel_jp.py +0 -56
  252. pyfemtet/opt/visualization/_complex_components/main_figure_creator.py +0 -332
  253. pyfemtet/opt/visualization/_complex_components/pm_graph_creator.py +0 -201
  254. pyfemtet/opt/visualization/_process_monitor/application.py +0 -226
  255. pyfemtet/opt/visualization/_process_monitor/pages.py +0 -406
  256. pyfemtet/opt/visualization/_wrapped_components/__init__.py +0 -0
  257. pyfemtet/opt/visualization/result_viewer/__init__.py +0 -0
  258. pyfemtet-0.9.5.dist-info/RECORD +0 -158
  259. pyfemtet-0.9.5.dist-info/entry_points.txt +0 -3
  260. /pyfemtet/{_femtet_config_util → opt/problem}/__init__.py +0 -0
  261. /pyfemtet/{brep → opt/visualization/history_viewer}/__init__.py +0 -0
  262. /pyfemtet/opt/{_test_utils → visualization/history_viewer/_complex_components}/__init__.py +0 -0
  263. /pyfemtet/opt/{optimizer/_optuna → visualization/history_viewer/_process_monitor}/__init__.py +0 -0
  264. /pyfemtet/opt/{optimizer/_optuna/_botorch_patch → visualization/history_viewer/_wrapped_components}/__init__.py +0 -0
  265. /pyfemtet/opt/visualization/{_wrapped_components → history_viewer/_wrapped_components}/str_enum.py +0 -0
  266. /pyfemtet/opt/visualization/{result_viewer → history_viewer/result_viewer}/.gitignore +0 -0
  267. /pyfemtet/opt/visualization/{_complex_components → history_viewer/result_viewer}/__init__.py +0 -0
  268. /pyfemtet/opt/visualization/{_process_monitor → plotter}/__init__.py +0 -0
  269. /pyfemtet/opt/{samples/femprj_sample_jp/wat_ex14_parametric_jp.femprj → wat_ex14_parametric_jp.femprj} +0 -0
  270. {pyfemtet-0.9.5.dist-info → pyfemtet-1.0.0b0.dist-info}/LICENSE +0 -0
  271. {pyfemtet-0.9.5.dist-info → pyfemtet-1.0.0b0.dist-info}/LICENSE_THIRD_PARTY.txt +0 -0
  272. {pyfemtet-0.9.5.dist-info → pyfemtet-1.0.0b0.dist-info}/WHEEL +0 -0
@@ -1,135 +0,0 @@
1
- """External CAD (NX) Integration
2
-
3
- Using Femtet's stress analysis solver and Siemens' CAD software NX,
4
- design a lightweight and high-strength H-shaped beam.
5
-
6
- As a preliminary step, please perform the following procedures:
7
- - Install NX
8
- - Create a C:\temp folder
9
- - Note: NX will save a .x_t file in this folder.
10
- - Place the following files in the same folder:
11
- - cad_ex01_NX.py (this file)
12
- - cad_ex01_NX.prt
13
- - cad_ex01_NX.femprj
14
- """
15
-
16
- import os
17
-
18
- from win32com.client import constants
19
-
20
- from pyfemtet.opt import FEMOpt
21
- from pyfemtet.opt.interface import FemtetWithNXInterface
22
- from pyfemtet.core import ModelError
23
-
24
-
25
- here, me = os.path.split(__file__)
26
- os.chdir(here)
27
-
28
-
29
- def von_mises(Femtet):
30
- """Obtain the maximum von Mises stress of the model.
31
-
32
- Note:
33
- The objective or constraint function should take Femtet
34
- as its first argument and return a float as the output.
35
-
36
- Warning:
37
- CAD integration may assign boundary conditions to unintended locations.
38
-
39
- In this example, if the boundary conditions are assigned as intended,
40
- the maximum z displacement is always negative.
41
- If the maximum displacement is not negative, it is assumed that
42
- boundary condition assignment has failed.
43
- Then this function raises a ModelError.
44
-
45
- If a ModelError, MeshError, or SolveError occurs during optimization,
46
- the optimization process considers the attempt a failure and skips to
47
- the next trial.
48
- """
49
-
50
- # Simple check for the correctness of boundary conditions.
51
- dx, dy, dz = Femtet.Gogh.Galileo.GetMaxDisplacement_py()
52
- if dz >= 0:
53
- raise ModelError('Assigning unintended boundary conditions.')
54
-
55
- # Von Mises stress calculation.
56
- Gogh = Femtet.Gogh
57
- Gogh.Galileo.Potential = constants.GALILEO_VON_MISES_C
58
- succeed, (x, y, z), mises = Gogh.Galileo.GetMAXPotentialPoint_py(constants.CMPX_REAL_C)
59
-
60
- return mises
61
-
62
-
63
- def mass(Femtet):
64
- """Obtain model mass."""
65
- return Femtet.Gogh.Galileo.GetMass('H_beam')
66
-
67
-
68
- def C_minus_B(Femtet, opt):
69
- """Calculate the difference between C and B dimensions.
70
-
71
- Another example uses the following snippet to access design variables:
72
-
73
- A = Femtet.GetVariableValue('A')
74
-
75
- However, when performing CAD integration, this method does not work
76
- because the variables are not set in the .femprj file.
77
-
78
- In CAD integration, design variables are obtained in the following way.
79
-
80
- # How to obtain a dictionary with the variable names of parameters
81
- # added by add_parameter() as keys.
82
- params: dict = opt.get_parameter()
83
- A = params['A']
84
-
85
- Or
86
-
87
- # How to obtain an array of values of parameters added in the order
88
- # by add_parameter().
89
- values: np.ndarray = opt.get_parameter('values')
90
- A, B, C = values
91
-
92
- Objective functions and constraint functions can take arbitrary variables
93
- after the first argument.
94
- The FEMOpt member variable `opt` has a method called get_parameter().
95
- This method allows you to retrieve design variables added by add_parameter().
96
- By taking `opt` as the second argument, you can execute get_parameter()
97
- within the objective or constraint function to retrieve design variables.
98
- """
99
- A, B, C = opt.get_parameter('values')
100
- return C - B
101
-
102
-
103
- if __name__ == '__main__':
104
-
105
- # Initialize NX-Femtet integration object.
106
- # At this point, Python is connected to the Femtet.
107
- fem = FemtetWithNXInterface(
108
- prt_path='cad_ex01_NX.prt',
109
- open_result_with_gui=False, # To calculate von Mises stress, set this argument to False. See Femtet Macro Help.
110
- export_curves=False,
111
- export_surfaces=False,
112
- export_solids=True,
113
- export_flattened_assembly=False,
114
- )
115
-
116
- # Initialize the FEMOpt object.
117
- # (establish connection between the optimization problem and Femtet)
118
- femopt = FEMOpt(fem=fem)
119
-
120
- # Add design variables to the optimization problem.
121
- # (Specify the variables registered in the femprj file.)
122
- femopt.add_parameter('A', 10, lower_bound=1, upper_bound=59)
123
- femopt.add_parameter('B', 10, lower_bound=1, upper_bound=40)
124
- femopt.add_parameter('C', 20, lower_bound=5, upper_bound=59)
125
-
126
- # Add the constraint function to the optimization problem.
127
- femopt.add_constraint(C_minus_B, 'C>B', lower_bound=1, args=femopt.opt)
128
-
129
- # Add the objective function to the optimization problem.
130
- femopt.add_objective(von_mises, name='von Mises (Pa)')
131
- femopt.add_objective(mass, name='mass (kg)')
132
-
133
- # Run optimization.
134
- femopt.set_random_seed(42)
135
- femopt.optimize(n_trials=20)
@@ -1,23 +0,0 @@
1
- "{""femprj_path"": null, ""model_name"": ""Analysis Model""}",prm,prm_lb,prm_ub,prm,prm_lb,prm_ub,prm,prm_lb,prm_ub,obj,obj_direction,obj,obj_direction,,cns,cns_lb,cns_ub,,,,
2
- ,,,,,,,,,,,,,,,,,,,,,
3
- trial,A,A_lower_bound,A_upper_bound,B,B_lower_bound,B_upper_bound,C,C_lower_bound,C_upper_bound,von Mises (Pa),von Mises (Pa)_direction,mass (kg),mass (kg)_direction,non_domi,C>B,C>B_lower_bound,C>B_upper_bound,feasible,hypervolume,message,time
4
- 1,10.0,1.0,59.0,10.0,1.0,40.0,20.0,5.0,59.0,12187480208.414427,minimize,5.615241407210086,minimize,True,10.0,1,,True,0.0,initial,2024-07-24 09:50:32.097923
5
- 2,35.722192083428126,1.0,59.0,7.084726977255024,1.0,40.0,13.423704098154943,5.0,59.0,7519676665.53638,minimize,8.728900507395284,minimize,False,6.338977120899918,1,,True,0.0,,2024-07-24 09:50:46.512275
6
- 3,42.06820951217064,1.0,59.0,1.8027952775362954,1.0,40.0,57.37513201674769,5.0,59.0,22480675646.096836,minimize,9.011481291190496,minimize,False,55.572336739211394,1,,True,0.0,,2024-07-24 09:51:01.360991
7
- 4,49.28167316642446,1.0,59.0,9.28122531645277,1.0,40.0,14.818548229183433,5.0,59.0,4473829483.306867,minimize,11.38617808276437,minimize,True,5.537322912730662,1,,True,4203391875.452818,,2024-07-24 09:51:10.100850
8
- 5,11.637461571499161,1.0,59.0,12.865447475421972,1.0,40.0,33.33684730814085,5.0,59.0,9250865273.829187,minimize,7.638439032091176,minimize,True,20.471399832718873,1,,True,7878103684.844186,,2024-07-24 09:51:18.443756
9
- 6,26.052811081242716,1.0,59.0,12.357936467723635,1.0,40.0,38.04005631500849,5.0,59.0,5608846597.7734165,minimize,10.015718884236131,minimize,True,25.68211984728486,1,,True,18883770151.979397,,2024-07-24 09:51:26.735550
10
- 7,9.090643917818426,1.0,59.0,12.393641292873507,1.0,40.0,24.78353953785935,5.0,59.0,9677909990.12775,minimize,6.4477508178425245,minimize,True,12.389898244985844,1,,True,23875008147.791668,,2024-07-24 09:51:34.794313
11
- 8,21.441337720814797,1.0,59.0,18.072617642299363,1.0,40.0,45.21168857033972,5.0,59.0,4042233022.9095497,minimize,11.546379519585152,minimize,True,27.139070928040354,1,,True,26863123829.53503,,2024-07-24 09:51:50.555086
12
- 9,37.73538456111445,1.0,59.0,2.051023324497365,1.0,40.0,5.434182199522157,5.0,59.0,49467429429.04644,minimize,7.690690579272188,minimize,False,3.383158875024792,1,,True,26863123829.53503,,2024-07-24 09:52:00.042133
13
- 10,34.35890124528135,1.0,59.0,6.2478110218036935,1.0,40.0,23.49586366183886,5.0,59.0,7426521617.115658,minimize,8.713041181770238,minimize,True,17.24805264003517,1,,True,26999590015.41306,,2024-07-24 09:52:08.391160
14
- 11,33.07122876558135,1.0,59.0,16.015501119793537,1.0,40.0,24.772488687883417,5.0,59.0,4967659892.43169,minimize,10.571545999177301,minimize,True,8.75698756808988,1,,True,29376121818.648865,,2024-07-24 09:52:17.118345
15
- 12,44.49232391461052,1.0,59.0,6.594534954244819,1.0,40.0,31.754020417753264,5.0,59.0,5722567823.730824,minimize,10.860949688986132,minimize,False,25.159485463508446,1,,True,29376121818.648865,,2024-07-24 09:52:25.653325
16
- 13,58.768958841351264,1.0,59.0,5.331491062142676,1.0,40.0,29.653341259152,5.0,59.0,6504123574.132211,minimize,12.846059384800473,minimize,False,24.321850197009326,1,,True,29376121818.648865,,2024-07-24 09:52:34.300756
17
- 14,41.931667740603416,1.0,59.0,15.432432848846828,1.0,40.0,25.249518595235475,5.0,59.0,3944370145.7178416,minimize,11.794198824024951,minimize,True,9.817085746388647,1,,True,29898453080.38972,,2024-07-24 09:52:49.958108
18
- 15,36.816310624574804,1.0,59.0,10.138554917176371,1.0,40.0,18.890867424341323,5.0,59.0,5890926471.473402,minimize,9.793323153548432,minimize,True,8.752312507164952,1,,True,29905143965.590454,,2024-07-24 09:52:58.152601
19
- 16,50.4663695486681,1.0,59.0,5.90091414254359,1.0,40.0,29.425620895390857,5.0,59.0,6756288747.227509,minimize,11.575200835069767,minimize,False,23.524706752847266,1,,True,29905143965.590454,,2024-07-24 09:53:06.781909
20
- 17,33.00960738761119,1.0,59.0,3.647820207249005,1.0,40.0,57.34057201063078,5.0,59.0,11701146103.834673,minimize,8.422141022544057,minimize,False,53.692751803381775,1,,True,29905143965.590454,,2024-07-24 09:53:15.773832
21
- 18,29.89239146401912,1.0,59.0,21.093464343210364,1.0,40.0,38.1038646366275,5.0,59.0,4562525040.83442,minimize,12.253735414187783,minimize,False,17.010400293417135,1,,True,29905143965.590454,,2024-07-24 09:53:24.116460
22
- 19,39.65771866413639,1.0,59.0,11.726584835682985,1.0,40.0,44.63063781981377,5.0,59.0,4738124374.9653225,minimize,12.384862721051968,minimize,False,32.904052984130786,1,,True,29905143965.590454,,2024-07-24 09:53:32.782403
23
- 20,10.443255153670096,1.0,59.0,7.644383519738286,1.0,40.0,19.30571184104179,5.0,59.0,12772033981.056494,minimize,4.957198530620907,minimize,True,11.661328321303506,1,,True,30246653770.046047,,2024-07-24 09:53:41.944991
@@ -1,131 +0,0 @@
1
- """External CAD (SOLIDWORKS) Integration
2
-
3
- Using Femtet's stress analysis solver and Dassault Systemes' CAD software SOLIDWORKS,
4
- design a lightweight and high-strength H-shaped beam.
5
-
6
- As a preliminary step, please perform the following procedures:
7
- - Install SOLIDWORKS
8
- - Create a C:\temp folder
9
- - Note: SOLIDWORKS will save a .x_t file in this folder.
10
- - Place the following files in the same folder:
11
- - cad_ex01_SW.py (this file)
12
- - cad_ex01_SW.SLDPRT
13
- - cad_ex01_SW.femprj
14
- """
15
-
16
- import os
17
-
18
- from win32com.client import constants
19
-
20
- from pyfemtet.opt import FEMOpt
21
- from pyfemtet.opt.interface import FemtetWithSolidworksInterface
22
- from pyfemtet.core import ModelError
23
-
24
-
25
- here, me = os.path.split(__file__)
26
- os.chdir(here)
27
-
28
-
29
- def von_mises(Femtet):
30
- """Obtain the maximum von Mises stress of the model.
31
-
32
- Note:
33
- The objective or constraint function should take Femtet
34
- as its first argument and return a float as the output.
35
-
36
- Warning:
37
- CAD integration may assign boundary conditions to unintended locations.
38
-
39
- In this example, if the boundary conditions are assigned as intended,
40
- the maximum z displacement is always negative.
41
- If the maximum displacement is not negative, it is assumed that
42
- boundary condition assignment has failed.
43
- Then this function raises a ModelError.
44
-
45
- If a ModelError, MeshError, or SolveError occurs during optimization,
46
- the optimization process considers the attempt a failure and skips to
47
- the next trial.
48
- """
49
-
50
- # Simple check for the correctness of boundary conditions.
51
- dx, dy, dz = Femtet.Gogh.Galileo.GetMaxDisplacement_py()
52
- if dz >= 0:
53
- raise ModelError('Assigning unintended boundary conditions.')
54
-
55
- # Von Mises stress calculation.
56
- Gogh = Femtet.Gogh
57
- Gogh.Galileo.Potential = constants.GALILEO_VON_MISES_C
58
- succeed, (x, y, z), mises = Gogh.Galileo.GetMAXPotentialPoint_py(constants.CMPX_REAL_C)
59
-
60
- return mises
61
-
62
-
63
- def mass(Femtet):
64
- """Obtain model mass."""
65
- return Femtet.Gogh.Galileo.GetMass('H_beam')
66
-
67
-
68
- def C_minus_B(Femtet, opt):
69
- """Calculate the difference between C and B dimensions.
70
-
71
- Another example uses the following snippet to access design variables:
72
-
73
- A = Femtet.GetVariableValue('A')
74
-
75
- However, when performing CAD integration, this method does not work
76
- because the variables are not set in the .femprj file.
77
-
78
- In CAD integration, design variables are obtained in the following way.
79
-
80
- # How to obtain a dictionary with the variable names of parameters
81
- # added by add_parameter() as keys.
82
- params: dict = opt.get_parameter()
83
- A = params['A']
84
-
85
- Or
86
-
87
- # How to obtain an array of values of parameters added in the order
88
- # by add_parameter().
89
- values: np.ndarray = opt.get_parameter('values')
90
- A, B, C = values
91
-
92
- Objective functions and constraint functions can take arbitrary variables
93
- after the first argument.
94
- The FEMOpt member variable `opt` has a method called get_parameter().
95
- This method allows you to retrieve design variables added by add_parameter().
96
- By taking `opt` as the second argument, you can execute get_parameter()
97
- within the objective or constraint function to retrieve design variables.
98
- """
99
- A, B, C = opt.get_parameter('values')
100
- return C - B
101
-
102
-
103
- if __name__ == '__main__':
104
-
105
- # Initialize NX-Femtet integration object.
106
- # At this point, Python is connected to the Femtet.
107
- fem = FemtetWithSolidworksInterface(
108
- sldprt_path='cad_ex01_SW.SLDPRT',
109
- open_result_with_gui=False, # To calculate von Mises stress, set this argument to False. See Femtet Macro Help.
110
- )
111
-
112
- # Initialize the FEMOpt object.
113
- # (establish connection between the optimization problem and Femtet)
114
- femopt = FEMOpt(fem=fem)
115
-
116
- # Add design variables to the optimization problem.
117
- # (Specify the variables registered in the femprj file.)
118
- femopt.add_parameter('A', 10, lower_bound=1, upper_bound=59)
119
- femopt.add_parameter('B', 10, lower_bound=1, upper_bound=40)
120
- femopt.add_parameter('C', 20, lower_bound=5, upper_bound=59)
121
-
122
- # Add the constraint function to the optimization problem.
123
- femopt.add_constraint(C_minus_B, 'C>B', lower_bound=1, args=femopt.opt)
124
-
125
- # Add the objective function to the optimization problem.
126
- femopt.add_objective(von_mises, name='von Mises (Pa)')
127
- femopt.add_objective(mass, name='mass (kg)')
128
-
129
- # Run optimization.
130
- femopt.set_random_seed(42)
131
- femopt.optimize(n_trials=20)
@@ -1,23 +0,0 @@
1
- "{""femprj_path"": null, ""model_name"": ""Analysis Model""}",prm,prm_lb,prm_ub,prm,prm_lb,prm_ub,prm,prm_lb,prm_ub,obj,obj_direction,obj,obj_direction,,cns,cns_lb,cns_ub,,,,
2
- ,,,,,,,,,,,,,,,,,,,,,
3
- trial,A,A_lower_bound,A_upper_bound,B,B_lower_bound,B_upper_bound,C,C_lower_bound,C_upper_bound,von Mises (Pa),von Mises (Pa)_direction,mass (kg),mass (kg)_direction,non_domi,C>B,C>B_lower_bound,C>B_upper_bound,feasible,hypervolume,message,time
4
- 1,10.0,1.0,59.0,10.0,1.0,40.0,20.0,5.0,59.0,10713610908.24202,minimize,5.615241407210081,minimize,True,10.0,1,,True,0.0,initial,2024-07-24 09:54:50.307882
5
- 2,35.722192083428126,1.0,59.0,7.084726977255024,1.0,40.0,13.423704098154943,5.0,59.0,6451312936.468065,minimize,8.728900507478476,minimize,True,6.338977120899918,1,,True,145876137626.11978,,2024-07-24 09:54:53.688085
6
- 3,42.06820951217064,1.0,59.0,1.8027952775362954,1.0,40.0,57.37513201674769,5.0,59.0,24065344414.778633,minimize,9.011481292235954,minimize,False,55.572336739211394,1,,True,145876137626.11978,,2024-07-24 09:54:57.979731
7
- 4,49.28167316642446,1.0,59.0,9.28122531645277,1.0,40.0,14.818548229183433,5.0,59.0,5503645118.524387,minimize,11.386178083846733,minimize,False,5.537322912730662,1,,True,145876137626.11978,,2024-07-24 09:55:01.056168
8
- 5,11.637461571499161,1.0,59.0,12.865447475421972,1.0,40.0,33.33684730814085,5.0,59.0,11438869243.373928,minimize,7.638439033366426,minimize,False,20.471399832718873,1,,True,145876137626.11978,,2024-07-24 09:55:03.859850
9
- 6,26.052811081242716,1.0,59.0,12.357936467723635,1.0,40.0,38.04005631500849,5.0,59.0,5495681889.607063,minimize,10.01571888509523,minimize,True,25.68211984728486,1,,True,153516179853.76138,,2024-07-24 09:55:06.837354
10
- 7,9.090643917818426,1.0,59.0,12.393641292873507,1.0,40.0,24.78353953785935,5.0,59.0,9483855035.111774,minimize,6.447750817595856,minimize,True,12.389898244985844,1,,True,153999396463.2158,,2024-07-24 09:55:09.733585
11
- 8,37.99457827883769,1.0,59.0,1.5209697385859142,1.0,40.0,23.897679644327795,5.0,59.0,30406250170.856964,minimize,7.778758622447119,minimize,False,22.37670990574188,1,,True,153999396463.2158,,2024-07-24 09:55:13.314997
12
- 9,34.35890124528135,1.0,59.0,6.2478110218036935,1.0,40.0,12.678079497056089,5.0,59.0,8761031684.825426,minimize,8.28729418409825,minimize,True,6.4302684752523955,1,,True,156804653691.83817,,2024-07-24 09:55:17.128276
13
- 10,16.48548223083144,1.0,59.0,15.540089806204016,1.0,40.0,47.73934394149744,5.0,59.0,5443514483.782774,minimize,10.442763870961809,minimize,True,32.19925413529342,1,,True,157123857054.0115,,2024-07-24 09:55:20.740157
14
- 11,31.61117579574186,1.0,59.0,6.349996259293115,1.0,40.0,19.822188557253973,5.0,59.0,9074520374.76584,minimize,8.13162247977363,minimize,True,13.47219229796086,1,,True,157127957770.34027,,2024-07-24 09:55:23.753393
15
- 12,45.77159271804414,1.0,59.0,6.286691200972086,1.0,40.0,11.516115144447737,5.0,59.0,7146383394.662491,minimize,10.180750385294035,minimize,False,5.22942394347565,1,,True,157127957770.34027,,2024-07-24 09:55:27.065773
16
- 13,25.856967098172454,1.0,59.0,13.177162500962542,1.0,40.0,39.81237900447662,5.0,59.0,7865665149.924187,minimize,10.363696138818305,minimize,False,26.635216503514076,1,,True,157127957770.34027,,2024-07-24 09:55:30.765081
17
- 14,21.401950687804057,1.0,59.0,11.148262705918398,1.0,40.0,32.95590234333009,5.0,59.0,7221556874.706432,minimize,8.579324905603093,minimize,True,21.80763963741169,1,,True,157191679594.55545,,2024-07-24 09:55:33.521637
18
- 15,12.670878704766015,1.0,59.0,4.379466144113291,1.0,40.0,10.277664459492886,5.0,59.0,28528452444.874542,minimize,3.9668848228126214,minimize,True,5.898198315379595,1,,True,157421947465.85098,,2024-07-24 09:55:36.562223
19
- 16,7.797785002291775,1.0,59.0,8.535545896262494,1.0,40.0,57.34057201063078,5.0,59.0,13421903355.914164,minimize,6.845257989137097,minimize,False,48.80502611436829,1,,True,157421947465.85098,,2024-07-24 09:55:39.711790
20
- 17,6.384676158645501,1.0,59.0,2.9595622079140185,1.0,40.0,21.66854065738089,5.0,59.0,40100488412.84058,minimize,2.582077175952352,minimize,True,18.708978449466873,1,,True,177068059660.24457,,2024-07-24 09:55:43.519329
21
- 18,1.2749269398791796,1.0,59.0,4.355873741157909,1.0,40.0,50.335120552067295,5.0,59.0,66671888609.68277,minimize,3.061340758008378,minimize,False,45.97924681090939,1,,True,177068059660.24457,,2024-07-24 09:55:46.497664
22
- 19,6.676161230791632,1.0,59.0,3.799493060906398,1.0,40.0,21.166583460985745,5.0,59.0,29298549516.19457,minimize,2.980158111433043,minimize,True,17.36709040007935,1,,True,177547992085.38452,,2024-07-24 09:55:50.730197
23
- 20,8.206418867626418,1.0,59.0,9.303411630645828,1.0,40.0,25.37658417274892,5.0,59.0,13800596362.955494,minimize,5.449166488749558,minimize,True,16.073172542103094,1,,True,188206553729.3952,,2024-07-24 09:55:53.707442
@@ -1,96 +0,0 @@
1
- """A sample to implement constrained optimization.
2
-
3
- This section describes the types of constraints and
4
- the steps to run optimization on models that require them.
5
-
6
- """
7
-
8
- from pyfemtet.opt import FEMOpt, OptunaOptimizer
9
- from pyfemtet.opt.optimizer import PoFBoTorchSampler
10
-
11
-
12
- def mises_stress(Femtet):
13
- """Calculate the von Mises stress as the objective function.
14
-
15
- This function is called automatically by the FEMOpt
16
- object while the optimization is running.
17
-
18
- Args:
19
- Femtet: When defining an objective or constraint
20
- function using PyFemtet, the first argument
21
- must take a Femtet instance.
22
-
23
- Returns:
24
- float: A single float representing the expression value you want to constrain.
25
- """
26
- return Femtet.Gogh.Galileo.GetMaxStress_py()[2]
27
-
28
-
29
- def radius_diff(Femtet, opt):
30
- """Calculate the difference between the outer and inner radii of the pipe.
31
-
32
- This constraint is called to ensure that the
33
- inner radius of the pipe does not exceed the
34
- outer radius while the optimization is running.
35
-
36
- Note:
37
- If you are using BoTorchSampler of OptunaOptimizer
38
- and use strict constraints, be aware that accessing
39
- the Femtet can be very slow, as it requires repeated
40
- calculations to propose parameters.
41
- We recommend that you do not access the Femtet,
42
- but rather get the parameters and perform the
43
- calculations via the Optimizer object, as in this
44
- function example.
45
-
46
- NOT recommended::
47
-
48
- p = Femtet.GetVariableValue('p')
49
-
50
- instead, use optimizer::
51
-
52
- params = opt.get_parameter()
53
- p = params['p']
54
-
55
- Args:
56
- Femtet: When defining an objective or constraint
57
- function using PyFemtet, the first argument
58
- must take a Femtet instance.
59
- opt: This object allows you to obtain the outer
60
- radius and inner radius values without going
61
- through Femtet.
62
- """
63
- params = opt.get_parameter()
64
- internal_r = params['internal_r']
65
- external_r = params['external_r']
66
- return external_r - internal_r
67
-
68
- if __name__ == '__main__':
69
- # Setup optimization method
70
- opt = OptunaOptimizer(
71
- sampler_class=PoFBoTorchSampler,
72
- sampler_kwargs=dict(
73
- n_startup_trials=3, # The first three samples are randomly sampled.
74
- )
75
- )
76
- femopt = FEMOpt(opt=opt)
77
-
78
- # Add parameters
79
- femopt.add_parameter("external_r", 10, lower_bound=0.1, upper_bound=10)
80
- femopt.add_parameter("internal_r", 5, lower_bound=0.1, upper_bound=10)
81
-
82
- # Add the strict constraint not to exceed the
83
- # outer radius while the optimization is running.
84
- femopt.add_constraint(
85
- radius_diff, # Constraint function (returns external radius - internal radius).
86
- name='wall thickness', # You can name the function anything you want.
87
- lower_bound=1, # Lower bound of constraint function (set minimum wall thickness is 1).
88
- args=(femopt.opt,) # Additional arguments passed to the function.
89
- )
90
-
91
- # Add the objective
92
- femopt.add_objective(mises_stress, name='Mises Stress')
93
-
94
- # Run optimization.
95
- femopt.set_random_seed(42)
96
- femopt.optimize(n_trials=10)
@@ -1,13 +0,0 @@
1
- "",prm,prm_lb,prm_ub,prm,prm_lb,prm_ub,obj,obj_direction,,cns,cns_lb,cns_ub,,,,
2
- ,,,,,,,,,,,,,,,,
3
- trial,external_r,external_r_lower_bound,external_r_upper_bound,internal_r,internal_r_lower_bound,internal_r_upper_bound,Mises Stress,Mises Stress_direction,non_domi,wall thickness,wall thickness_lower_bound,wall thickness_upper_bound,feasible,hypervolume,message,time
4
- 1,10.0,0.1,10.0,5.0,0.1,10.0,2369132.9299968677,minimize,False,5.0,1,,True,-1.0,initial,2024-09-17 14:52:32.436730
5
- 2,7.34674002393291,0.1,10.0,6.026718993550662,0.1,10.0,5797829.750527166,minimize,False,1.3200210303822484,1,,True,-1.0,,2024-09-17 14:52:42.927138
6
- 3,8.341182143924176,0.1,10.0,2.202157195714934,0.1,10.0,1977631.590419345,minimize,False,6.139024948209242,1,,True,-1.0,,2024-09-17 14:52:54.382893
7
- 4,9.999999999999995,0.1,10.0,0.6764719819158711,0.1,10.0,1514026.80705058,minimize,False,9.323528018084124,1,,True,-1.0,,2024-09-17 14:53:32.128331
8
- 5,7.61174007452904,0.1,10.0,0.10000000000001566,0.1,10.0,398224.5447358758,minimize,True,7.511740074529024,1,,True,-1.0,,2024-09-17 14:54:08.541865
9
- 6,5.026961232239628,0.1,10.0,0.10000000000001101,0.1,10.0,485322.32959281537,minimize,False,4.926961232239617,1,,True,-1.0,,2024-09-17 14:54:39.695340
10
- 7,1.1000000916874046,0.1,10.0,0.1,0.1,10.0,613872.6231008903,minimize,False,1.0000000916874046,1,,True,-1.0,,2024-09-17 14:55:07.711879
11
- 8,3.122874622702614,0.1,10.0,0.1,0.1,10.0,497544.0108231131,minimize,False,3.0228746227026138,1,,True,-1.0,,2024-09-17 14:55:41.036763
12
- 9,9.999999999999998,0.1,10.0,3.7062659141309533,0.1,10.0,2092780.7380693094,minimize,False,6.293734085869045,1,,True,-1.0,,2024-09-17 14:56:28.269065
13
- 10,6.601571760977393,0.1,10.0,0.10000000004171199,0.1,10.0,456263.04356135987,minimize,False,6.501571760935681,1,,True,-1.0,,2024-09-17 14:57:04.427906
@@ -1,74 +0,0 @@
1
- """Single-objective optimization: bending with consideration for springback.
2
-
3
- Using Femtet's stress analysis solver, we will determine the bending angle
4
- to achieve the desired material bend angle with consideration for springback.
5
- Elasto-plastic analysis is available in an optional package.
6
-
7
- Corresponding project: gal_ex58_parametric.femprj
8
- """
9
- import numpy as np
10
- from win32com.client import constants
11
- from optuna.integration.botorch import BoTorchSampler
12
-
13
- from pyfemtet.opt import FEMOpt, OptunaOptimizer
14
-
15
-
16
- def bending(Femtet):
17
- """Get the material bend angle.
18
-
19
- Note:
20
- The objective or constraint function should take Femtet
21
- as its first argument and return a float as the output.
22
-
23
- Params:
24
- Femtet: This is an instance for manipulating Femtet with macros. For detailed information, please refer to "Femtet Macro Help".
25
-
26
- Returns:
27
- float: material bend angle.
28
- """
29
- Gogh = Femtet.Gogh
30
-
31
- # Set the mode after unloading.
32
- Gogh.Galileo.Mode = Gogh.Galileo.nMode - 1
33
-
34
- # Obtain the displacement of the measurement target point.
35
- Gogh.Galileo.Vector = constants.GALILEO_DISPLACEMENT_C
36
- succeed, (x, y, z) = Gogh.Galileo.GetVectorAtPoint_py(200, 0, 0)
37
-
38
- # Calculate the angle formed by the line segment
39
- # connecting the bending origin (100, 0) and the
40
- # deformed point with the X-axis.
41
- bending_point = np.array((100, 0))
42
- bended_point = np.array((200 + 1000 * x.Real, 1000 * z.Real))
43
- dx, dz = bended_point - bending_point
44
- degree = np.arctan2(-dz, dx)
45
-
46
- return degree * 360 / (2*np.pi) # unit: degree
47
-
48
-
49
- if __name__ == '__main__':
50
-
51
- # Initialize the numerical optimization problem.
52
- # (determine the optimization method)
53
- opt = OptunaOptimizer(
54
- sampler_class=BoTorchSampler,
55
- sampler_kwargs=dict(
56
- n_startup_trials=3,
57
- )
58
- )
59
-
60
- # Initialize the FEMOpt object.
61
- # (establish connection between the optimization problem and Femtet)
62
- femopt = FEMOpt(opt=opt)
63
-
64
- # Add design variables to the optimization problem.
65
- # (Specify the variables registered in the femprj file.)
66
- femopt.add_parameter("rot", 90, lower_bound=80, upper_bound=100)
67
-
68
- # Add the objective function to the optimization problem.
69
- # The target bending angle is 90 degrees.
70
- femopt.add_objective(bending, name='final angle (degree)', direction=90)
71
-
72
- # Run optimization.
73
- femopt.set_random_seed(42)
74
- femopt.optimize(n_trials=10)
@@ -1,13 +0,0 @@
1
- "",prm,prm_lb,prm_ub,obj,obj_direction,,,,,
2
- ,,,,,,,,,,
3
- trial,rot,rot_lower_bound,rot_upper_bound,final angle (degree),final angle (degree)_direction,non_domi,feasible,hypervolume,message,time
4
- 1,90.0,80.0,100.0,81.62540666214329,90,False,True,-1.0,initial,2024-07-24 10:57:24.248429
5
- 2,87.49080237694724,80.0,100.0,79.02571753406903,90,False,True,-1.0,,2024-07-24 10:57:27.596882
6
- 3,99.01428612819832,80.0,100.0,90.96145916607375,90,False,True,-1.0,,2024-07-24 10:57:31.010370
7
- 4,99.99999999999999,80.0,100.0,91.89033160850201,90,False,True,-1.0,,2024-07-24 10:57:34.878708
8
- 5,96.87624029068405,80.0,100.0,88.88281351640448,90,False,True,-1.0,,2024-07-24 10:57:38.443873
9
- 6,97.86932823598721,80.0,100.0,89.88148176887373,90,False,True,-1.0,,2024-07-24 10:57:42.063686
10
- 7,80.0,80.0,100.0,71.5309188592805,90,False,True,-1.0,,2024-07-24 10:57:45.658223
11
- 8,97.6356229310297,80.0,100.0,89.64880326597084,90,False,True,-1.0,,2024-07-24 10:57:49.220276
12
- 9,98.08539472199536,80.0,100.0,90.07549754912081,90,True,True,-1.0,,2024-07-24 10:57:52.882134
13
- 10,93.84354938661555,80.0,100.0,85.71599925662619,90,False,True,-1.0,,2024-07-24 10:57:56.448858
@@ -1,58 +0,0 @@
1
- """Single-objective optimization: Self-inductance of a finite-length helical coil.
2
-
3
- Using Femtet's magnetic field analysis solver, design to achieve
4
- the target value for the self-inductance of a finite-length helical coil.
5
-
6
- Corresponding project: gau_ex08_parametric.femprj
7
- """
8
- from optuna.integration.botorch import BoTorchSampler
9
- from pyfemtet.opt import FEMOpt, OptunaOptimizer
10
-
11
-
12
- def inductance(Femtet):
13
- """Obtain the self-inductance.
14
-
15
- Note:
16
- The objective or constraint function should take Femtet
17
- as its first argument and return a float as the output.
18
-
19
- Params:
20
- Femtet: This is an instance for manipulating Femtet with macros. For detailed information, please refer to "Femtet Macro Help".
21
-
22
- Returns:
23
- float: Self-inductance.
24
- """
25
- Gogh = Femtet.Gogh
26
-
27
- coil_name = Gogh.Gauss.GetCoilList()[0]
28
- return Gogh.Gauss.GetL(coil_name, coil_name) # unit: F
29
-
30
-
31
- if __name__ == '__main__':
32
-
33
- # Initialize the numerical optimization problem.
34
- # (determine the optimization method)
35
- opt = OptunaOptimizer(
36
- sampler_class=BoTorchSampler,
37
- sampler_kwargs=dict(
38
- n_startup_trials=5,
39
- )
40
- )
41
-
42
- # Initialize the FEMOpt object.
43
- # (establish connection between the optimization problem and Femtet)
44
- femopt = FEMOpt(opt=opt)
45
-
46
- # Add design variables to the optimization problem.
47
- # (Specify the variables registered in the femprj file.)
48
- femopt.add_parameter("helical_pitch", 6, lower_bound=4.2, upper_bound=8)
49
- femopt.add_parameter("coil_radius", 10, lower_bound=1, upper_bound=10)
50
- femopt.add_parameter("n_turns", 5, lower_bound=1, upper_bound=5)
51
-
52
- # Add the objective function to the optimization problem.
53
- # The target inductance is 0.1 uF.
54
- femopt.add_objective(inductance, name='self-inductance (F)', direction=1e-7)
55
-
56
- # Run optimization.
57
- femopt.set_random_seed(42)
58
- femopt.optimize(n_trials=20)
@@ -1,23 +0,0 @@
1
- "{""femprj_path"": null, ""model_name"": ""ex8""}",prm,prm_lb,prm_ub,prm,prm_lb,prm_ub,prm,prm_lb,prm_ub,obj,obj_direction,,,,,
2
- ,,,,,,,,,,,,,,,,
3
- trial,helical_pitch,helical_pitch_lower_bound,helical_pitch_upper_bound,coil_radius,coil_radius_lower_bound,coil_radius_upper_bound,n_turns,n_turns_lower_bound,n_turns_upper_bound,self-inductance (F),self-inductance (F)_direction,non_domi,feasible,hypervolume,message,time
4
- 1,6.0,4.2,8.0,10.0,1.0,10.0,5.0,1.0,5.0,2.2519131001615743e-07,1e-07,False,True,-1.0,initial,2024-07-24 09:58:15.358912
5
- 2,5.623252451619978,4.2,8.0,9.556428757689245,1.0,10.0,3.9279757672456204,1.0,5.0,1.566960058810769e-07,1e-07,False,True,-1.0,,2024-07-24 09:58:19.258262
6
- 3,4.420717726239158,4.2,8.0,8.795585311974417,1.0,10.0,3.404460046972835,1.0,5.0,1.248686556706198e-07,1e-07,False,True,-1.0,,2024-07-24 09:58:23.877333
7
- 4,6.890675795624973,4.2,8.0,1.185260448662222,1.0,10.0,4.879639408647977,1.0,5.0,1.1068853339246818e-08,1e-07,False,True,-1.0,,2024-07-24 09:58:26.798210
8
- 5,7.363282035041603,4.2,8.0,2.9110519961044856,1.0,10.0,1.7272998688284025,1.0,5.0,5.928345320411823e-09,1e-07,False,True,-1.0,,2024-07-24 09:58:29.046402
9
- 6,4.506720164610959,4.2,8.0,8.847748295293755,1.0,10.0,3.369256043237217,1.0,5.0,1.2297792684115126e-07,1e-07,False,True,-1.0,,2024-07-24 09:58:33.300913
10
- 7,4.726319192706824,4.2,8.0,8.983609183728657,1.0,10.0,3.2249528933303577,1.0,5.0,1.1498139019761039e-07,1e-07,False,True,-1.0,,2024-07-24 09:58:37.272948
11
- 8,4.962549980320558,4.2,8.0,9.171627422480721,1.0,10.0,2.851110895485008,1.0,5.0,9.983020941290325e-08,1e-07,True,True,-1.0,,2024-07-24 09:58:41.746230
12
- 9,5.050776505064675,4.2,8.0,9.300811078672245,1.0,10.0,2.4947121172622975,1.0,5.0,8.3155685279894e-08,1e-07,False,True,-1.0,,2024-07-24 09:58:45.329267
13
- 10,5.000826194581878,4.2,8.0,9.199169607996211,1.0,10.0,2.8627720197139612,1.0,5.0,9.972903605466685e-08,1e-07,False,True,-1.0,,2024-07-24 09:58:49.405862
14
- 11,4.95860020375077,4.2,8.0,9.178798062739858,1.0,10.0,2.8575303624554946,1.0,5.0,1.0072301643095888e-07,1e-07,False,True,-1.0,,2024-07-24 09:58:53.695530
15
- 12,5.122546460811877,4.2,8.0,9.083931701720807,1.0,10.0,2.8617894824562873,1.0,5.0,9.647304150013922e-08,1e-07,False,True,-1.0,,2024-07-24 09:58:58.340271
16
- 13,4.764485683472439,4.2,8.0,9.862539991891884,1.0,10.0,2.8711470086976076,1.0,5.0,1.1533811097380779e-07,1e-07,False,True,-1.0,,2024-07-24 09:59:02.339150
17
- 14,4.968945595366566,4.2,8.0,9.161892011657752,1.0,10.0,2.8734870374362838,1.0,5.0,1.0056359149401165e-07,1e-07,False,True,-1.0,,2024-07-24 09:59:06.390307
18
- 15,4.859845797581561,4.2,8.0,9.26151325278322,1.0,10.0,2.8664730982646485,1.0,5.0,1.0218819608040895e-07,1e-07,False,True,-1.0,,2024-07-24 09:59:10.251527
19
- 16,4.973161997562328,4.2,8.0,9.184057459793724,1.0,10.0,2.8650256176749336,1.0,5.0,1.0070520417340285e-07,1e-07,False,True,-1.0,,2024-07-24 09:59:14.654137
20
- 17,4.969144305852682,4.2,8.0,9.169512917581903,1.0,10.0,2.8604997178931355,1.0,5.0,9.943667954213088e-08,1e-07,False,True,-1.0,,2024-07-24 09:59:18.304112
21
- 18,4.971098140849773,4.2,8.0,9.178412506598546,1.0,10.0,2.861253162496574,1.0,5.0,9.956172119870154e-08,1e-07,False,True,-1.0,,2024-07-24 09:59:22.125248
22
- 19,4.971607724219878,4.2,8.0,9.179995137812535,1.0,10.0,2.861038617389135,1.0,5.0,1.0069749441418149e-07,1e-07,False,True,-1.0,,2024-07-24 09:59:26.682442
23
- 20,4.9713095460170535,4.2,8.0,9.179603131437648,1.0,10.0,2.8608051498628724,1.0,5.0,9.93079291332147e-08,1e-07,False,True,-1.0,,2024-07-24 09:59:30.361099