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,129 +0,0 @@
1
- from typing import Optional, List, Any
2
- from abc import ABC
3
-
4
- import numpy as np
5
- import pandas as pd
6
-
7
- from pyfemtet.logger import get_module_logger
8
- from pyfemtet.opt._femopt_core import History, Objective
9
- from pyfemtet.opt.interface._base import FEMInterface
10
- from pyfemtet.opt.optimizer._base import AbstractOptimizer
11
-
12
- logger = get_module_logger('opt.interface', __name__)
13
-
14
-
15
- class SurrogateModelInterfaceBase(FEMInterface, ABC):
16
- def __init__(
17
- self,
18
- history_path: str = None,
19
- train_history: History = None,
20
- _output_directions: dict[int, str | float] | list[str | float] = None,
21
- ):
22
-
23
- self.train_history: History
24
- self.model: Any
25
- self.prm: dict[str, float] = dict()
26
- self.obj: dict[str, float] = dict()
27
- self.df_prm: pd.DataFrame
28
- self.df_obj: pd.DataFrame
29
- self._output_directions = _output_directions
30
-
31
- # history_path が与えられた場合、train_history をコンストラクトする
32
- if history_path is not None:
33
- train_history = History(history_path=history_path)
34
-
35
- # train_history が与えられるかコンストラクトされている場合
36
- if train_history is not None:
37
- # 学習データを準備する
38
- df_prm = train_history.get_df()[train_history.prm_names]
39
- df_obj = train_history.get_df()[train_history.obj_names]
40
-
41
- # obj の名前を作る
42
- for obj_name in train_history.obj_names:
43
- self.obj[obj_name] = np.nan
44
-
45
- # prm の名前を作る
46
- for prm_name in train_history.prm_names:
47
- self.prm[prm_name] = np.nan
48
-
49
- self.train_history = train_history
50
-
51
- # history から作らない場合、引数チェック
52
- else:
53
- # assert len(train_x) == len(train_y)
54
- raise NotImplementedError
55
-
56
- self.df_prm = df_prm
57
- self.df_obj = df_obj
58
-
59
- # _output_directions が与えられている場合、
60
- # history から objective の設定を読み込む
61
- if self._output_directions is not None:
62
- self._load_problem_from_me: bool = True
63
-
64
- FEMInterface.__init__(
65
- self,
66
- train_history=train_history, # コンストラクト済み train_history を渡せば並列計算時も何もしなくてよい
67
- )
68
-
69
-
70
- def load_objective(self, opt) -> None:
71
- from pyfemtet.opt._femopt_core import Objective
72
-
73
- assert self._output_directions is not None
74
-
75
- if isinstance(self._output_directions, dict):
76
-
77
- for index, direction in self._output_directions.items():
78
- obj_name = self.train_history.obj_names[index]
79
- opt.objectives[obj_name] = Objective(
80
- lambda obj_name_=obj_name: self.obj[obj_name_],
81
- name=obj_name,
82
- direction=direction,
83
- args=(),
84
- kwargs={},
85
- )
86
-
87
- elif isinstance(self._output_directions, list) \
88
- or isinstance(self._output_directions, tuple):
89
-
90
- obj_names = self.train_history.obj_names
91
- assert len(self._output_directions) == len(obj_names)
92
-
93
- for obj_name, direction in zip(obj_names, self._output_directions):
94
- opt.objectives[obj_name] = Objective(
95
- lambda obj_name_=obj_name: self.obj[obj_name_],
96
- name=obj_name,
97
- direction=direction,
98
- args=(),
99
- kwargs={},
100
- )
101
-
102
- else:
103
- raise ValueError('Invalid _output_directions')
104
-
105
- def filter_feasible(self, x: np.ndarray, y: np.ndarray, return_feasibility=False):
106
- feasible_idx = np.where(~np.isnan(y.sum(axis=1)))
107
- if return_feasibility:
108
- # calculated or not
109
- feas = np.zeros((len(y), 1), dtype=float)
110
- feas[feasible_idx] = 1.
111
- return x, feas
112
- else:
113
- return x[feasible_idx], y[feasible_idx]
114
-
115
- def _setup_after_parallel(self, *args, **kwargs):
116
- opt: AbstractOptimizer = kwargs['opt']
117
- obj: Objective
118
-
119
- # add_objective された目的のうち、
120
- # training data に含まれる名前で
121
- # あるものは fun を上書き
122
- for obj_name, obj in opt.objectives.items():
123
- if obj_name in self.train_history.obj_names:
124
- obj.fun = lambda obj_name_=obj_name: self.obj[obj_name_]
125
-
126
- def update_parameter(self, parameters: pd.DataFrame, with_warning=False) -> Optional[List[str]]:
127
- for i, row in parameters.iterrows():
128
- name, value = row['name'], row['value']
129
- self.prm[name] = value
@@ -1,71 +0,0 @@
1
- import numpy as np
2
- import pandas as pd
3
-
4
- from pyfemtet.logger import get_module_logger
5
- from pyfemtet.opt.interface._surrogate._base import SurrogateModelInterfaceBase
6
- from pyfemtet.opt.prediction.polynomial_expansion import PolynomialExpansionModel
7
-
8
-
9
- logger = get_module_logger('opt.interface', __name__)
10
-
11
-
12
- class PolynomialChaosInterface(SurrogateModelInterfaceBase):
13
-
14
- model: PolynomialExpansionModel # surrogate_func_expansion
15
-
16
- def train(self):
17
- x, y = self.filter_feasible(self.df_prm.values, self.df_obj.values)
18
- assert len(x) > 0, 'No feasible results in training data.'
19
- self.model.fit(x, y)
20
-
21
- def _setup_after_parallel(self, *args, **kwargs):
22
-
23
- # # update objectives
24
- # SurrogateModelInterfaceBase._setup_after_parallel(
25
- # self, *args, **kwargs
26
- # )
27
-
28
- # train model
29
- self.model = PolynomialExpansionModel()
30
- self.model.set_bounds_from_history(self.train_history)
31
- self.train()
32
-
33
- def update(self, parameters: pd.DataFrame) -> None:
34
- # self.prm 更新
35
- SurrogateModelInterfaceBase.update_parameter(
36
- self, parameters
37
- )
38
-
39
- # history.prm_name 順に並べ替え
40
- x = np.array([self.prm[k] for k in self.train_history.prm_names])
41
-
42
- # prediction
43
- dist_mean, _ = self.model.predict(x)
44
-
45
- # 目的関数の更新
46
- self.obj = {obj_name: value for obj_name, value in zip(self.train_history.obj_names, dist_mean)}
47
-
48
-
49
- if __name__ == '__main__':
50
- import os
51
- from pyfemtet.opt._femopt_core import History
52
-
53
- os.chdir(os.path.dirname(__file__))
54
-
55
- history = History(history_path='sample.csv')
56
- fem = PolynomialChaosInterface(history=history)
57
-
58
- import pandas as pd
59
- df = history.get_df()
60
- parameters = pd.DataFrame(
61
- dict(
62
- name=history.prm_names,
63
- value=[1. for _ in history.prm_names]
64
- )
65
- )
66
-
67
- fem._setup_after_parallel()
68
-
69
- fem.update(
70
- parameters
71
- )
@@ -1,71 +0,0 @@
1
- import numpy as np
2
- import pandas as pd
3
- from scipy.stats.distributions import norm
4
-
5
- from pyfemtet.core import SolveError
6
- from pyfemtet.logger import get_module_logger
7
- from pyfemtet.opt.interface._surrogate._base import SurrogateModelInterfaceBase
8
- from pyfemtet.opt.prediction.single_task_gp import SingleTaskGPModel
9
-
10
- from pyfemtet._message.messages import Message as Msg
11
-
12
-
13
- logger = get_module_logger('opt.interface', __name__)
14
-
15
-
16
- class PoFBoTorchInterface(SurrogateModelInterfaceBase):
17
- model_f: SingleTaskGPModel
18
- model: SingleTaskGPModel
19
- threshold = 0.5
20
-
21
- def train(self):
22
- # df そのまま用いて training する
23
- x, y = self.filter_feasible(self.df_prm.values, self.df_obj.values)
24
- assert len(x) > 0, 'No feasible results in training data.'
25
- self.model.fit(x, y)
26
-
27
- def train_f(self):
28
- # df そのまま用いて training する
29
- x, y = self.filter_feasible(self.df_prm.values, self.df_obj.values, return_feasibility=True)
30
- if y.min() == 1: # feasible values only
31
- self.model_f.predict = lambda *args, **kwargs: (1., 0.001) # mean, std
32
- self.model_f.fit(x, y)
33
-
34
- def _setup_after_parallel(self, *args, **kwargs):
35
-
36
- # update objectives
37
- SurrogateModelInterfaceBase._setup_after_parallel(
38
- self, *args, **kwargs
39
- )
40
-
41
- # model training
42
- self.model = SingleTaskGPModel()
43
- self.model.set_bounds_from_history(self.train_history)
44
- self.train()
45
-
46
- # model_f training
47
- self.model_f = SingleTaskGPModel(is_noise_free=False)
48
- self.model_f.set_bounds_from_history(self.train_history)
49
- self.train_f()
50
-
51
- def update(self, parameters: pd.DataFrame) -> None:
52
- # self.prm 更新
53
- SurrogateModelInterfaceBase.update_parameter(
54
- self, parameters
55
- )
56
-
57
- # train_history.prm_name 順に並べ替え
58
- x = np.array([self.prm[k] for k in self.train_history.prm_names])
59
-
60
- # feasibility の計算
61
- mean_f, std_f = self.model_f.predict(np.array([x]))
62
- pof = 1. - norm.cdf(self.threshold, loc=mean_f, scale=std_f)
63
- if pof < self.threshold:
64
- raise SolveError(Msg.INFO_POF_IS_LESS_THAN_THRESHOLD)
65
-
66
- # 実際の計算(現時点で mean は train_history.obj_names 順)
67
- _mean, _std = self.model.predict(np.array([x]))
68
- mean = _mean[0]
69
-
70
- # 目的関数の更新
71
- self.obj = {obj_name: value for obj_name, value in zip(self.train_history.obj_names, mean)}
@@ -1,102 +0,0 @@
1
- import re
2
- from pathlib import Path
3
-
4
- from pyfemtet.opt._femopt_core import History
5
- from pyfemtet.opt.interface._base import FEMInterface
6
- from pyfemtet.opt.interface._surrogate._singletaskgp import PoFBoTorchInterface
7
- from pyfemtet.opt.interface._excel_interface import ExcelInterface
8
-
9
-
10
- class PoFBoTorchInterfaceWithExcelSettingsInterface(
11
- PoFBoTorchInterface,
12
- ExcelInterface,
13
- FEMInterface,
14
- ):
15
-
16
- def __init__(
17
- self,
18
-
19
- # SurrogateModel
20
- history_path: str = None, train_history: History = None,
21
-
22
- # Excel
23
- input_xlsm_path: str or Path = None,
24
- input_sheet_name: str = None,
25
- output_xlsm_path: str or Path = None,
26
- output_sheet_name: str = None,
27
- constraint_xlsm_path: str or Path = None,
28
- constraint_sheet_name: str = None,
29
- procedure_name: str = None,
30
- procedure_args: list or tuple = None,
31
- # connect_method: str = 'auto', # or 'new'
32
- procedure_timeout: float or None = None,
33
- setup_xlsm_path: str or Path = None,
34
- setup_procedure_name: str = None,
35
- setup_procedure_args: list or tuple = None,
36
- teardown_xlsm_path: str or Path = None,
37
- teardown_procedure_name: str = None,
38
- teardown_procedure_args: list or tuple = None,
39
- related_file_paths: list[str or Path] = None,
40
- visible: bool = False,
41
- display_alerts: bool = False,
42
- terminate_excel_when_quit: bool = None,
43
- interactive: bool = True,
44
- use_named_range: bool = True,
45
- ):
46
- PoFBoTorchInterface.__init__(
47
- self,
48
- history_path,
49
- train_history,
50
- )
51
-
52
- connect_method = 'new'
53
-
54
- ExcelInterface.__init__(
55
- self,
56
- input_xlsm_path,
57
- input_sheet_name,
58
- output_xlsm_path,
59
- output_sheet_name,
60
- constraint_xlsm_path,
61
- constraint_sheet_name,
62
- procedure_name,
63
- procedure_args,
64
- connect_method, # or 'new'
65
- procedure_timeout,
66
- setup_xlsm_path,
67
- setup_procedure_name,
68
- setup_procedure_args,
69
- teardown_xlsm_path,
70
- teardown_procedure_name,
71
- teardown_procedure_args,
72
- related_file_paths,
73
- visible,
74
- display_alerts,
75
- terminate_excel_when_quit,
76
- interactive,
77
- use_named_range,
78
- )
79
-
80
- def load_parameter(self, opt, raise_if_no_keyword=True) -> None:
81
- ExcelInterface.load_parameter(self, opt, raise_if_no_keyword)
82
-
83
- def load_objective(self, opt, raise_if_no_keyword=True) -> None:
84
- ExcelInterface.load_objective(self, opt, raise_if_no_keyword)
85
-
86
- def load_constraint(self, opt, raise_if_no_keyword=False):
87
- ExcelInterface.load_constraint(self, opt, raise_if_no_keyword)
88
-
89
- def _setup_before_parallel(self, client):
90
- PoFBoTorchInterface._setup_before_parallel(self, client)
91
- ExcelInterface._setup_before_parallel(self, client)
92
-
93
- def _setup_after_parallel(self, *args, **kwargs):
94
- PoFBoTorchInterface._setup_after_parallel(self, *args, **kwargs)
95
- ExcelInterface._setup_after_parallel(self, *args, **kwargs)
96
-
97
- def update(self, parameters) -> None:
98
- PoFBoTorchInterface.update(self, parameters)
99
-
100
- def quit(self):
101
- PoFBoTorchInterface.quit(self)
102
- ExcelInterface.quit(self)