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.
- pyfemtet/__init__.py +6 -1
- pyfemtet/_i18n/1. make_pot_and_update_po.bat +8 -0
- pyfemtet/_i18n/2. build_mo.bat +5 -0
- pyfemtet/_i18n/__init__.py +4 -0
- pyfemtet/_i18n/babel.cfg +2 -0
- pyfemtet/_i18n/i18n.py +37 -0
- pyfemtet/_i18n/locales/ja/LC_MESSAGES/messages.mo +0 -0
- pyfemtet/_i18n/locales/ja/LC_MESSAGES/messages.po +1020 -0
- pyfemtet/_i18n/locales/messages.pot +987 -0
- pyfemtet/{_message → _i18n}/messages.py +128 -41
- pyfemtet/_util/closing.py +19 -0
- pyfemtet/_util/dask_util.py +89 -7
- pyfemtet/_util/df_util.py +29 -0
- pyfemtet/_util/excel_macro_util.py +8 -3
- pyfemtet/_util/excel_parse_util.py +43 -23
- pyfemtet/_util/femtet_access_inspection.py +120 -0
- pyfemtet/{_femtet_config_util/autosave.py → _util/femtet_autosave.py} +7 -0
- pyfemtet/_util/femtet_exit.py +105 -0
- pyfemtet/_util/femtet_version.py +20 -0
- pyfemtet/_util/helper.py +94 -0
- pyfemtet/_util/process_util.py +107 -0
- pyfemtet/_util/str_enum.py +44 -0
- pyfemtet/core.py +15 -47
- pyfemtet/dispatch_extensions/__init__.py +8 -11
- pyfemtet/dispatch_extensions/_impl.py +42 -198
- pyfemtet/logger/__init__.py +8 -1
- pyfemtet/logger/_impl.py +5 -6
- pyfemtet/opt/__init__.py +3 -17
- pyfemtet/opt/exceptions.py +45 -0
- pyfemtet/opt/femopt.py +608 -0
- pyfemtet/opt/history/__init__.py +11 -0
- pyfemtet/opt/history/_history.py +1404 -0
- pyfemtet/opt/history/_hypervolume.py +169 -0
- pyfemtet/opt/history/_optimality.py +79 -0
- pyfemtet/opt/interface/__init__.py +17 -24
- pyfemtet/opt/interface/_base_interface.py +222 -0
- pyfemtet/opt/interface/_excel_interface/__init__.py +3 -0
- pyfemtet/opt/interface/_excel_interface/debug-excel-interface.xlsm +0 -0
- pyfemtet/opt/interface/_excel_interface/excel_interface.py +999 -0
- pyfemtet/opt/interface/_femtet_interface/__init__.py +3 -0
- pyfemtet/opt/interface/{_femtet_parametric.py → _femtet_interface/_femtet_parametric.py} +20 -12
- pyfemtet/opt/interface/{_femtet.py → _femtet_interface/femtet_interface.py} +505 -349
- pyfemtet/opt/interface/_femtet_with_nx_interface/__init__.py +5 -0
- pyfemtet/opt/interface/_femtet_with_nx_interface/femtet_with_nx_interface.py +230 -0
- pyfemtet/opt/interface/_femtet_with_nx_interface/model1.prt +0 -0
- pyfemtet/opt/interface/_femtet_with_nx_interface/model1.x_t +98 -0
- pyfemtet/opt/interface/{_femtet_with_nx → _femtet_with_nx_interface}/update_model.py +1 -3
- pyfemtet/opt/interface/_femtet_with_solidworks/__init__.py +5 -0
- pyfemtet/opt/interface/_femtet_with_solidworks/femtet_with_solidworks_interface.py +122 -0
- pyfemtet/opt/interface/_solidworks_interface/__init__.py +5 -0
- pyfemtet/opt/interface/_solidworks_interface/solidworks_interface.py +206 -0
- pyfemtet/opt/interface/_surrogate_model_interface/__init__.py +8 -0
- pyfemtet/opt/interface/_surrogate_model_interface/base_surrogate_interface.py +150 -0
- pyfemtet/opt/interface/_surrogate_model_interface/botorch_interface.py +298 -0
- pyfemtet/opt/interface/_surrogate_model_interface/debug-pof-botorch.reccsv +18 -0
- pyfemtet/opt/interface/_with_excel_settings/__init__.py +61 -0
- pyfemtet/opt/interface/_with_excel_settings/with_excel_settings.py +134 -0
- pyfemtet/opt/meta_script/YAML_Generator.xlsm +0 -0
- pyfemtet/opt/meta_script/__main__.py +58 -36
- pyfemtet/opt/optimizer/__init__.py +7 -9
- pyfemtet/opt/optimizer/_base_optimizer.py +885 -0
- pyfemtet/opt/optimizer/optuna_optimizer/__init__.py +9 -0
- pyfemtet/opt/optimizer/optuna_optimizer/_optuna_attribute.py +73 -0
- pyfemtet/opt/optimizer/optuna_optimizer/_optuna_optimizer.py +678 -0
- pyfemtet/opt/optimizer/optuna_optimizer/_pof_botorch/__init__.py +7 -0
- pyfemtet/opt/optimizer/optuna_optimizer/_pof_botorch/debug-pof-botorch.reccsv +18 -0
- pyfemtet/opt/optimizer/optuna_optimizer/_pof_botorch/enable_nonlinear_constraint.py +244 -0
- pyfemtet/opt/optimizer/optuna_optimizer/_pof_botorch/pof_botorch_sampler.py +1249 -0
- pyfemtet/opt/optimizer/optuna_optimizer/wat_ex14_parametric_jp.femprj +0 -0
- pyfemtet/opt/optimizer/scipy_optimizer/__init__.py +1 -0
- pyfemtet/opt/optimizer/scipy_optimizer/_scipy_optimizer.py +364 -0
- pyfemtet/opt/prediction/__init__.py +7 -0
- pyfemtet/opt/prediction/_botorch_utils.py +133 -0
- pyfemtet/opt/prediction/_gpytorch_modules_extension.py +142 -0
- pyfemtet/opt/prediction/_helper.py +155 -0
- pyfemtet/opt/prediction/_model.py +118 -0
- pyfemtet/opt/problem/problem.py +304 -0
- pyfemtet/opt/problem/variable_manager/__init__.py +20 -0
- pyfemtet/opt/problem/variable_manager/_string_as_expression.py +115 -0
- pyfemtet/opt/problem/variable_manager/_variable_manager.py +295 -0
- pyfemtet/opt/visualization/history_viewer/__main__.py +5 -0
- pyfemtet/opt/visualization/{_base.py → history_viewer/_base_application.py} +18 -13
- pyfemtet/opt/visualization/history_viewer/_common_pages.py +150 -0
- pyfemtet/opt/visualization/{_complex_components → history_viewer/_complex_components}/alert_region.py +10 -5
- pyfemtet/opt/visualization/{_complex_components → history_viewer/_complex_components}/control_femtet.py +16 -13
- pyfemtet/opt/visualization/{_complex_components → history_viewer/_complex_components}/main_graph.py +117 -47
- pyfemtet/opt/visualization/{_complex_components → history_viewer/_complex_components}/pm_graph.py +159 -138
- pyfemtet/opt/visualization/history_viewer/_process_monitor/_application.py +173 -0
- pyfemtet/opt/visualization/history_viewer/_process_monitor/_pages.py +291 -0
- pyfemtet/opt/visualization/{_wrapped_components → history_viewer/_wrapped_components}/dbc.py +1 -1
- pyfemtet/opt/visualization/{_wrapped_components → history_viewer/_wrapped_components}/dcc.py +1 -1
- pyfemtet/opt/visualization/{_wrapped_components → history_viewer/_wrapped_components}/html.py +1 -1
- pyfemtet/opt/visualization/history_viewer/result_viewer/__main__.py +5 -0
- pyfemtet/opt/visualization/{result_viewer/application.py → history_viewer/result_viewer/_application.py} +6 -6
- pyfemtet/opt/visualization/{result_viewer/pages.py → history_viewer/result_viewer/_pages.py} +106 -82
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08.csv +18 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08.db +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8.log +45 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_1.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_1.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_10.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_10.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_11.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_11.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_12.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_12.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_13.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_13.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_14.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_14.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_15.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_15.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_16.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_16.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_17.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_17.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_18.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_18.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_19.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_19.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_2.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_2.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_20.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_20.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_3.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_3.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.bgr +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.bnd +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.btr +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.mtl +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_4.prm +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_5.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_5.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_6.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_6.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_7.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_7.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_8.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_8.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_9.jpg +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.Results/ex8_trial_9.pdt +0 -0
- pyfemtet/opt/visualization/history_viewer/result_viewer/tutorial_files/tutorial_gau_ex08_parametric.femprj +0 -0
- pyfemtet/opt/visualization/plotter/main_figure_creator.py +536 -0
- pyfemtet/opt/visualization/plotter/pm_graph_creator.py +359 -0
- pyfemtet/opt/worker_status.py +120 -0
- {pyfemtet-0.9.5.dist-info → pyfemtet-1.0.0b0.dist-info}/METADATA +23 -24
- pyfemtet-1.0.0b0.dist-info/RECORD +172 -0
- pyfemtet-1.0.0b0.dist-info/entry_points.txt +3 -0
- pyfemtet/_femtet_config_util/exit.py +0 -59
- pyfemtet/_message/1. make_pot.bat +0 -11
- pyfemtet/_message/2. make_mo.bat +0 -6
- pyfemtet/_message/__init__.py +0 -5
- pyfemtet/_message/babel.cfg +0 -2
- pyfemtet/_message/locales/ja/LC_MESSAGES/messages.mo +0 -0
- pyfemtet/_message/locales/ja/LC_MESSAGES/messages.po +0 -570
- pyfemtet/_message/locales/messages.pot +0 -551
- pyfemtet/_warning.py +0 -87
- pyfemtet/brep/_impl.py +0 -18
- pyfemtet/opt/_femopt.py +0 -1007
- pyfemtet/opt/_femopt_core.py +0 -1169
- pyfemtet/opt/_test_utils/control_femtet.py +0 -39
- pyfemtet/opt/_test_utils/hyper_sphere.py +0 -24
- pyfemtet/opt/_test_utils/record_history.py +0 -130
- pyfemtet/opt/advanced_samples/excel_ui/(ref) original_project.femprj +0 -0
- pyfemtet/opt/advanced_samples/excel_ui/femtet-macro.xlsm +0 -0
- pyfemtet/opt/advanced_samples/excel_ui/pyfemtet-core.py +0 -291
- pyfemtet/opt/advanced_samples/excel_ui/test-pyfemtet-core.cmd +0 -22
- pyfemtet/opt/advanced_samples/restart/gal_ex13_parametric.femprj +0 -0
- pyfemtet/opt/advanced_samples/restart/gal_ex13_parametric_restart.py +0 -99
- pyfemtet/opt/advanced_samples/restart/gal_ex13_parametric_restart_jp.py +0 -102
- pyfemtet/opt/advanced_samples/surrogate_model/gal_ex13_create_training_data.py +0 -60
- pyfemtet/opt/advanced_samples/surrogate_model/gal_ex13_create_training_data_jp.py +0 -57
- pyfemtet/opt/advanced_samples/surrogate_model/gal_ex13_optimize_with_surrogate.py +0 -100
- pyfemtet/opt/advanced_samples/surrogate_model/gal_ex13_optimize_with_surrogate_jp.py +0 -90
- pyfemtet/opt/advanced_samples/surrogate_model/gal_ex13_parametric.femprj +0 -0
- pyfemtet/opt/interface/_base.py +0 -101
- pyfemtet/opt/interface/_excel_interface.py +0 -984
- pyfemtet/opt/interface/_femtet_excel.py +0 -141
- pyfemtet/opt/interface/_femtet_with_nx/__init__.py +0 -3
- pyfemtet/opt/interface/_femtet_with_nx/_interface.py +0 -178
- pyfemtet/opt/interface/_femtet_with_sldworks.py +0 -298
- pyfemtet/opt/interface/_surrogate/__init__.py +0 -5
- pyfemtet/opt/interface/_surrogate/_base.py +0 -129
- pyfemtet/opt/interface/_surrogate/_chaospy.py +0 -71
- pyfemtet/opt/interface/_surrogate/_singletaskgp.py +0 -71
- pyfemtet/opt/interface/_surrogate_excel.py +0 -102
- pyfemtet/opt/optimizer/_base.py +0 -376
- pyfemtet/opt/optimizer/_optuna/_botorch_patch/enable_nonlinear_constraint.py +0 -220
- pyfemtet/opt/optimizer/_optuna/_optuna.py +0 -434
- pyfemtet/opt/optimizer/_optuna/_pof_botorch.py +0 -1914
- pyfemtet/opt/optimizer/_scipy.py +0 -159
- pyfemtet/opt/optimizer/_scipy_scalar.py +0 -127
- pyfemtet/opt/optimizer/parameter.py +0 -113
- pyfemtet/opt/prediction/_base.py +0 -61
- pyfemtet/opt/prediction/single_task_gp.py +0 -119
- pyfemtet/opt/samples/femprj_sample/ParametricIF.femprj +0 -0
- pyfemtet/opt/samples/femprj_sample/ParametricIF.py +0 -29
- pyfemtet/opt/samples/femprj_sample/ParametricIF_test_result.reccsv +0 -13
- pyfemtet/opt/samples/femprj_sample/cad_ex01_NX.femprj +0 -0
- pyfemtet/opt/samples/femprj_sample/cad_ex01_NX.prt +0 -0
- pyfemtet/opt/samples/femprj_sample/cad_ex01_NX.py +0 -135
- pyfemtet/opt/samples/femprj_sample/cad_ex01_NX_test_result.reccsv +0 -23
- pyfemtet/opt/samples/femprj_sample/cad_ex01_SW.SLDPRT +0 -0
- pyfemtet/opt/samples/femprj_sample/cad_ex01_SW.femprj +0 -0
- pyfemtet/opt/samples/femprj_sample/cad_ex01_SW.py +0 -131
- pyfemtet/opt/samples/femprj_sample/cad_ex01_SW_test_result.reccsv +0 -23
- pyfemtet/opt/samples/femprj_sample/constrained_pipe.femprj +0 -0
- pyfemtet/opt/samples/femprj_sample/constrained_pipe.py +0 -96
- pyfemtet/opt/samples/femprj_sample/constrained_pipe_test_result.reccsv +0 -13
- pyfemtet/opt/samples/femprj_sample/gal_ex58_parametric.femprj +0 -0
- pyfemtet/opt/samples/femprj_sample/gal_ex58_parametric.py +0 -74
- pyfemtet/opt/samples/femprj_sample/gal_ex58_parametric_test_result.reccsv +0 -13
- pyfemtet/opt/samples/femprj_sample/gau_ex08_parametric.femprj +0 -0
- pyfemtet/opt/samples/femprj_sample/gau_ex08_parametric.py +0 -58
- pyfemtet/opt/samples/femprj_sample/gau_ex08_parametric_test_result.reccsv +0 -23
- pyfemtet/opt/samples/femprj_sample/gau_ex12_parametric.femprj +0 -0
- pyfemtet/opt/samples/femprj_sample/gau_ex12_parametric.py +0 -52
- pyfemtet/opt/samples/femprj_sample/her_ex40_parametric.femprj +0 -0
- pyfemtet/opt/samples/femprj_sample/her_ex40_parametric.py +0 -138
- pyfemtet/opt/samples/femprj_sample/her_ex40_parametric_test_result.reccsv +0 -18
- pyfemtet/opt/samples/femprj_sample/paswat_ex1_parametric.femprj +0 -0
- pyfemtet/opt/samples/femprj_sample/paswat_ex1_parametric.py +0 -60
- pyfemtet/opt/samples/femprj_sample/paswat_ex1_parametric_parallel.py +0 -61
- pyfemtet/opt/samples/femprj_sample/paswat_ex1_parametric_test_result.reccsv +0 -18
- pyfemtet/opt/samples/femprj_sample/wat_ex14_parametric.femprj +0 -0
- pyfemtet/opt/samples/femprj_sample/wat_ex14_parametric.py +0 -58
- pyfemtet/opt/samples/femprj_sample/wat_ex14_parametric_parallel.py +0 -58
- pyfemtet/opt/samples/femprj_sample/wat_ex14_parametric_test_result.reccsv +0 -18
- pyfemtet/opt/samples/femprj_sample_jp/ParametricIF_jp.femprj +0 -0
- pyfemtet/opt/samples/femprj_sample_jp/ParametricIF_jp.py +0 -29
- pyfemtet/opt/samples/femprj_sample_jp/cad_ex01_NX_jp.femprj +0 -0
- pyfemtet/opt/samples/femprj_sample_jp/cad_ex01_NX_jp.py +0 -129
- pyfemtet/opt/samples/femprj_sample_jp/cad_ex01_SW_jp.femprj +0 -0
- pyfemtet/opt/samples/femprj_sample_jp/cad_ex01_SW_jp.py +0 -125
- pyfemtet/opt/samples/femprj_sample_jp/constrained_pipe_jp.py +0 -93
- pyfemtet/opt/samples/femprj_sample_jp/gal_ex58_parametric_jp.femprj +0 -0
- pyfemtet/opt/samples/femprj_sample_jp/gal_ex58_parametric_jp.py +0 -70
- pyfemtet/opt/samples/femprj_sample_jp/gau_ex08_parametric_jp.femprj +0 -0
- pyfemtet/opt/samples/femprj_sample_jp/gau_ex08_parametric_jp.py +0 -57
- pyfemtet/opt/samples/femprj_sample_jp/gau_ex12_parametric_jp.py +0 -52
- pyfemtet/opt/samples/femprj_sample_jp/her_ex40_parametric_jp.femprj +0 -0
- pyfemtet/opt/samples/femprj_sample_jp/her_ex40_parametric_jp.py +0 -138
- pyfemtet/opt/samples/femprj_sample_jp/paswat_ex1_parametric_jp.femprj +0 -0
- pyfemtet/opt/samples/femprj_sample_jp/paswat_ex1_parametric_jp.py +0 -58
- pyfemtet/opt/samples/femprj_sample_jp/paswat_ex1_parametric_parallel_jp.py +0 -59
- pyfemtet/opt/samples/femprj_sample_jp/wat_ex14_parametric_jp.py +0 -56
- pyfemtet/opt/samples/femprj_sample_jp/wat_ex14_parametric_parallel_jp.py +0 -56
- pyfemtet/opt/visualization/_complex_components/main_figure_creator.py +0 -332
- pyfemtet/opt/visualization/_complex_components/pm_graph_creator.py +0 -201
- pyfemtet/opt/visualization/_process_monitor/application.py +0 -226
- pyfemtet/opt/visualization/_process_monitor/pages.py +0 -406
- pyfemtet/opt/visualization/_wrapped_components/__init__.py +0 -0
- pyfemtet/opt/visualization/result_viewer/__init__.py +0 -0
- pyfemtet-0.9.5.dist-info/RECORD +0 -158
- pyfemtet-0.9.5.dist-info/entry_points.txt +0 -3
- /pyfemtet/{_femtet_config_util → opt/problem}/__init__.py +0 -0
- /pyfemtet/{brep → opt/visualization/history_viewer}/__init__.py +0 -0
- /pyfemtet/opt/{_test_utils → visualization/history_viewer/_complex_components}/__init__.py +0 -0
- /pyfemtet/opt/{optimizer/_optuna → visualization/history_viewer/_process_monitor}/__init__.py +0 -0
- /pyfemtet/opt/{optimizer/_optuna/_botorch_patch → visualization/history_viewer/_wrapped_components}/__init__.py +0 -0
- /pyfemtet/opt/visualization/{_wrapped_components → history_viewer/_wrapped_components}/str_enum.py +0 -0
- /pyfemtet/opt/visualization/{result_viewer → history_viewer/result_viewer}/.gitignore +0 -0
- /pyfemtet/opt/visualization/{_complex_components → history_viewer/result_viewer}/__init__.py +0 -0
- /pyfemtet/opt/visualization/{_process_monitor → plotter}/__init__.py +0 -0
- /pyfemtet/opt/{samples/femprj_sample_jp/wat_ex14_parametric_jp.femprj → wat_ex14_parametric_jp.femprj} +0 -0
- {pyfemtet-0.9.5.dist-info → pyfemtet-1.0.0b0.dist-info}/LICENSE +0 -0
- {pyfemtet-0.9.5.dist-info → pyfemtet-1.0.0b0.dist-info}/LICENSE_THIRD_PARTY.txt +0 -0
- {pyfemtet-0.9.5.dist-info → pyfemtet-1.0.0b0.dist-info}/WHEEL +0 -0
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
from time import sleep
|
|
3
|
-
|
|
4
|
-
from optuna.samplers import RandomSampler, NSGAIISampler, GPSampler, BaseSampler
|
|
5
|
-
|
|
6
|
-
from pyfemtet.opt import FEMOpt, FemtetInterface, OptunaOptimizer
|
|
7
|
-
|
|
8
|
-
os.chdir(os.path.dirname(__file__))
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
def get_res_freq(Femtet):
|
|
12
|
-
Galileo = Femtet.Gogh.Galileo
|
|
13
|
-
Galileo.Mode = 0
|
|
14
|
-
sleep(0.01)
|
|
15
|
-
return Galileo.GetFreq().Real
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
def main(n_trials, sampler_class: type[BaseSampler], sampler_kwargs: dict):
|
|
19
|
-
"""メイン関数
|
|
20
|
-
|
|
21
|
-
このサンプルは最適化を途中で中断して続きから行う場合で、
|
|
22
|
-
各リスタートで異なるアルゴリズムを使用して
|
|
23
|
-
最適化を再開する方法を示しています。
|
|
24
|
-
|
|
25
|
-
このメイン関数は n_trials と sampler_class を与えると
|
|
26
|
-
その回数、アルゴリズムに応じて最適化を行います。
|
|
27
|
-
|
|
28
|
-
Args:
|
|
29
|
-
|
|
30
|
-
n_trials (int):
|
|
31
|
-
最適化を終了するために必要な追加の成功した試行回数。
|
|
32
|
-
|
|
33
|
-
sampler_class (type[optuna.samplers.BaseSampler]):
|
|
34
|
-
使用するアルゴリズム。
|
|
35
|
-
|
|
36
|
-
sampler_kwargs (dict):
|
|
37
|
-
アルゴリズムの引数。
|
|
38
|
-
|
|
39
|
-
"""
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
# Femtet に接続します。
|
|
43
|
-
fem = FemtetInterface(
|
|
44
|
-
femprj_path='gal_ex13_parametric.femprj',
|
|
45
|
-
)
|
|
46
|
-
|
|
47
|
-
# 最適化オブジェクトを初期化します。
|
|
48
|
-
opt = OptunaOptimizer(
|
|
49
|
-
sampler_class=sampler_class,
|
|
50
|
-
sampler_kwargs=sampler_kwargs,
|
|
51
|
-
)
|
|
52
|
-
|
|
53
|
-
# リスタートするためには以前の最適化の履歴を
|
|
54
|
-
# 新しい最適化プログラムに知らせる必要があります。
|
|
55
|
-
# FEMOpt の `history_path` 引数に csv を指定すると、
|
|
56
|
-
# それが存在しない場合、新しい csv ファイルを作り、
|
|
57
|
-
# それが存在する場合、その csv ファイルの続きから
|
|
58
|
-
# 最適化を実行します。
|
|
59
|
-
#
|
|
60
|
-
# 注意:
|
|
61
|
-
# リスタートする場合、変数の数と名前、目的関数の数と
|
|
62
|
-
# 名前、および拘束関数の数と名前が一貫している必要が
|
|
63
|
-
# あります。
|
|
64
|
-
# ただし、変数の上下限や目的関数の方向、拘束関数の内容
|
|
65
|
-
# などは変更できます。
|
|
66
|
-
#
|
|
67
|
-
# 注意:
|
|
68
|
-
# OptunaOptimizer を使用する場合、csv と同名の
|
|
69
|
-
# .db ファイル (ここでは restarting-sample.db) が
|
|
70
|
-
# csv ファイルと同じフォルダにある必要があります。
|
|
71
|
-
femopt = FEMOpt(
|
|
72
|
-
fem=fem,
|
|
73
|
-
opt=opt,
|
|
74
|
-
history_path='restarting-sample.csv'
|
|
75
|
-
)
|
|
76
|
-
|
|
77
|
-
# 設計パラメータを指定します。
|
|
78
|
-
femopt.add_parameter('length', 0.1, 0.02, 0.2)
|
|
79
|
-
femopt.add_parameter('width', 0.01, 0.001, 0.02)
|
|
80
|
-
femopt.add_parameter('base_radius', 0.008, 0.006, 0.01)
|
|
81
|
-
|
|
82
|
-
# 目的関数を指定します。
|
|
83
|
-
femopt.add_objective(fun=get_res_freq, name='First Resonant Frequency (Hz)', direction=800)
|
|
84
|
-
|
|
85
|
-
# 最適化を実行します。
|
|
86
|
-
femopt.set_random_seed(42)
|
|
87
|
-
femopt.optimize(n_trials=n_trials, confirm_before_exit=False)
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
if __name__ == '__main__':
|
|
91
|
-
# 最初に、RandomSampler を使用して 3 回計算を行います。
|
|
92
|
-
main(3, RandomSampler, {})
|
|
93
|
-
|
|
94
|
-
# 次に、NSGAIISampler を使用して 3 回計算を行います。
|
|
95
|
-
main(3, NSGAIISampler, {})
|
|
96
|
-
|
|
97
|
-
# 最後に、GPSampler を使用して 3 回計算を行います。
|
|
98
|
-
main(3, GPSampler, {'n_startup_trials': 0, 'deterministic_objective': True})
|
|
99
|
-
|
|
100
|
-
# このプログラム終了後、
|
|
101
|
-
# restarting-sample.csv と同名の .db ファイルを用いて
|
|
102
|
-
# さらに続きの最適化を行うことができます。
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
from time import sleep
|
|
3
|
-
|
|
4
|
-
from optuna.samplers import RandomSampler
|
|
5
|
-
|
|
6
|
-
from pyfemtet.opt import FEMOpt, FemtetInterface, OptunaOptimizer
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
def get_res_freq(Femtet):
|
|
10
|
-
Galileo = Femtet.Gogh.Galileo
|
|
11
|
-
Galileo.Mode = 0
|
|
12
|
-
sleep(0.01)
|
|
13
|
-
return Galileo.GetFreq().Real
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
if __name__ == '__main__':
|
|
17
|
-
|
|
18
|
-
os.chdir(os.path.dirname(__file__))
|
|
19
|
-
|
|
20
|
-
# Connect to Femtet.
|
|
21
|
-
fem = FemtetInterface(
|
|
22
|
-
femprj_path='gal_ex13_parametric.femprj',
|
|
23
|
-
)
|
|
24
|
-
|
|
25
|
-
# Initialize the optimization object.
|
|
26
|
-
# However, this script is not for optimization;
|
|
27
|
-
# instead, it is for creating training data.
|
|
28
|
-
# Therefore, we will use Optuna's random sampling
|
|
29
|
-
# class to select the design variables.
|
|
30
|
-
opt = OptunaOptimizer(
|
|
31
|
-
sampler_class=RandomSampler,
|
|
32
|
-
)
|
|
33
|
-
|
|
34
|
-
# We will set up the FEMOpt object. To refer to
|
|
35
|
-
# history_path in the optimization script, we will
|
|
36
|
-
# specify a clear CSV file name.
|
|
37
|
-
femopt = FEMOpt(
|
|
38
|
-
fem=fem,
|
|
39
|
-
opt=opt,
|
|
40
|
-
history_path='training_data.csv'
|
|
41
|
-
)
|
|
42
|
-
|
|
43
|
-
# Set the design variables.
|
|
44
|
-
femopt.add_parameter('length', 0.1, 0.02, 0.2)
|
|
45
|
-
femopt.add_parameter('width', 0.01, 0.001, 0.02)
|
|
46
|
-
femopt.add_parameter('base_radius', 0.008, 0.006, 0.01)
|
|
47
|
-
|
|
48
|
-
# Set the objective function. Since this is random
|
|
49
|
-
# sampling, specifying the direction does not affect
|
|
50
|
-
# the sampling.
|
|
51
|
-
femopt.add_objective(fun=get_res_freq, name='First Resonant Frequency (Hz)')
|
|
52
|
-
|
|
53
|
-
# Create the training data.
|
|
54
|
-
# If no termination condition is specified,
|
|
55
|
-
# it will continue creating training data until
|
|
56
|
-
# manually stopped.
|
|
57
|
-
femopt.set_random_seed(42)
|
|
58
|
-
femopt.optimize(
|
|
59
|
-
# n_trials=100
|
|
60
|
-
)
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
from time import sleep
|
|
3
|
-
|
|
4
|
-
from optuna.samplers import RandomSampler
|
|
5
|
-
|
|
6
|
-
from pyfemtet.opt import FEMOpt, FemtetInterface, OptunaOptimizer
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
def get_res_freq(Femtet):
|
|
10
|
-
Galileo = Femtet.Gogh.Galileo
|
|
11
|
-
Galileo.Mode = 0
|
|
12
|
-
sleep(0.01)
|
|
13
|
-
return Galileo.GetFreq().Real
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
if __name__ == '__main__':
|
|
17
|
-
|
|
18
|
-
os.chdir(os.path.dirname(__file__))
|
|
19
|
-
|
|
20
|
-
# Femtet との接続を行います。
|
|
21
|
-
fem = FemtetInterface(
|
|
22
|
-
femprj_path='gal_ex13_parametric.femprj',
|
|
23
|
-
)
|
|
24
|
-
|
|
25
|
-
# 最適化用オブジェクトの設定を行います。
|
|
26
|
-
# ただしこのスクリプトでは最適化ではなく
|
|
27
|
-
# 学習データ作成を行うので、 optuna の
|
|
28
|
-
# ランダムサンプリングクラスを用いて
|
|
29
|
-
# 設計変数の選定を行います。
|
|
30
|
-
opt = OptunaOptimizer(
|
|
31
|
-
sampler_class=RandomSampler,
|
|
32
|
-
)
|
|
33
|
-
|
|
34
|
-
# FEMOpt オブジェクトを設定します。
|
|
35
|
-
# 最適化スクリプトで history_path を参照するため、
|
|
36
|
-
# わかりやすい csv ファイル名を指定します。
|
|
37
|
-
femopt = FEMOpt(
|
|
38
|
-
fem=fem,
|
|
39
|
-
opt=opt,
|
|
40
|
-
history_path='training_data.csv'
|
|
41
|
-
)
|
|
42
|
-
|
|
43
|
-
# 設計変数を設定します。
|
|
44
|
-
femopt.add_parameter('length', 0.1, 0.02, 0.2)
|
|
45
|
-
femopt.add_parameter('width', 0.01, 0.001, 0.02)
|
|
46
|
-
femopt.add_parameter('base_radius', 0.008, 0.006, 0.01)
|
|
47
|
-
# 目的関数を設定します。ランダムサンプリングなので
|
|
48
|
-
# direction は指定してもサンプリングに影響しません。
|
|
49
|
-
femopt.add_objective(fun=get_res_freq, name='第一共振周波数(Hz)')
|
|
50
|
-
|
|
51
|
-
# 学習データ作成を行います。
|
|
52
|
-
# 終了条件を指定しない場合、手動で停止するまで
|
|
53
|
-
# 学習データ作成を続けます。
|
|
54
|
-
femopt.set_random_seed(42)
|
|
55
|
-
femopt.optimize(
|
|
56
|
-
# n_trials=100
|
|
57
|
-
)
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
|
|
3
|
-
from optuna.samplers import TPESampler
|
|
4
|
-
|
|
5
|
-
from pyfemtet.opt import FEMOpt, OptunaOptimizer
|
|
6
|
-
from pyfemtet.opt.interface import PoFBoTorchInterface
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
def main(target):
|
|
10
|
-
|
|
11
|
-
os.chdir(os.path.dirname(__file__))
|
|
12
|
-
|
|
13
|
-
# Instead of connecting with Femtet, create
|
|
14
|
-
# a surrogate model. Read the CSV file created
|
|
15
|
-
# by the training data creation script to build
|
|
16
|
-
# the surrogate model.
|
|
17
|
-
fem = PoFBoTorchInterface(
|
|
18
|
-
history_path='training_data.csv'
|
|
19
|
-
)
|
|
20
|
-
|
|
21
|
-
# Set up the optimization object.
|
|
22
|
-
opt = OptunaOptimizer(
|
|
23
|
-
sampler_class=TPESampler,
|
|
24
|
-
)
|
|
25
|
-
|
|
26
|
-
# Set up the FEMOpt object.
|
|
27
|
-
femopt = FEMOpt(
|
|
28
|
-
fem=fem,
|
|
29
|
-
opt=opt,
|
|
30
|
-
history_path=f'optimized_result_target_{target}.csv'
|
|
31
|
-
)
|
|
32
|
-
|
|
33
|
-
# Set up the design variables.
|
|
34
|
-
# The upper and lower limits can differ from
|
|
35
|
-
# those in the training data creation script,
|
|
36
|
-
# but please note that extrapolation will
|
|
37
|
-
# occur outside the range that has not been
|
|
38
|
-
# trained, which may reduce the prediction
|
|
39
|
-
# accuracy of the surrogate model.
|
|
40
|
-
femopt.add_parameter('length', 0.1, 0.02, 0.2)
|
|
41
|
-
femopt.add_parameter('width', 0.01, 0.001, 0.02)
|
|
42
|
-
|
|
43
|
-
# If there are parameters that were set as
|
|
44
|
-
# design variables during training and wanted
|
|
45
|
-
# to fix during optimization, specify only the
|
|
46
|
-
# `initial_value` and set the `fix` argument True.
|
|
47
|
-
# You cannot add design variables that were not
|
|
48
|
-
# set during training for optimization.
|
|
49
|
-
femopt.add_parameter('base_radius', 0.008, fix=True)
|
|
50
|
-
|
|
51
|
-
# Specify the objective functions set during
|
|
52
|
-
# training that you want to optimize.
|
|
53
|
-
# You may provide the fun argument, but it will
|
|
54
|
-
# be overwritten during surrogate model creation,
|
|
55
|
-
# so it will be ignored.
|
|
56
|
-
# You cannot use objective functions that were
|
|
57
|
-
# not set during training for optimization.
|
|
58
|
-
obj_name = 'First Resonant Frequency (Hz)'
|
|
59
|
-
femopt.add_objective(
|
|
60
|
-
name=obj_name,
|
|
61
|
-
direction=target,
|
|
62
|
-
)
|
|
63
|
-
|
|
64
|
-
# Execute the optimization.
|
|
65
|
-
femopt.set_random_seed(42)
|
|
66
|
-
df = femopt.optimize(
|
|
67
|
-
n_trials=50,
|
|
68
|
-
confirm_before_exit=False
|
|
69
|
-
)
|
|
70
|
-
|
|
71
|
-
# Display the optimal solution.
|
|
72
|
-
prm_names = femopt.history.prm_names
|
|
73
|
-
obj_names = femopt.history.obj_names
|
|
74
|
-
prm_values = df[df['non_domi'] == True][prm_names].values[0]
|
|
75
|
-
obj_values = df[df['non_domi'] == True][obj_names].values[0]
|
|
76
|
-
|
|
77
|
-
message = f'''
|
|
78
|
-
===== Optimization Results =====
|
|
79
|
-
Target Value: {target}
|
|
80
|
-
Prediction by Surrogate Model:
|
|
81
|
-
'''
|
|
82
|
-
for name, value in zip(prm_names, prm_values):
|
|
83
|
-
message += f' {name}: {value}\n'
|
|
84
|
-
for name, value in zip(obj_names, obj_values):
|
|
85
|
-
message += f' {name}: {value}\n'
|
|
86
|
-
|
|
87
|
-
return message
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
if __name__ == '__main__':
|
|
91
|
-
# Using the surrogate model created from the training data,
|
|
92
|
-
# we will find a design that results in a resonant frequency of 1000.
|
|
93
|
-
message_1000 = main(target=1000)
|
|
94
|
-
|
|
95
|
-
# Next, using the same surrogate model,
|
|
96
|
-
# we will find a design that results in a resonant frequency of 2000.
|
|
97
|
-
message_2000 = main(target=2000)
|
|
98
|
-
|
|
99
|
-
print(message_1000)
|
|
100
|
-
print(message_2000)
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
|
|
3
|
-
from optuna.samplers import TPESampler
|
|
4
|
-
|
|
5
|
-
from pyfemtet.opt import FEMOpt, OptunaOptimizer
|
|
6
|
-
from pyfemtet.opt.interface import PoFBoTorchInterface
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
def main(target):
|
|
10
|
-
|
|
11
|
-
os.chdir(os.path.dirname(__file__))
|
|
12
|
-
|
|
13
|
-
# Femtet との接続の代わりに、サロゲートモデルを作成します。
|
|
14
|
-
# 学習データ作成スクリプトで作成した csv ファイルを読み込んで
|
|
15
|
-
# サロゲートモデルを作成します。
|
|
16
|
-
fem = PoFBoTorchInterface(
|
|
17
|
-
history_path='training_data.csv'
|
|
18
|
-
)
|
|
19
|
-
|
|
20
|
-
# 最適化用オブジェクトの設定を行います。
|
|
21
|
-
opt = OptunaOptimizer(
|
|
22
|
-
sampler_class=TPESampler,
|
|
23
|
-
)
|
|
24
|
-
|
|
25
|
-
# FEMOpt オブジェクトの設定を行います。
|
|
26
|
-
femopt = FEMOpt(
|
|
27
|
-
fem=fem,
|
|
28
|
-
opt=opt,
|
|
29
|
-
history_path=f'optimized_result_target_{target}.csv'
|
|
30
|
-
)
|
|
31
|
-
|
|
32
|
-
# 設計変数の設定を行います。
|
|
33
|
-
# 上下限は学習データ作成スクリプトと異なっても良いですが、
|
|
34
|
-
# 学習していない範囲は外挿となりサロゲートモデルによる
|
|
35
|
-
# 予測精度が低下することに注意してください。
|
|
36
|
-
femopt.add_parameter('length', 0.1, 0.02, 0.2)
|
|
37
|
-
femopt.add_parameter('width', 0.01, 0.001, 0.02)
|
|
38
|
-
|
|
39
|
-
# 学習時は設計変数としていたが最適化時に固定したいパラメータがある場合
|
|
40
|
-
# initial_value のみを指定して fix 引数を True にしてください。
|
|
41
|
-
# 学習時に設定しなかった設計変数を最適化時に追加することはできません。
|
|
42
|
-
femopt.add_parameter('base_radius', 0.008, fix=True)
|
|
43
|
-
|
|
44
|
-
# 学習時に設定した目的関数のうち
|
|
45
|
-
# 最適化したいものを指定します。
|
|
46
|
-
# fun 引数は与えてもいいですが、サロゲートモデル作成時に上書きされるため無視されます。
|
|
47
|
-
# 学習時に設定しなかった目的関数を最適化時に使用することはできません。
|
|
48
|
-
obj_name = '第一共振周波数(Hz)'
|
|
49
|
-
femopt.add_objective(
|
|
50
|
-
name=obj_name,
|
|
51
|
-
direction=target,
|
|
52
|
-
)
|
|
53
|
-
|
|
54
|
-
# 最適化を実行します。
|
|
55
|
-
femopt.set_random_seed(42)
|
|
56
|
-
df = femopt.optimize(
|
|
57
|
-
n_trials=50,
|
|
58
|
-
confirm_before_exit=False
|
|
59
|
-
)
|
|
60
|
-
|
|
61
|
-
# 最適解を表示します。
|
|
62
|
-
prm_names = femopt.history.prm_names
|
|
63
|
-
obj_names = femopt.history.obj_names
|
|
64
|
-
prm_values = df[df['non_domi'] == True][prm_names].values[0]
|
|
65
|
-
obj_values = df[df['non_domi'] == True][obj_names].values[0]
|
|
66
|
-
|
|
67
|
-
message = f'''
|
|
68
|
-
===== 最適化結果 =====
|
|
69
|
-
ターゲット値: {target}
|
|
70
|
-
サロゲートモデルによる予測:
|
|
71
|
-
'''
|
|
72
|
-
for name, value in zip(prm_names, prm_values):
|
|
73
|
-
message += f' {name}: {value}\n'
|
|
74
|
-
for name, value in zip(obj_names, obj_values):
|
|
75
|
-
message += f' {name}: {value}\n'
|
|
76
|
-
|
|
77
|
-
return message
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
if __name__ == '__main__':
|
|
81
|
-
# 学習データから作成したサロゲートモデルで
|
|
82
|
-
# 共振周波数が 1000 になる設計を見つけます。
|
|
83
|
-
message_1000 = main(target=1000)
|
|
84
|
-
|
|
85
|
-
# 続いて、同じサロゲートモデルで
|
|
86
|
-
# 共振周波数が 2000 になる設計を見つけます。
|
|
87
|
-
message_2000 = main(target=2000)
|
|
88
|
-
|
|
89
|
-
print(message_1000)
|
|
90
|
-
print(message_2000)
|
|
Binary file
|
pyfemtet/opt/interface/_base.py
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
from typing import Optional, List
|
|
2
|
-
|
|
3
|
-
import os
|
|
4
|
-
from abc import ABC, abstractmethod
|
|
5
|
-
|
|
6
|
-
import pandas as pd
|
|
7
|
-
|
|
8
|
-
from pyfemtet.logger import get_module_logger
|
|
9
|
-
|
|
10
|
-
logger = get_module_logger('opt.interface', __name__)
|
|
11
|
-
|
|
12
|
-
here, me = os.path.split(__file__)
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
class FEMInterface(ABC):
|
|
16
|
-
"""Abstract base class for the interface with FEM software.
|
|
17
|
-
|
|
18
|
-
Stores information necessary to restore FEMInterface instance in a subprocess.
|
|
19
|
-
|
|
20
|
-
The concrete class should call super().__init__() with the desired arguments when restoring.
|
|
21
|
-
|
|
22
|
-
Args:
|
|
23
|
-
**kwargs: keyword arguments for FEMInterface (re)constructor.
|
|
24
|
-
|
|
25
|
-
"""
|
|
26
|
-
|
|
27
|
-
kwargs = None
|
|
28
|
-
|
|
29
|
-
def __init__(
|
|
30
|
-
self,
|
|
31
|
-
**kwargs
|
|
32
|
-
):
|
|
33
|
-
# restore のための情報保管
|
|
34
|
-
if self.kwargs is None:
|
|
35
|
-
self.kwargs = kwargs
|
|
36
|
-
else:
|
|
37
|
-
self.kwargs.update(kwargs)
|
|
38
|
-
|
|
39
|
-
@abstractmethod
|
|
40
|
-
def update(self, parameters: pd.DataFrame) -> None:
|
|
41
|
-
"""Updates the FEM analysis based on the proposed parameters."""
|
|
42
|
-
raise NotImplementedError('update() must be implemented.')
|
|
43
|
-
|
|
44
|
-
@property
|
|
45
|
-
def object_passed_to_functions(self):
|
|
46
|
-
return self
|
|
47
|
-
|
|
48
|
-
def check_param_value(self, param_name) -> float or None:
|
|
49
|
-
"""Checks the value of a parameter in the FEM model (if implemented in concrete class)."""
|
|
50
|
-
pass
|
|
51
|
-
|
|
52
|
-
def update_parameter(self, parameters: pd.DataFrame, with_warning=False) -> Optional[List[str]]:
|
|
53
|
-
"""Updates only FEM variables (if implemented in concrete class).
|
|
54
|
-
|
|
55
|
-
If this method is implemented,
|
|
56
|
-
it is able to get parameter via FEMInterface.
|
|
57
|
-
|
|
58
|
-
"""
|
|
59
|
-
pass
|
|
60
|
-
|
|
61
|
-
def load_parameter(self, opt) -> None: # opt: AbstractOptimizer
|
|
62
|
-
pass
|
|
63
|
-
|
|
64
|
-
def load_objective(self, opt) -> None: # opt: AbstractOptimizer
|
|
65
|
-
pass
|
|
66
|
-
|
|
67
|
-
def load_constraint(self, opt) -> None: # opt: AbstractOptimizer
|
|
68
|
-
pass
|
|
69
|
-
|
|
70
|
-
def _setup_before_parallel(self, client) -> None:
|
|
71
|
-
"""Preprocessing before launching a dask worker (if implemented in concrete class).
|
|
72
|
-
|
|
73
|
-
Args:
|
|
74
|
-
client: dask client.
|
|
75
|
-
i.e. you can update associated files by
|
|
76
|
-
`client.upload_file(file_path)`
|
|
77
|
-
The file will be saved to dask-scratch-space directory
|
|
78
|
-
without any directory structure.
|
|
79
|
-
|
|
80
|
-
"""
|
|
81
|
-
pass
|
|
82
|
-
|
|
83
|
-
def _setup_after_parallel(self, *args, **kwargs):
|
|
84
|
-
"""Preprocessing after launching a dask worker and before run optimization (if implemented in concrete class)."""
|
|
85
|
-
pass
|
|
86
|
-
|
|
87
|
-
def _postprocess_func(self, trial: int, df: pd.DataFrame, *args, dask_scheduler=None, **kwargs):
|
|
88
|
-
pass
|
|
89
|
-
|
|
90
|
-
def _create_postprocess_args(self):
|
|
91
|
-
pass
|
|
92
|
-
|
|
93
|
-
def quit(self):
|
|
94
|
-
pass
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
class NoFEM(FEMInterface):
|
|
98
|
-
"""Dummy interface without FEM. Intended for debugging purposes."""
|
|
99
|
-
|
|
100
|
-
def update(self, parameters: pd.DataFrame) -> None:
|
|
101
|
-
pass
|