PyFemtet 1.0.0__tar.gz → 1.0.0b0__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.0 → pyfemtet-1.0.0b0}/PKG-INFO +1 -1
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/_util/df_util.py +1 -18
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/_util/helper.py +0 -9
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/femopt.py +0 -13
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/history/_history.py +5 -17
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/interface/_excel_interface/excel_interface.py +2 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/interface/_femtet_interface/femtet_interface.py +4 -3
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/interface/_femtet_with_solidworks/femtet_with_solidworks_interface.py +0 -20
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/interface/_solidworks_interface/solidworks_interface.py +0 -21
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/optimizer/_base_optimizer.py +22 -48
- pyfemtet-1.0.0b0/pyfemtet/opt/optimizer/optuna_optimizer/_optuna_attribute.py +73 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/optimizer/optuna_optimizer/_optuna_optimizer.py +20 -138
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/optimizer/optuna_optimizer/_pof_botorch/pof_botorch_sampler.py +3 -3
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/optimizer/scipy_optimizer/_scipy_optimizer.py +0 -19
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyproject.toml +4 -3
- pyfemtet-1.0.0/pyfemtet/opt/optimizer/optuna_optimizer/_optuna_attribute.py +0 -63
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/LICENSE +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/LICENSE_THIRD_PARTY.txt +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/README.md +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/__init__.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/_i18n/1. make_pot_and_update_po.bat +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/_i18n/2. build_mo.bat +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/_i18n/__init__.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/_i18n/babel.cfg +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/_i18n/i18n.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/_i18n/locales/ja/LC_MESSAGES/messages.mo +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/_i18n/locales/ja/LC_MESSAGES/messages.po +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/_i18n/locales/messages.pot +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/_i18n/messages.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/_util/__init__.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/_util/closing.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/_util/dask_util.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/_util/excel_macro_util.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/_util/excel_parse_util.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/_util/femtet_access_inspection.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/_util/femtet_autosave.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/_util/femtet_exit.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/_util/femtet_version.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/_util/process_util.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/_util/sample.xlsx +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/_util/str_enum.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/core.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/dispatch_extensions/__init__.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/dispatch_extensions/_impl.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/logger/__init__.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/logger/_impl.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/__init__.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/exceptions.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/history/__init__.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/history/_hypervolume.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/history/_optimality.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/interface/__init__.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/interface/_base_interface.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/interface/_excel_interface/__init__.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/interface/_excel_interface/debug-excel-interface.xlsm +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/interface/_femtet_interface/__init__.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/interface/_femtet_interface/_femtet_parametric.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/interface/_femtet_with_nx_interface/__init__.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/interface/_femtet_with_nx_interface/femtet_with_nx_interface.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/interface/_femtet_with_nx_interface/model1.prt +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/interface/_femtet_with_nx_interface/model1.x_t +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/interface/_femtet_with_nx_interface/update_model.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/interface/_femtet_with_solidworks/__init__.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/interface/_solidworks_interface/__init__.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/interface/_surrogate_model_interface/__init__.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/interface/_surrogate_model_interface/base_surrogate_interface.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/interface/_surrogate_model_interface/botorch_interface.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/interface/_surrogate_model_interface/debug-pof-botorch.reccsv +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/interface/_with_excel_settings/__init__.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/interface/_with_excel_settings/with_excel_settings.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/meta_script/YAML_Generator.xlsm +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/meta_script/__init__.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/meta_script/__main__.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/meta_script/sample/sample.bas +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/meta_script/sample/sample.femprj +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/optimizer/__init__.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/optimizer/optuna_optimizer/__init__.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/optimizer/optuna_optimizer/_pof_botorch/__init__.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/optimizer/optuna_optimizer/_pof_botorch/debug-pof-botorch.reccsv +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/optimizer/optuna_optimizer/_pof_botorch/enable_nonlinear_constraint.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/optimizer/optuna_optimizer/wat_ex14_parametric_jp.femprj +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/optimizer/scipy_optimizer/__init__.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/prediction/__init__.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/prediction/_botorch_utils.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/prediction/_gpytorch_modules_extension.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/prediction/_helper.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/prediction/_model.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/problem/__init__.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/problem/problem.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/problem/variable_manager/__init__.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/problem/variable_manager/_string_as_expression.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/problem/variable_manager/_variable_manager.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/__init__.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/_create_wrapped_components.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/__init__.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/__main__.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/_base_application.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/_common_pages.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/_complex_components/__init__.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/_complex_components/alert_region.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/_complex_components/control_femtet.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/_complex_components/main_graph.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/_complex_components/pm_graph.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/_process_monitor/__init__.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/_process_monitor/_application.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/_process_monitor/_pages.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/_wrapped_components/__init__.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/_wrapped_components/dbc.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/_wrapped_components/dcc.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/_wrapped_components/html.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/_wrapped_components/str_enum.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/result_viewer/.gitignore +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/result_viewer/__init__.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/result_viewer/__main__.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/result_viewer/_application.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/result_viewer/_pages.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08.csv +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08.db +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8.jpg +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8.log +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8.pdt +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_1.jpg +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_1.pdt +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_10.jpg +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_10.pdt +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_11.jpg +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_11.pdt +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_12.jpg +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_12.pdt +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_13.jpg +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_13.pdt +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_14.jpg +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_14.pdt +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_15.jpg +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_15.pdt +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_16.jpg +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_16.pdt +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_17.jpg +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_17.pdt +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_18.jpg +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_18.pdt +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_19.jpg +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_19.pdt +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_2.jpg +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_2.pdt +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_20.jpg +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_20.pdt +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_3.jpg +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_3.pdt +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.bgr +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.bnd +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.btr +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.jpg +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.mtl +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.pdt +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.prm +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_5.jpg +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_5.pdt +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_6.jpg +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_6.pdt +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_7.jpg +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_7.pdt +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_8.jpg +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_8.pdt +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_9.jpg +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_9.pdt +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.femprj +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/plotter/__init__.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/plotter/main_figure_creator.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/visualization/plotter/pm_graph_creator.py +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/wat_ex14_parametric_jp.femprj +0 -0
- {pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/worker_status.py +0 -0
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
from math import isnan
|
|
2
1
|
import pandas as pd
|
|
3
2
|
|
|
4
3
|
|
|
@@ -10,24 +9,8 @@ __all__ = [
|
|
|
10
9
|
|
|
11
10
|
def get_index(df, equality_filters):
|
|
12
11
|
# フィルタ条件に一致する行のインデックスを取得
|
|
13
|
-
|
|
14
|
-
# na との == での比較は常に False なので別処理するために別リストを作る
|
|
15
|
-
want_na_keys = []
|
|
16
|
-
for key, value in equality_filters.items():
|
|
17
|
-
if isinstance(value, float):
|
|
18
|
-
if isnan(value):
|
|
19
|
-
want_na_keys.append(key)
|
|
20
|
-
[equality_filters.pop(key) for key in want_na_keys]
|
|
21
|
-
|
|
22
|
-
# na 以外の比較
|
|
23
12
|
# noinspection PyUnresolvedReferences
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
# na との比較
|
|
27
|
-
for key in want_na_keys:
|
|
28
|
-
out = out & df[key].isna()
|
|
29
|
-
|
|
30
|
-
return out
|
|
13
|
+
return (df[list(equality_filters.keys())] == pd.Series(equality_filters)).all(axis=1)
|
|
31
14
|
|
|
32
15
|
|
|
33
16
|
def get_partial_df(df: pd.DataFrame, equality_filters: dict):
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
from typing import Callable
|
|
4
|
-
|
|
5
|
-
import string
|
|
6
|
-
import secrets
|
|
7
4
|
import warnings
|
|
8
5
|
from time import time, sleep
|
|
9
6
|
from threading import Thread
|
|
@@ -13,7 +10,6 @@ from pyfemtet._i18n import _
|
|
|
13
10
|
__all__ = [
|
|
14
11
|
'float_',
|
|
15
12
|
'time_counting',
|
|
16
|
-
'generate_random_id',
|
|
17
13
|
]
|
|
18
14
|
|
|
19
15
|
|
|
@@ -96,8 +92,3 @@ def time_counting(
|
|
|
96
92
|
warning_message,
|
|
97
93
|
warning_fun,
|
|
98
94
|
)
|
|
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))
|
|
@@ -29,19 +29,6 @@ logger = get_module_logger('opt.femopt', False)
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
class FEMOpt:
|
|
32
|
-
"""
|
|
33
|
-
A class to manage finite element method (FEM) optimization using a specified optimizer and FEM interface.
|
|
34
|
-
|
|
35
|
-
Attributes:
|
|
36
|
-
opt (AbstractOptimizer): The optimizer instance to be used for optimization.
|
|
37
|
-
monitor_info (dict[str, str | int | None]): Dictionary to store monitoring information such as host and port.
|
|
38
|
-
|
|
39
|
-
Args:
|
|
40
|
-
fem (AbstractFEMInterface, optional): An instance of a FEM interface. Defaults to None, in which case a FemtetInterface is used.
|
|
41
|
-
opt (AbstractOptimizer, optional): An optimizer instance. Defaults to None, in which case OptunaOptimizer is used.
|
|
42
|
-
|
|
43
|
-
"""
|
|
44
|
-
|
|
45
32
|
opt: AbstractOptimizer
|
|
46
33
|
|
|
47
34
|
def __init__(
|
|
@@ -43,10 +43,7 @@ __all__ = [
|
|
|
43
43
|
'MAIN_FILTER',
|
|
44
44
|
]
|
|
45
45
|
|
|
46
|
-
MAIN_FILTER: dict = {
|
|
47
|
-
'sub_fidelity_name': MAIN_FIDELITY_NAME,
|
|
48
|
-
'sub_sampling': float('nan')
|
|
49
|
-
}
|
|
46
|
+
MAIN_FILTER: dict = {'sub_fidelity_name': MAIN_FIDELITY_NAME}
|
|
50
47
|
|
|
51
48
|
|
|
52
49
|
logger = get_module_logger('opt.history', False)
|
|
@@ -1056,14 +1053,6 @@ class Records:
|
|
|
1056
1053
|
|
|
1057
1054
|
with self.df_wrapper.lock_if_not_locked:
|
|
1058
1055
|
|
|
1059
|
-
# check trial_id is filled
|
|
1060
|
-
trial_processed = False
|
|
1061
|
-
if processing_df['trial_id'].notna().all():
|
|
1062
|
-
id_to_n: dict = {tid: i + 1 for i, tid
|
|
1063
|
-
in enumerate(processing_df['trial_id'].unique())}
|
|
1064
|
-
processing_df['trial'] = processing_df['trial_id'].map(id_to_n)
|
|
1065
|
-
trial_processed = True
|
|
1066
|
-
|
|
1067
1056
|
# update main fidelity
|
|
1068
1057
|
equality_filters = MAIN_FILTER
|
|
1069
1058
|
mgr = EntireDependentValuesCalculator(
|
|
@@ -1073,13 +1062,13 @@ class Records:
|
|
|
1073
1062
|
)
|
|
1074
1063
|
mgr.update_optimality()
|
|
1075
1064
|
mgr.update_hypervolume()
|
|
1076
|
-
|
|
1077
|
-
mgr.update_trial_number() # per_fidelity
|
|
1065
|
+
mgr.update_trial_number()
|
|
1078
1066
|
pdf = mgr.partial_df
|
|
1079
1067
|
apply_partial_df(df=processing_df, partial_df=pdf, equality_filters=equality_filters)
|
|
1080
1068
|
|
|
1081
1069
|
# update sub fidelity
|
|
1082
|
-
|
|
1070
|
+
entire_df = self.df_wrapper.get_df()
|
|
1071
|
+
sub_fidelity_names: list = np.unique(entire_df['sub_fidelity_name']).tolist()
|
|
1083
1072
|
if MAIN_FIDELITY_NAME in sub_fidelity_names:
|
|
1084
1073
|
sub_fidelity_names.remove(MAIN_FIDELITY_NAME)
|
|
1085
1074
|
for sub_fidelity_name in sub_fidelity_names:
|
|
@@ -1089,8 +1078,7 @@ class Records:
|
|
|
1089
1078
|
equality_filters,
|
|
1090
1079
|
processing_df
|
|
1091
1080
|
)
|
|
1092
|
-
|
|
1093
|
-
mgr.update_trial_number() # per_fidelity
|
|
1081
|
+
mgr.update_trial_number()
|
|
1094
1082
|
pdf = mgr.partial_df
|
|
1095
1083
|
apply_partial_df(df=processing_df, partial_df=pdf, equality_filters=equality_filters)
|
|
1096
1084
|
|
{pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/interface/_femtet_interface/femtet_interface.py
RENAMED
|
@@ -102,6 +102,8 @@ class FemtetInterface(COMInterface):
|
|
|
102
102
|
If you do not want to delete the swept table,
|
|
103
103
|
make a copy of the original file.
|
|
104
104
|
|
|
105
|
+
**kwargs: Additional arguments from inherited classes.
|
|
106
|
+
|
|
105
107
|
Warning:
|
|
106
108
|
Even if you specify ``strictly_pid_specify=True`` on the constructor,
|
|
107
109
|
**the connection behavior is like** ``strictly_pid_specify=False`` **in parallel processing**
|
|
@@ -117,7 +119,6 @@ class FemtetInterface(COMInterface):
|
|
|
117
119
|
|
|
118
120
|
com_members = {'Femtet': 'FemtetMacro.Femtet'}
|
|
119
121
|
_show_parametric_index_warning = True # for GUI
|
|
120
|
-
_femtet_connection_timeout = 10
|
|
121
122
|
|
|
122
123
|
def __init__(
|
|
123
124
|
self,
|
|
@@ -315,9 +316,9 @@ class FemtetInterface(COMInterface):
|
|
|
315
316
|
logger.info("└ Try to connect existing Femtet process.")
|
|
316
317
|
# 既存の Femtet を探して Dispatch する。
|
|
317
318
|
if pid is None:
|
|
318
|
-
self.Femtet, self.femtet_pid = dispatch_femtet(timeout=
|
|
319
|
+
self.Femtet, self.femtet_pid = dispatch_femtet(timeout=5)
|
|
319
320
|
else:
|
|
320
|
-
self.Femtet, self.femtet_pid = dispatch_specific_femtet(pid, timeout=
|
|
321
|
+
self.Femtet, self.femtet_pid = dispatch_specific_femtet(pid, timeout=5)
|
|
321
322
|
self.connected_method = "existing"
|
|
322
323
|
|
|
323
324
|
def connect_femtet(self, connect_method: str = "auto", pid: int or None = None):
|
|
@@ -20,26 +20,6 @@ if TYPE_CHECKING:
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
class FemtetWithSolidworksInterface(FemtetInterface, SolidworksInterface, AbstractFEMInterface):
|
|
23
|
-
"""
|
|
24
|
-
Interface class integrating Femtet and SolidWorks operations.
|
|
25
|
-
|
|
26
|
-
This class combines the capabilities of both Femtet and SolidWorks interfaces, allowing
|
|
27
|
-
coordinated operation between simulation (Femtet) and CAD manipulation (SolidWorks).
|
|
28
|
-
|
|
29
|
-
Args:
|
|
30
|
-
sldprt_path (str): Path to the SolidWorks part file (.sldprt).
|
|
31
|
-
femprj_path (str, optional): Path to the Femtet project file (.femprj). Defaults to None.
|
|
32
|
-
model_name (str, optional): Name of the model in the project. Defaults to None.
|
|
33
|
-
connect_method (str, optional): Connection method for Femtet. Defaults to "auto".
|
|
34
|
-
save_pdt (str, optional): Specifies which data to save. Defaults to "all".
|
|
35
|
-
strictly_pid_specify (bool, optional): Whether to strictly specify parameter IDs. Defaults to True.
|
|
36
|
-
allow_without_project (bool, optional): If True, allows operation without a project file. Defaults to False.
|
|
37
|
-
open_result_with_gui (bool, optional): If True, open results with GUI. Defaults to True.
|
|
38
|
-
parametric_output_indexes_use_as_objective (dict[int, str | float], optional): Indexes for parametric output used as objectives. Defaults to None.
|
|
39
|
-
always_open_copy (bool, optional): If True, always open a copy of the project. Defaults to False.
|
|
40
|
-
close_solidworks_on_terminate (bool, optional): If True, SolidWorks will close when this object is destroyed. Defaults to False.
|
|
41
|
-
solidworks_visible (bool, optional): If True, SolidWorks will be started in visible mode. Defaults to True.
|
|
42
|
-
"""
|
|
43
23
|
|
|
44
24
|
def __init__(
|
|
45
25
|
self,
|
|
@@ -41,27 +41,6 @@ class FileNotOpenedError(Exception):
|
|
|
41
41
|
|
|
42
42
|
# noinspection PyPep8Naming
|
|
43
43
|
class SolidworksInterface(COMInterface):
|
|
44
|
-
"""
|
|
45
|
-
Interface class for interacting with SolidWorks through COM automation.
|
|
46
|
-
|
|
47
|
-
This class manages the connection and interaction with SolidWorks using its COM interface.
|
|
48
|
-
It handles initialization, visibility, and clean termination of the SolidWorks application.
|
|
49
|
-
|
|
50
|
-
Attributes:
|
|
51
|
-
swApp (CDispatch): The COM dispatch object for SolidWorks application.
|
|
52
|
-
com_members (dict): Mapping of COM member names to their interface strings.
|
|
53
|
-
sldprt_path (str): Absolute path to the SolidWorks part file (.sldprt).
|
|
54
|
-
quit_solidworks_on_terminate (bool): Whether to close SolidWorks upon object destruction.
|
|
55
|
-
solidworks_visible (bool): Whether the SolidWorks application window is visible.
|
|
56
|
-
|
|
57
|
-
Args:
|
|
58
|
-
sldprt_path (str): Path to the SolidWorks part file (.sldprt).
|
|
59
|
-
close_solidworks_on_terminate (bool, optional): If True, SolidWorks will close when this object is destroyed. Defaults to False.
|
|
60
|
-
visible (bool, optional): If True, SolidWorks will be started in visible mode. Defaults to True.
|
|
61
|
-
|
|
62
|
-
Raises:
|
|
63
|
-
AssertionError: If the specified part file does not exist.
|
|
64
|
-
"""
|
|
65
44
|
|
|
66
45
|
swApp: CDispatch
|
|
67
46
|
com_members = {'swApp': 'SLDWORKS.Application'}
|
|
@@ -434,7 +434,6 @@ class AbstractOptimizer:
|
|
|
434
434
|
|
|
435
435
|
def __init__(self, opt: AbstractOptimizer):
|
|
436
436
|
self.opt: AbstractOptimizer = opt
|
|
437
|
-
self.subsampling_idx: SubSampling | None = None
|
|
438
437
|
|
|
439
438
|
def _preprocess(self):
|
|
440
439
|
pass
|
|
@@ -461,7 +460,6 @@ class AbstractOptimizer:
|
|
|
461
460
|
variables_pass_to_fem: dict[str, SupportedVariableTypes],
|
|
462
461
|
history: History = None,
|
|
463
462
|
datetime_start=None,
|
|
464
|
-
trial_id=None,
|
|
465
463
|
) -> _FReturnValue:
|
|
466
464
|
|
|
467
465
|
# create context
|
|
@@ -488,8 +486,6 @@ class AbstractOptimizer:
|
|
|
488
486
|
{obj_name: ObjectiveResult(obj, opt_.fem, float('nan'))
|
|
489
487
|
for obj_name, obj in opt_.objectives.items()}
|
|
490
488
|
)
|
|
491
|
-
record.sub_sampling = self.subsampling_idx
|
|
492
|
-
record.trial_id = trial_id
|
|
493
489
|
record.sub_fidelity_name = opt_.sub_fidelity_name
|
|
494
490
|
record.fidelity = opt_.fidelity
|
|
495
491
|
record.datetime_start = datetime_start
|
|
@@ -502,8 +498,7 @@ class AbstractOptimizer:
|
|
|
502
498
|
raise SkipSolve
|
|
503
499
|
|
|
504
500
|
# start solve
|
|
505
|
-
if opt_.
|
|
506
|
-
logger.info('----------')
|
|
501
|
+
if opt_.sub_fidelity_models != MAIN_FIDELITY_NAME:
|
|
507
502
|
logger.info(_('fidelity: ({name})', name=opt_.sub_fidelity_name))
|
|
508
503
|
logger.info(_('input variables:'))
|
|
509
504
|
logger.info(parameters)
|
|
@@ -634,9 +629,7 @@ class AbstractOptimizer:
|
|
|
634
629
|
x: TrialInput,
|
|
635
630
|
x_pass_to_fem_: dict[str, SupportedVariableTypes],
|
|
636
631
|
opt_: AbstractOptimizer | None = None,
|
|
637
|
-
trial_id: str =None,
|
|
638
632
|
) -> _FReturnValue | None:
|
|
639
|
-
"""Nothing will be raised even if infeasible."""
|
|
640
633
|
|
|
641
634
|
vm = self.opt.variable_manager
|
|
642
635
|
|
|
@@ -650,40 +643,32 @@ class AbstractOptimizer:
|
|
|
650
643
|
# if opt_ is not self, update variable manager
|
|
651
644
|
opt_.variable_manager = vm
|
|
652
645
|
|
|
653
|
-
#
|
|
654
|
-
|
|
655
|
-
def __enter__(self_):
|
|
656
|
-
# preprocess
|
|
657
|
-
self._preprocess()
|
|
646
|
+
# preprocess
|
|
647
|
+
self._preprocess()
|
|
658
648
|
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
self._postprocess()
|
|
649
|
+
# declare output
|
|
650
|
+
f_return = None
|
|
662
651
|
|
|
663
|
-
|
|
652
|
+
# start solve
|
|
653
|
+
datetime_start = datetime.datetime.now()
|
|
654
|
+
try:
|
|
655
|
+
f_return = self._solve_or_raise(
|
|
656
|
+
opt_, x, x_pass_to_fem_, self.opt.history, datetime_start
|
|
657
|
+
)
|
|
664
658
|
|
|
665
|
-
|
|
666
|
-
|
|
659
|
+
except HardConstraintViolation as e:
|
|
660
|
+
self._hard_constraint_handling(e)
|
|
667
661
|
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
try:
|
|
671
|
-
f_return = self._solve_or_raise(
|
|
672
|
-
opt_, x, x_pass_to_fem_, self.opt.history,
|
|
673
|
-
datetime_start, trial_id
|
|
674
|
-
)
|
|
675
|
-
|
|
676
|
-
except HardConstraintViolation as e:
|
|
677
|
-
self._hard_constraint_handling(e)
|
|
662
|
+
except _HiddenConstraintViolation as e:
|
|
663
|
+
self._hidden_constraint_handling(e)
|
|
678
664
|
|
|
679
|
-
|
|
680
|
-
|
|
665
|
+
except SkipSolve as e:
|
|
666
|
+
self._skip_handling(e)
|
|
681
667
|
|
|
682
|
-
|
|
683
|
-
|
|
668
|
+
else:
|
|
669
|
+
self._if_succeeded(f_return)
|
|
684
670
|
|
|
685
|
-
|
|
686
|
-
self._if_succeeded(f_return)
|
|
671
|
+
self._postprocess()
|
|
687
672
|
|
|
688
673
|
# check interruption
|
|
689
674
|
self.opt._check_and_raise_interruption()
|
|
@@ -814,19 +799,8 @@ class AbstractOptimizer:
|
|
|
814
799
|
# noinspection PyMethodParameters
|
|
815
800
|
class LoggingOutput:
|
|
816
801
|
def __enter__(self_):
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
)
|
|
820
|
-
self_.count = len(df) + 1
|
|
821
|
-
|
|
822
|
-
succeeded_count = len(df[df['state'] == TrialState.succeeded])
|
|
823
|
-
succeeded_text = _(
|
|
824
|
-
en_message='{succeeded_count} succeeded trials',
|
|
825
|
-
jp_message='成功した試行数: {succeeded_count}',
|
|
826
|
-
succeeded_count=succeeded_count,
|
|
827
|
-
)
|
|
828
|
-
|
|
829
|
-
logger.info(f'▼▼▼▼▼ solve {self_.count} ({succeeded_text}) start ▼▼▼▼▼')
|
|
802
|
+
self_.count = len(self.history.get_df()) + 1
|
|
803
|
+
logger.info(f'▼▼▼▼▼ solve {self_.count} start ▼▼▼▼▼')
|
|
830
804
|
|
|
831
805
|
def __exit__(self_, exc_type, exc_val, exc_tb):
|
|
832
806
|
logger.info(f'▲▲▲▲▲ solve {self_.count} end ▲▲▲▲▲\n')
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from pyfemtet.opt.problem.problem import *
|
|
4
|
+
from pyfemtet.opt.history import *
|
|
5
|
+
from pyfemtet.opt.optimizer._base_optimizer import *
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class OptunaAttribute:
|
|
9
|
+
"""Manage optuna user attribute
|
|
10
|
+
|
|
11
|
+
user attributes are:
|
|
12
|
+
sub_fidelity_name:
|
|
13
|
+
fidelity: ...
|
|
14
|
+
OBJECTIVE_ATTR_KEY: ...
|
|
15
|
+
PYFEMTET_STATE_ATTR_KEY: ...
|
|
16
|
+
CONSTRAINT_ATTR_KEY: ...
|
|
17
|
+
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
OBJECTIVE_KEY = 'internal_objective'
|
|
21
|
+
CONSTRAINT_KEY = 'constraint'
|
|
22
|
+
PYFEMTET_TRIAL_STATE_KEY = 'pyfemtet_trial_state'
|
|
23
|
+
|
|
24
|
+
sub_fidelity_name: str # key
|
|
25
|
+
fidelity: Fidelity | None
|
|
26
|
+
v_values: tuple | None # violation
|
|
27
|
+
y_values: tuple | None # internal objective
|
|
28
|
+
pf_state: TrialState | None # PyFemtet state
|
|
29
|
+
|
|
30
|
+
def __init__(self, opt: AbstractOptimizer):
|
|
31
|
+
self.sub_fidelity_name = opt.sub_fidelity_name
|
|
32
|
+
self.fidelity = None
|
|
33
|
+
self.v_values = None
|
|
34
|
+
self.y_values = None
|
|
35
|
+
self.pf_state = None
|
|
36
|
+
|
|
37
|
+
# noinspection PyPropertyDefinition
|
|
38
|
+
@classmethod
|
|
39
|
+
def main_fidelity_key(cls):
|
|
40
|
+
return MAIN_FIDELITY_NAME
|
|
41
|
+
|
|
42
|
+
@property
|
|
43
|
+
def key(self):
|
|
44
|
+
return self.sub_fidelity_name
|
|
45
|
+
|
|
46
|
+
@property
|
|
47
|
+
def value(self):
|
|
48
|
+
d = {}
|
|
49
|
+
if self.fidelity:
|
|
50
|
+
d.update({'fidelity': self.fidelity})
|
|
51
|
+
if self.y_values:
|
|
52
|
+
d.update({self.OBJECTIVE_KEY: self.y_values})
|
|
53
|
+
if self.v_values:
|
|
54
|
+
d.update({self.CONSTRAINT_KEY: self.v_values})
|
|
55
|
+
if self.pf_state:
|
|
56
|
+
d.update({self.PYFEMTET_TRIAL_STATE_KEY: self.pf_state})
|
|
57
|
+
return d
|
|
58
|
+
|
|
59
|
+
@staticmethod
|
|
60
|
+
def get_fidelity(optuna_attribute: OptunaAttribute):
|
|
61
|
+
return optuna_attribute.value['fidelity']
|
|
62
|
+
|
|
63
|
+
@staticmethod
|
|
64
|
+
def get_violation(optuna_attribute: OptunaAttribute):
|
|
65
|
+
return optuna_attribute.value[OptunaAttribute.CONSTRAINT_KEY]
|
|
66
|
+
|
|
67
|
+
@staticmethod
|
|
68
|
+
def get_violation_from_trial_attr(trial_attr: dict): # value is OptunaAttribute.value
|
|
69
|
+
return trial_attr[OptunaAttribute.CONSTRAINT_KEY]
|
|
70
|
+
|
|
71
|
+
@staticmethod
|
|
72
|
+
def get_pf_state_from_trial_attr(trial_attr: dict): # value is OptunaAttribute.value
|
|
73
|
+
return trial_attr[OptunaAttribute.PYFEMTET_TRIAL_STATE_KEY]
|
{pyfemtet-1.0.0 → pyfemtet-1.0.0b0}/pyfemtet/opt/optimizer/optuna_optimizer/_optuna_optimizer.py
RENAMED
|
@@ -39,37 +39,6 @@ warnings.filterwarnings('ignore', 'Argument ``constraints_func`` is an experimen
|
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
class OptunaOptimizer(AbstractOptimizer):
|
|
42
|
-
"""
|
|
43
|
-
An optimizer class utilizing Optuna for hyperparameter optimization.
|
|
44
|
-
|
|
45
|
-
This class provides an interface to conduct optimization studies using Optuna.
|
|
46
|
-
It manages the study lifecycle, sampler configuration, and trial execution.
|
|
47
|
-
|
|
48
|
-
Attributes:
|
|
49
|
-
study_name (str): Name of the Optuna study.
|
|
50
|
-
storage (str | optuna.storages.BaseStorage): Storage URL or object for the Optuna study.
|
|
51
|
-
storage_path (str): Path to the Optuna study storage.
|
|
52
|
-
current_trial (optuna.trial.Trial | None): The current Optuna trial being evaluated.
|
|
53
|
-
sampler_class (type[optuna.samplers.BaseSampler]): The class of the Optuna sampler to use.
|
|
54
|
-
sampler_kwargs (dict): Keyword arguments to initialize the sampler.
|
|
55
|
-
n_trials (int | None): Number of trials to run in the study.
|
|
56
|
-
timeout (float | None): Maximum time allowed for the optimization.
|
|
57
|
-
callbacks (list): List of callback functions to invoke during optimization.
|
|
58
|
-
|
|
59
|
-
Args:
|
|
60
|
-
sampler_class (type[optuna.samplers.BaseSampler], optional): The sampler class for suggesting parameter values. Defaults to TPESampler if None.
|
|
61
|
-
sampler_kwargs (dict[str, ...], optional): Dictionary of keyword arguments for the sampler. Defaults to an empty dictionary.
|
|
62
|
-
|
|
63
|
-
Raises:
|
|
64
|
-
None
|
|
65
|
-
|
|
66
|
-
Examples:
|
|
67
|
-
>>> optimizer = OptunaOptimizer()
|
|
68
|
-
>>> optimizer.n_trials = 100
|
|
69
|
-
>>> optimizer.timeout = 600
|
|
70
|
-
>>> # Further configuration and usage...
|
|
71
|
-
"""
|
|
72
|
-
|
|
73
42
|
# system
|
|
74
43
|
study_name = 'pyfemtet-study'
|
|
75
44
|
storage: str | optuna.storages.BaseStorage
|
|
@@ -153,7 +122,7 @@ class OptunaOptimizer(AbstractOptimizer):
|
|
|
153
122
|
|
|
154
123
|
y, dict_y_internal, c, record = f_return
|
|
155
124
|
|
|
156
|
-
# convert constraint to **sorted
|
|
125
|
+
# convert constraint to **sorted** violation
|
|
157
126
|
assert len(c) == len(self.opt_.constraints)
|
|
158
127
|
v = {}
|
|
159
128
|
for cns_name, cns in self.opt_.constraints.items():
|
|
@@ -170,7 +139,10 @@ class OptunaOptimizer(AbstractOptimizer):
|
|
|
170
139
|
|
|
171
140
|
def _postprocess(self):
|
|
172
141
|
# update trial attribute
|
|
173
|
-
self.
|
|
142
|
+
self.opt.current_trial.set_user_attr(
|
|
143
|
+
self.optuna_attr.key,
|
|
144
|
+
self.optuna_attr.value,
|
|
145
|
+
)
|
|
174
146
|
|
|
175
147
|
def _create_infeasible_constraints(self, opt_: AbstractOptimizer = None) -> tuple:
|
|
176
148
|
opt_ = opt_ if opt_ is not None else self
|
|
@@ -183,9 +155,9 @@ class OptunaOptimizer(AbstractOptimizer):
|
|
|
183
155
|
return tuple(1e9 * np.ones(count, dtype=np.float64))
|
|
184
156
|
|
|
185
157
|
def _constraint(self, trial: optuna.trial.FrozenTrial):
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
return
|
|
158
|
+
key = OptunaAttribute(self).key
|
|
159
|
+
value = trial.user_attrs[key]
|
|
160
|
+
return OptunaAttribute.get_violation_from_trial_attr(value)
|
|
189
161
|
|
|
190
162
|
def _objective(self, trial: optuna.trial.Trial):
|
|
191
163
|
|
|
@@ -254,9 +226,9 @@ class OptunaOptimizer(AbstractOptimizer):
|
|
|
254
226
|
|
|
255
227
|
# To avoid trial FAILED with hard constraint
|
|
256
228
|
# violation, check pf_state and raise TrialPruned.
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
state
|
|
229
|
+
key = OptunaAttribute(self).key
|
|
230
|
+
value = trial.user_attrs[key]
|
|
231
|
+
state = OptunaAttribute.get_pf_state_from_trial_attr(value)
|
|
260
232
|
if state in [
|
|
261
233
|
TrialState.hard_constraint_violation,
|
|
262
234
|
TrialState.model_error,
|
|
@@ -273,6 +245,9 @@ class OptunaOptimizer(AbstractOptimizer):
|
|
|
273
245
|
|
|
274
246
|
return y_internal
|
|
275
247
|
|
|
248
|
+
if get_client() is None:
|
|
249
|
+
self.history.save()
|
|
250
|
+
|
|
276
251
|
def _get_callback(self, n_trials: int):
|
|
277
252
|
|
|
278
253
|
# restart である場合、追加 N 回と見做す
|
|
@@ -612,16 +587,16 @@ def debug_1():
|
|
|
612
587
|
_opt.add_parameter('x1', 1, -1, 1, step=0.1)
|
|
613
588
|
_opt.add_parameter('x2', 1, -1, 1, step=0.1)
|
|
614
589
|
_opt.add_categorical_parameter('x3', 'a', choices=['a', 'b', 'c'])
|
|
615
|
-
|
|
616
|
-
_opt.add_objective('obj1', _parabola, args=(_opt
|
|
617
|
-
# _opt.add_objective('obj2', _parabola2, args=(_opt
|
|
590
|
+
_opt.add_constraint('cns', _cns, lower_bound=-0.9, args=(_fem, _opt))
|
|
591
|
+
_opt.add_objective('obj1', _parabola, args=(_fem, _opt))
|
|
592
|
+
# _opt.add_objective('obj2', _parabola2, args=(_fem, _opt))
|
|
618
593
|
|
|
619
594
|
# # ===== sub-fidelity =====
|
|
620
595
|
# __fem = NoFEM()
|
|
621
596
|
# __opt = SubFidelityModel()
|
|
622
597
|
# __opt.fem = __fem
|
|
623
|
-
# __opt.add_objective('obj1', _parabola, args=(__opt
|
|
624
|
-
#
|
|
598
|
+
# __opt.add_objective('obj1', _parabola, args=(__fem, __opt))
|
|
599
|
+
# __opt.add_objective('obj2', _parabola2, args=(__fem, __opt))
|
|
625
600
|
#
|
|
626
601
|
# _opt.add_sub_fidelity_model(name='low-fidelity', sub_fidelity_model=__opt, fidelity=0.5)
|
|
627
602
|
#
|
|
@@ -647,96 +622,6 @@ def debug_1():
|
|
|
647
622
|
_opt.history.save()
|
|
648
623
|
|
|
649
624
|
|
|
650
|
-
def debug_1s():
|
|
651
|
-
# from pyfemtet.opt.optimizer.optuna_optimizer.pof_botorch.pof_botorch_sampler import
|
|
652
|
-
# sampler = PoFBoTorchSampler(
|
|
653
|
-
# n_startup_trials=5,
|
|
654
|
-
# seed=42,
|
|
655
|
-
# constraints_func=self._constraint,
|
|
656
|
-
# pof_config=PoFConfig(
|
|
657
|
-
# # consider_pof=False,
|
|
658
|
-
# # feasibility_cdf_threshold='mean',
|
|
659
|
-
# ),
|
|
660
|
-
# partial_optimize_acqf_kwargs=PartialOptimizeACQFConfig(
|
|
661
|
-
# # gen_candidates='scipy',
|
|
662
|
-
# timeout_sec=5.,
|
|
663
|
-
# # method='SLSQP' # 'COBYLA, COBYQA, SLSQP or trust-constr
|
|
664
|
-
# tol=0.1,
|
|
665
|
-
# # scipy_minimize_kwargs=dict(),
|
|
666
|
-
# ),
|
|
667
|
-
# )
|
|
668
|
-
# from optuna_integration import BoTorchSampler
|
|
669
|
-
# sampler = BoTorchSampler(n_startup_trials=5)
|
|
670
|
-
|
|
671
|
-
os.chdir(os.path.dirname(__file__))
|
|
672
|
-
|
|
673
|
-
def _parabola(_fem: AbstractFEMInterface, _opt: AbstractOptimizer) -> float:
|
|
674
|
-
d = _opt.get_variables()
|
|
675
|
-
x1 = d['x1']
|
|
676
|
-
x2 = d['x2']
|
|
677
|
-
# if _cns(_fem, _opt) < 0:
|
|
678
|
-
# raise PostProcessError
|
|
679
|
-
return x1 ** 2 + x2 ** 2
|
|
680
|
-
|
|
681
|
-
def _parabola2(_fem: AbstractFEMInterface, _opt: AbstractOptimizer) -> float:
|
|
682
|
-
x = _opt.get_variables('values')
|
|
683
|
-
return ((x - 0.1) ** 2).sum()
|
|
684
|
-
|
|
685
|
-
def _cns(_fem: AbstractFEMInterface, _opt: AbstractOptimizer) -> float:
|
|
686
|
-
x = _opt.get_variables('values')
|
|
687
|
-
return x[0]
|
|
688
|
-
|
|
689
|
-
_fem = NoFEM()
|
|
690
|
-
_opt = OptunaOptimizer()
|
|
691
|
-
_opt.fem = _fem
|
|
692
|
-
|
|
693
|
-
# _opt.sampler = optuna.samplers.RandomSampler(seed=42)
|
|
694
|
-
_opt.seed = 42
|
|
695
|
-
_opt.sampler_class = optuna.samplers.TPESampler
|
|
696
|
-
# _opt.sampler_class = optuna.samplers.RandomSampler
|
|
697
|
-
_opt.sampler_kwargs = dict(
|
|
698
|
-
n_startup_trials=5,
|
|
699
|
-
)
|
|
700
|
-
_opt.n_trials = 10
|
|
701
|
-
|
|
702
|
-
_opt.add_parameter('x1', 1, -1, 1, step=0.1)
|
|
703
|
-
_opt.add_parameter('x2', 1, -1, 1, step=0.1)
|
|
704
|
-
_opt.add_categorical_parameter('x3', 'a', choices=['a', 'b', 'c'])
|
|
705
|
-
# _opt.add_constraint('cns', _cns, lower_bound=-0.9, args=(_opt,))
|
|
706
|
-
_opt.add_objective('obj1', _parabola, args=(_opt,))
|
|
707
|
-
# _opt.add_objective('obj2', _parabola2, args=(_opt,))
|
|
708
|
-
|
|
709
|
-
# ===== sub-fidelity =====
|
|
710
|
-
__fem = NoFEM()
|
|
711
|
-
__opt = SubFidelityModel()
|
|
712
|
-
__opt.fem = __fem
|
|
713
|
-
__opt.add_objective('obj1', _parabola, args=(__opt,))
|
|
714
|
-
# __opt.add_objective('obj2', _parabola2, args=(__opt,))
|
|
715
|
-
|
|
716
|
-
_opt.add_sub_fidelity_model(name='low-fidelity', sub_fidelity_model=__opt, fidelity=0.5)
|
|
717
|
-
|
|
718
|
-
def _solve_condition(_history: History):
|
|
719
|
-
|
|
720
|
-
sub_fidelity_df = _history.get_df(
|
|
721
|
-
{'sub_fidelity_name': 'low-fidelity'}
|
|
722
|
-
)
|
|
723
|
-
idx = sub_fidelity_df['state'] == TrialState.succeeded
|
|
724
|
-
pdf = sub_fidelity_df[idx]
|
|
725
|
-
|
|
726
|
-
return len(pdf) % 5 == 0
|
|
727
|
-
|
|
728
|
-
_opt.set_solve_condition(_solve_condition)
|
|
729
|
-
|
|
730
|
-
# _opt.history.path = 'restart-test.csv'
|
|
731
|
-
_opt.run()
|
|
732
|
-
|
|
733
|
-
# import plotly.express as px
|
|
734
|
-
# _df = _opt.history.get_df()
|
|
735
|
-
# px.scatter_3d(_df, x='x1', y='x2', z='obj', color='fidelity', opacity=0.5).show()
|
|
736
|
-
|
|
737
|
-
_opt.history.save()
|
|
738
|
-
|
|
739
|
-
|
|
740
625
|
def substrate_size(Femtet):
|
|
741
626
|
"""基板のXY平面上での専有面積を計算します。"""
|
|
742
627
|
substrate_w = Femtet.GetVariableValue('substrate_w')
|
|
@@ -784,13 +669,10 @@ def debug_3():
|
|
|
784
669
|
opt.add_parameter(name="substrate_d", initial_value=60, lower_bound=34, upper_bound=60)
|
|
785
670
|
|
|
786
671
|
opt.n_trials = 5
|
|
787
|
-
opt.history.path = os.path.join(os.path.dirname(__file__), 'femtet-test
|
|
672
|
+
opt.history.path = os.path.join(os.path.dirname(__file__), 'femtet-test.csv')
|
|
788
673
|
|
|
789
674
|
opt.run()
|
|
790
675
|
|
|
791
676
|
|
|
792
677
|
if __name__ == '__main__':
|
|
793
|
-
debug_1()
|
|
794
|
-
debug_1s()
|
|
795
|
-
debug_2()
|
|
796
678
|
debug_3()
|
|
@@ -973,9 +973,9 @@ class PoFBoTorchSampler(BoTorchSampler):
|
|
|
973
973
|
feasible_trials: list[FrozenTrial] = []
|
|
974
974
|
infeasible_trials: list[FrozenTrial] = []
|
|
975
975
|
for trial in (completed_trials + pruned_trials):
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
976
|
+
state: PFTrialState = OptunaAttribute.get_pf_state_from_trial_attr(
|
|
977
|
+
trial.user_attrs[OptunaAttribute.main_fidelity_key()]
|
|
978
|
+
)
|
|
979
979
|
|
|
980
980
|
if state in self.pof_config._states_to_consider_pof:
|
|
981
981
|
infeasible_trials.append(trial)
|