pyfemtet 0.8.8__tar.gz → 0.8.9__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of pyfemtet might be problematic. Click here for more details.
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/PKG-INFO +1 -1
- pyfemtet-0.8.9/pyfemtet/__init__.py +1 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/_femopt.py +1 -1
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/_femopt_core.py +33 -25
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/_test_utils/record_history.py +1 -0
- pyfemtet-0.8.9/pyfemtet/opt/advanced_samples/restart/gal_ex13_parametric_restart.py +99 -0
- pyfemtet-0.8.9/pyfemtet/opt/advanced_samples/restart/gal_ex13_parametric_restart_jp.py +102 -0
- pyfemtet-0.8.9/pyfemtet/opt/advanced_samples/surrogate_model/gal_ex13_parametric.femprj +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/interface/_femtet.py +58 -1
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/optimizer/_base.py +2 -6
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/optimizer/_optuna/_optuna.py +2 -2
- pyfemtet-0.8.9/pyfemtet/opt/samples/femprj_sample/gau_ex12_parametric.femprj +0 -0
- pyfemtet-0.8.9/pyfemtet/opt/samples/femprj_sample/gau_ex12_parametric.py +52 -0
- pyfemtet-0.8.9/pyfemtet/opt/samples/femprj_sample_jp/gau_ex12_parametric_jp.py +52 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyproject.toml +2 -2
- pyfemtet-0.8.8/pyfemtet/__init__.py +0 -1
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/LICENSE +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/README.md +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/_femtet_config_util/__init__.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/_femtet_config_util/autosave.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/_femtet_config_util/exit.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/_message/1. make_pot.bat +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/_message/2. make_mo.bat +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/_message/__init__.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/_message/babel.cfg +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/_message/locales/ja/LC_MESSAGES/messages.mo +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/_message/locales/ja/LC_MESSAGES/messages.po +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/_message/locales/messages.pot +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/_message/messages.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/_util/__init__.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/_util/dask_util.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/_util/excel_macro_util.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/_util/excel_parse_util.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/_util/sample.xlsx +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/_warning.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/brep/__init__.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/brep/_impl.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/core.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/dispatch_extensions/__init__.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/dispatch_extensions/_impl.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/logger/__init__.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/logger/_impl.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/__init__.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/_test_utils/__init__.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/_test_utils/control_femtet.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/_test_utils/hyper_sphere.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/advanced_samples/excel_ui/(ref) original_project.femprj +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/advanced_samples/excel_ui/femtet-macro.xlsm +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/advanced_samples/excel_ui/pyfemtet-core.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/advanced_samples/excel_ui/test-pyfemtet-core.cmd +0 -0
- {pyfemtet-0.8.8/pyfemtet/opt/advanced_samples/surrogate_model → pyfemtet-0.8.9/pyfemtet/opt/advanced_samples/restart}/gal_ex13_parametric.femprj +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/advanced_samples/surrogate_model/gal_ex13_create_training_data.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/advanced_samples/surrogate_model/gal_ex13_create_training_data_jp.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/advanced_samples/surrogate_model/gal_ex13_optimize_with_surrogate.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/advanced_samples/surrogate_model/gal_ex13_optimize_with_surrogate_jp.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/interface/__init__.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/interface/_base.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/interface/_excel_interface.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/interface/_femtet_parametric.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/interface/_femtet_with_nx/__init__.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/interface/_femtet_with_nx/_interface.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/interface/_femtet_with_nx/update_model.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/interface/_femtet_with_sldworks.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/interface/_surrogate/__init__.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/interface/_surrogate/_base.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/interface/_surrogate/_chaospy.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/interface/_surrogate/_singletaskgp.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/optimizer/__init__.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/optimizer/_optuna/__init__.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/optimizer/_optuna/_botorch_patch/__init__.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/optimizer/_optuna/_botorch_patch/enable_nonlinear_constraint.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/optimizer/_optuna/_pof_botorch.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/optimizer/_scipy.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/optimizer/_scipy_scalar.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/optimizer/parameter.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/prediction/__init__.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/prediction/_base.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/prediction/single_task_gp.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample/ParametricIF.femprj +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample/ParametricIF.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample/ParametricIF_test_result.reccsv +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample/cad_ex01_NX.femprj +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample/cad_ex01_NX.prt +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample/cad_ex01_NX.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample/cad_ex01_NX_test_result.reccsv +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample/cad_ex01_SW.SLDPRT +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample/cad_ex01_SW.femprj +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample/cad_ex01_SW.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample/cad_ex01_SW_test_result.reccsv +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample/constrained_pipe.femprj +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample/constrained_pipe.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample/constrained_pipe_test_result.reccsv +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample/gal_ex58_parametric.femprj +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample/gal_ex58_parametric.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample/gal_ex58_parametric_test_result.reccsv +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample/gau_ex08_parametric.femprj +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample/gau_ex08_parametric.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample/gau_ex08_parametric_test_result.reccsv +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample/her_ex40_parametric.femprj +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample/her_ex40_parametric.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample/her_ex40_parametric_test_result.reccsv +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample/paswat_ex1_parametric.femprj +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample/paswat_ex1_parametric.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample/paswat_ex1_parametric_parallel.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample/paswat_ex1_parametric_test_result.reccsv +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample/wat_ex14_parametric.femprj +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample/wat_ex14_parametric.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample/wat_ex14_parametric_parallel.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample/wat_ex14_parametric_test_result.reccsv +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample_jp/ParametricIF_jp.femprj +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample_jp/ParametricIF_jp.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample_jp/cad_ex01_NX_jp.femprj +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample_jp/cad_ex01_NX_jp.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample_jp/cad_ex01_SW_jp.femprj +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample_jp/cad_ex01_SW_jp.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample_jp/constrained_pipe_jp.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample_jp/gal_ex58_parametric_jp.femprj +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample_jp/gal_ex58_parametric_jp.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample_jp/gau_ex08_parametric_jp.femprj +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample_jp/gau_ex08_parametric_jp.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample_jp/her_ex40_parametric_jp.femprj +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample_jp/her_ex40_parametric_jp.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample_jp/paswat_ex1_parametric_jp.femprj +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample_jp/paswat_ex1_parametric_jp.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample_jp/paswat_ex1_parametric_parallel_jp.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample_jp/wat_ex14_parametric_jp.femprj +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample_jp/wat_ex14_parametric_jp.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample_jp/wat_ex14_parametric_parallel_jp.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/visualization/__init__.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/visualization/_base.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/visualization/_complex_components/__init__.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/visualization/_complex_components/alert_region.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/visualization/_complex_components/control_femtet.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/visualization/_complex_components/main_figure_creator.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/visualization/_complex_components/main_graph.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/visualization/_complex_components/pm_graph.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/visualization/_complex_components/pm_graph_creator.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/visualization/_create_wrapped_components.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/visualization/_process_monitor/__init__.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/visualization/_process_monitor/application.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/visualization/_process_monitor/pages.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/visualization/_wrapped_components/__init__.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/visualization/_wrapped_components/dbc.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/visualization/_wrapped_components/dcc.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/visualization/_wrapped_components/html.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/visualization/_wrapped_components/str_enum.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/visualization/result_viewer/.gitignore +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/visualization/result_viewer/__init__.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/visualization/result_viewer/application.py +0 -0
- {pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/visualization/result_viewer/pages.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.8.9"
|
|
@@ -131,7 +131,7 @@ class FEMOpt:
|
|
|
131
131
|
# メンバーの宣言
|
|
132
132
|
self.client = None
|
|
133
133
|
self.status = None # actor
|
|
134
|
-
self.history = None
|
|
134
|
+
self.history: History = None
|
|
135
135
|
self.worker_status_list = None # [actor]
|
|
136
136
|
self.monitor_process_future = None
|
|
137
137
|
self.monitor_server_kwargs = dict()
|
|
@@ -553,7 +553,7 @@ class History:
|
|
|
553
553
|
hv_reference=None,
|
|
554
554
|
):
|
|
555
555
|
# hypervolume 計算メソッド
|
|
556
|
-
self._hv_reference =
|
|
556
|
+
self._hv_reference = 'dynamic-pareto' if hv_reference is None else hv_reference
|
|
557
557
|
|
|
558
558
|
# 引数の処理
|
|
559
559
|
self.path = history_path # .csv
|
|
@@ -728,6 +728,14 @@ class History:
|
|
|
728
728
|
|
|
729
729
|
return columns, meta_columns
|
|
730
730
|
|
|
731
|
+
def generate_hidden_infeasible_result(self):
|
|
732
|
+
y = np.full_like(np.zeros(len(self.obj_names)), np.nan)
|
|
733
|
+
c = np.full_like(np.zeros(len(self.cns_names)), np.nan)
|
|
734
|
+
return y, c
|
|
735
|
+
|
|
736
|
+
def is_hidden_infeasible_result(self, y):
|
|
737
|
+
return np.all(np.isnan(y))
|
|
738
|
+
|
|
731
739
|
def record(
|
|
732
740
|
self,
|
|
733
741
|
parameters,
|
|
@@ -780,7 +788,7 @@ class History:
|
|
|
780
788
|
feasible_list.append(is_feasible(cns_value, cns.lb, cns.ub))
|
|
781
789
|
|
|
782
790
|
# feasibility
|
|
783
|
-
row.append(all(feasible_list))
|
|
791
|
+
row.append(all(feasible_list) and not self.is_hidden_infeasible_result(obj_values))
|
|
784
792
|
|
|
785
793
|
# the others
|
|
786
794
|
row.append(-1.) # dummy hypervolume
|
|
@@ -892,7 +900,29 @@ class History:
|
|
|
892
900
|
ret.append(row)
|
|
893
901
|
return np.array(ret).max(axis=0)
|
|
894
902
|
|
|
895
|
-
if
|
|
903
|
+
if (
|
|
904
|
+
isinstance(self._hv_reference, np.ndarray)
|
|
905
|
+
or isinstance(self._hv_reference, list)
|
|
906
|
+
):
|
|
907
|
+
_buff = np.array(self._hv_reference)
|
|
908
|
+
assert _buff.shape == (len(self.obj_names),)
|
|
909
|
+
|
|
910
|
+
ref_point = np.array(
|
|
911
|
+
[obj.convert(raw_value) for obj, raw_value in zip(objectives.values(), _buff)]
|
|
912
|
+
)
|
|
913
|
+
|
|
914
|
+
_buff = get_pareto(objective_values)
|
|
915
|
+
|
|
916
|
+
pareto_set = np.empty((0, len(objectives)))
|
|
917
|
+
for pareto_sol in _buff:
|
|
918
|
+
if all(pareto_sol < ref_point):
|
|
919
|
+
pareto_set = np.concatenate([pareto_set, [pareto_sol]], axis=0)
|
|
920
|
+
|
|
921
|
+
hv = compute_hypervolume(pareto_set, ref_point)
|
|
922
|
+
df.loc[len(df) - 1, 'hypervolume'] = hv
|
|
923
|
+
return
|
|
924
|
+
|
|
925
|
+
elif self._hv_reference == 'dynamic-pareto':
|
|
896
926
|
pareto_set, pareto_set_list = get_pareto(objective_values, with_partial=True)
|
|
897
927
|
for i, partial_pareto_set in enumerate(pareto_set_list):
|
|
898
928
|
# 並列計算時など Valid な解がまだ一つもない場合は pareto_set が長さ 0 になる
|
|
@@ -943,28 +973,6 @@ class History:
|
|
|
943
973
|
df.loc[len(df) - 1, 'hypervolume'] = hv
|
|
944
974
|
return
|
|
945
975
|
|
|
946
|
-
elif (
|
|
947
|
-
isinstance(self._hv_reference, np.ndarray)
|
|
948
|
-
or isinstance(self._hv_reference, list)
|
|
949
|
-
):
|
|
950
|
-
_buff = np.array(self._hv_reference)
|
|
951
|
-
assert _buff.shape == (len(self.obj_names),)
|
|
952
|
-
|
|
953
|
-
ref_point = np.array(
|
|
954
|
-
[obj.convert(raw_value) for obj, raw_value in zip(objectives.values(), _buff)]
|
|
955
|
-
)
|
|
956
|
-
|
|
957
|
-
_buff = get_pareto(objective_values)
|
|
958
|
-
|
|
959
|
-
pareto_set = np.empty((0, len(objectives)))
|
|
960
|
-
for pareto_sol in _buff:
|
|
961
|
-
if all(pareto_sol < ref_point):
|
|
962
|
-
pareto_set = np.concatenate([pareto_set, [pareto_sol]], axis=0)
|
|
963
|
-
|
|
964
|
-
hv = compute_hypervolume(pareto_set, ref_point)
|
|
965
|
-
df.loc[len(df) - 1, 'hypervolume'] = hv
|
|
966
|
-
return
|
|
967
|
-
|
|
968
976
|
else:
|
|
969
977
|
raise NotImplementedError(f'Invalid Hypervolume reference point calculation method: {self._hv_reference}')
|
|
970
978
|
|
|
@@ -92,6 +92,7 @@ def is_equal_result(ref_path, dif_path, log_path=None, threashold=0.05):
|
|
|
92
92
|
assert len(ref_columns) == len(dif_columns), "結果 csv の column 数が異なります。"
|
|
93
93
|
assert len(ref_df) == len(dif_df), "結果 csv の row 数が異なります。"
|
|
94
94
|
assert difference <= threashold*100, f"前回の結果との平均差異が {int(difference)}% で {int(threashold*100)}% を超えています。"
|
|
95
|
+
print(f"OK! 前回の結果との平均差異が {int(difference)}% で {int(threashold*100)}% 以下です。")
|
|
95
96
|
|
|
96
97
|
|
|
97
98
|
def _get_simplified_df_values(csv_path, exclude_columns=None):
|
|
@@ -0,0 +1,99 @@
|
|
|
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
|
+
"""Main function
|
|
20
|
+
|
|
21
|
+
length
|
|
22
|
+
using different algorithms for each restarting.
|
|
23
|
+
|
|
24
|
+
So this main function requires n_trials and sampler_class.
|
|
25
|
+
|
|
26
|
+
Args:
|
|
27
|
+
|
|
28
|
+
n_trials (int):
|
|
29
|
+
How many additional succeeded trials
|
|
30
|
+
to terminate optimization.
|
|
31
|
+
|
|
32
|
+
sampler_class (type[optuna.samplers.BaseSampler]):
|
|
33
|
+
The algorithm we use.
|
|
34
|
+
|
|
35
|
+
sampler_kwargs (dict):
|
|
36
|
+
The arguments of sampler.
|
|
37
|
+
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
# Connect to Femtet.
|
|
42
|
+
fem = FemtetInterface(
|
|
43
|
+
femprj_path='gal_ex13_parametric.femprj',
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
# Initialize the optimization object.
|
|
47
|
+
opt = OptunaOptimizer(
|
|
48
|
+
sampler_class=sampler_class,
|
|
49
|
+
sampler_kwargs=sampler_kwargs,
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
# To restart, it is necessary to inform the new optimization program
|
|
53
|
+
# about the history of the previous optimization.
|
|
54
|
+
# By specifying a csv for the `history_path` argument of FEMOpt,
|
|
55
|
+
# if it does not exist, a new csv file will be created,
|
|
56
|
+
# and if it exists, optimization will continue from that csv file.
|
|
57
|
+
#
|
|
58
|
+
# Note:
|
|
59
|
+
# When restarting, the number and names of variables,
|
|
60
|
+
# as well as the number and names of objective functions
|
|
61
|
+
# and constraints must be consistent.
|
|
62
|
+
# However, you can change the bounds of variables,
|
|
63
|
+
# direction of objective functions, and content of constraints.
|
|
64
|
+
#
|
|
65
|
+
# Note:
|
|
66
|
+
# When using OptunaOptimizer, the .db file with the same name
|
|
67
|
+
# (in this case restarting-sample.db) that is saved along with
|
|
68
|
+
# csv is required to be in the same folder as the csv file.
|
|
69
|
+
femopt = FEMOpt(
|
|
70
|
+
fem=fem,
|
|
71
|
+
opt=opt,
|
|
72
|
+
history_path='restarting-sample.csv'
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
# Set the design variables.
|
|
76
|
+
femopt.add_parameter('length', 0.1, 0.02, 0.2)
|
|
77
|
+
femopt.add_parameter('width', 0.01, 0.001, 0.02)
|
|
78
|
+
femopt.add_parameter('base_radius', 0.008, 0.006, 0.01)
|
|
79
|
+
|
|
80
|
+
# Set the objective function.
|
|
81
|
+
femopt.add_objective(fun=get_res_freq, name='First Resonant Frequency (Hz)', direction=800)
|
|
82
|
+
|
|
83
|
+
# Run optimization.
|
|
84
|
+
femopt.set_random_seed(42)
|
|
85
|
+
femopt.optimize(n_trials=n_trials, confirm_before_exit=False)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
if __name__ == '__main__':
|
|
89
|
+
# First, we will perform 3 optimizations using the RandomSampler.
|
|
90
|
+
main(3, RandomSampler, {})
|
|
91
|
+
|
|
92
|
+
# Next, we will perform 3 optimizations using the NSGAIISampler.
|
|
93
|
+
main(3, NSGAIISampler, {})
|
|
94
|
+
|
|
95
|
+
# Finally, we will perform 3 optimizations using the GPSampler.
|
|
96
|
+
main(3, GPSampler, {'n_startup_trials': 0, 'deterministic_objective': True})
|
|
97
|
+
|
|
98
|
+
# After this program ends, you can continue further with
|
|
99
|
+
# restarting-sample.csv and the .db file.
|
|
@@ -0,0 +1,102 @@
|
|
|
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
|
+
# さらに続きの最適化を行うことができます。
|
|
Binary file
|
|
@@ -201,6 +201,40 @@ class FemtetInterface(FEMInterface):
|
|
|
201
201
|
**kwargs
|
|
202
202
|
)
|
|
203
203
|
|
|
204
|
+
def use_parametric_output_as_objective(self, number: int, direction: str | float = 'minimize') -> None:
|
|
205
|
+
"""Use output setting of Femtet parametric analysis as an objective function.
|
|
206
|
+
|
|
207
|
+
Args:
|
|
208
|
+
number (int): The index of output settings tab in parametric analysis dialog of Femtet. Starts at 1.
|
|
209
|
+
direction (str | float): Objective direction. Valid input is one of 'minimize', 'maximize' or a specific value. Defaults to 'minimize'.
|
|
210
|
+
|
|
211
|
+
Returns:
|
|
212
|
+
None
|
|
213
|
+
|
|
214
|
+
"""
|
|
215
|
+
# check
|
|
216
|
+
if isinstance(direction, str):
|
|
217
|
+
if direction not in ('minimize', 'maximize'):
|
|
218
|
+
raise ValueError(f'direction must be one of "minimize", "maximize" or a specific value. Passed value is {direction}')
|
|
219
|
+
else:
|
|
220
|
+
try:
|
|
221
|
+
direction = float(direction)
|
|
222
|
+
except (TypeError, ValueError):
|
|
223
|
+
raise ValueError(f'direction must be one of "minimize", "maximize" or a specific value. Passed value is {direction}')
|
|
224
|
+
|
|
225
|
+
index = {number - 1: direction}
|
|
226
|
+
|
|
227
|
+
if self.parametric_output_indexes_use_as_objective is None:
|
|
228
|
+
self.parametric_output_indexes_use_as_objective = index
|
|
229
|
+
|
|
230
|
+
else:
|
|
231
|
+
self.parametric_output_indexes_use_as_objective.update(index)
|
|
232
|
+
|
|
233
|
+
# TODO: FEMInterface.__init__ の仕様を変えたらここも変える
|
|
234
|
+
self.kwargs['parametric_output_indexes_use_as_objective'] = self.parametric_output_indexes_use_as_objective
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
|
|
204
238
|
def __del__(self):
|
|
205
239
|
self.quit()
|
|
206
240
|
# CoUninitialize() # Win32 exception occurred releasing IUnknown at 0x0000022427692748
|
|
@@ -682,6 +716,14 @@ class FemtetInterface(FEMInterface):
|
|
|
682
716
|
|
|
683
717
|
if self.parametric_output_indexes_use_as_objective is not None:
|
|
684
718
|
from pyfemtet.opt.interface._femtet_parametric import solve_via_parametric_dll
|
|
719
|
+
|
|
720
|
+
pdt_path = self.Femtet.ResultFilePath + '.pdt'
|
|
721
|
+
|
|
722
|
+
# 前のものが残っているとややこしいので消しておく
|
|
723
|
+
if os.path.exists(pdt_path):
|
|
724
|
+
os.remove(pdt_path)
|
|
725
|
+
|
|
726
|
+
# parametric analysis 経由で解析
|
|
685
727
|
self._call_femtet_api(
|
|
686
728
|
fun=solve_via_parametric_dll,
|
|
687
729
|
return_value_if_failed=False,
|
|
@@ -690,8 +732,23 @@ class FemtetInterface(FEMInterface):
|
|
|
690
732
|
is_Gaudi_method=True,
|
|
691
733
|
args=(self.Femtet,),
|
|
692
734
|
)
|
|
735
|
+
|
|
736
|
+
# parametric analysis の場合
|
|
737
|
+
# ダイアログで「解析結果を保存する」に
|
|
738
|
+
# チェックがついていないと次にすべき
|
|
739
|
+
# OpenCurrentResult に失敗するので
|
|
740
|
+
# parametric の場合も pdt を保存する
|
|
741
|
+
self._call_femtet_api(
|
|
742
|
+
fun=self.Femtet.SavePDT,
|
|
743
|
+
args=(pdt_path, True),
|
|
744
|
+
return_value_if_failed=False,
|
|
745
|
+
if_error=SolveError,
|
|
746
|
+
error_message=Msg.ERR_FAILED_TO_SAVE_PDT,
|
|
747
|
+
is_Gaudi_method=False,
|
|
748
|
+
)
|
|
749
|
+
|
|
693
750
|
else:
|
|
694
|
-
#
|
|
751
|
+
# ソルブする
|
|
695
752
|
self._call_femtet_api(
|
|
696
753
|
self.Femtet.Solve,
|
|
697
754
|
False,
|
|
@@ -155,11 +155,6 @@ class AbstractOptimizer(ABC):
|
|
|
155
155
|
"""Setup before parallel processes are launched."""
|
|
156
156
|
pass
|
|
157
157
|
|
|
158
|
-
def generate_infeasible_result(self):
|
|
159
|
-
y = np.full_like(np.zeros(len(self.objectives)), np.nan)
|
|
160
|
-
c = np.full_like(np.zeros(len(self.constraints)), np.nan)
|
|
161
|
-
return y, y, c
|
|
162
|
-
|
|
163
158
|
# ===== calc =====
|
|
164
159
|
def f(self, x: np.ndarray, _record_infeasible=False) -> list[np.ndarray]:
|
|
165
160
|
"""Calculate objectives and constraints.
|
|
@@ -208,7 +203,8 @@ class AbstractOptimizer(ABC):
|
|
|
208
203
|
c = [cns.calc(self.fem) for cns in self.constraints.values()]
|
|
209
204
|
|
|
210
205
|
else:
|
|
211
|
-
y,
|
|
206
|
+
y, c = self.history.generate_hidden_infeasible_result()
|
|
207
|
+
_y = y
|
|
212
208
|
|
|
213
209
|
# register to history
|
|
214
210
|
df_to_opt = self.variables.get_variables(
|
|
@@ -207,9 +207,9 @@ class OptunaOptimizer(AbstractOptimizer):
|
|
|
207
207
|
|
|
208
208
|
# create storage
|
|
209
209
|
self.study_name = 'pyfemtet-study'
|
|
210
|
-
storage_path = self.history.path
|
|
210
|
+
storage_path = os.path.splitext(self.history.path)[0] + '.db' # history と同じところに保存
|
|
211
211
|
if self.is_cluster: # remote cluster なら scheduler の working dir に保存
|
|
212
|
-
storage_path = os.path.basename(self.history.path)
|
|
212
|
+
storage_path = os.path.splitext(os.path.basename(self.history.path))[0] + '.db'
|
|
213
213
|
|
|
214
214
|
# callback to terminate
|
|
215
215
|
if self.n_trials is not None:
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"""Optimization using parametric analysis output settings as the objective function
|
|
2
|
+
|
|
3
|
+
This demo shows how to use the values outputted by Femtet's parametric
|
|
4
|
+
analysis output setting feature as the objective function for optimization.
|
|
5
|
+
This feature allows you to perform optimization without coding the objective function.
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Note:
|
|
9
|
+
|
|
10
|
+
Please be aware of the following when using this feature.
|
|
11
|
+
|
|
12
|
+
- The sweep table from the parametric analysis will be deleted.
|
|
13
|
+
- Output settings that produce complex numbers or vectors will only use
|
|
14
|
+
the first value as the objective function. (For complex numbers, it will be
|
|
15
|
+
the real part, and for vector values, it will be components such as X.)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
Corresponding project: gau_ex12_parametric.femprj
|
|
19
|
+
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
from pyfemtet.opt import FEMOpt, FemtetInterface
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
if __name__ == '__main__':
|
|
26
|
+
|
|
27
|
+
# Initialize an object to connect to
|
|
28
|
+
# Femtet for referencing Femtet settings.
|
|
29
|
+
fem = FemtetInterface()
|
|
30
|
+
|
|
31
|
+
# Set the output settings of the parametric analysis as the objective function.
|
|
32
|
+
# `number` is the index from the `results output settings` tab of the
|
|
33
|
+
# Femtet parametric analysis dialog, and `direction` is
|
|
34
|
+
# the goal of that objective function (similar to FEMOpt.add_objective).
|
|
35
|
+
|
|
36
|
+
# Mutual inductance
|
|
37
|
+
fem.use_parametric_output_as_objective(number=1, direction=1.5e-7)
|
|
38
|
+
|
|
39
|
+
# Strength of magnetic field at the center of the coil
|
|
40
|
+
fem.use_parametric_output_as_objective(number=2, direction='minimize')
|
|
41
|
+
|
|
42
|
+
# Initialize optimization object.
|
|
43
|
+
# Pass in the previously initialized fem object.
|
|
44
|
+
femopt = FEMOpt(fem=fem)
|
|
45
|
+
|
|
46
|
+
# Set parameters.
|
|
47
|
+
femopt.add_parameter('in_radius', 10, 5, 10)
|
|
48
|
+
femopt.add_parameter('out_radius', 20, 20, 25)
|
|
49
|
+
|
|
50
|
+
# Execute optimization.
|
|
51
|
+
femopt.set_random_seed(42) # Fix random seed
|
|
52
|
+
femopt.optimize(n_trials=20)
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"""パラメトリック解析出力設定を目的関数とする最適化
|
|
2
|
+
|
|
3
|
+
Femtet のパラメトリック解析の結果出力設定機能で出力される値を
|
|
4
|
+
最適化の目的関数として使用する方法をデモします。
|
|
5
|
+
この機能により、目的関数をコーディングすることなく
|
|
6
|
+
最適化を実施できます。
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
注意:
|
|
10
|
+
|
|
11
|
+
この機能を使う際は、以下のことに注意してください。
|
|
12
|
+
|
|
13
|
+
- パラメトリック解析のスイープテーブルが削除されます。
|
|
14
|
+
- 複素数やベクトルを出力する出力設定は、第一の値のみが
|
|
15
|
+
目的関数として使用されます。(複素数の場合は実数、
|
|
16
|
+
ベクトル値の場合は X 成分など)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
対応するプロジェクト: gau_ex12_parametric.femprj
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
from pyfemtet.opt import FEMOpt, FemtetInterface
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
if __name__ == '__main__':
|
|
26
|
+
|
|
27
|
+
# Femtet の設定を参照するため、Femtet と接続を
|
|
28
|
+
# 行うためのオブジェクトを初期化します。
|
|
29
|
+
fem = FemtetInterface()
|
|
30
|
+
|
|
31
|
+
# パラメトリック解析の結果出力設定を目的関数にします。
|
|
32
|
+
# number は Femtet パラメトリック解析ダイアログの
|
|
33
|
+
# 結果出力設定タブのテーブルの番号で、direction は
|
|
34
|
+
# その目的関数の目標です(FEMOpt.add_objective と同様)。
|
|
35
|
+
|
|
36
|
+
# 相互インダクタンス
|
|
37
|
+
fem.use_parametric_output_as_objective(number=1, direction=1.5e-7)
|
|
38
|
+
|
|
39
|
+
# コイル中央の磁界の強さ
|
|
40
|
+
fem.use_parametric_output_as_objective(number=2, direction='minimize')
|
|
41
|
+
|
|
42
|
+
# 最適化用オブジェクトを初期化します。
|
|
43
|
+
# さきほど初期化した fem を渡します。
|
|
44
|
+
femopt = FEMOpt(fem=fem)
|
|
45
|
+
|
|
46
|
+
# パラメータを設定します。
|
|
47
|
+
femopt.add_parameter('in_radius', 10, 5, 10)
|
|
48
|
+
femopt.add_parameter('out_radius', 20, 20, 25)
|
|
49
|
+
|
|
50
|
+
# 最適化を実行します。
|
|
51
|
+
femopt.set_random_seed(42) # 乱数シードの固定
|
|
52
|
+
femopt.optimize(n_trials=20)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "pyfemtet"
|
|
3
|
-
version = "0.8.
|
|
3
|
+
version = "0.8.9" # ignored by versioning plugin
|
|
4
4
|
description = "Design parameter optimization using Femtet."
|
|
5
5
|
authors = ["kazuma.naito <kazuma.naito@murata.com>"]
|
|
6
6
|
readme = "README.md"
|
|
@@ -15,7 +15,7 @@ tqdm = "^4.66.1"
|
|
|
15
15
|
colorlog = "^6.8.0"
|
|
16
16
|
psutil = "^5.9.6"
|
|
17
17
|
# win32 / Femtet
|
|
18
|
-
# markers
|
|
18
|
+
# markers requires ```poetry config installer.re-resolve false```
|
|
19
19
|
pywin32 = { version = "^306", markers = "sys_platform=='win32'" }
|
|
20
20
|
femtetutils = { version = "^1.0.0", markers = "sys_platform=='win32'" }
|
|
21
21
|
# distributed
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.8.8"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/advanced_samples/excel_ui/test-pyfemtet-core.cmd
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample/ParametricIF_test_result.reccsv
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample/cad_ex01_NX_test_result.reccsv
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample/cad_ex01_SW_test_result.reccsv
RENAMED
|
File without changes
|
{pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample/constrained_pipe.femprj
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample/gal_ex58_parametric.femprj
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample/gau_ex08_parametric.femprj
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample/her_ex40_parametric.femprj
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample/paswat_ex1_parametric.femprj
RENAMED
|
File without changes
|
{pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample/paswat_ex1_parametric.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample/wat_ex14_parametric.femprj
RENAMED
|
File without changes
|
|
File without changes
|
{pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample/wat_ex14_parametric_parallel.py
RENAMED
|
File without changes
|
|
File without changes
|
{pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample_jp/ParametricIF_jp.femprj
RENAMED
|
File without changes
|
|
File without changes
|
{pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample_jp/cad_ex01_NX_jp.femprj
RENAMED
|
File without changes
|
|
File without changes
|
{pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample_jp/cad_ex01_SW_jp.femprj
RENAMED
|
File without changes
|
|
File without changes
|
{pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample_jp/constrained_pipe_jp.py
RENAMED
|
File without changes
|
|
File without changes
|
{pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample_jp/gal_ex58_parametric_jp.py
RENAMED
|
File without changes
|
|
File without changes
|
{pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample_jp/gau_ex08_parametric_jp.py
RENAMED
|
File without changes
|
|
File without changes
|
{pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample_jp/her_ex40_parametric_jp.py
RENAMED
|
File without changes
|
|
File without changes
|
{pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample_jp/paswat_ex1_parametric_jp.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/samples/femprj_sample_jp/wat_ex14_parametric_jp.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/visualization/_complex_components/__init__.py
RENAMED
|
File without changes
|
{pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/visualization/_complex_components/alert_region.py
RENAMED
|
File without changes
|
{pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/visualization/_complex_components/control_femtet.py
RENAMED
|
File without changes
|
|
File without changes
|
{pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/visualization/_complex_components/main_graph.py
RENAMED
|
File without changes
|
{pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/visualization/_complex_components/pm_graph.py
RENAMED
|
File without changes
|
{pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/visualization/_complex_components/pm_graph_creator.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/visualization/_process_monitor/application.py
RENAMED
|
File without changes
|
|
File without changes
|
{pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/visualization/_wrapped_components/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyfemtet-0.8.8 → pyfemtet-0.8.9}/pyfemtet/opt/visualization/_wrapped_components/str_enum.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|