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,58 +0,0 @@
|
|
|
1
|
-
"""多目的の最適化: プリント基板上ICの空冷(強制対流)
|
|
2
|
-
|
|
3
|
-
Femtet の簡易熱流体解析ソルバを利用して、強制対流を受ける
|
|
4
|
-
プリント基板上のICチップについて、チップ温度を低減しつつ
|
|
5
|
-
基板サイズを小さくする設計を行います。
|
|
6
|
-
|
|
7
|
-
対応プロジェクト:paswat_ex1_parametric_jp.femprj
|
|
8
|
-
"""
|
|
9
|
-
from pyfemtet.opt import FEMOpt
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
def chip_temp(Femtet, chip_name):
|
|
13
|
-
"""チップの最高温度を取得します。
|
|
14
|
-
|
|
15
|
-
Note:
|
|
16
|
-
目的関数または制約関数は、
|
|
17
|
-
第一引数としてFemtetを受け取り、
|
|
18
|
-
戻り値としてfloat型を返す必要があります。
|
|
19
|
-
|
|
20
|
-
Params:
|
|
21
|
-
Femtet: Femtet をマクロで操作するためのインスタンスです。詳細な情報については、「Femtet マクロヘルプ」をご覧ください。
|
|
22
|
-
chip_name (str): femprj 内で定義されているボディ属性名です。有効な値は 'MAINCHIP' 又は 'SUBCHIP' です。
|
|
23
|
-
|
|
24
|
-
Returns:
|
|
25
|
-
float: 指定されたボディ属性名のボディの最高温度です。
|
|
26
|
-
"""
|
|
27
|
-
Gogh = Femtet.Gogh
|
|
28
|
-
|
|
29
|
-
max_temperature, min_temperature, mean_temperature = Gogh.Watt.GetTemp(chip_name)
|
|
30
|
-
|
|
31
|
-
return max_temperature # 単位: 度
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
def substrate_size(Femtet):
|
|
35
|
-
"""基板のXY平面上での専有面積を計算します。"""
|
|
36
|
-
substrate_w = Femtet.GetVariableValue('substrate_w')
|
|
37
|
-
substrate_d = Femtet.GetVariableValue('substrate_d')
|
|
38
|
-
return substrate_w * substrate_d # 単位: mm2
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
if __name__ == '__main__':
|
|
42
|
-
|
|
43
|
-
# FEMOpt オブジェクトの初期化 (最適化問題とFemtetとの接続を行います)
|
|
44
|
-
femopt = FEMOpt()
|
|
45
|
-
|
|
46
|
-
# 設計変数を最適化問題に追加 (femprj ファイルに登録されている変数を指定してください)
|
|
47
|
-
femopt.add_parameter("substrate_w", 40, lower_bound=22, upper_bound=60)
|
|
48
|
-
femopt.add_parameter("substrate_d", 60, lower_bound=34, upper_bound=60)
|
|
49
|
-
femopt.add_parameter("rot", 0, lower_bound=0, upper_bound=180)
|
|
50
|
-
|
|
51
|
-
# 目的関数を最適化問題に追加
|
|
52
|
-
femopt.add_objective(chip_temp, name='MAINCHIP<br>最高温度(度)', direction='minimize', args=('MAINCHIP',))
|
|
53
|
-
femopt.add_objective(chip_temp, name='SUBCHIP<br>最高温度(度)', direction='minimize', args=('SUBCHIP',))
|
|
54
|
-
femopt.add_objective(substrate_size, name='基板サイズ(mm2)', direction='minimize')
|
|
55
|
-
|
|
56
|
-
# 最適化を実行
|
|
57
|
-
femopt.set_random_seed(42)
|
|
58
|
-
femopt.optimize(n_trials=15)
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"""多目的の最適化: プリント基板上ICの空冷(強制対流)
|
|
2
|
-
|
|
3
|
-
Femtet の簡易熱流体解析ソルバを利用して、強制対流を受ける
|
|
4
|
-
プリント基板上のICチップについて、チップ温度を低減しつつ
|
|
5
|
-
基板サイズを小さくする設計を行います。
|
|
6
|
-
|
|
7
|
-
対応プロジェクト:paswat_ex1_parametric_jp.femprj
|
|
8
|
-
"""
|
|
9
|
-
from pyfemtet.opt import FEMOpt
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
def chip_temp(Femtet, chip_name):
|
|
13
|
-
"""チップの最高温度を取得します。
|
|
14
|
-
|
|
15
|
-
Note:
|
|
16
|
-
目的関数または制約関数は、
|
|
17
|
-
第一引数としてFemtetを受け取り、
|
|
18
|
-
戻り値としてfloat型を返す必要があります。
|
|
19
|
-
|
|
20
|
-
Params:
|
|
21
|
-
Femtet: Femtet をマクロで操作するためのインスタンスです。詳細な情報については、「Femtet マクロヘルプ」をご覧ください。
|
|
22
|
-
chip_name (str): femprj 内で定義されているボディ属性名です。有効な値は 'MAINCHIP' 又は 'SUBCHIP' です。
|
|
23
|
-
|
|
24
|
-
Returns:
|
|
25
|
-
float: 指定されたボディ属性名のボディの最高温度です。
|
|
26
|
-
"""
|
|
27
|
-
Gogh = Femtet.Gogh
|
|
28
|
-
|
|
29
|
-
max_temperature, min_temperature, mean_temperature = Gogh.Watt.GetTemp(chip_name)
|
|
30
|
-
|
|
31
|
-
return max_temperature # 単位: 度
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
def substrate_size(Femtet):
|
|
35
|
-
"""基板のXY平面上での専有面積を計算します。"""
|
|
36
|
-
substrate_w = Femtet.GetVariableValue('substrate_w')
|
|
37
|
-
substrate_d = Femtet.GetVariableValue('substrate_d')
|
|
38
|
-
return substrate_w * substrate_d # 単位: mm2
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
if __name__ == '__main__':
|
|
42
|
-
|
|
43
|
-
# FEMOpt オブジェクトの初期化 (最適化問題とFemtetとの接続を行います)
|
|
44
|
-
femopt = FEMOpt()
|
|
45
|
-
|
|
46
|
-
# 設計変数を最適化問題に追加 (femprj ファイルに登録されている変数を指定してください)
|
|
47
|
-
femopt.add_parameter("substrate_w", 40, lower_bound=22, upper_bound=60)
|
|
48
|
-
femopt.add_parameter("substrate_d", 60, lower_bound=34, upper_bound=60)
|
|
49
|
-
femopt.add_parameter("rot", 0, lower_bound=0, upper_bound=180)
|
|
50
|
-
|
|
51
|
-
# 目的関数を最適化問題に追加
|
|
52
|
-
femopt.add_objective(chip_temp, name='MAINCHIP<br>最高温度(度)', direction='minimize', args=('MAINCHIP',))
|
|
53
|
-
femopt.add_objective(chip_temp, name='SUBCHIP<br>最高温度(度)', direction='minimize', args=('SUBCHIP',))
|
|
54
|
-
femopt.add_objective(substrate_size, name='基板サイズ(mm2)', direction='minimize')
|
|
55
|
-
|
|
56
|
-
# 最適化を実行
|
|
57
|
-
femopt.set_random_seed(42)
|
|
58
|
-
# femopt.optimize(n_trials=15)
|
|
59
|
-
femopt.optimize(n_trials=30, n_parallel=3) # 並列計算しない場合との差はこの行のみです。
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"""多目的最適化: プリント基板上ICの発熱
|
|
2
|
-
|
|
3
|
-
Femtetの熱伝導解析ソルバを使用して、ICチップの発熱を抑えつつ
|
|
4
|
-
基板サイズを小さくする設計を行います。
|
|
5
|
-
|
|
6
|
-
対応プロジェクト: wat_ex14_parametric_jp.femprj
|
|
7
|
-
"""
|
|
8
|
-
from pyfemtet.opt import FEMOpt
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
def chip_temp(Femtet, chip_name):
|
|
12
|
-
"""チップの最高温度を取得します。
|
|
13
|
-
|
|
14
|
-
Note:
|
|
15
|
-
目的関数または制約関数は、
|
|
16
|
-
第一引数としてFemtetを受け取り、
|
|
17
|
-
戻り値としてfloat型を返す必要があります。
|
|
18
|
-
|
|
19
|
-
Params:
|
|
20
|
-
Femtet: Femtet をマクロで操作するためのインスタンスです。詳細な情報については、「Femtet マクロヘルプ」をご覧ください。
|
|
21
|
-
chip_name (str): femprj 内で定義されているボディ属性名です。有効な値は 'MAINCHIP' 又は 'SUBCHIP' です。
|
|
22
|
-
|
|
23
|
-
Returns:
|
|
24
|
-
float: 指定されたボディ属性名のボディの最高温度です。
|
|
25
|
-
"""
|
|
26
|
-
Gogh = Femtet.Gogh
|
|
27
|
-
|
|
28
|
-
max_temperature, min_temperature, mean_temperature = Gogh.Watt.GetTemp(chip_name)
|
|
29
|
-
|
|
30
|
-
return max_temperature # 単位: 度
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
def substrate_size(Femtet):
|
|
34
|
-
"""基板のXY平面上での専有面積を計算します。"""
|
|
35
|
-
substrate_w = Femtet.GetVariableValue('substrate_w')
|
|
36
|
-
substrate_d = Femtet.GetVariableValue('substrate_d')
|
|
37
|
-
return substrate_w * substrate_d # 単位: mm2
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if __name__ == '__main__':
|
|
41
|
-
|
|
42
|
-
# FEMOpt オブジェクトの初期化 (最適化問題とFemtetとの接続を行います)
|
|
43
|
-
femopt = FEMOpt()
|
|
44
|
-
|
|
45
|
-
# 設計変数を最適化問題に追加 (femprj ファイルに登録されている変数を指定してください)
|
|
46
|
-
femopt.add_parameter("substrate_w", 40, lower_bound=22, upper_bound=60)
|
|
47
|
-
femopt.add_parameter("substrate_d", 60, lower_bound=34, upper_bound=60)
|
|
48
|
-
|
|
49
|
-
# 目的関数を最適化問題に追加
|
|
50
|
-
femopt.add_objective(chip_temp, name='MAINCHIP<br>最高温度(度)', direction='minimize', args=('MAINCHIP',))
|
|
51
|
-
femopt.add_objective(chip_temp, name='SUBCHIP<br>最高温度(度)', direction='minimize', args=('SUBCHIP',))
|
|
52
|
-
femopt.add_objective(substrate_size, name='基板サイズ(mm2)')
|
|
53
|
-
|
|
54
|
-
# 最適化を実行
|
|
55
|
-
femopt.set_random_seed(42)
|
|
56
|
-
femopt.optimize(n_trials=15)
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"""多目的最適化: プリント基板上ICの発熱
|
|
2
|
-
|
|
3
|
-
Femtetの熱伝導解析ソルバを使用して、ICチップの発熱を抑えつつ
|
|
4
|
-
基板サイズを小さくする設計を行います。
|
|
5
|
-
|
|
6
|
-
対応プロジェクト: wat_ex14_parametric_jp.femprj
|
|
7
|
-
"""
|
|
8
|
-
from pyfemtet.opt import FEMOpt
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
def chip_temp(Femtet, chip_name):
|
|
12
|
-
"""チップの最高温度を取得します。
|
|
13
|
-
|
|
14
|
-
Note:
|
|
15
|
-
目的関数または制約関数は、
|
|
16
|
-
第一引数としてFemtetを受け取り、
|
|
17
|
-
戻り値としてfloat型を返す必要があります。
|
|
18
|
-
|
|
19
|
-
Params:
|
|
20
|
-
Femtet: Femtet をマクロで操作するためのインスタンスです。詳細な情報については、「Femtet マクロヘルプ」をご覧ください。
|
|
21
|
-
chip_name (str): femprj 内で定義されているボディ属性名です。有効な値は 'MAINCHIP' 又は 'SUBCHIP' です。
|
|
22
|
-
|
|
23
|
-
Returns:
|
|
24
|
-
float: 指定されたボディ属性名のボディの最高温度です。
|
|
25
|
-
"""
|
|
26
|
-
Gogh = Femtet.Gogh
|
|
27
|
-
|
|
28
|
-
max_temperature, min_temperature, mean_temperature = Gogh.Watt.GetTemp(chip_name)
|
|
29
|
-
|
|
30
|
-
return max_temperature # 単位: 度
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
def substrate_size(Femtet):
|
|
34
|
-
"""基板のXY平面上での専有面積を計算します。"""
|
|
35
|
-
substrate_w = Femtet.GetVariableValue('substrate_w')
|
|
36
|
-
substrate_d = Femtet.GetVariableValue('substrate_d')
|
|
37
|
-
return substrate_w * substrate_d # 単位: mm2
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if __name__ == '__main__':
|
|
41
|
-
|
|
42
|
-
# FEMOpt オブジェクトの初期化 (最適化問題とFemtetとの接続を行います)
|
|
43
|
-
femopt = FEMOpt()
|
|
44
|
-
|
|
45
|
-
# 設計変数を最適化問題に追加 (femprj ファイルに登録されている変数を指定してください)
|
|
46
|
-
femopt.add_parameter("substrate_w", 40, lower_bound=22, upper_bound=60)
|
|
47
|
-
femopt.add_parameter("substrate_d", 60, lower_bound=34, upper_bound=60)
|
|
48
|
-
|
|
49
|
-
# 目的関数を最適化問題に追加
|
|
50
|
-
femopt.add_objective(chip_temp, name='MAINCHIP<br>最高温度(度)', direction='minimize', args=('MAINCHIP',))
|
|
51
|
-
femopt.add_objective(chip_temp, name='SUBCHIP<br>最高温度(度)', direction='minimize', args=('SUBCHIP',))
|
|
52
|
-
femopt.add_objective(substrate_size, name='基板サイズ(mm2)')
|
|
53
|
-
|
|
54
|
-
# 最適化を実行
|
|
55
|
-
femopt.set_random_seed(42)
|
|
56
|
-
femopt.optimize(n_trials=15, n_parallel=3) # この部分のみ変更します
|
|
@@ -1,332 +0,0 @@
|
|
|
1
|
-
import pandas as pd
|
|
2
|
-
import plotly.graph_objs as go
|
|
3
|
-
import plotly.express as px
|
|
4
|
-
|
|
5
|
-
from pyfemtet.opt._femopt_core import History
|
|
6
|
-
from pyfemtet._message import Msg
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class _ColorSet:
|
|
10
|
-
non_domi = {True: '#007bff', False: '#6c757d'} # color
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
class _SymbolSet:
|
|
14
|
-
feasible = {True: 'circle', False: 'circle-open'} # style
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
class _LanguageSet:
|
|
18
|
-
|
|
19
|
-
feasible = {'label': 'feasible', True: True, False: False}
|
|
20
|
-
non_domi = {'label': 'non_domi', True: True, False: False}
|
|
21
|
-
|
|
22
|
-
def __init__(self):
|
|
23
|
-
self.feasible = {
|
|
24
|
-
'label': Msg.LEGEND_LABEL_CONSTRAINT,
|
|
25
|
-
True: Msg.LEGEND_LABEL_FEASIBLE,
|
|
26
|
-
False: Msg.LEGEND_LABEL_INFEASIBLE,
|
|
27
|
-
}
|
|
28
|
-
self.non_domi = {
|
|
29
|
-
'label': Msg.LEGEND_LABEL_OPTIMAL,
|
|
30
|
-
True: Msg.LEGEND_LABEL_NON_DOMI,
|
|
31
|
-
False: Msg.LEGEND_LABEL_DOMI,
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
def localize(self, df):
|
|
35
|
-
# 元のオブジェクトを変更しないようにコピー
|
|
36
|
-
cdf = df.copy()
|
|
37
|
-
|
|
38
|
-
# feasible, non_domi の localize
|
|
39
|
-
cdf[self.feasible['label']] = [self.feasible[v] for v in cdf['feasible']]
|
|
40
|
-
cdf[self.non_domi['label']] = [self.non_domi[v] for v in cdf['non_domi']]
|
|
41
|
-
|
|
42
|
-
return cdf
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
_ls = _LanguageSet()
|
|
46
|
-
_cs = _ColorSet()
|
|
47
|
-
_ss = _SymbolSet()
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
def get_hypervolume_plot(_: History, df):
|
|
51
|
-
df = _ls.localize(df)
|
|
52
|
-
|
|
53
|
-
# create figure
|
|
54
|
-
fig = px.line(
|
|
55
|
-
df,
|
|
56
|
-
x="trial",
|
|
57
|
-
y="hypervolume",
|
|
58
|
-
markers=True,
|
|
59
|
-
custom_data=['trial'],
|
|
60
|
-
)
|
|
61
|
-
|
|
62
|
-
fig.update_layout(
|
|
63
|
-
dict(
|
|
64
|
-
title_text=Msg.GRAPH_TITLE_HYPERVOLUME,
|
|
65
|
-
# transition_duration=1000, # Causes graph freeze on tab change
|
|
66
|
-
xaxis_title=Msg.GRAPH_AXIS_LABEL_TRIAL,
|
|
67
|
-
yaxis_title='hypervolume',
|
|
68
|
-
)
|
|
69
|
-
)
|
|
70
|
-
|
|
71
|
-
return fig
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
def get_default_figure(history, df):
|
|
75
|
-
# df = history.local_data # monitor process and history process is different workers, so history.local_data is not updated in monitor process.
|
|
76
|
-
# df = history.actor_data.copy() # access to actor from flask callback makes termination unstable.
|
|
77
|
-
|
|
78
|
-
# data setting
|
|
79
|
-
obj_names = history.obj_names
|
|
80
|
-
|
|
81
|
-
fig = go.Figure()
|
|
82
|
-
|
|
83
|
-
if len(obj_names) == 1:
|
|
84
|
-
fig = _get_single_objective_plot(history, df)
|
|
85
|
-
|
|
86
|
-
elif len(obj_names) >= 2:
|
|
87
|
-
fig = _get_multi_objective_pairplot(history, df)
|
|
88
|
-
|
|
89
|
-
fig.update_traces(hoverinfo="none", hovertemplate=None)
|
|
90
|
-
fig.update_layout(
|
|
91
|
-
clickmode='event+select',
|
|
92
|
-
transition_duration=1000,
|
|
93
|
-
)
|
|
94
|
-
|
|
95
|
-
return fig
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
def _get_single_objective_plot(history, df):
|
|
99
|
-
|
|
100
|
-
df = _ls.localize(df)
|
|
101
|
-
obj_name = history.obj_names[0]
|
|
102
|
-
|
|
103
|
-
df.columns = [c.replace(' / ', '<BR>/ ') for c in df.columns]
|
|
104
|
-
obj_name = obj_name.replace(' / ', '<BR>/ ')
|
|
105
|
-
|
|
106
|
-
# ===== base figure =====
|
|
107
|
-
fig = go.Figure()
|
|
108
|
-
|
|
109
|
-
# ===== i 番目が、その時点までで最適かどうか =====
|
|
110
|
-
# その時点までの最適な点 index
|
|
111
|
-
indices = []
|
|
112
|
-
anti_indices = []
|
|
113
|
-
objectives = df[obj_name].values
|
|
114
|
-
objective_directions = df[f'{obj_name}_direction'].values
|
|
115
|
-
for i, (obj, direction) in enumerate(zip(objectives, objective_directions)):
|
|
116
|
-
# DESCRIPTION: 最適化中に direction は変化しない前提
|
|
117
|
-
if direction == 'maximize':
|
|
118
|
-
if obj == max(objectives[:i+1]):
|
|
119
|
-
indices.append(i)
|
|
120
|
-
else:
|
|
121
|
-
anti_indices.append(i)
|
|
122
|
-
elif direction == 'minimize':
|
|
123
|
-
if obj == min(objectives[:i+1]):
|
|
124
|
-
indices.append(i)
|
|
125
|
-
else:
|
|
126
|
-
anti_indices.append(i)
|
|
127
|
-
else:
|
|
128
|
-
residuals = (objectives - objective_directions) ** 2
|
|
129
|
-
residual = residuals[i]
|
|
130
|
-
if residual == min(residuals[:i+1]):
|
|
131
|
-
indices.append(i)
|
|
132
|
-
else:
|
|
133
|
-
anti_indices.append(i)
|
|
134
|
-
|
|
135
|
-
# ===== 最適でない点を灰色で打つ =====
|
|
136
|
-
fig.add_trace(
|
|
137
|
-
go.Scatter(
|
|
138
|
-
x=df['trial'],
|
|
139
|
-
y=df[obj_name],
|
|
140
|
-
customdata=df['trial'].values.reshape((-1, 1)),
|
|
141
|
-
# x=df['trial'][anti_indices],
|
|
142
|
-
# y=df[obj_name][anti_indices],
|
|
143
|
-
# customdata=df['trial'][anti_indices].values.reshape((-1, 1)),
|
|
144
|
-
mode="markers",
|
|
145
|
-
marker=dict(color='#6c757d', size=6),
|
|
146
|
-
name=Msg.LEGEND_LABEL_ALL_SOLUTIONS,
|
|
147
|
-
)
|
|
148
|
-
)
|
|
149
|
-
|
|
150
|
-
# ===== その時点までの最小の点を青で打つ =====
|
|
151
|
-
fig.add_trace(
|
|
152
|
-
go.Scatter(
|
|
153
|
-
x=df['trial'].iloc[indices],
|
|
154
|
-
y=df[obj_name].iloc[indices],
|
|
155
|
-
mode="markers+lines",
|
|
156
|
-
marker=dict(color='#007bff', size=9),
|
|
157
|
-
name=Msg.LEGEND_LABEL_OPTIMAL_SOLUTIONS,
|
|
158
|
-
line=dict(width=1, color='#6c757d',),
|
|
159
|
-
customdata=df['trial'].iloc[indices].values.reshape((-1, 1)),
|
|
160
|
-
legendgroup='optimal',
|
|
161
|
-
)
|
|
162
|
-
)
|
|
163
|
-
|
|
164
|
-
# ===== その時点までの最小の点から現在までの平行点線を引く =====
|
|
165
|
-
if len(indices) > 1:
|
|
166
|
-
x = [df['trial'].iloc[indices].iloc[-1], df['trial'].iloc[-1]]
|
|
167
|
-
y = [df[obj_name].iloc[indices].iloc[-1]] * 2
|
|
168
|
-
fig.add_trace(
|
|
169
|
-
go.Scatter(
|
|
170
|
-
x=x,
|
|
171
|
-
y=y,
|
|
172
|
-
mode="lines",
|
|
173
|
-
line=dict(width=0.5, color='#6c757d', dash='dash'),
|
|
174
|
-
showlegend=False,
|
|
175
|
-
legendgroup='optimal',
|
|
176
|
-
)
|
|
177
|
-
)
|
|
178
|
-
|
|
179
|
-
# ===== direction が float の場合、目標値を描く =====
|
|
180
|
-
if len(df) > 1:
|
|
181
|
-
if isinstance(objective_directions[0], float):
|
|
182
|
-
x = [df['trial'].iloc[0], df['trial'].iloc[-1]]
|
|
183
|
-
y = [objective_directions[0]] * 2
|
|
184
|
-
fig.add_trace(
|
|
185
|
-
go.Scatter(
|
|
186
|
-
x=x,
|
|
187
|
-
y=y,
|
|
188
|
-
mode="lines",
|
|
189
|
-
line=dict(width=0.5, color='#FF2400', dash='dash'),
|
|
190
|
-
name=Msg.LEGEND_LABEL_OBJECTIVE_TARGET,
|
|
191
|
-
)
|
|
192
|
-
)
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
# ===== layout =====
|
|
196
|
-
fig.update_layout(
|
|
197
|
-
dict(
|
|
198
|
-
title_text=Msg.GRAPH_TITLE_SINGLE_OBJECTIVE,
|
|
199
|
-
xaxis_title=Msg.GRAPH_AXIS_LABEL_TRIAL,
|
|
200
|
-
yaxis_title=obj_name,
|
|
201
|
-
)
|
|
202
|
-
)
|
|
203
|
-
|
|
204
|
-
return fig
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
def _get_multi_objective_pairplot(history, df):
|
|
208
|
-
df = _ls.localize(df)
|
|
209
|
-
|
|
210
|
-
obj_names = history.obj_names
|
|
211
|
-
|
|
212
|
-
df.columns = [c.replace(' / ', '<BR>/ ') for c in df.columns]
|
|
213
|
-
obj_names = [o.replace(' / ', '<BR>/ ') for o in obj_names]
|
|
214
|
-
|
|
215
|
-
common_kwargs = dict(
|
|
216
|
-
color=_ls.non_domi['label'],
|
|
217
|
-
color_discrete_map={
|
|
218
|
-
_ls.non_domi[True]: _cs.non_domi[True],
|
|
219
|
-
_ls.non_domi[False]: _cs.non_domi[False],
|
|
220
|
-
},
|
|
221
|
-
symbol=_ls.feasible['label'],
|
|
222
|
-
symbol_map={
|
|
223
|
-
_ls.feasible[True]: _ss.feasible[True],
|
|
224
|
-
_ls.feasible[False]: _ss.feasible[False],
|
|
225
|
-
},
|
|
226
|
-
custom_data=['trial'],
|
|
227
|
-
category_orders={
|
|
228
|
-
_ls.feasible['label']: (_ls.feasible[False], _ls.feasible[True]),
|
|
229
|
-
_ls.non_domi['label']: (_ls.non_domi[False], _ls.non_domi[True]),
|
|
230
|
-
},
|
|
231
|
-
)
|
|
232
|
-
|
|
233
|
-
if len(obj_names) == 2:
|
|
234
|
-
fig = px.scatter(
|
|
235
|
-
data_frame=df,
|
|
236
|
-
x=obj_names[0],
|
|
237
|
-
y=obj_names[1],
|
|
238
|
-
**common_kwargs,
|
|
239
|
-
)
|
|
240
|
-
fig.update_layout(
|
|
241
|
-
dict(
|
|
242
|
-
xaxis_title=obj_names[0],
|
|
243
|
-
yaxis_title=obj_names[1],
|
|
244
|
-
)
|
|
245
|
-
)
|
|
246
|
-
|
|
247
|
-
else:
|
|
248
|
-
fig = px.scatter_matrix(
|
|
249
|
-
data_frame=df,
|
|
250
|
-
dimensions=obj_names,
|
|
251
|
-
**common_kwargs,
|
|
252
|
-
)
|
|
253
|
-
fig.update_traces(
|
|
254
|
-
patch={'diagonal.visible': False},
|
|
255
|
-
showupperhalf=False,
|
|
256
|
-
)
|
|
257
|
-
|
|
258
|
-
fig.update_layout(
|
|
259
|
-
dict(
|
|
260
|
-
title_text=Msg.GRAPH_TITLE_MULTI_OBJECTIVE,
|
|
261
|
-
)
|
|
262
|
-
)
|
|
263
|
-
|
|
264
|
-
return fig
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
def get_objective_plot(history: History, df: pd.DataFrame, obj_names: list[str]) -> go.Figure:
|
|
268
|
-
df = _ls.localize(df)
|
|
269
|
-
df.columns = [c.replace(' / ', '<BR>/ ') for c in df.columns]
|
|
270
|
-
obj_names = [o.replace(' / ', '<BR>/ ') for o in obj_names]
|
|
271
|
-
|
|
272
|
-
common_kwargs = dict(
|
|
273
|
-
color=_ls.non_domi['label'],
|
|
274
|
-
color_discrete_map={
|
|
275
|
-
_ls.non_domi[True]: _cs.non_domi[True],
|
|
276
|
-
_ls.non_domi[False]: _cs.non_domi[False],
|
|
277
|
-
},
|
|
278
|
-
symbol=_ls.feasible['label'],
|
|
279
|
-
symbol_map={
|
|
280
|
-
_ls.feasible[True]: _ss.feasible[True],
|
|
281
|
-
_ls.feasible[False]: _ss.feasible[False],
|
|
282
|
-
},
|
|
283
|
-
custom_data=['trial'],
|
|
284
|
-
category_orders={
|
|
285
|
-
_ls.feasible['label']: (_ls.feasible[False], _ls.feasible[True]),
|
|
286
|
-
_ls.non_domi['label']: (_ls.non_domi[False], _ls.non_domi[True]),
|
|
287
|
-
},
|
|
288
|
-
)
|
|
289
|
-
|
|
290
|
-
if len(obj_names) == 2:
|
|
291
|
-
fig = px.scatter(
|
|
292
|
-
data_frame=df,
|
|
293
|
-
x=obj_names[0],
|
|
294
|
-
y=obj_names[1],
|
|
295
|
-
**common_kwargs,
|
|
296
|
-
)
|
|
297
|
-
fig.update_layout(
|
|
298
|
-
dict(
|
|
299
|
-
xaxis_title=obj_names[0],
|
|
300
|
-
yaxis_title=obj_names[1],
|
|
301
|
-
)
|
|
302
|
-
)
|
|
303
|
-
|
|
304
|
-
elif len(obj_names) == 3:
|
|
305
|
-
fig = px.scatter_3d(
|
|
306
|
-
df,
|
|
307
|
-
x=obj_names[0],
|
|
308
|
-
y=obj_names[1],
|
|
309
|
-
z=obj_names[2],
|
|
310
|
-
**common_kwargs,
|
|
311
|
-
)
|
|
312
|
-
fig.update_layout(
|
|
313
|
-
margin=dict(l=0, r=0, b=0, t=30),
|
|
314
|
-
)
|
|
315
|
-
fig.update_traces(
|
|
316
|
-
marker=dict(
|
|
317
|
-
size=3,
|
|
318
|
-
),
|
|
319
|
-
)
|
|
320
|
-
|
|
321
|
-
else:
|
|
322
|
-
raise Exception
|
|
323
|
-
|
|
324
|
-
fig.update_layout(
|
|
325
|
-
dict(
|
|
326
|
-
title_text="Objective plot",
|
|
327
|
-
)
|
|
328
|
-
)
|
|
329
|
-
|
|
330
|
-
fig.update_traces(hoverinfo="none", hovertemplate=None)
|
|
331
|
-
|
|
332
|
-
return fig
|