pyfemtet 0.8.10__py3-none-any.whl → 0.8.12__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 +1 -1
- pyfemtet/opt/_femopt_core.py +3 -3
- pyfemtet/opt/interface/_base.py +1 -1
- pyfemtet/opt/interface/_excel_interface.py +12 -6
- pyfemtet/opt/interface/_femtet.py +25 -2
- pyfemtet/opt/interface/_femtet_excel.py +6 -3
- pyfemtet/opt/interface/_femtet_parametric.py +2 -1
- pyfemtet/opt/interface/_surrogate_excel.py +7 -7
- pyfemtet/opt/meta_script/YAML_Generator.xlsm +0 -0
- pyfemtet/opt/meta_script/__init__.py +0 -0
- pyfemtet/opt/meta_script/__main__.py +213 -0
- {pyfemtet-0.8.10.dist-info → pyfemtet-0.8.12.dist-info}/METADATA +1 -1
- {pyfemtet-0.8.10.dist-info → pyfemtet-0.8.12.dist-info}/RECORD +16 -17
- pyfemtet/opt/advanced_samples/meta_script/meta_script.py +0 -163
- pyfemtet/opt/advanced_samples/meta_script/sample.yaml +0 -14
- pyfemtet/opt/advanced_samples/meta_script/yaml_generator.txt +0 -0
- pyfemtet/opt/advanced_samples/meta_script/yaml_generator.xlsm +0 -0
- {pyfemtet-0.8.10.dist-info → pyfemtet-0.8.12.dist-info}/LICENSE +0 -0
- {pyfemtet-0.8.10.dist-info → pyfemtet-0.8.12.dist-info}/WHEEL +0 -0
- {pyfemtet-0.8.10.dist-info → pyfemtet-0.8.12.dist-info}/entry_points.txt +0 -0
pyfemtet/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.8.
|
|
1
|
+
__version__ = "0.8.12"
|
pyfemtet/opt/_femopt_core.py
CHANGED
|
@@ -306,7 +306,7 @@ class Function:
|
|
|
306
306
|
fun.__globals__[varname] = _Scapegoat()
|
|
307
307
|
|
|
308
308
|
self.fun = fun
|
|
309
|
-
self.name = name
|
|
309
|
+
self.name: str = name
|
|
310
310
|
self.args = args
|
|
311
311
|
self.kwargs = kwargs
|
|
312
312
|
|
|
@@ -817,7 +817,7 @@ class History:
|
|
|
817
817
|
df = self.get_df()
|
|
818
818
|
trial = df['trial'].values[-1]
|
|
819
819
|
client = get_client() # always returns valid client
|
|
820
|
-
client.run_on_scheduler(postprocess_func, trial, **postprocess_args)
|
|
820
|
+
client.run_on_scheduler(postprocess_func, *(trial, df), **postprocess_args)
|
|
821
821
|
|
|
822
822
|
def _calc_non_domi(self, objectives, df):
|
|
823
823
|
|
|
@@ -853,7 +853,7 @@ class History:
|
|
|
853
853
|
|
|
854
854
|
# 最小化問題に変換された objective values を取得
|
|
855
855
|
raw_objective_values = df[self.obj_names].values
|
|
856
|
-
objective_values = np.full_like(raw_objective_values, np.nan)
|
|
856
|
+
objective_values = np.full_like(raw_objective_values, np.nan, dtype=float)
|
|
857
857
|
for n_trial in range(len(raw_objective_values)):
|
|
858
858
|
for obj_idx, (_, objective) in enumerate(objectives.items()):
|
|
859
859
|
objective_values[n_trial, obj_idx] = objective.convert(raw_objective_values[n_trial, obj_idx])
|
pyfemtet/opt/interface/_base.py
CHANGED
|
@@ -84,7 +84,7 @@ class FEMInterface(ABC):
|
|
|
84
84
|
"""Preprocessing after launching a dask worker and before run optimization (if implemented in concrete class)."""
|
|
85
85
|
pass
|
|
86
86
|
|
|
87
|
-
def _postprocess_func(self, trial: int, *args, dask_scheduler=None, **kwargs):
|
|
87
|
+
def _postprocess_func(self, trial: int, df: pd.DataFrame, *args, dask_scheduler=None, **kwargs):
|
|
88
88
|
pass
|
|
89
89
|
|
|
90
90
|
def _create_postprocess_args(self):
|
|
@@ -79,7 +79,7 @@ class ExcelInterface(FEMInterface):
|
|
|
79
79
|
|
|
80
80
|
connect_method (str, optional):
|
|
81
81
|
Excel との接続方法を指定します。 'auto' または
|
|
82
|
-
'new' が利用可能です。デフォルトは '
|
|
82
|
+
'new' が利用可能です。デフォルトは 'new' です。
|
|
83
83
|
|
|
84
84
|
procedure_timeout (float or None, optional):
|
|
85
85
|
Excel マクロ関数のタイムアウト時間を秒単位で指定
|
|
@@ -232,7 +232,7 @@ class ExcelInterface(FEMInterface):
|
|
|
232
232
|
constraint_sheet_name: str = None,
|
|
233
233
|
procedure_name: str = None,
|
|
234
234
|
procedure_args: list or tuple = None,
|
|
235
|
-
connect_method: str = '
|
|
235
|
+
connect_method: str = 'new', # or 'auto'
|
|
236
236
|
procedure_timeout: float or None = None,
|
|
237
237
|
setup_xlsm_path: str or Path = None,
|
|
238
238
|
setup_procedure_name: str = None,
|
|
@@ -443,7 +443,7 @@ class ExcelInterface(FEMInterface):
|
|
|
443
443
|
self.excel = DispatchEx('Excel.Application')
|
|
444
444
|
|
|
445
445
|
# FemtetRef を追加する
|
|
446
|
-
self.open_femtet_ref_xla()
|
|
446
|
+
self.open_femtet_ref_xla()
|
|
447
447
|
sleep(0.5)
|
|
448
448
|
|
|
449
449
|
# 起動した excel の pid を記憶する
|
|
@@ -730,11 +730,15 @@ class ExcelInterface(FEMInterface):
|
|
|
730
730
|
def input_workbook(self) -> CDispatch:
|
|
731
731
|
return self.wb_input
|
|
732
732
|
|
|
733
|
-
def load_parameter(self, opt) -> None:
|
|
733
|
+
def load_parameter(self, opt, raise_if_no_keyword=True) -> None:
|
|
734
734
|
from pyfemtet.opt.optimizer import AbstractOptimizer, logger
|
|
735
735
|
opt: AbstractOptimizer
|
|
736
736
|
|
|
737
|
-
df = ParseAsParameter.parse(
|
|
737
|
+
df = ParseAsParameter.parse(
|
|
738
|
+
self.input_xlsm_path,
|
|
739
|
+
self.input_sheet_name,
|
|
740
|
+
raise_if_no_keyword,
|
|
741
|
+
)
|
|
738
742
|
|
|
739
743
|
for i, row in df.iterrows():
|
|
740
744
|
|
|
@@ -781,6 +785,7 @@ class ExcelInterface(FEMInterface):
|
|
|
781
785
|
opt.variables.add_parameter(prm)
|
|
782
786
|
|
|
783
787
|
else:
|
|
788
|
+
# noinspection PyTypeChecker
|
|
784
789
|
fixed_prm = Expression(
|
|
785
790
|
name=name,
|
|
786
791
|
fun=lambda: value,
|
|
@@ -794,7 +799,7 @@ class ExcelInterface(FEMInterface):
|
|
|
794
799
|
)
|
|
795
800
|
opt.variables.add_expression(fixed_prm)
|
|
796
801
|
|
|
797
|
-
def load_objective(self, opt):
|
|
802
|
+
def load_objective(self, opt, raise_if_no_keyword=True):
|
|
798
803
|
from pyfemtet.opt.optimizer import AbstractOptimizer
|
|
799
804
|
from pyfemtet.opt._femopt_core import Objective
|
|
800
805
|
opt: AbstractOptimizer
|
|
@@ -802,6 +807,7 @@ class ExcelInterface(FEMInterface):
|
|
|
802
807
|
df = ParseAsObjective.parse(
|
|
803
808
|
self.output_xlsm_path,
|
|
804
809
|
self.output_sheet_name,
|
|
810
|
+
raise_if_no_keyword,
|
|
805
811
|
)
|
|
806
812
|
|
|
807
813
|
for i, row in df.iterrows():
|
|
@@ -8,6 +8,7 @@ import winreg
|
|
|
8
8
|
|
|
9
9
|
import pandas as pd
|
|
10
10
|
import psutil
|
|
11
|
+
import shutil
|
|
11
12
|
from dask.distributed import get_worker
|
|
12
13
|
|
|
13
14
|
# noinspection PyUnresolvedReferences
|
|
@@ -54,6 +55,9 @@ class FailedToPostProcess(Exception):
|
|
|
54
55
|
pass
|
|
55
56
|
|
|
56
57
|
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
57
61
|
class FemtetInterface(FEMInterface):
|
|
58
62
|
"""Control Femtet from optimizer.
|
|
59
63
|
|
|
@@ -73,7 +77,8 @@ class FemtetInterface(FEMInterface):
|
|
|
73
77
|
|
|
74
78
|
save_pdt (str, optional):
|
|
75
79
|
The type to save result file.
|
|
76
|
-
|
|
80
|
+
Valid values are 'all', 'none' or 'optimal'.
|
|
81
|
+
Default is 'all'.
|
|
77
82
|
|
|
78
83
|
strictly_pid_specify (bool, optional):
|
|
79
84
|
Whether to strictly specify the PID in Femtet connection.
|
|
@@ -124,7 +129,7 @@ class FemtetInterface(FEMInterface):
|
|
|
124
129
|
femprj_path: str = None,
|
|
125
130
|
model_name: str = None,
|
|
126
131
|
connect_method: str = 'auto', # dask worker では __init__ の中で 'new' にするので super() の引数にしない。(しても意味がない)
|
|
127
|
-
save_pdt: str = 'all', # 'all' or
|
|
132
|
+
save_pdt: str = 'all', # 'all', 'none' or 'optimal'
|
|
128
133
|
strictly_pid_specify: bool = True, # dask worker では True にしたいので super() の引数にしない。
|
|
129
134
|
allow_without_project: bool = False, # main でのみ True を許容したいので super() の引数にしない。
|
|
130
135
|
open_result_with_gui: bool = True,
|
|
@@ -834,6 +839,7 @@ class FemtetInterface(FEMInterface):
|
|
|
834
839
|
model_name=self.model_name,
|
|
835
840
|
pdt_file_content=file_content,
|
|
836
841
|
jpg_file_content=jpg_content,
|
|
842
|
+
save_results=self.save_pdt, # 'all', 'optimal' or 'none'
|
|
837
843
|
)
|
|
838
844
|
return out
|
|
839
845
|
|
|
@@ -847,12 +853,20 @@ class FemtetInterface(FEMInterface):
|
|
|
847
853
|
@staticmethod
|
|
848
854
|
def _postprocess_func(
|
|
849
855
|
trial: int,
|
|
856
|
+
df: pd.DataFrame,
|
|
850
857
|
original_femprj_path: str,
|
|
858
|
+
save_results: str,
|
|
851
859
|
model_name: str,
|
|
852
860
|
pdt_file_content=None,
|
|
853
861
|
jpg_file_content=None,
|
|
854
862
|
dask_scheduler=None
|
|
855
863
|
):
|
|
864
|
+
|
|
865
|
+
# none なら何もしない
|
|
866
|
+
if save_results.lower() == 'none':
|
|
867
|
+
return
|
|
868
|
+
|
|
869
|
+
# all or optimal ならいったん保存する
|
|
856
870
|
result_dir = original_femprj_path.replace('.femprj', '.Results')
|
|
857
871
|
if pdt_file_content is not None:
|
|
858
872
|
pdt_path = FemtetInterface._create_pdt_path(original_femprj_path, model_name, trial)
|
|
@@ -864,6 +878,15 @@ class FemtetInterface(FEMInterface):
|
|
|
864
878
|
with open(jpg_path, 'wb') as f:
|
|
865
879
|
f.write(jpg_file_content)
|
|
866
880
|
|
|
881
|
+
# optimal なら不要ファイルの削除を実行する
|
|
882
|
+
if save_results.lower() == 'optimal':
|
|
883
|
+
for i, row in df.iterrows():
|
|
884
|
+
if not bool(row['non_domi']):
|
|
885
|
+
trial_to_remove = int(row['trial'])
|
|
886
|
+
pdt_path_to_remove = FemtetInterface._create_pdt_path(original_femprj_path, model_name, trial_to_remove)
|
|
887
|
+
if os.path.isfile(pdt_path_to_remove):
|
|
888
|
+
os.remove(pdt_path_to_remove)
|
|
889
|
+
|
|
867
890
|
def _create_result_file_content(self):
|
|
868
891
|
"""Called after solve"""
|
|
869
892
|
if self.save_pdt == 'all':
|
|
@@ -44,9 +44,12 @@ class FemtetWithExcelSettingsInterface(FemtetInterface, ExcelInterface, FEMInter
|
|
|
44
44
|
terminate_excel_when_quit: bool = None, interactive: bool = True, use_named_range: bool = True,
|
|
45
45
|
|
|
46
46
|
):
|
|
47
|
+
|
|
48
|
+
excel_connect_method = 'new'
|
|
49
|
+
|
|
47
50
|
ExcelInterface.__init__(
|
|
48
51
|
self, input_xlsm_path, input_sheet_name, output_xlsm_path, output_sheet_name, constraint_xlsm_path,
|
|
49
|
-
constraint_sheet_name, procedure_name, procedure_args,
|
|
52
|
+
constraint_sheet_name, procedure_name, procedure_args, excel_connect_method, procedure_timeout,
|
|
50
53
|
setup_xlsm_path, setup_procedure_name, setup_procedure_args, teardown_xlsm_path,
|
|
51
54
|
teardown_procedure_name, teardown_procedure_args, related_file_paths, visible, display_alerts,
|
|
52
55
|
terminate_excel_when_quit, interactive, use_named_range)
|
|
@@ -58,7 +61,7 @@ class FemtetWithExcelSettingsInterface(FemtetInterface, ExcelInterface, FEMInter
|
|
|
58
61
|
)
|
|
59
62
|
|
|
60
63
|
|
|
61
|
-
def load_objective(self, opt):
|
|
64
|
+
def load_objective(self, opt, raise_if_no_keyword=True):
|
|
62
65
|
from pyfemtet.opt.optimizer import AbstractOptimizer
|
|
63
66
|
from pyfemtet.opt._femopt_core import Objective
|
|
64
67
|
opt: AbstractOptimizer
|
|
@@ -66,7 +69,7 @@ class FemtetWithExcelSettingsInterface(FemtetInterface, ExcelInterface, FEMInter
|
|
|
66
69
|
df = ParseAsObjective.parse(
|
|
67
70
|
self.output_xlsm_path,
|
|
68
71
|
self.output_sheet_name,
|
|
69
|
-
|
|
72
|
+
raise_if_no_keyword,
|
|
70
73
|
)
|
|
71
74
|
|
|
72
75
|
for i, row in df.iterrows():
|
|
@@ -107,7 +107,8 @@ class ParametricResultCSVProcessor:
|
|
|
107
107
|
|
|
108
108
|
# 与えられた output_number に関連する行だけ抜き出し
|
|
109
109
|
# エラーがあるかどうかチェックする
|
|
110
|
-
|
|
110
|
+
idx = df['結果出力設定番号'] == parametric_output_index + 1
|
|
111
|
+
pdf = df[idx]
|
|
111
112
|
|
|
112
113
|
# 結果出力設定番号 カラムが存在しない
|
|
113
114
|
else:
|
|
@@ -18,7 +18,6 @@ class PoFBoTorchInterfaceWithExcelSettingsInterface(
|
|
|
18
18
|
|
|
19
19
|
# SurrogateModel
|
|
20
20
|
history_path: str = None, train_history: History = None,
|
|
21
|
-
_output_directions: dict[int, str | float] | list[str | float] = None,
|
|
22
21
|
|
|
23
22
|
# Excel
|
|
24
23
|
input_xlsm_path: str or Path = None,
|
|
@@ -29,7 +28,7 @@ class PoFBoTorchInterfaceWithExcelSettingsInterface(
|
|
|
29
28
|
constraint_sheet_name: str = None,
|
|
30
29
|
procedure_name: str = None,
|
|
31
30
|
procedure_args: list or tuple = None,
|
|
32
|
-
connect_method: str = 'auto', # or 'new'
|
|
31
|
+
# connect_method: str = 'auto', # or 'new'
|
|
33
32
|
procedure_timeout: float or None = None,
|
|
34
33
|
setup_xlsm_path: str or Path = None,
|
|
35
34
|
setup_procedure_name: str = None,
|
|
@@ -48,9 +47,10 @@ class PoFBoTorchInterfaceWithExcelSettingsInterface(
|
|
|
48
47
|
self,
|
|
49
48
|
history_path,
|
|
50
49
|
train_history,
|
|
51
|
-
_output_directions,
|
|
52
50
|
)
|
|
53
51
|
|
|
52
|
+
connect_method = 'new'
|
|
53
|
+
|
|
54
54
|
ExcelInterface.__init__(
|
|
55
55
|
self,
|
|
56
56
|
input_xlsm_path,
|
|
@@ -77,11 +77,11 @@ class PoFBoTorchInterfaceWithExcelSettingsInterface(
|
|
|
77
77
|
use_named_range,
|
|
78
78
|
)
|
|
79
79
|
|
|
80
|
-
def load_parameter(self, opt) -> None:
|
|
81
|
-
ExcelInterface.load_parameter(self, opt)
|
|
80
|
+
def load_parameter(self, opt, raise_if_no_keyword=True) -> None:
|
|
81
|
+
ExcelInterface.load_parameter(self, opt, raise_if_no_keyword)
|
|
82
82
|
|
|
83
|
-
def load_objective(self, opt) -> None:
|
|
84
|
-
|
|
83
|
+
def load_objective(self, opt, raise_if_no_keyword=True) -> None:
|
|
84
|
+
ExcelInterface.load_objective(self, opt, raise_if_no_keyword)
|
|
85
85
|
|
|
86
86
|
def load_constraint(self, opt, raise_if_no_keyword=False):
|
|
87
87
|
ExcelInterface.load_constraint(self, opt, raise_if_no_keyword)
|
|
Binary file
|
|
File without changes
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
CONFIRM_BEFORE_ABNORMAL_TERMINATION = True
|
|
2
|
+
|
|
3
|
+
try:
|
|
4
|
+
|
|
5
|
+
# for meta script
|
|
6
|
+
import os
|
|
7
|
+
import sys
|
|
8
|
+
import importlib
|
|
9
|
+
import pyfemtet
|
|
10
|
+
|
|
11
|
+
if __name__ == '__main__':
|
|
12
|
+
print(f'pyfemtet {pyfemtet.__version__} starting.')
|
|
13
|
+
|
|
14
|
+
from pyfemtet._message.messages import encoding
|
|
15
|
+
|
|
16
|
+
from fire import Fire
|
|
17
|
+
import yaml
|
|
18
|
+
|
|
19
|
+
# for concrete script
|
|
20
|
+
from optuna.samplers import *
|
|
21
|
+
from pyfemtet.opt import FEMOpt
|
|
22
|
+
from pyfemtet.opt.interface import *
|
|
23
|
+
from pyfemtet.opt.optimizer import *
|
|
24
|
+
from pyfemtet.opt.interface._femtet_excel import FemtetWithExcelSettingsInterface
|
|
25
|
+
from pyfemtet.opt.interface._surrogate_excel import PoFBoTorchInterfaceWithExcelSettingsInterface
|
|
26
|
+
|
|
27
|
+
# for debug
|
|
28
|
+
DEBUG = False
|
|
29
|
+
|
|
30
|
+
class ContentContext:
|
|
31
|
+
|
|
32
|
+
def __init__(self, content_):
|
|
33
|
+
self.content = content_
|
|
34
|
+
|
|
35
|
+
def __enter__(self):
|
|
36
|
+
return self.content
|
|
37
|
+
|
|
38
|
+
def __exit__(self, exc_type, exc_val, exc_tb):
|
|
39
|
+
pass
|
|
40
|
+
|
|
41
|
+
# for importing user-defined module
|
|
42
|
+
def import_from_path(module_name, file_path):
|
|
43
|
+
|
|
44
|
+
print(f'{file_path=}')
|
|
45
|
+
|
|
46
|
+
# noinspection PyUnresolvedReferences
|
|
47
|
+
spec = importlib.util.spec_from_file_location(module_name, file_path)
|
|
48
|
+
|
|
49
|
+
print(f'{spec=}')
|
|
50
|
+
|
|
51
|
+
# noinspection PyUnresolvedReferences
|
|
52
|
+
module = importlib.util.module_from_spec(spec)
|
|
53
|
+
|
|
54
|
+
print(f'{module=}')
|
|
55
|
+
|
|
56
|
+
sys.modules[module_name] = module
|
|
57
|
+
spec.loader.exec_module(module)
|
|
58
|
+
return module
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def main(
|
|
62
|
+
yaml_path: str = None,
|
|
63
|
+
|
|
64
|
+
interface_class: str = None, # including parameter definition excel
|
|
65
|
+
interface_kwargs: str = None, # including Parametric Analysis Output
|
|
66
|
+
optimizer_class: str = None,
|
|
67
|
+
optimizer_kwargs: str = None,
|
|
68
|
+
femopt_kwargs: str = None,
|
|
69
|
+
seed: str = 'null',
|
|
70
|
+
optimize_kwargs: str = None,
|
|
71
|
+
additional_module_paths: list[str] = None,
|
|
72
|
+
|
|
73
|
+
confirm_before_abnormal_termination: bool = True,
|
|
74
|
+
):
|
|
75
|
+
"""
|
|
76
|
+
|
|
77
|
+
Args:
|
|
78
|
+
yaml_path:
|
|
79
|
+
If this argument is passed, the other arguments will be ignored
|
|
80
|
+
and load by .yaml file.
|
|
81
|
+
The yaml file must contain the other arguments.
|
|
82
|
+
|
|
83
|
+
interface_class: FemtetWithExcelSettingsInterface or SurrogateModelInterface.
|
|
84
|
+
interface_kwargs: See documentation of each interface class.
|
|
85
|
+
optimizer_class: OptunaOptimizer or ScipyOptimizer.
|
|
86
|
+
optimizer_kwargs: See documentation of each optimizer class.
|
|
87
|
+
femopt_kwargs: See documentation of FEMOpt.
|
|
88
|
+
seed: int or None.
|
|
89
|
+
optimize_kwargs: See documentation of FEMOpt.optimize().
|
|
90
|
+
additional_module_paths:
|
|
91
|
+
The .py file paths containing user-defined objective and constraints functions.
|
|
92
|
+
The module must contain __objective_functions__ or __constraint_functions__.
|
|
93
|
+
They must be a dict variable that contains the required arguments of
|
|
94
|
+
`FEMOpt.add_objective()` or `FEMOpt.add_constraint()` method.
|
|
95
|
+
Note that the `args` argument of constraint function is reserved by meta_script
|
|
96
|
+
and that value is fixed to `FEMOpt.opt`, so you can not use `args` argument
|
|
97
|
+
in __constraint_functions__.
|
|
98
|
+
Note that the functions should not contain the python variables defined outside
|
|
99
|
+
global scope.
|
|
100
|
+
confirm_before_abnormal_termination: Pause before termination if an error occurs. Default is True.
|
|
101
|
+
|
|
102
|
+
"""
|
|
103
|
+
|
|
104
|
+
global CONFIRM_BEFORE_ABNORMAL_TERMINATION
|
|
105
|
+
CONFIRM_BEFORE_ABNORMAL_TERMINATION = confirm_before_abnormal_termination
|
|
106
|
+
|
|
107
|
+
# load variables from yaml file
|
|
108
|
+
if yaml_path is not None:
|
|
109
|
+
|
|
110
|
+
# check
|
|
111
|
+
if os.path.isfile(yaml_path):
|
|
112
|
+
context = open(yaml_path, 'r', encoding='utf-8')
|
|
113
|
+
|
|
114
|
+
else:
|
|
115
|
+
if DEBUG:
|
|
116
|
+
print('debug mode')
|
|
117
|
+
context = ContentContext(yaml_path) # yaml_path is yaml content
|
|
118
|
+
|
|
119
|
+
else:
|
|
120
|
+
raise FileNotFoundError(yaml_path)
|
|
121
|
+
|
|
122
|
+
# load **as yaml content**
|
|
123
|
+
with context as f:
|
|
124
|
+
d = yaml.safe_load(f)
|
|
125
|
+
interface_class = yaml.safe_dump(d['interface_class'], allow_unicode=True)
|
|
126
|
+
interface_kwargs = yaml.safe_dump(d['interface_kwargs'], allow_unicode=True)
|
|
127
|
+
optimizer_class = yaml.safe_dump(d['optimizer_class'], allow_unicode=True)
|
|
128
|
+
optimizer_kwargs = yaml.safe_dump(d['optimizer_kwargs'], allow_unicode=True)
|
|
129
|
+
femopt_kwargs = yaml.safe_dump(d['femopt_kwargs'], allow_unicode=True)
|
|
130
|
+
seed = yaml.safe_dump(d['seed'], allow_unicode=True)
|
|
131
|
+
optimize_kwargs = yaml.safe_dump(d['optimize_kwargs'], allow_unicode=True)
|
|
132
|
+
additional_module_paths = yaml.safe_dump(d.get('additional_module_paths', None), allow_unicode=True)
|
|
133
|
+
|
|
134
|
+
# load **python variables** from yaml content
|
|
135
|
+
|
|
136
|
+
# additional import
|
|
137
|
+
additional_module_paths_ = yaml.safe_load(additional_module_paths)
|
|
138
|
+
|
|
139
|
+
if additional_module_paths_ is not None:
|
|
140
|
+
|
|
141
|
+
for i, path_ in enumerate(additional_module_paths_):
|
|
142
|
+
|
|
143
|
+
# noinspection PyUnresolvedReferences
|
|
144
|
+
additional_module = import_from_path(f'additional_module_{i}', path_)
|
|
145
|
+
|
|
146
|
+
# from additional_module import *
|
|
147
|
+
if hasattr(additional_module, '__all__'):
|
|
148
|
+
globals().update({key: getattr(additional_module, key) for key in additional_module.__all__})
|
|
149
|
+
|
|
150
|
+
Interface = eval(yaml.safe_load(interface_class))
|
|
151
|
+
interface_kwargs_ = yaml.safe_load(interface_kwargs)
|
|
152
|
+
|
|
153
|
+
Optimizer = eval(yaml.safe_load(optimizer_class))
|
|
154
|
+
optimizer_kwargs_ = yaml.safe_load(optimizer_kwargs)
|
|
155
|
+
|
|
156
|
+
optimizer_kwargs_['sampler_class'] = eval(optimizer_kwargs_['sampler_class'])
|
|
157
|
+
|
|
158
|
+
femopt_kwargs_ = yaml.safe_load(femopt_kwargs)
|
|
159
|
+
|
|
160
|
+
seed_ = yaml.safe_load(seed)
|
|
161
|
+
|
|
162
|
+
optimize_kwargs_ = yaml.safe_load(optimize_kwargs)
|
|
163
|
+
|
|
164
|
+
fem = Interface(**interface_kwargs_)
|
|
165
|
+
opt = Optimizer(**optimizer_kwargs_)
|
|
166
|
+
femopt = FEMOpt(fem=fem, opt=opt, **femopt_kwargs_)
|
|
167
|
+
|
|
168
|
+
if additional_module_paths_ is not None:
|
|
169
|
+
|
|
170
|
+
for i, path_ in enumerate(additional_module_paths_):
|
|
171
|
+
|
|
172
|
+
# noinspection PyUnresolvedReferences
|
|
173
|
+
additional_module = import_from_path(f'additional_module_{i}', path_)
|
|
174
|
+
|
|
175
|
+
# import obj & cns
|
|
176
|
+
d: dict
|
|
177
|
+
if hasattr(additional_module, '__objective_functions__'):
|
|
178
|
+
for d in additional_module.__objective_functions__:
|
|
179
|
+
femopt.add_objective(
|
|
180
|
+
fun=d['fun'],
|
|
181
|
+
name=d.get('name'),
|
|
182
|
+
direction=d.get('direction'),
|
|
183
|
+
args=d.get('args'),
|
|
184
|
+
kwargs=d.get('kwargs'),
|
|
185
|
+
)
|
|
186
|
+
if hasattr(additional_module, '__constraint_functions__'):
|
|
187
|
+
for d in additional_module.__constraint_functions__:
|
|
188
|
+
femopt.add_constraint(
|
|
189
|
+
fun=d['fun'],
|
|
190
|
+
name=d.get('name'),
|
|
191
|
+
lower_bound=d.get('lower_bound'),
|
|
192
|
+
upper_bound=d.get('upper_bound'),
|
|
193
|
+
strict=d.get('strict', True),
|
|
194
|
+
using_fem=d.get('using_fem'),
|
|
195
|
+
args=(femopt.opt,),
|
|
196
|
+
kwargs=d.get('kwargs'),
|
|
197
|
+
)
|
|
198
|
+
|
|
199
|
+
femopt.set_random_seed(seed_)
|
|
200
|
+
femopt.optimize(**optimize_kwargs_)
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
if __name__ == '__main__':
|
|
204
|
+
Fire(main)
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
except Exception as e:
|
|
208
|
+
from traceback import print_exception
|
|
209
|
+
|
|
210
|
+
print_exception(e)
|
|
211
|
+
print()
|
|
212
|
+
if CONFIRM_BEFORE_ABNORMAL_TERMINATION:
|
|
213
|
+
input('終了するには Enter を押してください。')
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
pyfemtet/__init__.py,sha256=
|
|
1
|
+
pyfemtet/__init__.py,sha256=nqflePlGMLvgA4B4Sx2NaBXGTAXFSefnD2S5uc8TjBg,22
|
|
2
2
|
pyfemtet/_femtet_config_util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
3
|
pyfemtet/_femtet_config_util/autosave.py,sha256=dNirA9XGuFehas8_Jkj2BW9GOzMbPyhnt1WHcH_ObSU,2070
|
|
4
4
|
pyfemtet/_femtet_config_util/exit.py,sha256=0BWID-tjOkmZwmgPFkcJMkWW39voccz5ARIBWvZbHaw,1877
|
|
@@ -25,7 +25,7 @@ pyfemtet/logger/__init__.py,sha256=UOJ9n_U2xwdTrp0Xgg-N6geySxNzKqTBQlXsaH0kW_w,4
|
|
|
25
25
|
pyfemtet/logger/_impl.py,sha256=rsAd0HpmveOaLS39ucp3U2OcDhQMWjC5fnVGhbJtWVw,6375
|
|
26
26
|
pyfemtet/opt/__init__.py,sha256=wRR8LbEhb5I6MUgmnCgjB6-tqHlOVxDIo7yPkq0QbBs,758
|
|
27
27
|
pyfemtet/opt/_femopt.py,sha256=MSqSJzyD2sRYBNQAe0P5rpSvvVihOV2ugUa-hZyYnBA,40671
|
|
28
|
-
pyfemtet/opt/_femopt_core.py,sha256=
|
|
28
|
+
pyfemtet/opt/_femopt_core.py,sha256=AFHxZSVke1jpHAsdJtN_lY015TL5ipXO9qfZ8zYGL8g,39373
|
|
29
29
|
pyfemtet/opt/_test_utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
30
30
|
pyfemtet/opt/_test_utils/control_femtet.py,sha256=8oAl9y5V2n8Nnsgx_ebcZVzwFt1eI3swkdiKg6pg3-M,1085
|
|
31
31
|
pyfemtet/opt/_test_utils/hyper_sphere.py,sha256=nQhw8EIY0DwvcTqrbKhkxiITLZifr4-nG77E-_6ggmA,700
|
|
@@ -34,10 +34,6 @@ pyfemtet/opt/advanced_samples/excel_ui/(ref) original_project.femprj,sha256=5OqZ
|
|
|
34
34
|
pyfemtet/opt/advanced_samples/excel_ui/femtet-macro.xlsm,sha256=7G9hr1Oj1zwTFv6mh2fWk4FZ0R5ZNDQmvjNvujy6gbw,124145
|
|
35
35
|
pyfemtet/opt/advanced_samples/excel_ui/pyfemtet-core.py,sha256=aF2TWXdbt7dnkeBqqVO6GvIExozjFp0mxx3BX8rpYNc,9879
|
|
36
36
|
pyfemtet/opt/advanced_samples/excel_ui/test-pyfemtet-core.cmd,sha256=r-Pa1Ng9sa6wfDqIhTf2BUDrN9rePWFymz7pmtBbvcQ,895
|
|
37
|
-
pyfemtet/opt/advanced_samples/meta_script/meta_script.py,sha256=v0D-4xqH_fvMEQ4B_OnJrtlUsJ6kQfLLcE4YHlsgmMw,4896
|
|
38
|
-
pyfemtet/opt/advanced_samples/meta_script/sample.yaml,sha256=_X95DVX1BMIFlML1mW4UqymOMxLElw3aeWiI9KJBD-k,351
|
|
39
|
-
pyfemtet/opt/advanced_samples/meta_script/yaml_generator.txt,sha256=n2IWoAge_fWWBDfOi-rHQYZvfyGQqdS4BOSTvsdKYjk,670
|
|
40
|
-
pyfemtet/opt/advanced_samples/meta_script/yaml_generator.xlsm,sha256=YUaVVqtoa5dTY0c2gJ5C3s4y7eC5Gx5PRtxA2rwV9-s,18287
|
|
41
37
|
pyfemtet/opt/advanced_samples/restart/gal_ex13_parametric.femprj,sha256=iIHH1X-wWBqEYj4cFJXco73LCJXSrYBsSKOD0HxYu60,87599
|
|
42
38
|
pyfemtet/opt/advanced_samples/restart/gal_ex13_parametric_restart.py,sha256=YCqtLjazFDRKhEu7sGJlDJDDL7YPH6GmWEb6X0e30Og,3045
|
|
43
39
|
pyfemtet/opt/advanced_samples/restart/gal_ex13_parametric_restart_jp.py,sha256=Oaua2Eb8NGtlWjvYC9B1uYTKcEuWxWZxzJbLi_4IqxE,3580
|
|
@@ -47,11 +43,11 @@ pyfemtet/opt/advanced_samples/surrogate_model/gal_ex13_optimize_with_surrogate.p
|
|
|
47
43
|
pyfemtet/opt/advanced_samples/surrogate_model/gal_ex13_optimize_with_surrogate_jp.py,sha256=OAOpHKyMMo1StSqNMqx4saYDn4hiGOKDypyK6uhTILQ,3215
|
|
48
44
|
pyfemtet/opt/advanced_samples/surrogate_model/gal_ex13_parametric.femprj,sha256=iIHH1X-wWBqEYj4cFJXco73LCJXSrYBsSKOD0HxYu60,87599
|
|
49
45
|
pyfemtet/opt/interface/__init__.py,sha256=SstCN9WMYqF5lKNbb8xAzq0hBV-Hk8YuCrajvF3sOg0,1350
|
|
50
|
-
pyfemtet/opt/interface/_base.py,sha256=
|
|
51
|
-
pyfemtet/opt/interface/_excel_interface.py,sha256=
|
|
52
|
-
pyfemtet/opt/interface/_femtet.py,sha256=
|
|
53
|
-
pyfemtet/opt/interface/_femtet_excel.py,sha256=
|
|
54
|
-
pyfemtet/opt/interface/_femtet_parametric.py,sha256=
|
|
46
|
+
pyfemtet/opt/interface/_base.py,sha256=hDv4C8LQpKaeZJR8iEfTSVd4Na2fQblFBv0Yw78xcRY,2856
|
|
47
|
+
pyfemtet/opt/interface/_excel_interface.py,sha256=1PYB056rU2mX-LgBWRwwTUxDkt7crgHAk3fKJuMNMMU,40152
|
|
48
|
+
pyfemtet/opt/interface/_femtet.py,sha256=XAfG00jWylXQd4qji8FwmbgkwP7kxTx5YgJNtyiNt7o,38622
|
|
49
|
+
pyfemtet/opt/interface/_femtet_excel.py,sha256=dWPQguKNOVdJ4jTfwLykCeM9iwA2S1KOLynw8UGzmvk,5968
|
|
50
|
+
pyfemtet/opt/interface/_femtet_parametric.py,sha256=hxNiZfhR1IPtrMXg39TZutXTcOXdoxTKiRTTcYRGgVs,10181
|
|
55
51
|
pyfemtet/opt/interface/_femtet_with_nx/__init__.py,sha256=-6W2g2FDEcKzGHmI5KAKQe-4U5jDpMj0CXuma-GZca0,83
|
|
56
52
|
pyfemtet/opt/interface/_femtet_with_nx/_interface.py,sha256=LkaODUSpBLq05uz5Jf-JKuH6Evq8ElZoItXxFZopWeM,5994
|
|
57
53
|
pyfemtet/opt/interface/_femtet_with_nx/update_model.py,sha256=P7VH0i_o-X9OUe6AGaLF1fACPeHNrMjcrOBCA3MMrI4,3092
|
|
@@ -60,7 +56,10 @@ pyfemtet/opt/interface/_surrogate/__init__.py,sha256=2UT5NuBylyWQJNjg1zsBRCV-MzN
|
|
|
60
56
|
pyfemtet/opt/interface/_surrogate/_base.py,sha256=s_Mqo7CUAhaj-ZYYxxGKekiox4EnH_SnWB8eVj-VnFU,4739
|
|
61
57
|
pyfemtet/opt/interface/_surrogate/_chaospy.py,sha256=Bqej89Mo0zgdJq1OK7YKRqHOcuyN0wL4ZQUQXdJtYJ8,1987
|
|
62
58
|
pyfemtet/opt/interface/_surrogate/_singletaskgp.py,sha256=bHzY5QIjA9zhLxweexz259XQMZLgkHWfrIDW7f3q-2k,2520
|
|
63
|
-
pyfemtet/opt/interface/_surrogate_excel.py,sha256=
|
|
59
|
+
pyfemtet/opt/interface/_surrogate_excel.py,sha256=r0i9xNb6R-1SHL911Pi9x6lD4mQbCl8m3cQG2dQft1E,3509
|
|
60
|
+
pyfemtet/opt/meta_script/YAML_Generator.xlsm,sha256=2hZKioZfGkH_0ufre8xi2gps8SJUNwgSB_6b9vCc2tI,66648
|
|
61
|
+
pyfemtet/opt/meta_script/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
62
|
+
pyfemtet/opt/meta_script/__main__.py,sha256=J7RD6aFr67t62tcwgLcoC4GzQ2DdYFxx7z63imro9A4,8061
|
|
64
63
|
pyfemtet/opt/optimizer/__init__.py,sha256=Ia6viowECkG0IFXtFef0tJ4jDKsoDzJLqMJ9xLFH2LQ,543
|
|
65
64
|
pyfemtet/opt/optimizer/_base.py,sha256=1TY1iVZdpgJcmF6g3-CcY-6u4REs8_gR_0y9cXUQe2s,12932
|
|
66
65
|
pyfemtet/opt/optimizer/_optuna/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -149,8 +148,8 @@ pyfemtet/opt/visualization/result_viewer/.gitignore,sha256=ryvb4aqbbsHireHWlPQfx
|
|
|
149
148
|
pyfemtet/opt/visualization/result_viewer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
150
149
|
pyfemtet/opt/visualization/result_viewer/application.py,sha256=WcHBx_J5eNLKSaprpk9BGifwhO04oN8FiNGYTWorrXA,1691
|
|
151
150
|
pyfemtet/opt/visualization/result_viewer/pages.py,sha256=MZAjzbuq0toZrR-iJhElM3A12_jHVCTt65gz1kdNPbw,32193
|
|
152
|
-
pyfemtet-0.8.
|
|
153
|
-
pyfemtet-0.8.
|
|
154
|
-
pyfemtet-0.8.
|
|
155
|
-
pyfemtet-0.8.
|
|
156
|
-
pyfemtet-0.8.
|
|
151
|
+
pyfemtet-0.8.12.dist-info/LICENSE,sha256=sVQBhyoglGJUu65-BP3iR6ujORI6YgEU2Qm-V4fGlOA,1485
|
|
152
|
+
pyfemtet-0.8.12.dist-info/METADATA,sha256=ZAHZFCSgxUtsYDTxSiKHzHwXUemQ_7PqbzGNfJXCj4w,3549
|
|
153
|
+
pyfemtet-0.8.12.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
|
|
154
|
+
pyfemtet-0.8.12.dist-info/entry_points.txt,sha256=ZfYqRaoiPtuWqFi2_msccyrVF0LurMn-IHlYamAegZo,104
|
|
155
|
+
pyfemtet-0.8.12.dist-info/RECORD,,
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
# for meta script
|
|
2
|
-
import os
|
|
3
|
-
import pyfemtet
|
|
4
|
-
|
|
5
|
-
if __name__ == '__main__':
|
|
6
|
-
print(f'pyfemtet {pyfemtet.__version__} starting.')
|
|
7
|
-
|
|
8
|
-
from pyfemtet._message.messages import encoding
|
|
9
|
-
|
|
10
|
-
from fire import Fire
|
|
11
|
-
import yaml
|
|
12
|
-
|
|
13
|
-
# for concrete script
|
|
14
|
-
from pyfemtet.opt import FEMOpt
|
|
15
|
-
from pyfemtet.opt.interface import *
|
|
16
|
-
from pyfemtet.opt.optimizer import *
|
|
17
|
-
from optuna.samplers import *
|
|
18
|
-
from pyfemtet.opt.interface._femtet_excel import FemtetWithExcelSettingsInterface
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
# fore debug
|
|
22
|
-
class ContentContext:
|
|
23
|
-
|
|
24
|
-
def __init__(self, content_):
|
|
25
|
-
self.content = content_
|
|
26
|
-
|
|
27
|
-
def __enter__(self):
|
|
28
|
-
return self.content
|
|
29
|
-
|
|
30
|
-
def __exit__(self, exc_type, exc_val, exc_tb):
|
|
31
|
-
pass
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
def main(
|
|
35
|
-
yaml_path: str = None,
|
|
36
|
-
|
|
37
|
-
interface_class: str = None, # including parameter definition excel
|
|
38
|
-
interface_kwargs: str = None, # including Parametric Analysis Output
|
|
39
|
-
optimizer_class: str = None,
|
|
40
|
-
optimizer_kwargs: str = None,
|
|
41
|
-
femopt_kwargs: str = None,
|
|
42
|
-
seed: str = 'null',
|
|
43
|
-
optimize_kwargs: str = None,
|
|
44
|
-
):
|
|
45
|
-
"""
|
|
46
|
-
|
|
47
|
-
Args:
|
|
48
|
-
yaml_path:
|
|
49
|
-
If this argument is passed, the other arguments will be ignored
|
|
50
|
-
and load by .yaml file.
|
|
51
|
-
The yaml file must contain the other arguments.
|
|
52
|
-
|
|
53
|
-
interface_class: FemtetWithExcelSettingsInterface or SurrogateModelInterface.
|
|
54
|
-
interface_kwargs: See documentation of each interface class.
|
|
55
|
-
optimizer_class: OptunaOptimizer or ScipyOptimizer.
|
|
56
|
-
optimizer_kwargs: See documentation of each optimizer class.
|
|
57
|
-
femopt_kwargs: See documentation of FEMOpt.
|
|
58
|
-
seed: int or None.
|
|
59
|
-
optimize_kwargs: See documentation of FEMOpt.optimize().
|
|
60
|
-
|
|
61
|
-
"""
|
|
62
|
-
|
|
63
|
-
if yaml_path is not None:
|
|
64
|
-
if os.path.isfile(yaml_path):
|
|
65
|
-
context = open(yaml_path, 'r', encoding='utf-8')
|
|
66
|
-
else:
|
|
67
|
-
print('debug mode')
|
|
68
|
-
context = ContentContext(yaml_path)
|
|
69
|
-
with context as f:
|
|
70
|
-
d = yaml.safe_load(f)
|
|
71
|
-
interface_class = yaml.safe_dump(d['interface_class'], allow_unicode=True)
|
|
72
|
-
interface_kwargs = yaml.safe_dump(d['interface_kwargs'], allow_unicode=True)
|
|
73
|
-
optimizer_class = yaml.safe_dump(d['optimizer_class'], allow_unicode=True)
|
|
74
|
-
optimizer_kwargs = yaml.safe_dump(d['optimizer_kwargs'], allow_unicode=True)
|
|
75
|
-
femopt_kwargs = yaml.safe_dump(d['femopt_kwargs'], allow_unicode=True)
|
|
76
|
-
seed = yaml.safe_dump(d['seed'], allow_unicode=True)
|
|
77
|
-
optimize_kwargs = yaml.safe_dump(d['optimize_kwargs'], allow_unicode=True)
|
|
78
|
-
|
|
79
|
-
Interface = eval(yaml.safe_load(interface_class))
|
|
80
|
-
interface_kwargs_ = yaml.safe_load(interface_kwargs)
|
|
81
|
-
|
|
82
|
-
Optimizer = eval(yaml.safe_load(optimizer_class))
|
|
83
|
-
optimizer_kwargs_ = yaml.safe_load(optimizer_kwargs)
|
|
84
|
-
|
|
85
|
-
femopt_kwargs_ = yaml.safe_load(femopt_kwargs)
|
|
86
|
-
|
|
87
|
-
seed_ = yaml.safe_load(seed)
|
|
88
|
-
|
|
89
|
-
optimize_kwargs_ = yaml.safe_load(optimize_kwargs)
|
|
90
|
-
|
|
91
|
-
fem = Interface(**interface_kwargs_)
|
|
92
|
-
opt = Optimizer(**optimizer_kwargs_)
|
|
93
|
-
femopt = FEMOpt(fem=fem, opt=opt, **femopt_kwargs_)
|
|
94
|
-
femopt.set_random_seed(seed_)
|
|
95
|
-
femopt.optimize(**optimize_kwargs_)
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
# if __name__ == '__main__':
|
|
99
|
-
# Fire(main)
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
# for debugging file input
|
|
103
|
-
if __name__ == '__main__':
|
|
104
|
-
os.chdir(os.path.dirname(__file__))
|
|
105
|
-
path = 'sample.yaml'
|
|
106
|
-
main(yaml_path=path)
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
# for debugging yaml input
|
|
110
|
-
# if __name__ == '__main__':
|
|
111
|
-
# content = r"""
|
|
112
|
-
# interface_class: FemtetInterface
|
|
113
|
-
# interface_kwargs:
|
|
114
|
-
# femprj_path: C:\日本語ファイル.femprj
|
|
115
|
-
# optimizer_class: OptunaOptimizer
|
|
116
|
-
# optimizer_kwargs:
|
|
117
|
-
# sampler_class: TPESampler
|
|
118
|
-
# sampler_kwargs:
|
|
119
|
-
# n_startup_trials: 10
|
|
120
|
-
# femopt_kwargs:
|
|
121
|
-
# history_path: sample.csv
|
|
122
|
-
# optimize_kwargs:
|
|
123
|
-
# n_trials: 15
|
|
124
|
-
# confirm_before_exit: False
|
|
125
|
-
# seed: null
|
|
126
|
-
# """
|
|
127
|
-
#
|
|
128
|
-
# main(yaml_path=content)
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
# for debugging CLI input
|
|
132
|
-
# if __name__ == '__main__':
|
|
133
|
-
#
|
|
134
|
-
# interface_kwargs = dict(
|
|
135
|
-
# femprj_path=r'sample.femprj',
|
|
136
|
-
# parametric_output_indexes_use_as_objective={0: 0, 1: 'minimize'}
|
|
137
|
-
# )
|
|
138
|
-
# optimizer_kwargs = dict(
|
|
139
|
-
# sampler_class='TPESampler',
|
|
140
|
-
# sampler_kwargs=dict(
|
|
141
|
-
# n_startup_trials=10,
|
|
142
|
-
# )
|
|
143
|
-
# )
|
|
144
|
-
# femopt_kwargs = dict(
|
|
145
|
-
# history_path='sample.csv'
|
|
146
|
-
# )
|
|
147
|
-
#
|
|
148
|
-
# seed = None
|
|
149
|
-
#
|
|
150
|
-
# optimize_kwargs = dict(
|
|
151
|
-
# n_trials=15,
|
|
152
|
-
# confirm_before_exit=False,
|
|
153
|
-
# )
|
|
154
|
-
#
|
|
155
|
-
# main(
|
|
156
|
-
# interface_class='FemtetWithExcelSettingsInterface',
|
|
157
|
-
# interface_kwargs=yaml.safe_dump(interface_kwargs, allow_unicode=True),
|
|
158
|
-
# optimizer_class='OptunaOptimizer',
|
|
159
|
-
# optimizer_kwargs=yaml.safe_dump(optimizer_kwargs, allow_unicode=True),
|
|
160
|
-
# femopt_kwargs=yaml.safe_dump(femopt_kwargs, allow_unicode=True),
|
|
161
|
-
# seed=yaml.safe_dump(femopt_kwargs, allow_unicode=True),
|
|
162
|
-
# optimize_kwargs=yaml.safe_dump(optimize_kwargs, allow_unicode=True),
|
|
163
|
-
# )
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
interface_class: FemtetInterface
|
|
2
|
-
interface_kwargs:
|
|
3
|
-
femprj_path: C:\日本語ファイル.femprj
|
|
4
|
-
optimizer_class: OptunaOptimizer
|
|
5
|
-
optimizer_kwargs:
|
|
6
|
-
sampler_class: TPESampler
|
|
7
|
-
sampler_kwargs:
|
|
8
|
-
n_startup_trials: 10
|
|
9
|
-
femopt_kwargs:
|
|
10
|
-
history_path: sample.csv
|
|
11
|
-
optimize_kwargs:
|
|
12
|
-
n_trials: 15
|
|
13
|
-
confirm_before_exit: False
|
|
14
|
-
seed: null
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|