pyfemtet 1.0.0b0__tar.gz → 1.5.1__tar.gz
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.
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/PKG-INFO +11 -9
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/_i18n/locales/ja/LC_MESSAGES/messages.mo +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/_i18n/locales/ja/LC_MESSAGES/messages.po +2 -2
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/_i18n/messages.py +0 -1
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/_util/dask_util.py +4 -5
- pyfemtet-1.5.1/pyfemtet/_util/df_util.py +61 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/_util/helper.py +9 -0
- pyfemtet-1.5.1/pyfemtet/_util/solidworks_variable.py +169 -0
- pyfemtet-1.5.1/pyfemtet/_util/symbol_support_for_param_name.py +15 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/logger/_impl.py +26 -1
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/exceptions.py +14 -4
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/femopt.py +58 -19
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/history/__init__.py +1 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/history/_history.py +245 -100
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/history/_hypervolume.py +64 -6
- pyfemtet-1.5.1/pyfemtet/opt/interface/__init__.py +47 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/interface/_base_interface.py +24 -17
- pyfemtet-1.5.1/pyfemtet/opt/interface/_dummy_classes.py +18 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/interface/_excel_interface/excel_interface.py +13 -13
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/interface/_femtet_interface/_femtet_parametric.py +57 -32
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/interface/_femtet_interface/femtet_interface.py +94 -56
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/interface/_femtet_with_nx_interface/femtet_with_nx_interface.py +16 -9
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/interface/_femtet_with_solidworks/femtet_with_solidworks_interface.py +25 -5
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/interface/_solidworks_interface/solidworks_interface.py +73 -71
- pyfemtet-1.5.1/pyfemtet/opt/interface/_solidworks_interface/sw_const.py +32 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/interface/_surrogate_model_interface/base_surrogate_interface.py +2 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/interface/_surrogate_model_interface/botorch_interface.py +10 -4
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/interface/_with_excel_settings/with_excel_settings.py +5 -5
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/optimizer/_base_optimizer.py +215 -44
- pyfemtet-1.5.1/pyfemtet/opt/optimizer/_trial_queue.py +101 -0
- pyfemtet-1.5.1/pyfemtet/opt/optimizer/optuna_optimizer/_optuna_attribute.py +63 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/optimizer/optuna_optimizer/_optuna_optimizer.py +327 -53
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/optimizer/optuna_optimizer/_pof_botorch/enable_nonlinear_constraint.py +7 -3
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/optimizer/optuna_optimizer/_pof_botorch/pof_botorch_sampler.py +66 -14
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/optimizer/scipy_optimizer/_scipy_optimizer.py +118 -52
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/prediction/_botorch_utils.py +59 -2
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/prediction/_helper.py +35 -8
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/prediction/_model.py +3 -2
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/problem/problem.py +9 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/problem/variable_manager/_string_as_expression.py +31 -5
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/problem/variable_manager/_variable_manager.py +101 -29
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/_complex_components/alert_region.py +3 -4
- pyfemtet-1.5.1/pyfemtet/opt/visualization/history_viewer/_complex_components/detail_graphs.py +556 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/_complex_components/pm_graph.py +141 -14
- pyfemtet-1.5.1/pyfemtet/opt/visualization/history_viewer/_detail_page.py +106 -0
- pyfemtet-1.5.1/pyfemtet/opt/visualization/history_viewer/_helper.py +41 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/_process_monitor/_application.py +3 -2
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/result_viewer/_application.py +3 -2
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/result_viewer/_pages.py +19 -20
- pyfemtet-1.5.1/pyfemtet/opt/visualization/plotter/contour_creator.py +105 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/plotter/main_figure_creator.py +101 -57
- pyfemtet-1.5.1/pyfemtet/opt/visualization/plotter/parallel_plot_creator.py +33 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/plotter/pm_graph_creator.py +41 -11
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/worker_status.py +5 -2
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyproject.toml +13 -20
- pyfemtet-1.0.0b0/pyfemtet/_util/df_util.py +0 -29
- pyfemtet-1.0.0b0/pyfemtet/opt/interface/__init__.py +0 -30
- pyfemtet-1.0.0b0/pyfemtet/opt/optimizer/optuna_optimizer/_optuna_attribute.py +0 -73
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/LICENSE +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/LICENSE_THIRD_PARTY.txt +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/README.md +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/__init__.py +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/_i18n/1. make_pot_and_update_po.bat +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/_i18n/2. build_mo.bat +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/_i18n/__init__.py +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/_i18n/babel.cfg +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/_i18n/i18n.py +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/_i18n/locales/messages.pot +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/_util/__init__.py +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/_util/closing.py +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/_util/excel_macro_util.py +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/_util/excel_parse_util.py +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/_util/femtet_access_inspection.py +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/_util/femtet_autosave.py +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/_util/femtet_exit.py +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/_util/femtet_version.py +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/_util/process_util.py +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/_util/sample.xlsx +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/_util/str_enum.py +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/core.py +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/dispatch_extensions/__init__.py +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/dispatch_extensions/_impl.py +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/logger/__init__.py +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/__init__.py +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/history/_optimality.py +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/interface/_excel_interface/__init__.py +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/interface/_excel_interface/debug-excel-interface.xlsm +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/interface/_femtet_interface/__init__.py +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/interface/_femtet_with_nx_interface/__init__.py +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/interface/_femtet_with_nx_interface/model1.prt +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/interface/_femtet_with_nx_interface/model1.x_t +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/interface/_femtet_with_nx_interface/update_model.py +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/interface/_femtet_with_solidworks/__init__.py +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/interface/_solidworks_interface/__init__.py +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/interface/_surrogate_model_interface/__init__.py +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/interface/_surrogate_model_interface/debug-pof-botorch.reccsv +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/interface/_with_excel_settings/__init__.py +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/meta_script/YAML_Generator.xlsm +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/meta_script/__init__.py +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/meta_script/__main__.py +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/meta_script/sample/sample.bas +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/meta_script/sample/sample.femprj +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/optimizer/__init__.py +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/optimizer/optuna_optimizer/__init__.py +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/optimizer/optuna_optimizer/_pof_botorch/__init__.py +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/optimizer/optuna_optimizer/_pof_botorch/debug-pof-botorch.reccsv +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/optimizer/optuna_optimizer/wat_ex14_parametric_jp.femprj +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/optimizer/scipy_optimizer/__init__.py +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/prediction/__init__.py +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/prediction/_gpytorch_modules_extension.py +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/problem/__init__.py +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/problem/variable_manager/__init__.py +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/__init__.py +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/_create_wrapped_components.py +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/__init__.py +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/__main__.py +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/_base_application.py +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/_common_pages.py +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/_complex_components/__init__.py +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/_complex_components/control_femtet.py +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/_complex_components/main_graph.py +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/_process_monitor/__init__.py +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/_process_monitor/_pages.py +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/_wrapped_components/__init__.py +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/_wrapped_components/dbc.py +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/_wrapped_components/dcc.py +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/_wrapped_components/html.py +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/_wrapped_components/str_enum.py +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/result_viewer/.gitignore +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/result_viewer/__init__.py +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/result_viewer/__main__.py +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08.csv +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08.db +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8.jpg +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8.log +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8.pdt +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_1.jpg +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_1.pdt +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_10.jpg +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_10.pdt +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_11.jpg +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_11.pdt +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_12.jpg +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_12.pdt +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_13.jpg +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_13.pdt +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_14.jpg +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_14.pdt +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_15.jpg +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_15.pdt +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_16.jpg +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_16.pdt +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_17.jpg +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_17.pdt +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_18.jpg +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_18.pdt +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_19.jpg +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_19.pdt +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_2.jpg +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_2.pdt +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_20.jpg +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_20.pdt +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_3.jpg +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_3.pdt +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.bgr +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.bnd +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.btr +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.jpg +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.mtl +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.pdt +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.prm +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_5.jpg +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_5.pdt +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_6.jpg +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_6.pdt +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_7.jpg +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_7.pdt +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_8.jpg +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_8.pdt +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_9.jpg +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_9.pdt +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.femprj +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/visualization/plotter/__init__.py +0 -0
- {pyfemtet-1.0.0b0 → pyfemtet-1.5.1}/pyfemtet/opt/wat_ex14_parametric_jp.femprj +0 -0
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: pyfemtet
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.5.1
|
|
4
4
|
Summary: Design parameter optimization using Femtet.
|
|
5
|
-
License: MIT
|
|
6
|
-
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
License-File: LICENSE_THIRD_PARTY.txt
|
|
8
|
+
Author: pyfemtet
|
|
7
9
|
Author-email: 148934231+pyfemtet@users.noreply.github.com
|
|
8
|
-
Requires-Python: >= 3.10, < 3.
|
|
9
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Requires-Python: >= 3.10, < 3.15
|
|
10
11
|
Classifier: Programming Language :: Python :: 3
|
|
11
12
|
Classifier: Programming Language :: Python :: 3.10
|
|
12
13
|
Classifier: Programming Language :: Python :: 3.11
|
|
13
14
|
Classifier: Programming Language :: Python :: 3.12
|
|
14
15
|
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
15
17
|
Requires-Dist: babel (>=2.15.0,<3)
|
|
16
18
|
Requires-Dist: botorch (>=0.12.0,<0.15.0)
|
|
17
19
|
Requires-Dist: colorlog (>=6.8.0,<7)
|
|
@@ -21,15 +23,15 @@ Requires-Dist: dask (>=2024.12.1,<2024.13.0)
|
|
|
21
23
|
Requires-Dist: distributed (>=2024.12.1,<2024.13.0)
|
|
22
24
|
Requires-Dist: femtetutils (>=1.0.0,<2) ; sys_platform == "win32"
|
|
23
25
|
Requires-Dist: fire (>=0.7)
|
|
26
|
+
Requires-Dist: frozendict (>=2.4.6)
|
|
24
27
|
Requires-Dist: numpy (>=2.0.0,<3)
|
|
25
28
|
Requires-Dist: openpyxl (>=3.1.2,<4)
|
|
26
|
-
Requires-Dist: optuna (>=
|
|
29
|
+
Requires-Dist: optuna (>=4.5.0,<4.6.0)
|
|
27
30
|
Requires-Dist: optuna-integration (>=3.6.0,<5.0.0)
|
|
28
31
|
Requires-Dist: pandas (>=2.2.3,<3)
|
|
29
32
|
Requires-Dist: plotly (>=5.22.0,<6)
|
|
30
33
|
Requires-Dist: psutil (>=5.9.6,<6)
|
|
31
|
-
Requires-Dist: pywin32 (
|
|
32
|
-
Requires-Dist: pywin32 (>=309) ; sys_platform == "win32" and python_version >= "3.13"
|
|
34
|
+
Requires-Dist: pywin32 (>=310) ; sys_platform == "win32"
|
|
33
35
|
Requires-Dist: pyyaml (>=6.0.2,<7)
|
|
34
36
|
Requires-Dist: scipy (>=1.11.4,<2)
|
|
35
37
|
Requires-Dist: torch
|
|
Binary file
|
|
@@ -976,11 +976,11 @@ msgstr "解析モデル互換性チェックで不明なエラーが発生しま
|
|
|
976
976
|
|
|
977
977
|
#: pyfemtet/opt/visualization/plotter/pm_graph_creator.py:146
|
|
978
978
|
msgid "Upper of pred. std-dev"
|
|
979
|
-
msgstr "
|
|
979
|
+
msgstr "予測の標準偏差(+)"
|
|
980
980
|
|
|
981
981
|
#: pyfemtet/opt/visualization/plotter/pm_graph_creator.py:150
|
|
982
982
|
msgid "Lower of pred. std-dev"
|
|
983
|
-
msgstr "
|
|
983
|
+
msgstr "予測の標準偏差(-)"
|
|
984
984
|
|
|
985
985
|
#: pyfemtet/opt/visualization/plotter/pm_graph_creator.py:183
|
|
986
986
|
msgid "Std-dev of pred."
|
|
@@ -59,7 +59,6 @@ class Message:
|
|
|
59
59
|
ERR_RUN_JOURNAL_NOT_FOUND = _(r'"%UGII_BASE_DIR%\NXBIN\run_journal.exe" is not found. Make sure you have NX installed and the environment variable UGII_BASE_DIR is set.')
|
|
60
60
|
ERR_MODEL_RECONSTRUCTION_FAILED = _('Model reconstruction failed.')
|
|
61
61
|
ERR_MODEL_UPDATE_FAILED = _('Model update failed.')
|
|
62
|
-
ERR_NO_MAKEPY = _('It was detected that the configuration of Femtet python macro constants has not been completed. The configuration was done automatically (python -m win32com.client.makepy FemtetMacro). Please restart the program. If the error persists, please run "py -m win32com.client.makepy FemtetMacro" or "python -m win32com.client.makepy FemtetMacro" on the command prompt.')
|
|
63
62
|
ERR_FEMTET_CONNECTION_FAILED = _('Failed to connect to Femtet.')
|
|
64
63
|
|
|
65
64
|
@staticmethod
|
|
@@ -23,6 +23,7 @@ remove_all_output(get_dask_logger())
|
|
|
23
23
|
warnings.filterwarnings('ignore', category=RuntimeWarning, message="Couldn't detect a suitable IP address")
|
|
24
24
|
|
|
25
25
|
cfg.set({'distributed.scheduler.worker-ttl': None})
|
|
26
|
+
cfg.set({"distributed.scheduler.locks.lease-timeout": "inf"})
|
|
26
27
|
|
|
27
28
|
logger = get_module_logger('opt.dask', False)
|
|
28
29
|
|
|
@@ -40,9 +41,9 @@ __all__ = [
|
|
|
40
41
|
_lock_pool = {}
|
|
41
42
|
|
|
42
43
|
|
|
43
|
-
def get_client():
|
|
44
|
+
def get_client(scheduler_address=None):
|
|
44
45
|
try:
|
|
45
|
-
return _get_client()
|
|
46
|
+
return _get_client(scheduler_address)
|
|
46
47
|
except ValueError:
|
|
47
48
|
return None
|
|
48
49
|
|
|
@@ -62,9 +63,7 @@ def Lock(name, client=None):
|
|
|
62
63
|
|
|
63
64
|
if client is not None:
|
|
64
65
|
# import inspect
|
|
65
|
-
|
|
66
|
-
with cfg.set({"distributed.scheduler.locks.lease-timeout": "inf"}):
|
|
67
|
-
_lock = _DaskLock(name)
|
|
66
|
+
_lock = _DaskLock(name)
|
|
68
67
|
|
|
69
68
|
else:
|
|
70
69
|
if name in _lock_pool:
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
from typing import TypeAlias, Literal
|
|
2
|
+
from math import isnan
|
|
3
|
+
import pandas as pd
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
__all__ = [
|
|
7
|
+
'apply_partial_df',
|
|
8
|
+
'get_partial_df',
|
|
9
|
+
]
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
_Method: TypeAlias = Literal['all', 'any', 'all-exclude']
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def get_index(df, equality_filters, method: _Method = 'all'):
|
|
16
|
+
# 値渡しに変換
|
|
17
|
+
equality_filters = equality_filters.copy()
|
|
18
|
+
|
|
19
|
+
# フィルタ条件に一致する行のインデックスを取得
|
|
20
|
+
|
|
21
|
+
# na との == での比較は常に False なので別処理するために別リストを作る
|
|
22
|
+
want_na_keys = []
|
|
23
|
+
for key, value in equality_filters.items():
|
|
24
|
+
if isinstance(value, float):
|
|
25
|
+
if isnan(value):
|
|
26
|
+
want_na_keys.append(key)
|
|
27
|
+
[equality_filters.pop(key) for key in want_na_keys]
|
|
28
|
+
|
|
29
|
+
# na 以外の比較
|
|
30
|
+
# noinspection PyUnresolvedReferences
|
|
31
|
+
if 'all' in method.lower():
|
|
32
|
+
out: pd.Series = (df[list(equality_filters.keys())] == pd.Series(equality_filters)).all(axis=1)
|
|
33
|
+
elif 'any' in method.lower():
|
|
34
|
+
out: pd.Series = (df[list(equality_filters.keys())] == pd.Series(equality_filters)).any(axis=1)
|
|
35
|
+
else:
|
|
36
|
+
raise NotImplementedError(f'Unknown method: {method}')
|
|
37
|
+
|
|
38
|
+
# na との比較
|
|
39
|
+
for key in want_na_keys:
|
|
40
|
+
out = out & df[key].isna()
|
|
41
|
+
|
|
42
|
+
if 'exclude' in method:
|
|
43
|
+
out = ~out
|
|
44
|
+
|
|
45
|
+
return out
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def get_partial_df(df: pd.DataFrame, equality_filters: dict, method: _Method = 'all'):
|
|
49
|
+
return df[get_index(df, equality_filters, method=method)]
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def apply_partial_df(df: pd.DataFrame, partial_df: pd.DataFrame, equality_filters: dict):
|
|
53
|
+
|
|
54
|
+
idx = get_index(df, equality_filters)
|
|
55
|
+
|
|
56
|
+
# インデクスに対応する部分を上書き
|
|
57
|
+
assert len(df[idx]) == len(partial_df), ('equality_filters の実行結果と'
|
|
58
|
+
'与えられた partial_df の長さが一致しません。')
|
|
59
|
+
df[idx] = partial_df
|
|
60
|
+
|
|
61
|
+
return df
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
from typing import Callable
|
|
4
|
+
|
|
5
|
+
import string
|
|
6
|
+
import secrets
|
|
4
7
|
import warnings
|
|
5
8
|
from time import time, sleep
|
|
6
9
|
from threading import Thread
|
|
@@ -10,6 +13,7 @@ from pyfemtet._i18n import _
|
|
|
10
13
|
__all__ = [
|
|
11
14
|
'float_',
|
|
12
15
|
'time_counting',
|
|
16
|
+
'generate_random_id',
|
|
13
17
|
]
|
|
14
18
|
|
|
15
19
|
|
|
@@ -92,3 +96,8 @@ def time_counting(
|
|
|
92
96
|
warning_message,
|
|
93
97
|
warning_fun,
|
|
94
98
|
)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def generate_random_id(length: int = 16) -> str:
|
|
102
|
+
alphabet = string.ascii_letters + string.digits
|
|
103
|
+
return ''.join(secrets.choice(alphabet) for _ in range(length))
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
from typing import TypeAlias
|
|
2
|
+
|
|
3
|
+
SWVariables: TypeAlias = dict[str, str]
|
|
4
|
+
"""<prm_name>: <expression>. Note that the <prm_name> does not contain `"`."""
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class EquationContext:
|
|
8
|
+
def __init__(self, swModel) -> None:
|
|
9
|
+
self.swModel = swModel
|
|
10
|
+
self.swEqnMgr = None
|
|
11
|
+
|
|
12
|
+
def __enter__(self):
|
|
13
|
+
# プロパティを退避
|
|
14
|
+
self.swEqnMgr = self.swModel.GetEquationMgr
|
|
15
|
+
self.buffer_aso = self.swEqnMgr.AutomaticSolveOrder
|
|
16
|
+
self.buffer_ar = self.swEqnMgr.AutomaticRebuild
|
|
17
|
+
self.swEqnMgr.AutomaticSolveOrder = False
|
|
18
|
+
self.swEqnMgr.AutomaticRebuild = False
|
|
19
|
+
return self.swEqnMgr
|
|
20
|
+
|
|
21
|
+
def __exit__(self, exc_type, exc_val, exc_tb):
|
|
22
|
+
# プロパティをもとに戻す
|
|
23
|
+
assert self.swEqnMgr is not None
|
|
24
|
+
self.swEqnMgr.AutomaticSolveOrder = self.buffer_aso
|
|
25
|
+
self.swEqnMgr.AutomaticRebuild = self.buffer_ar
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class EditPartContext:
|
|
29
|
+
def __init__(self, swModel, component) -> None:
|
|
30
|
+
self.swModel = swModel
|
|
31
|
+
self.component = component
|
|
32
|
+
|
|
33
|
+
def __enter__(self):
|
|
34
|
+
swSelMgr = self.swModel.SelectionManager
|
|
35
|
+
swSelData = swSelMgr.CreateSelectData
|
|
36
|
+
swSelMgr.AddSelectionListObject(self.component, swSelData)
|
|
37
|
+
# self.swModel.EditPart() # 対象がアセンブリの場合動作しない
|
|
38
|
+
self.swModel.AssemblyPartToggle() # Obsolete だが代わりにこれを使う
|
|
39
|
+
|
|
40
|
+
def __exit__(self, exc_type, exc_val, exc_tb):
|
|
41
|
+
self.swModel.EditAssembly()
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def is_assembly(swModel_or_name):
|
|
45
|
+
if isinstance(swModel_or_name, str):
|
|
46
|
+
return swModel_or_name.lower().endswith('.sldasm')
|
|
47
|
+
else:
|
|
48
|
+
return swModel_or_name.GetPathName.lower().endswith('.sldasm')
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def _iter_parts(swModel):
|
|
52
|
+
components = swModel.GetComponents(
|
|
53
|
+
False # TopOnly
|
|
54
|
+
)
|
|
55
|
+
return components
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
# Used by pyfemtet-opt-gui
|
|
59
|
+
class SolidworksVariableManager:
|
|
60
|
+
|
|
61
|
+
def __init__(self, logger=None):
|
|
62
|
+
# Used by pyfemtet-opt-gui
|
|
63
|
+
self.updated_objects = set()
|
|
64
|
+
"""Updated variable names, sldprt file paths and linked .txt equation file paths."""
|
|
65
|
+
if logger is None:
|
|
66
|
+
from logging import getLogger
|
|
67
|
+
logger = getLogger('solidworks_variable_manager')
|
|
68
|
+
self.logger = logger
|
|
69
|
+
|
|
70
|
+
# Used by pyfemtet-opt-gui
|
|
71
|
+
def update_global_variables_recourse(self, swModel, x: SWVariables):
|
|
72
|
+
# まず自身のパラメータを更新
|
|
73
|
+
self.logger.debug(f'Processing `{swModel.GetPathName}`')
|
|
74
|
+
self._update_global_variables_core(swModel, x)
|
|
75
|
+
|
|
76
|
+
# アセンブリならば、構成部品のパラメータを更新
|
|
77
|
+
if is_assembly(swModel):
|
|
78
|
+
components = _iter_parts(swModel)
|
|
79
|
+
for component in components:
|
|
80
|
+
swPartModel = component.GetModelDoc2
|
|
81
|
+
self.logger.debug(f'Checking `{swPartModel.GetPathName}`')
|
|
82
|
+
if swPartModel.GetPathName.lower() not in self.updated_objects:
|
|
83
|
+
self.logger.debug(f'Processing `{swPartModel.GetPathName}`')
|
|
84
|
+
with EditPartContext(swModel, component):
|
|
85
|
+
self._update_global_variables_core(swPartModel, x)
|
|
86
|
+
self.updated_objects.add(swPartModel.GetPathName.lower())
|
|
87
|
+
|
|
88
|
+
def _update_global_variables_core(self, swModel, x: SWVariables):
|
|
89
|
+
with EquationContext(swModel) as swEqnMgr:
|
|
90
|
+
# txt にリンクされている場合は txt を更新
|
|
91
|
+
if swEqnMgr.LinkToFile:
|
|
92
|
+
self._update_global_variables_linked_txt(swEqnMgr, x)
|
|
93
|
+
self._update_global_variables_simple(swEqnMgr, x)
|
|
94
|
+
# noinspection PyStatementEffect
|
|
95
|
+
swEqnMgr.EvaluateAll
|
|
96
|
+
|
|
97
|
+
def _update_global_variables_linked_txt(self, swEqnMgr, x: SWVariables):
|
|
98
|
+
txt_path = swEqnMgr.FilePath
|
|
99
|
+
if txt_path in self.updated_objects:
|
|
100
|
+
return
|
|
101
|
+
with open(txt_path, 'r', encoding='utf_8_sig') as f:
|
|
102
|
+
equations = [line.strip() for line in f.readlines() if line.strip() != '']
|
|
103
|
+
for i, eq in enumerate(equations):
|
|
104
|
+
equations[i] = self._update_equation(eq, x)
|
|
105
|
+
with open(txt_path, 'w', encoding='utf_8_sig') as f:
|
|
106
|
+
f.writelines([eq + '\n' for eq in equations])
|
|
107
|
+
self.logger.debug(f'`{txt_path}` is updated.')
|
|
108
|
+
self.updated_objects.add(txt_path)
|
|
109
|
+
|
|
110
|
+
def _update_global_variables_simple(self, swEqnMgr, x: SWVariables):
|
|
111
|
+
nEquation = swEqnMgr.GetCount
|
|
112
|
+
|
|
113
|
+
# equation を列挙
|
|
114
|
+
self.logger.debug(f'{nEquation} equations detected.')
|
|
115
|
+
for i in range(nEquation):
|
|
116
|
+
# name, equation の取得
|
|
117
|
+
eq = swEqnMgr.Equation(i)
|
|
118
|
+
prm_name = self._get_left(eq)
|
|
119
|
+
# COM 経由なので必要な時以外は触らない
|
|
120
|
+
self.logger.debug(f'Checking `{prm_name}`')
|
|
121
|
+
if (prm_name in x) and (prm_name not in self.updated_objects):
|
|
122
|
+
self.logger.debug(f'Processing `{prm_name}`')
|
|
123
|
+
# 特定の Equation がテキストリンク有効か
|
|
124
|
+
# どうかを判定する術がないので、一旦更新する
|
|
125
|
+
new_eq = self._update_equation(eq, x)
|
|
126
|
+
swEqnMgr.Equation(i, new_eq)
|
|
127
|
+
# テキストリンクの場合、COM インスタンスに
|
|
128
|
+
# 更新された値が残ってしまうのでテキストを再読み込み
|
|
129
|
+
if swEqnMgr.LinkToFile:
|
|
130
|
+
# noinspection PyStatementEffect
|
|
131
|
+
swEqnMgr.UpdateValuesFromExternalEquationFile
|
|
132
|
+
self.updated_objects.add(prm_name)
|
|
133
|
+
|
|
134
|
+
def _update_equation(self, equation: str, x: SWVariables):
|
|
135
|
+
prm_name = self._get_left(equation)
|
|
136
|
+
if prm_name not in x:
|
|
137
|
+
return equation
|
|
138
|
+
new_eq = f'"{prm_name}" = {x[prm_name]}'
|
|
139
|
+
self.logger.debug(f'New eq.: `{new_eq}`')
|
|
140
|
+
return new_eq
|
|
141
|
+
|
|
142
|
+
@staticmethod
|
|
143
|
+
def _get_left(equation: str):
|
|
144
|
+
tmp = equation.split('=')
|
|
145
|
+
if len(tmp) == 0:
|
|
146
|
+
raise RuntimeError(f'Invalid solidworks equation: {equation} (no `=` contained)')
|
|
147
|
+
return tmp[0].strip('" ')
|
|
148
|
+
|
|
149
|
+
# Used by pyfemtet-opt-gui
|
|
150
|
+
@staticmethod
|
|
151
|
+
def get_equations_recourse(swModel, global_variables_only=False) -> list[str]:
|
|
152
|
+
out = list()
|
|
153
|
+
swEqnMgr = swModel.GetEquationMgr
|
|
154
|
+
for i in range(swEqnMgr.GetCount):
|
|
155
|
+
if global_variables_only and not swEqnMgr.GlobalVariable(i):
|
|
156
|
+
continue
|
|
157
|
+
eq = swEqnMgr.Equation(i)
|
|
158
|
+
out.append(eq)
|
|
159
|
+
if is_assembly(swModel):
|
|
160
|
+
components = _iter_parts(swModel)
|
|
161
|
+
for component in components:
|
|
162
|
+
swPartModel = component.GetModelDoc2
|
|
163
|
+
swEqnMgr = swPartModel.GetEquationMgr
|
|
164
|
+
for i in range(swEqnMgr.GetCount):
|
|
165
|
+
if global_variables_only and not swEqnMgr.GlobalVariable(i):
|
|
166
|
+
continue
|
|
167
|
+
eq = swEqnMgr.Equation(i)
|
|
168
|
+
out.append(eq)
|
|
169
|
+
return out
|
|
@@ -81,6 +81,7 @@ def __create_formatter(colored=True):
|
|
|
81
81
|
# ===== handler config =====
|
|
82
82
|
|
|
83
83
|
STDOUT_HANDLER_NAME = 'stdout-handler'
|
|
84
|
+
STDERR_HANDLER_NAME = 'stderr-handler'
|
|
84
85
|
|
|
85
86
|
|
|
86
87
|
def __get_stdout_handler():
|
|
@@ -94,6 +95,17 @@ def __has_stdout_handler(logger):
|
|
|
94
95
|
return any([handler.get_name() != STDOUT_HANDLER_NAME for handler in logger.handlers])
|
|
95
96
|
|
|
96
97
|
|
|
98
|
+
def __get_stderr_handler():
|
|
99
|
+
stderr_handler = logging.StreamHandler(sys.stderr)
|
|
100
|
+
stderr_handler.set_name(STDERR_HANDLER_NAME)
|
|
101
|
+
stderr_handler.setFormatter(__create_formatter(colored=True))
|
|
102
|
+
return stderr_handler
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
def __has_stderr_handler(logger):
|
|
106
|
+
return any([handler.get_name() != STDERR_HANDLER_NAME for handler in logger.handlers])
|
|
107
|
+
|
|
108
|
+
|
|
97
109
|
def set_stdout_output(logger, level=logging.INFO):
|
|
98
110
|
|
|
99
111
|
if not __has_stdout_handler(logger):
|
|
@@ -107,6 +119,19 @@ def remove_stdout_output(logger):
|
|
|
107
119
|
logger.removeHandler(__get_stdout_handler())
|
|
108
120
|
|
|
109
121
|
|
|
122
|
+
def set_stderr_output(logger, level=logging.INFO):
|
|
123
|
+
|
|
124
|
+
if not __has_stderr_handler(logger):
|
|
125
|
+
logger.addHandler(__get_stderr_handler())
|
|
126
|
+
|
|
127
|
+
logger.setLevel(level)
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
def remove_stderr_output(logger):
|
|
131
|
+
if __has_stderr_handler(logger):
|
|
132
|
+
logger.removeHandler(__get_stderr_handler())
|
|
133
|
+
|
|
134
|
+
|
|
110
135
|
def add_file_output(logger, filepath=None, level=logging.INFO) -> str:
|
|
111
136
|
"""Add FileHandler to the logger.
|
|
112
137
|
|
|
@@ -165,7 +190,7 @@ def setup_package_root_logger(package_name):
|
|
|
165
190
|
with __lock:
|
|
166
191
|
logger = logging.getLogger(package_name)
|
|
167
192
|
logger.propagate = True
|
|
168
|
-
|
|
193
|
+
set_stderr_output(logger)
|
|
169
194
|
logger.setLevel(logging.INFO)
|
|
170
195
|
__initialized_root_packages.append(package_name)
|
|
171
196
|
else:
|
|
@@ -39,7 +39,17 @@ class InterruptOptimization(ExceptionDuringOptimization): ...
|
|
|
39
39
|
class SkipSolve(ExceptionDuringOptimization): ...
|
|
40
40
|
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
_shown = set()
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def show_experimental_warning(feature_name, logger=None):
|
|
46
|
+
global _shown
|
|
47
|
+
if feature_name not in _shown:
|
|
48
|
+
_shown.add(feature_name)
|
|
49
|
+
msg = (f'{feature_name} は実験的機能です。将来 API 等が'
|
|
50
|
+
'大きく変更されるか、機能自体が削除される'
|
|
51
|
+
'可能性があります。')
|
|
52
|
+
if logger is not None:
|
|
53
|
+
logger.warning(msg)
|
|
54
|
+
else:
|
|
55
|
+
warnings.warn(msg)
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import platform
|
|
2
4
|
from typing import Callable, Sequence
|
|
3
5
|
|
|
4
6
|
import os
|
|
@@ -18,6 +20,7 @@ from pyfemtet.opt.problem.variable_manager import *
|
|
|
18
20
|
from pyfemtet.opt.interface import *
|
|
19
21
|
from pyfemtet.opt.optimizer import *
|
|
20
22
|
from pyfemtet.opt.optimizer._base_optimizer import DIRECTION
|
|
23
|
+
from pyfemtet.opt.history import History
|
|
21
24
|
from pyfemtet.logger import get_module_logger
|
|
22
25
|
from pyfemtet.opt.visualization.history_viewer._process_monitor._application import (
|
|
23
26
|
process_monitor_main,
|
|
@@ -29,6 +32,19 @@ logger = get_module_logger('opt.femopt', False)
|
|
|
29
32
|
|
|
30
33
|
|
|
31
34
|
class FEMOpt:
|
|
35
|
+
"""
|
|
36
|
+
A class to manage finite element method (FEM) optimization using a specified optimizer and FEM interface.
|
|
37
|
+
|
|
38
|
+
Attributes:
|
|
39
|
+
opt (AbstractOptimizer): The optimizer instance to be used for optimization.
|
|
40
|
+
monitor_info (dict[str, str | int | None]): Dictionary to store monitoring information such as host and port.
|
|
41
|
+
|
|
42
|
+
Args:
|
|
43
|
+
fem (AbstractFEMInterface, optional): An instance of a FEM interface. Defaults to None, in which case a FemtetInterface is used.
|
|
44
|
+
opt (AbstractOptimizer, optional): An optimizer instance. Defaults to None, in which case OptunaOptimizer is used.
|
|
45
|
+
|
|
46
|
+
"""
|
|
47
|
+
|
|
32
48
|
opt: AbstractOptimizer
|
|
33
49
|
|
|
34
50
|
def __init__(
|
|
@@ -101,8 +117,8 @@ class FEMOpt:
|
|
|
101
117
|
def add_categorical_parameter(
|
|
102
118
|
self,
|
|
103
119
|
name: str,
|
|
104
|
-
initial_value:
|
|
105
|
-
choices: list[
|
|
120
|
+
initial_value: SupportedVariableTypes | None = None,
|
|
121
|
+
choices: list[SupportedVariableTypes] | None = None,
|
|
106
122
|
properties: dict[str, ...] | None = None,
|
|
107
123
|
*,
|
|
108
124
|
pass_to_fem: bool = True,
|
|
@@ -144,6 +160,21 @@ class FEMOpt:
|
|
|
144
160
|
):
|
|
145
161
|
self.opt.add_constraint(name, fun, lower_bound, upper_bound, args, kwargs, strict, using_fem)
|
|
146
162
|
|
|
163
|
+
def add_other_output(
|
|
164
|
+
self,
|
|
165
|
+
name: str,
|
|
166
|
+
fun: Callable[..., float],
|
|
167
|
+
args: tuple | None = None,
|
|
168
|
+
kwargs: dict | None = None,
|
|
169
|
+
):
|
|
170
|
+
self.opt.add_other_output(name, fun, args, kwargs)
|
|
171
|
+
|
|
172
|
+
def add_trial(
|
|
173
|
+
self,
|
|
174
|
+
parameters: dict[str, SupportedVariableTypes],
|
|
175
|
+
):
|
|
176
|
+
self.opt.add_trial(parameters)
|
|
177
|
+
|
|
147
178
|
def add_sub_fidelity_model(
|
|
148
179
|
self,
|
|
149
180
|
name: str,
|
|
@@ -152,6 +183,12 @@ class FEMOpt:
|
|
|
152
183
|
):
|
|
153
184
|
self.opt.add_sub_fidelity_model(name, sub_fidelity_model, fidelity)
|
|
154
185
|
|
|
186
|
+
def set_termination_condition(
|
|
187
|
+
self,
|
|
188
|
+
func: Callable[[History], bool] | None,
|
|
189
|
+
):
|
|
190
|
+
self.opt.set_termination_condition(func)
|
|
191
|
+
|
|
155
192
|
def set_monitor_host(self, host: str = None, port: int = None):
|
|
156
193
|
"""Sets the host IP address and the port of the process monitor.
|
|
157
194
|
|
|
@@ -345,19 +382,20 @@ class FEMOpt:
|
|
|
345
382
|
def save_history():
|
|
346
383
|
while True:
|
|
347
384
|
sleep(2)
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
385
|
+
if len(self.opt.history.get_df()) > 0:
|
|
386
|
+
try:
|
|
387
|
+
self.opt.history.save()
|
|
388
|
+
logger.debug('History saved!')
|
|
389
|
+
except PermissionError:
|
|
390
|
+
logger.error(
|
|
391
|
+
_('Cannot save history. '
|
|
392
|
+
'The most common reason is '
|
|
393
|
+
'that the csv is opened by '
|
|
394
|
+
'another program (such as Excel). '
|
|
395
|
+
'Please free {path} or lost the '
|
|
396
|
+
'optimization history.',
|
|
397
|
+
path=self.opt.history.path)
|
|
398
|
+
)
|
|
361
399
|
if entire_status.value >= WorkerStatus.finished:
|
|
362
400
|
break
|
|
363
401
|
logger.debug('History save thread finished!')
|
|
@@ -442,21 +480,22 @@ class FEMOpt:
|
|
|
442
480
|
'using the result viewer.\n'
|
|
443
481
|
'The result viewer can be launched by '
|
|
444
482
|
'performing one of the following actions:\n'
|
|
445
|
-
'-
|
|
483
|
+
'- {windows_only}Launch the `pyfemtet-opt-result-viewer` '
|
|
446
484
|
'shortcut on your desktop if exists.\n'
|
|
447
|
-
'-
|
|
485
|
+
'- {windows_only}Launch {path}.\n'
|
|
448
486
|
'- Execute "py -m pyfemtet.opt.visualization.history_viewer" '
|
|
449
487
|
'in the command line',
|
|
450
488
|
jp_message='プログラム終了後も、結果ビューワを使って最適化結果を'
|
|
451
489
|
'確認することができます。'
|
|
452
490
|
'結果ビューワは以下のいずれかを実施すると起動できます。\n'
|
|
453
|
-
'-
|
|
491
|
+
'- {windows_only}デスクトップの pyfemtet-opt-result-viewer '
|
|
454
492
|
'ショートカットを起動する\n'
|
|
455
|
-
'-
|
|
493
|
+
'- {windows_only}{dir} にある {filename} を起動する\n'
|
|
456
494
|
'- コマンドラインで「py -m pyfemtet.opt.visualization.history_viewer」'
|
|
457
495
|
'を実行する',
|
|
458
496
|
dir=os.path.abspath(os.path.dirname(sys.executable)),
|
|
459
497
|
filename='pyfemtet-opt-result-viewer.exe (or .cmd)',
|
|
498
|
+
windows_only='(Windows only) ' if platform.system() != 'Windows' else '',
|
|
460
499
|
)
|
|
461
500
|
print("====================")
|
|
462
501
|
print(confirm_msg)
|