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
|
@@ -0,0 +1,536 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
import pandas as pd
|
|
3
|
+
import plotly.graph_objs as go
|
|
4
|
+
import plotly.express as px
|
|
5
|
+
|
|
6
|
+
from pyfemtet._util.df_util import *
|
|
7
|
+
from pyfemtet.opt.history import *
|
|
8
|
+
from pyfemtet.opt.problem.problem import MAIN_FIDELITY_NAME
|
|
9
|
+
from pyfemtet._i18n import Msg
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
__all__ = [
|
|
13
|
+
'get_hypervolume_plot',
|
|
14
|
+
'get_default_figure',
|
|
15
|
+
'get_objective_plot',
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class _ColorSet:
|
|
20
|
+
non_domi = {True: '#007bff', False: '#6c757d'} # color
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class _SymbolSet:
|
|
24
|
+
feasible = {True: 'circle', False: 'circle-open'} # style
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class _LanguageSet:
|
|
28
|
+
|
|
29
|
+
feasible = {'label': 'feasibility', True: True, False: False}
|
|
30
|
+
non_domi = {'label': 'optimality', True: True, False: False}
|
|
31
|
+
|
|
32
|
+
def __init__(self):
|
|
33
|
+
self.feasible = {
|
|
34
|
+
'label': Msg.LEGEND_LABEL_CONSTRAINT,
|
|
35
|
+
True: Msg.LEGEND_LABEL_FEASIBLE,
|
|
36
|
+
False: Msg.LEGEND_LABEL_INFEASIBLE,
|
|
37
|
+
}
|
|
38
|
+
self.non_domi = {
|
|
39
|
+
'label': Msg.LEGEND_LABEL_OPTIMAL,
|
|
40
|
+
True: Msg.LEGEND_LABEL_NON_DOMI,
|
|
41
|
+
False: Msg.LEGEND_LABEL_DOMI,
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
def localize(self, df):
|
|
45
|
+
# 元のオブジェクトを変更しないようにコピー
|
|
46
|
+
cdf = df.copy()
|
|
47
|
+
|
|
48
|
+
# feasible, non_domi の localize
|
|
49
|
+
cdf[self.feasible['label']] = [self.feasible[v] for v in cdf['feasibility']]
|
|
50
|
+
cdf[self.non_domi['label']] = [self.non_domi[v] for v in cdf['optimality']]
|
|
51
|
+
|
|
52
|
+
return cdf
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
_ls = _LanguageSet()
|
|
56
|
+
_cs = _ColorSet()
|
|
57
|
+
_ss = _SymbolSet()
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def get_hypervolume_plot(_: History, df: pd.DataFrame) -> go.Figure:
|
|
61
|
+
|
|
62
|
+
df = _ls.localize(df)
|
|
63
|
+
|
|
64
|
+
# メインデータを抽出
|
|
65
|
+
df = get_partial_df(df, equality_filters=MAIN_FILTER)
|
|
66
|
+
|
|
67
|
+
# create figure
|
|
68
|
+
fig = px.line(
|
|
69
|
+
df,
|
|
70
|
+
x="trial",
|
|
71
|
+
y="hypervolume",
|
|
72
|
+
markers=True,
|
|
73
|
+
custom_data=['trial'],
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
fig.update_layout(
|
|
77
|
+
dict(
|
|
78
|
+
title_text=Msg.GRAPH_TITLE_HYPERVOLUME,
|
|
79
|
+
# transition_duration=1000, # Causes graph freeze on tab change
|
|
80
|
+
xaxis_title=Msg.GRAPH_AXIS_LABEL_TRIAL,
|
|
81
|
+
yaxis_title='hypervolume',
|
|
82
|
+
xaxis=dict(
|
|
83
|
+
tick0=1,
|
|
84
|
+
type='category',
|
|
85
|
+
)
|
|
86
|
+
)
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
return fig
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def get_default_figure(history, df) -> go.Figure:
|
|
93
|
+
|
|
94
|
+
# data setting
|
|
95
|
+
obj_names = history.obj_names
|
|
96
|
+
|
|
97
|
+
fig = go.Figure()
|
|
98
|
+
|
|
99
|
+
if len(obj_names) == 1:
|
|
100
|
+
fig = _get_single_objective_plot(history, df)
|
|
101
|
+
|
|
102
|
+
elif len(obj_names) >= 2:
|
|
103
|
+
fig = _get_multi_objective_pairplot(history, df)
|
|
104
|
+
|
|
105
|
+
fig.update_traces(hoverinfo="none", hovertemplate=None)
|
|
106
|
+
fig.update_layout(
|
|
107
|
+
clickmode='event+select',
|
|
108
|
+
transition_duration=900, # 画面更新の頻度よりも短くする
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
return fig
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def _get_single_objective_plot(history: History, df: pd.DataFrame):
|
|
115
|
+
|
|
116
|
+
df: pd.DataFrame = _ls.localize(df)
|
|
117
|
+
obj_name = history.obj_names[0]
|
|
118
|
+
|
|
119
|
+
# 「成功した試行数」を表示するために
|
|
120
|
+
# obj が na ではない row の連番を作成
|
|
121
|
+
df = (df[~df[obj_name].isna()]).copy()
|
|
122
|
+
SUCCEEDED_TRIAL_COLUMN = 'succeeded_trial'
|
|
123
|
+
assert SUCCEEDED_TRIAL_COLUMN not in df.columns
|
|
124
|
+
df[SUCCEEDED_TRIAL_COLUMN] = range(len(df))
|
|
125
|
+
df[SUCCEEDED_TRIAL_COLUMN] += 1
|
|
126
|
+
|
|
127
|
+
df_main = get_partial_df(df, equality_filters=MAIN_FILTER)
|
|
128
|
+
|
|
129
|
+
df.columns = [c.replace(' / ', '<BR>/ ') for c in df.columns]
|
|
130
|
+
df_main.columns = [c.replace(' / ', '<BR>/ ') for c in df.columns]
|
|
131
|
+
obj_name = obj_name.replace(' / ', '<BR>/ ')
|
|
132
|
+
|
|
133
|
+
sub_fidelity_names = history.sub_fidelity_names
|
|
134
|
+
obj_names_per_sub_fidelity_list: list[list[str]] = [
|
|
135
|
+
history.obj_names for _ in sub_fidelity_names
|
|
136
|
+
]
|
|
137
|
+
|
|
138
|
+
# ===== base figure =====
|
|
139
|
+
fig = go.Figure()
|
|
140
|
+
|
|
141
|
+
# ===== all results of sub-fidelity =====
|
|
142
|
+
for (
|
|
143
|
+
sub_fidelity_name,
|
|
144
|
+
obj_names_per_sub_fidelity,
|
|
145
|
+
color
|
|
146
|
+
) in zip(
|
|
147
|
+
sub_fidelity_names,
|
|
148
|
+
obj_names_per_sub_fidelity_list,
|
|
149
|
+
px.colors.qualitative.G10[::-1]
|
|
150
|
+
):
|
|
151
|
+
|
|
152
|
+
if sub_fidelity_name == MAIN_FIDELITY_NAME:
|
|
153
|
+
continue
|
|
154
|
+
|
|
155
|
+
assert len(obj_names_per_sub_fidelity) == 1
|
|
156
|
+
obj_name_per_sub_fidelity = obj_names_per_sub_fidelity[0]
|
|
157
|
+
df_sub = get_partial_df(df, equality_filters=dict(sub_fidelity_name=sub_fidelity_name))
|
|
158
|
+
trace = go.Scatter(
|
|
159
|
+
x=df_sub[SUCCEEDED_TRIAL_COLUMN],
|
|
160
|
+
y=df_sub[obj_name_per_sub_fidelity],
|
|
161
|
+
mode='markers',
|
|
162
|
+
marker=dict(color=color, symbol='square-open'),
|
|
163
|
+
name=sub_fidelity_name,
|
|
164
|
+
)
|
|
165
|
+
fig.add_trace(trace)
|
|
166
|
+
|
|
167
|
+
# ===== i 番目が、その時点までで最適かどうか =====
|
|
168
|
+
# NOTE: 最後の direction をその最適化全体の direction と見做す
|
|
169
|
+
# その時点までの最適な点 index
|
|
170
|
+
indices = []
|
|
171
|
+
anti_indices = []
|
|
172
|
+
objectives = df_main[obj_name].values
|
|
173
|
+
direction = df_main[f'{obj_name}_direction'].values[-1]
|
|
174
|
+
for i, obj in enumerate(objectives):
|
|
175
|
+
|
|
176
|
+
obj_halfway = objectives[:i+1]
|
|
177
|
+
feasible_obj_halfway = obj_halfway[np.where(~np.isnan(obj_halfway))]
|
|
178
|
+
|
|
179
|
+
if len(feasible_obj_halfway) == 0:
|
|
180
|
+
indices.append(i)
|
|
181
|
+
continue
|
|
182
|
+
|
|
183
|
+
if direction == 'maximize':
|
|
184
|
+
if obj == max(feasible_obj_halfway):
|
|
185
|
+
indices.append(i)
|
|
186
|
+
else:
|
|
187
|
+
anti_indices.append(i)
|
|
188
|
+
|
|
189
|
+
elif direction == 'minimize':
|
|
190
|
+
if obj == min(feasible_obj_halfway):
|
|
191
|
+
indices.append(i)
|
|
192
|
+
else:
|
|
193
|
+
anti_indices.append(i)
|
|
194
|
+
|
|
195
|
+
else:
|
|
196
|
+
residuals_halfway = (feasible_obj_halfway - direction) ** 2
|
|
197
|
+
if ((obj - direction) ** 2) == min(residuals_halfway):
|
|
198
|
+
indices.append(i)
|
|
199
|
+
else:
|
|
200
|
+
anti_indices.append(i)
|
|
201
|
+
|
|
202
|
+
# ===== すべての点を灰色で打つ =====
|
|
203
|
+
fig.add_trace(
|
|
204
|
+
go.Scatter(
|
|
205
|
+
x=df_main[SUCCEEDED_TRIAL_COLUMN],
|
|
206
|
+
y=df_main[obj_name],
|
|
207
|
+
customdata=df_main[SUCCEEDED_TRIAL_COLUMN].values.reshape((-1, 1)),
|
|
208
|
+
mode="markers",
|
|
209
|
+
marker=dict(color='#6c757d', size=6),
|
|
210
|
+
name=Msg.LEGEND_LABEL_ALL_SOLUTIONS,
|
|
211
|
+
)
|
|
212
|
+
)
|
|
213
|
+
|
|
214
|
+
# ===== その時点までの最小の点を青で打つ(上から描く) =====
|
|
215
|
+
fig.add_trace(
|
|
216
|
+
go.Scatter(
|
|
217
|
+
x=df_main[SUCCEEDED_TRIAL_COLUMN].iloc[indices],
|
|
218
|
+
y=df_main[obj_name].iloc[indices],
|
|
219
|
+
mode="markers+lines",
|
|
220
|
+
marker=dict(color='#007bff', size=9),
|
|
221
|
+
name=Msg.LEGEND_LABEL_OPTIMAL_SOLUTIONS,
|
|
222
|
+
line=dict(width=1, color='#6c757d',),
|
|
223
|
+
customdata=df_main['trial'].iloc[indices].values.reshape((-1, 1)),
|
|
224
|
+
legendgroup='optimality',
|
|
225
|
+
)
|
|
226
|
+
)
|
|
227
|
+
|
|
228
|
+
# ===== その時点までの最小の点から現在までの平行点線を引く =====
|
|
229
|
+
if len(indices) > 1:
|
|
230
|
+
x = [df_main[SUCCEEDED_TRIAL_COLUMN].iloc[indices].iloc[-1],
|
|
231
|
+
df_main[SUCCEEDED_TRIAL_COLUMN].iloc[-1]]
|
|
232
|
+
y = [df_main[obj_name].iloc[indices].iloc[-1]] * 2
|
|
233
|
+
fig.add_trace(
|
|
234
|
+
go.Scatter(
|
|
235
|
+
x=x,
|
|
236
|
+
y=y,
|
|
237
|
+
mode="lines",
|
|
238
|
+
line=dict(width=0.5, color='#6c757d', dash='dash'),
|
|
239
|
+
showlegend=False,
|
|
240
|
+
legendgroup='optimality',
|
|
241
|
+
)
|
|
242
|
+
)
|
|
243
|
+
|
|
244
|
+
# ===== direction が float の場合、目標値を描く =====
|
|
245
|
+
if len(df_main) > 1:
|
|
246
|
+
if isinstance(direction, float):
|
|
247
|
+
x = [df_main[SUCCEEDED_TRIAL_COLUMN].iloc[0],
|
|
248
|
+
df_main[SUCCEEDED_TRIAL_COLUMN].iloc[-1]]
|
|
249
|
+
y = [direction] * 2
|
|
250
|
+
fig.add_trace(
|
|
251
|
+
go.Scatter(
|
|
252
|
+
x=x,
|
|
253
|
+
y=y,
|
|
254
|
+
mode="lines",
|
|
255
|
+
line=dict(width=0.5, color='#FF2400', dash='dash'),
|
|
256
|
+
name=Msg.LEGEND_LABEL_OBJECTIVE_TARGET,
|
|
257
|
+
)
|
|
258
|
+
)
|
|
259
|
+
|
|
260
|
+
# ===== layout =====
|
|
261
|
+
fig.update_layout(
|
|
262
|
+
dict(
|
|
263
|
+
title_text=Msg.GRAPH_TITLE_SINGLE_OBJECTIVE,
|
|
264
|
+
xaxis_title=Msg.GRAPH_AXIS_LABEL_TRIAL,
|
|
265
|
+
yaxis_title=obj_name,
|
|
266
|
+
xaxis=dict(
|
|
267
|
+
tick0=1,
|
|
268
|
+
type='category', # 負の数や小数点を表示しない。ただし hover の callback があるのでオフセットしたり文字を入れたりしないこと
|
|
269
|
+
)
|
|
270
|
+
)
|
|
271
|
+
)
|
|
272
|
+
|
|
273
|
+
return fig
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
def _get_multi_objective_pairplot(history: History, df: pd.DataFrame):
|
|
277
|
+
|
|
278
|
+
df = _ls.localize(df)
|
|
279
|
+
df_main = get_partial_df(df, equality_filters=MAIN_FILTER)
|
|
280
|
+
|
|
281
|
+
obj_names = history.obj_names
|
|
282
|
+
|
|
283
|
+
df.columns = [c.replace(' / ', '<BR>/ ') for c in df.columns]
|
|
284
|
+
df_main.columns = [c.replace(' / ', '<BR>/ ') for c in df.columns]
|
|
285
|
+
obj_names = [o.replace(' / ', '<BR>/ ') for o in obj_names]
|
|
286
|
+
|
|
287
|
+
sub_fidelity_names = history.sub_fidelity_names
|
|
288
|
+
obj_names_per_sub_fidelity_list: list[list[str]] = [
|
|
289
|
+
history.obj_names for _ in sub_fidelity_names
|
|
290
|
+
]
|
|
291
|
+
|
|
292
|
+
common_kwargs = dict(
|
|
293
|
+
color=_ls.non_domi['label'],
|
|
294
|
+
color_discrete_map={
|
|
295
|
+
_ls.non_domi[True]: _cs.non_domi[True],
|
|
296
|
+
_ls.non_domi[False]: _cs.non_domi[False],
|
|
297
|
+
},
|
|
298
|
+
symbol=_ls.feasible['label'],
|
|
299
|
+
symbol_map={
|
|
300
|
+
_ls.feasible[True]: _ss.feasible[True],
|
|
301
|
+
_ls.feasible[False]: _ss.feasible[False],
|
|
302
|
+
},
|
|
303
|
+
custom_data=['trial'],
|
|
304
|
+
category_orders={
|
|
305
|
+
_ls.feasible['label']: (_ls.feasible[False], _ls.feasible[True]),
|
|
306
|
+
_ls.non_domi['label']: (_ls.non_domi[False], _ls.non_domi[True]),
|
|
307
|
+
},
|
|
308
|
+
)
|
|
309
|
+
|
|
310
|
+
if len(obj_names) == 2:
|
|
311
|
+
|
|
312
|
+
# plot main data
|
|
313
|
+
fig = px.scatter(
|
|
314
|
+
data_frame=df_main,
|
|
315
|
+
x=obj_names[0],
|
|
316
|
+
y=obj_names[1],
|
|
317
|
+
**common_kwargs,
|
|
318
|
+
)
|
|
319
|
+
|
|
320
|
+
# ===== sub-fidelity =====
|
|
321
|
+
for (
|
|
322
|
+
sub_fidelity_name,
|
|
323
|
+
obj_names_per_sub_fidelity,
|
|
324
|
+
color
|
|
325
|
+
) in zip(
|
|
326
|
+
sub_fidelity_names,
|
|
327
|
+
obj_names_per_sub_fidelity_list,
|
|
328
|
+
px.colors.qualitative.G10[::-1]
|
|
329
|
+
):
|
|
330
|
+
|
|
331
|
+
if sub_fidelity_name == MAIN_FIDELITY_NAME:
|
|
332
|
+
continue
|
|
333
|
+
|
|
334
|
+
assert len(obj_names_per_sub_fidelity) == 2
|
|
335
|
+
name1, name2 = obj_names_per_sub_fidelity
|
|
336
|
+
df_sub = get_partial_df(df, equality_filters=dict(sub_fidelity_name=sub_fidelity_name))
|
|
337
|
+
trace = go.Scatter(
|
|
338
|
+
x=df_sub[name1],
|
|
339
|
+
y=df_sub[name2],
|
|
340
|
+
mode='markers',
|
|
341
|
+
marker=dict(color=color, symbol='square-open'),
|
|
342
|
+
name=sub_fidelity_name,
|
|
343
|
+
)
|
|
344
|
+
fig.add_trace(trace)
|
|
345
|
+
|
|
346
|
+
fig.update_layout(
|
|
347
|
+
dict(
|
|
348
|
+
xaxis_title=obj_names[0],
|
|
349
|
+
yaxis_title=obj_names[1],
|
|
350
|
+
)
|
|
351
|
+
)
|
|
352
|
+
|
|
353
|
+
else:
|
|
354
|
+
# plot main data
|
|
355
|
+
fig = px.scatter_matrix(
|
|
356
|
+
data_frame=df_main,
|
|
357
|
+
dimensions=obj_names,
|
|
358
|
+
**common_kwargs,
|
|
359
|
+
)
|
|
360
|
+
|
|
361
|
+
# ===== sub-fidelity =====
|
|
362
|
+
for (
|
|
363
|
+
sub_fidelity_name,
|
|
364
|
+
obj_names_per_sub_fidelity,
|
|
365
|
+
color
|
|
366
|
+
) in zip(
|
|
367
|
+
sub_fidelity_names,
|
|
368
|
+
obj_names_per_sub_fidelity_list,
|
|
369
|
+
px.colors.qualitative.G10[::-1]
|
|
370
|
+
):
|
|
371
|
+
|
|
372
|
+
if sub_fidelity_name == MAIN_FIDELITY_NAME:
|
|
373
|
+
continue
|
|
374
|
+
df_sub = get_partial_df(df, equality_filters=dict(sub_fidelity_name=sub_fidelity_name))
|
|
375
|
+
|
|
376
|
+
fig.add_trace(
|
|
377
|
+
go.Splom(
|
|
378
|
+
dimensions=[
|
|
379
|
+
{
|
|
380
|
+
'label': obj_name,
|
|
381
|
+
'values': df_sub[sub_obj_name]
|
|
382
|
+
} for obj_name, sub_obj_name in zip(
|
|
383
|
+
obj_names, obj_names_per_sub_fidelity
|
|
384
|
+
)
|
|
385
|
+
],
|
|
386
|
+
marker=dict(color=color, symbol='square-open'),
|
|
387
|
+
name=sub_fidelity_name,
|
|
388
|
+
)
|
|
389
|
+
)
|
|
390
|
+
|
|
391
|
+
fig.update_traces(
|
|
392
|
+
patch={'diagonal.visible': False},
|
|
393
|
+
showupperhalf=False,
|
|
394
|
+
)
|
|
395
|
+
|
|
396
|
+
fig.update_layout(
|
|
397
|
+
dict(
|
|
398
|
+
title_text=Msg.GRAPH_TITLE_MULTI_OBJECTIVE,
|
|
399
|
+
)
|
|
400
|
+
)
|
|
401
|
+
|
|
402
|
+
return fig
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
def get_objective_plot(history: History, df: pd.DataFrame, obj_names: list[str]) -> go.Figure:
|
|
406
|
+
|
|
407
|
+
df = _ls.localize(df)
|
|
408
|
+
|
|
409
|
+
df_main = get_partial_df(df, equality_filters=MAIN_FILTER)
|
|
410
|
+
|
|
411
|
+
df.columns = [c.replace(' / ', '<BR>/ ') for c in df.columns]
|
|
412
|
+
df_main.columns = [c.replace(' / ', '<BR>/ ') for c in df.columns]
|
|
413
|
+
obj_names = [o.replace(' / ', '<BR>/ ') for o in obj_names]
|
|
414
|
+
|
|
415
|
+
sub_fidelity_names = history.sub_fidelity_names
|
|
416
|
+
obj_names_per_sub_fidelity_list: list[list[str]] = [
|
|
417
|
+
history.obj_names for _ in sub_fidelity_names
|
|
418
|
+
]
|
|
419
|
+
|
|
420
|
+
common_kwargs = dict(
|
|
421
|
+
color=_ls.non_domi['label'],
|
|
422
|
+
color_discrete_map={
|
|
423
|
+
_ls.non_domi[True]: _cs.non_domi[True],
|
|
424
|
+
_ls.non_domi[False]: _cs.non_domi[False],
|
|
425
|
+
},
|
|
426
|
+
symbol=_ls.feasible['label'],
|
|
427
|
+
symbol_map={
|
|
428
|
+
_ls.feasible[True]: _ss.feasible[True],
|
|
429
|
+
_ls.feasible[False]: _ss.feasible[False],
|
|
430
|
+
},
|
|
431
|
+
custom_data=['trial'],
|
|
432
|
+
category_orders={
|
|
433
|
+
_ls.feasible['label']: (_ls.feasible[False], _ls.feasible[True]),
|
|
434
|
+
_ls.non_domi['label']: (_ls.non_domi[False], _ls.non_domi[True]),
|
|
435
|
+
},
|
|
436
|
+
)
|
|
437
|
+
|
|
438
|
+
if len(obj_names) == 2:
|
|
439
|
+
|
|
440
|
+
# main plot
|
|
441
|
+
fig = px.scatter(
|
|
442
|
+
data_frame=df_main,
|
|
443
|
+
x=obj_names[0],
|
|
444
|
+
y=obj_names[1],
|
|
445
|
+
**common_kwargs,
|
|
446
|
+
)
|
|
447
|
+
|
|
448
|
+
# ===== sub-fidelity =====
|
|
449
|
+
for sub_fidelity_name, obj_names_per_sub_fidelity, color \
|
|
450
|
+
in zip(sub_fidelity_names,
|
|
451
|
+
obj_names_per_sub_fidelity_list,
|
|
452
|
+
px.colors.qualitative.G10[::-1]
|
|
453
|
+
):
|
|
454
|
+
|
|
455
|
+
if sub_fidelity_name == MAIN_FIDELITY_NAME:
|
|
456
|
+
continue
|
|
457
|
+
df_sub = get_partial_df(df, equality_filters=dict(sub_fidelity_name=sub_fidelity_name))
|
|
458
|
+
|
|
459
|
+
sub_name0 = obj_names_per_sub_fidelity[history.obj_names.index(obj_names[0])]
|
|
460
|
+
sub_name1 = obj_names_per_sub_fidelity[history.obj_names.index(obj_names[1])]
|
|
461
|
+
|
|
462
|
+
trace = go.Scatter(
|
|
463
|
+
x=df_sub[sub_name0],
|
|
464
|
+
y=df_sub[sub_name1],
|
|
465
|
+
mode='markers',
|
|
466
|
+
marker=dict(color=color, symbol='square-open'),
|
|
467
|
+
name=sub_fidelity_name,
|
|
468
|
+
)
|
|
469
|
+
fig.add_trace(trace)
|
|
470
|
+
|
|
471
|
+
fig.update_layout(
|
|
472
|
+
dict(
|
|
473
|
+
xaxis_title=obj_names[0],
|
|
474
|
+
yaxis_title=obj_names[1],
|
|
475
|
+
)
|
|
476
|
+
)
|
|
477
|
+
|
|
478
|
+
elif len(obj_names) == 3:
|
|
479
|
+
|
|
480
|
+
# main plot
|
|
481
|
+
fig = px.scatter_3d(
|
|
482
|
+
df_main,
|
|
483
|
+
x=obj_names[0],
|
|
484
|
+
y=obj_names[1],
|
|
485
|
+
z=obj_names[2],
|
|
486
|
+
**common_kwargs,
|
|
487
|
+
)
|
|
488
|
+
|
|
489
|
+
# ===== sub-fidelity =====
|
|
490
|
+
for sub_fidelity_name, obj_names_per_sub_fidelity, color \
|
|
491
|
+
in zip(sub_fidelity_names,
|
|
492
|
+
obj_names_per_sub_fidelity_list,
|
|
493
|
+
px.colors.qualitative.G10[::-1]
|
|
494
|
+
):
|
|
495
|
+
|
|
496
|
+
if sub_fidelity_name == MAIN_FIDELITY_NAME:
|
|
497
|
+
continue
|
|
498
|
+
df_sub = get_partial_df(df, equality_filters=dict(sub_fidelity_name=sub_fidelity_name))
|
|
499
|
+
|
|
500
|
+
sub_name0 = obj_names_per_sub_fidelity[history.obj_names.index(obj_names[0])]
|
|
501
|
+
sub_name1 = obj_names_per_sub_fidelity[history.obj_names.index(obj_names[1])]
|
|
502
|
+
sub_name2 = obj_names_per_sub_fidelity[history.obj_names.index(obj_names[2])]
|
|
503
|
+
|
|
504
|
+
fig.add_trace(
|
|
505
|
+
go.Scatter3d(
|
|
506
|
+
x=df_sub[sub_name0],
|
|
507
|
+
y=df_sub[sub_name1],
|
|
508
|
+
z=df_sub[sub_name2],
|
|
509
|
+
mode='markers',
|
|
510
|
+
marker=dict(color=color, symbol='square-open'),
|
|
511
|
+
name=sub_fidelity_name,
|
|
512
|
+
)
|
|
513
|
+
)
|
|
514
|
+
|
|
515
|
+
fig.update_layout(
|
|
516
|
+
margin=dict(l=0, r=0, b=0, t=30),
|
|
517
|
+
scene=dict(aspectmode="cube")
|
|
518
|
+
)
|
|
519
|
+
fig.update_traces(
|
|
520
|
+
marker=dict(
|
|
521
|
+
size=3,
|
|
522
|
+
),
|
|
523
|
+
)
|
|
524
|
+
|
|
525
|
+
else:
|
|
526
|
+
raise Exception
|
|
527
|
+
|
|
528
|
+
fig.update_layout(
|
|
529
|
+
dict(
|
|
530
|
+
title_text="Objective plot",
|
|
531
|
+
)
|
|
532
|
+
)
|
|
533
|
+
|
|
534
|
+
fig.update_traces(hoverinfo="none", hovertemplate=None)
|
|
535
|
+
|
|
536
|
+
return fig
|