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
@@ -0,0 +1,61 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import TYPE_CHECKING, TypeAlias
4
+
5
+ import platform
6
+
7
+
8
+ __all__ = [] # appended later
9
+
10
+
11
+ if platform.system() == 'Windows':
12
+
13
+ from pyfemtet.opt.interface._excel_interface import ExcelInterface
14
+
15
+ from pyfemtet.opt.interface._femtet_interface import FemtetInterface
16
+ from pyfemtet.opt.interface._femtet_with_nx_interface import FemtetWithNXInterface
17
+ from pyfemtet.opt.interface._femtet_with_solidworks import FemtetWithSolidworksInterface
18
+
19
+ from .with_excel_settings import _class_factory
20
+
21
+ if TYPE_CHECKING:
22
+ class FemtetWithExcelSettingsInterface(FemtetInterface, ExcelInterface):
23
+ init_excel = ExcelInterface
24
+ else:
25
+ FemtetWithExcelSettingsInterface = _class_factory(FemtetInterface)
26
+ __all__.append('FemtetWithExcelSettingsInterface')
27
+
28
+ if TYPE_CHECKING:
29
+ class FemtetWithNXWithExcelSettingsInterface(FemtetWithNXInterface, ExcelInterface):
30
+ def init_excel(self, *args, **kwargs):
31
+ pass
32
+ else:
33
+ FemtetWithNXWithExcelSettingsInterface = _class_factory(FemtetWithNXInterface)
34
+ __all__.append('FemtetWithNXWithExcelSettingsInterface')
35
+
36
+ if TYPE_CHECKING:
37
+ class FemtetWithSolidworksWithExcelSettingsInterface(FemtetWithSolidworksInterface, ExcelInterface):
38
+ def init_excel(self, *args, **kwargs):
39
+ pass
40
+ else:
41
+ FemtetWithSolidworksWithExcelSettingsInterface = _class_factory(FemtetWithSolidworksInterface)
42
+ __all__.append('FemtetWithSolidworksWithExcelSettingsInterface')
43
+
44
+
45
+ from pyfemtet.opt.interface._surrogate_model_interface import BoTorchInterface, PoFBoTorchInterface
46
+
47
+ if TYPE_CHECKING:
48
+ class BoTorchWithExcelSettingsInterface(BoTorchInterface, ExcelInterface):
49
+ def init_excel(self, *args, **kwargs):
50
+ pass
51
+ else:
52
+ BoTorchWithExcelSettingsInterface = _class_factory(BoTorchInterface)
53
+ __all__.append('BoTorchWithExcelSettingsInterface')
54
+
55
+ if TYPE_CHECKING:
56
+ class PoFBoTorchWithExcelSettingsInterface(PoFBoTorchInterface, ExcelInterface):
57
+ def init_excel(self, *args, **kwargs):
58
+ pass
59
+ else:
60
+ PoFBoTorchWithExcelSettingsInterface = _class_factory(PoFBoTorchInterface)
61
+ __all__.append('PoFBoTorchWithExcelSettingsInterface')
@@ -0,0 +1,134 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import TYPE_CHECKING
4
+
5
+ import re
6
+
7
+ from pyfemtet.opt.problem.problem import SupportedVariableTypes
8
+ from pyfemtet.opt.interface._base_interface import AbstractFEMInterface
9
+ from pyfemtet.opt.interface._excel_interface import ExcelInterface
10
+ from pyfemtet.opt.interface._femtet_interface import FemtetInterface
11
+
12
+ if TYPE_CHECKING:
13
+ from pyfemtet.opt.optimizer import AbstractOptimizer
14
+
15
+
16
+ def _get_name(FEMClass: type):
17
+ return FEMClass.__name__.removesuffix('Interface') + 'WithExcelSettingsInterface'
18
+
19
+
20
+ def _is_parametric_output(obj_name: str) -> bool:
21
+ if obj_name.startswith('パラメトリック結果出力'):
22
+ return True
23
+
24
+ return False
25
+
26
+
27
+ class ParametricNumberNotFoundError(Exception):
28
+ pass
29
+
30
+
31
+ def _get_parametric_output_number(obj_name: str) -> int:
32
+ # 最後のマッチを取得
33
+ matches = re.findall(r'\d+', obj_name)
34
+
35
+ if matches:
36
+ last_match = matches[-1]
37
+ return int(last_match)
38
+
39
+ else:
40
+ raise ParametricNumberNotFoundError(
41
+ 'Excel の設定シートからパラメトリック結果出力機能を'
42
+ '使うことを意図した目的名が検出されましたが、'
43
+ '出力番号が取得できませんでした。目的名には、'
44
+ 'パラメトリック結果出力番号を表す自然数を含めてください。'
45
+ '例:「パラメトリック結果出力 1 番」')
46
+
47
+
48
+ def _class_factory(FEMClass: type[AbstractFEMInterface]) -> type[AbstractFEMInterface]:
49
+
50
+ class _WithExcelSettingsInterface(FEMClass, ExcelInterface):
51
+
52
+ __name__ = _get_name(FEMClass=FEMClass)
53
+
54
+ # 構造が複雑で型ヒントが働かないため
55
+ _excel_initialized: bool
56
+ _load_problem_from_fem: bool
57
+
58
+ def init_excel(self, *args, **kwargs):
59
+ ExcelInterface.__init__(self, *args, **kwargs)
60
+ self._excel_initialized = True
61
+ self._load_problem_from_fem = True
62
+
63
+ def _setup_before_parallel(self):
64
+ assert self._excel_initialized, '最初に init_excel() を呼び出してください。'
65
+ ExcelInterface._setup_before_parallel(self)
66
+ FEMClass._setup_before_parallel(self)
67
+
68
+ def _setup_after_parallel(self, opt: AbstractOptimizer):
69
+ assert self._excel_initialized, '最初に init_excel() を呼び出してください。'
70
+ ExcelInterface._setup_after_parallel(self, opt)
71
+ FEMClass._setup_after_parallel(self, opt)
72
+
73
+ def load_variable(self, opt: AbstractOptimizer, raise_if_no_keyword=True) -> None:
74
+ assert self._excel_initialized, '最初に init_excel() を呼び出してください。'
75
+ ExcelInterface.load_variables(self, opt, raise_if_no_keyword)
76
+ FEMClass.load_variables(self, opt)
77
+
78
+ def load_objectives(self, opt: AbstractOptimizer, raise_if_no_keyword=False) -> None:
79
+ assert self._excel_initialized, '最初に init_excel() を呼び出してください。'
80
+ ExcelInterface.load_objectives(self, opt, raise_if_no_keyword)
81
+
82
+ # FEMClass が FemtetInterface なら
83
+ # この時点での objectives を列挙して
84
+ # 「パラメトリック」から始まる目的関数を
85
+ # 削除して parametric 結果出力の
86
+ # それに置き換える
87
+ if isinstance(self, FemtetInterface):
88
+
89
+ # 削除すべき obj を取得
90
+ obj_names_to_replace = []
91
+ for obj_name in opt.objectives.keys():
92
+ if _is_parametric_output(obj_name):
93
+ obj_names_to_replace.append(obj_name)
94
+
95
+ # 削除と置換の予約
96
+ for old_obj_name in obj_names_to_replace:
97
+
98
+ # 削除
99
+ old_obj = opt.objectives.pop(old_obj_name)
100
+
101
+ # 追加すべき内容の決定
102
+ self: FemtetInterface
103
+ self.use_parametric_output_as_objective(
104
+ number=_get_parametric_output_number(old_obj_name),
105
+ direction=old_obj.direction,
106
+ )
107
+
108
+ # parametric 結果出力の追加の実行
109
+ FemtetInterface.load_objectives(self, opt)
110
+
111
+ else:
112
+ FEMClass.load_objectives(self, opt)
113
+
114
+ def load_constraints(self, opt: AbstractOptimizer, raise_if_no_keyword=False) -> None:
115
+ assert self._excel_initialized, '最初に init_excel() を呼び出してください。'
116
+ ExcelInterface.load_constraints(self, opt, raise_if_no_keyword)
117
+ FEMClass.load_constraints(self, opt)
118
+
119
+ def update_parameter(self, x: SupportedVariableTypes) -> None:
120
+ assert self._excel_initialized, '最初に init_excel() を呼び出してください。'
121
+ ExcelInterface.update_parameter(self, x)
122
+ FEMClass.update_parameter(self, x)
123
+
124
+ def update(self) -> None:
125
+ assert self._excel_initialized, '最初に init_excel() を呼び出してください。'
126
+ ExcelInterface.update(self)
127
+ FEMClass.update(self)
128
+
129
+ def close(self):
130
+ assert self._excel_initialized, '最初に init_excel() を呼び出してください。'
131
+ ExcelInterface.close(self)
132
+ FEMClass.close(self)
133
+
134
+ return _WithExcelSettingsInterface
@@ -11,7 +11,7 @@ try:
11
11
  if __name__ == '__main__':
12
12
  print(f'pyfemtet {pyfemtet.__version__} starting.')
13
13
 
14
- from pyfemtet._message.messages import encoding
14
+ from pyfemtet._i18n import ENCODING
15
15
 
16
16
  from fire import Fire
17
17
  import yaml
@@ -21,11 +21,6 @@ try:
21
21
  from pyfemtet.opt import FEMOpt
22
22
  from pyfemtet.opt.interface import *
23
23
  from pyfemtet.opt.optimizer import *
24
- from pyfemtet.opt.interface._femtet_excel import FemtetWithExcelSettingsInterface
25
- from pyfemtet.opt.interface._surrogate_excel import PoFBoTorchInterfaceWithExcelSettingsInterface
26
-
27
- # for debug
28
- DEBUG = False
29
24
 
30
25
  class ContentContext:
31
26
 
@@ -62,13 +57,12 @@ try:
62
57
  yaml_path: str = None,
63
58
 
64
59
  interface_class: str = None, # including parameter definition excel
65
- interface_kwargs: str = None, # including Parametric Analysis Output
60
+ interface_kwargs: str | dict = None, # including Parametric Analysis Output
66
61
  optimizer_class: str = None,
67
- optimizer_kwargs: str = None,
68
- femopt_kwargs: str = None,
62
+ optimizer_kwargs: str | dict = None,
69
63
  seed: str = 'null',
70
- optimize_kwargs: str = None,
71
- additional_module_paths: list[str] = None,
64
+ optimize_kwargs: str | dict = None,
65
+ additional_module_paths: str | list[str] = None,
72
66
 
73
67
  confirm_before_abnormal_termination: bool = True,
74
68
  ):
@@ -80,17 +74,16 @@ try:
80
74
  and load by .yaml file.
81
75
  The yaml file must contain the other arguments.
82
76
 
83
- interface_class: FemtetWithExcelSettingsInterface or SurrogateModelInterface.
77
+ interface_class: Class whose name ends with `~WithExcelSettingsInterface`.
84
78
  interface_kwargs: See documentation of each interface class.
85
79
  optimizer_class: OptunaOptimizer or ScipyOptimizer.
86
80
  optimizer_kwargs: See documentation of each optimizer class.
87
- femopt_kwargs: See documentation of FEMOpt.
88
81
  seed: int or None.
89
82
  optimize_kwargs: See documentation of FEMOpt.optimize().
90
83
  additional_module_paths:
91
84
  The .py file paths containing user-defined objective and constraints functions.
92
85
  The module must contain __objective_functions__ or __constraint_functions__.
93
- They must be a dict variable that contains the required arguments of
86
+ They must be a `list` of `dict` that contains the required arguments of
94
87
  `FEMOpt.add_objective()` or `FEMOpt.add_constraint()` method.
95
88
  Note that the `args` argument of constraint function is reserved by meta_script
96
89
  and that value is fixed to `FEMOpt.opt`, so you can not use `args` argument
@@ -104,37 +97,44 @@ try:
104
97
  global CONFIRM_BEFORE_ABNORMAL_TERMINATION
105
98
  CONFIRM_BEFORE_ABNORMAL_TERMINATION = confirm_before_abnormal_termination
106
99
 
107
- # load variables from yaml file
100
+ # Override arguments,
101
+ # if yaml is given.
102
+ # ===================
108
103
  if yaml_path is not None:
109
104
 
110
105
  # check
111
106
  if os.path.isfile(yaml_path):
112
- context = open(yaml_path, 'r', encoding='utf-8')
107
+ # noinspection PyBroadException
108
+ try:
109
+ context = open(yaml_path, 'r', encoding='utf-8')
110
+ except Exception:
111
+ context = open(yaml_path, 'r', encoding=ENCODING)
113
112
 
114
113
  else:
115
- if DEBUG:
116
- print('debug mode')
117
- context = ContentContext(yaml_path) # yaml_path is yaml content
118
-
119
- else:
120
- raise FileNotFoundError(yaml_path)
114
+ raise FileNotFoundError(yaml_path)
121
115
 
122
- # load **as yaml content**
116
+ # load
123
117
  with context as f:
124
118
  d = yaml.safe_load(f)
125
119
  interface_class = yaml.safe_dump(d['interface_class'], allow_unicode=True)
126
120
  interface_kwargs = yaml.safe_dump(d['interface_kwargs'], allow_unicode=True)
127
121
  optimizer_class = yaml.safe_dump(d['optimizer_class'], allow_unicode=True)
128
122
  optimizer_kwargs = yaml.safe_dump(d['optimizer_kwargs'], allow_unicode=True)
129
- femopt_kwargs = yaml.safe_dump(d['femopt_kwargs'], allow_unicode=True)
130
123
  seed = yaml.safe_dump(d['seed'], allow_unicode=True)
131
124
  optimize_kwargs = yaml.safe_dump(d['optimize_kwargs'], allow_unicode=True)
132
125
  additional_module_paths = yaml.safe_dump(d.get('additional_module_paths', None), allow_unicode=True)
133
126
 
134
- # load **python variables** from yaml content
127
+ # Construct python variables
128
+ # by evaluating string
129
+ # or Fire arguments
130
+ # ==========================
135
131
 
136
132
  # additional import
137
- additional_module_paths_ = yaml.safe_load(additional_module_paths)
133
+ # -----------------
134
+ if yaml_path is not None:
135
+ additional_module_paths_ = yaml.safe_load(additional_module_paths)
136
+ else:
137
+ additional_module_paths_ = [yaml.safe_load(p) for p in additional_module_paths]
138
138
 
139
139
  if additional_module_paths_ is not None:
140
140
 
@@ -147,24 +147,43 @@ try:
147
147
  if hasattr(additional_module, '__all__'):
148
148
  globals().update({key: getattr(additional_module, key) for key in additional_module.__all__})
149
149
 
150
- Interface = eval(yaml.safe_load(interface_class))
151
- interface_kwargs_ = yaml.safe_load(interface_kwargs)
150
+ # Python variables
151
+ # ----------------
152
+ if yaml_path is not None:
153
+ Interface = eval(yaml.safe_load(interface_class))
154
+ interface_kwargs_ = yaml.safe_load(interface_kwargs)
155
+
156
+ Optimizer = eval(yaml.safe_load(optimizer_class))
157
+ optimizer_kwargs_ = yaml.safe_load(optimizer_kwargs)
152
158
 
153
- Optimizer = eval(yaml.safe_load(optimizer_class))
154
- optimizer_kwargs_ = yaml.safe_load(optimizer_kwargs)
159
+ optimizer_kwargs_['sampler_class'] = eval(optimizer_kwargs_['sampler_class'])
155
160
 
156
- optimizer_kwargs_['sampler_class'] = eval(optimizer_kwargs_['sampler_class'])
161
+ seed_ = yaml.safe_load(seed)
157
162
 
158
- femopt_kwargs_ = yaml.safe_load(femopt_kwargs)
163
+ optimize_kwargs_ = yaml.safe_load(optimize_kwargs)
159
164
 
160
- seed_ = yaml.safe_load(seed)
165
+ else:
166
+ Interface = eval(interface_class)
167
+ interface_kwargs_ = interface_kwargs
161
168
 
162
- optimize_kwargs_ = yaml.safe_load(optimize_kwargs)
169
+ Optimizer = eval(optimizer_class)
170
+ optimizer_kwargs_ = optimizer_kwargs
163
171
 
172
+ optimizer_kwargs_['sampler_class'] = eval(optimizer_kwargs_['sampler_class'])
173
+
174
+ seed_ = seed
175
+
176
+ optimize_kwargs_ = optimize_kwargs
177
+
178
+ # meta-script
179
+ # ===========
180
+
181
+ # prepare common object
164
182
  fem = Interface(**interface_kwargs_)
165
183
  opt = Optimizer(**optimizer_kwargs_)
166
- femopt = FEMOpt(fem=fem, opt=opt, **femopt_kwargs_)
184
+ femopt = FEMOpt(fem=fem, opt=opt)
167
185
 
186
+ # add user-defined functions
168
187
  if additional_module_paths_ is not None:
169
188
 
170
189
  for i, path_ in enumerate(additional_module_paths_):
@@ -196,6 +215,7 @@ try:
196
215
  kwargs=d.get('kwargs'),
197
216
  )
198
217
 
218
+ # optimize
199
219
  femopt.set_random_seed(seed_)
200
220
  femopt.optimize(**optimize_kwargs_)
201
221
 
@@ -210,4 +230,6 @@ except Exception as e:
210
230
  print_exception(e)
211
231
  print()
212
232
  if CONFIRM_BEFORE_ABNORMAL_TERMINATION:
213
- input('終了するには Enter を押してください。')
233
+ input('Press Enter to quit...')
234
+
235
+ raise e # for test
@@ -1,16 +1,14 @@
1
- from pyfemtet.opt.optimizer._base import AbstractOptimizer, logger, OptimizationMethodChecker
2
- from pyfemtet.opt.optimizer._optuna._optuna import OptunaOptimizer
3
- from pyfemtet.opt.optimizer._scipy import ScipyOptimizer
4
- from pyfemtet.opt.optimizer._scipy_scalar import ScipyScalarOptimizer
1
+ from pyfemtet.opt.optimizer._base_optimizer import AbstractOptimizer, SubFidelityModel
2
+ from pyfemtet.opt.optimizer.optuna_optimizer import OptunaOptimizer, PoFConfig, PoFBoTorchSampler, PartialOptimizeACQFConfig
3
+ from pyfemtet.opt.optimizer.scipy_optimizer import ScipyOptimizer
5
4
 
6
- from pyfemtet.opt.optimizer._optuna._pof_botorch import PoFBoTorchSampler, PoFConfig
7
5
 
8
6
  __all__ = [
9
- 'ScipyScalarOptimizer',
10
- 'ScipyOptimizer',
11
- 'OptunaOptimizer',
12
7
  'AbstractOptimizer',
13
- 'logger',
8
+ 'SubFidelityModel',
9
+ 'OptunaOptimizer',
14
10
  'PoFBoTorchSampler',
15
11
  'PoFConfig',
12
+ 'ScipyOptimizer',
13
+ 'PartialOptimizeACQFConfig',
16
14
  ]