pyfemtet 0.4.6__py3-none-any.whl → 0.4.8__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/_test_util.py +115 -0
- pyfemtet/opt/_femopt.py +7 -1
- pyfemtet/opt/_femopt_core.py +20 -3
- pyfemtet/opt/femprj_sample/cad_ex01_NX.py +4 -0
- pyfemtet/opt/femprj_sample/cad_ex01_NX_test_result.reccsv +13 -0
- pyfemtet/opt/femprj_sample/cad_ex01_SW_test_result.reccsv +13 -0
- pyfemtet/opt/femprj_sample/gal_ex58_parametric.femprj +0 -0
- pyfemtet/opt/femprj_sample/gal_ex58_parametric_test_result.reccsv +13 -0
- pyfemtet/opt/femprj_sample/gau_ex08_parametric_test_result.reccsv +23 -0
- pyfemtet/opt/femprj_sample/her_ex40_parametric_test_result.reccsv +18 -0
- pyfemtet/opt/femprj_sample/paswat_ex1_parametric_test_result.reccsv +18 -0
- pyfemtet/opt/femprj_sample/wat_ex14_parametric_test_result.reccsv +18 -0
- pyfemtet/opt/femprj_sample_jp/cad_ex01_NX_jp.py +4 -0
- pyfemtet/opt/femprj_sample_jp/gal_ex58_parametric_jp.femprj +0 -0
- pyfemtet/opt/interface/_base.py +6 -0
- pyfemtet/opt/interface/_femtet.py +203 -27
- pyfemtet/opt/interface/_femtet_parametric.py +3 -3
- pyfemtet/opt/interface/_femtet_with_nx/_interface.py +35 -2
- pyfemtet/opt/interface/_femtet_with_nx/update_model.py +36 -28
- pyfemtet/opt/opt/_base.py +2 -0
- pyfemtet/opt/visualization/_graphs.py +16 -13
- pyfemtet/opt/visualization/_monitor.py +88 -10
- {pyfemtet-0.4.6.dist-info → pyfemtet-0.4.8.dist-info}/METADATA +2 -1
- {pyfemtet-0.4.6.dist-info → pyfemtet-0.4.8.dist-info}/RECORD +28 -20
- {pyfemtet-0.4.6.dist-info → pyfemtet-0.4.8.dist-info}/LICENSE +0 -0
- {pyfemtet-0.4.6.dist-info → pyfemtet-0.4.8.dist-info}/WHEEL +0 -0
- {pyfemtet-0.4.6.dist-info → pyfemtet-0.4.8.dist-info}/entry_points.txt +0 -0
pyfemtet/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.4.
|
|
1
|
+
__version__ = "0.4.8"
|
pyfemtet/_test_util.py
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import csv
|
|
3
|
+
from shutil import copy
|
|
4
|
+
from time import sleep
|
|
5
|
+
from subprocess import run
|
|
6
|
+
from multiprocessing import Process
|
|
7
|
+
from glob import glob
|
|
8
|
+
|
|
9
|
+
import numpy as np
|
|
10
|
+
import pandas as pd
|
|
11
|
+
from tqdm import tqdm
|
|
12
|
+
from win32com.client import Dispatch
|
|
13
|
+
from femtetutils import util
|
|
14
|
+
|
|
15
|
+
from pyfemtet.opt import FEMOpt
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def _open_femprj(femprj_path):
|
|
19
|
+
Femtet = Dispatch('FemtetMacro.Femtet')
|
|
20
|
+
for _ in tqdm(range(5), 'wait for dispatch Femtet'):
|
|
21
|
+
sleep(1)
|
|
22
|
+
Femtet.LoadProject(femprj_path, True)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def launch_femtet(femprj_path):
|
|
26
|
+
# launch Femtet externally
|
|
27
|
+
print('Launching Femtet...')
|
|
28
|
+
util.execute_femtet()
|
|
29
|
+
pid = util.get_last_executed_femtet_process_id()
|
|
30
|
+
for _ in tqdm(range(8), 'Wait for launch Femtet.'):
|
|
31
|
+
sleep(1)
|
|
32
|
+
|
|
33
|
+
# open femprj in a different process
|
|
34
|
+
# to release Femtet for sample program
|
|
35
|
+
print('Opening femprj...')
|
|
36
|
+
p = Process(
|
|
37
|
+
target=_open_femprj,
|
|
38
|
+
args=(femprj_path,),
|
|
39
|
+
)
|
|
40
|
+
p.start()
|
|
41
|
+
p.join()
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def taskkill_femtet():
|
|
45
|
+
for _ in tqdm(range(3), 'wait before taskkill Femtet'):
|
|
46
|
+
sleep(1)
|
|
47
|
+
run(['taskkill', '/f', '/im', 'Femtet.exe'])
|
|
48
|
+
for _ in tqdm(range(3), 'wait after taskkill Femtet'):
|
|
49
|
+
sleep(1)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def find_latest_csv(dir_path=None):
|
|
53
|
+
if dir_path is None: dir_path = '.'
|
|
54
|
+
target = os.path.join(dir_path, '*.csv')
|
|
55
|
+
files = [(f, os.path.getmtime(f)) for f in glob(target)]
|
|
56
|
+
out = sorted(files, key=lambda files: files[1])[-1]
|
|
57
|
+
return os.path.abspath(out[0])
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def py_to_reccsv(py_path, suffix=''):
|
|
61
|
+
dst_csv_path = py_path + suffix
|
|
62
|
+
dst_csv_path = dst_csv_path.replace(f'.py{suffix}', f'{suffix}.reccsv')
|
|
63
|
+
return dst_csv_path
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def record_result(src: FEMOpt or str, py_path, suffix=''):
|
|
67
|
+
"""Record the result csv for `is_equal_result`."""
|
|
68
|
+
|
|
69
|
+
if isinstance(src, FEMOpt): # get df directory
|
|
70
|
+
src_csv_path = src.history_path
|
|
71
|
+
else:
|
|
72
|
+
src_csv_path = os.path.abspath(src)
|
|
73
|
+
|
|
74
|
+
dst_csv_path = py_to_reccsv(py_path, suffix)
|
|
75
|
+
copy(src_csv_path, dst_csv_path)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def _get_obj_from_csv(csv_path):
|
|
79
|
+
df = pd.read_csv(csv_path, encoding='cp932', header=2)
|
|
80
|
+
columns = df.columns
|
|
81
|
+
with open(csv_path, mode='r', encoding='cp932', newline='\n') as f:
|
|
82
|
+
reader = csv.reader(f, delimiter=',')
|
|
83
|
+
meta = reader.__next__()
|
|
84
|
+
obj_indices = np.where(np.array(meta) == 'obj')[0]
|
|
85
|
+
out = df.iloc[:, obj_indices]
|
|
86
|
+
return out, columns
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def is_equal_result(csv1, csv2, result_save_to=None):
|
|
90
|
+
"""Check the equality of two result csv files."""
|
|
91
|
+
df1, columns1 = _get_obj_from_csv(csv1)
|
|
92
|
+
df2, columns2 = _get_obj_from_csv(csv2)
|
|
93
|
+
|
|
94
|
+
if result_save_to is not None:
|
|
95
|
+
import datetime
|
|
96
|
+
with open(result_save_to, 'a', encoding='utf-8', newline='\n') as f:
|
|
97
|
+
name = os.path.basename(csv1)
|
|
98
|
+
content = [
|
|
99
|
+
f'===== result of {name} =====\n',
|
|
100
|
+
f'{datetime.datetime.now()}\n',
|
|
101
|
+
f'----- column numbers -----\n',
|
|
102
|
+
f'csv1: {len(columns1)} columns\n',
|
|
103
|
+
f'csv2: {len(columns2)} columns\n',
|
|
104
|
+
f'----- row numbers -----\n',
|
|
105
|
+
f'csv1: {len(df1)} columns\n',
|
|
106
|
+
f'csv2: {len(df2)} columns\n',
|
|
107
|
+
f'----- difference -----\n',
|
|
108
|
+
f'max difference ratio: {(np.abs(df1.values - df2.values) / np.abs(df2.values)).max() * 100}%\n',
|
|
109
|
+
'\n'
|
|
110
|
+
]
|
|
111
|
+
f.writelines(content)
|
|
112
|
+
|
|
113
|
+
assert len(columns1) == len(columns2), '結果 csv の column 数が異なります。'
|
|
114
|
+
assert len(df1) == len(df2), '結果 csv の row 数が異なります。'
|
|
115
|
+
assert (np.abs(df1.values - df2.values) / np.abs(df2.values)).max() <= 0.01, '前回の結果と 1% を超える相違があります。'
|
pyfemtet/opt/_femopt.py
CHANGED
|
@@ -383,7 +383,13 @@ class FEMOpt:
|
|
|
383
383
|
# Femtet の parametric 設定を目的関数に用いるかどうか
|
|
384
384
|
if self.fem.parametric_output_indexes_use_as_objective is not None:
|
|
385
385
|
from pyfemtet.opt.interface._femtet_parametric import add_parametric_results_as_objectives
|
|
386
|
-
|
|
386
|
+
indexes = list(self.fem.parametric_output_indexes_use_as_objective.keys())
|
|
387
|
+
directions = list(self.fem.parametric_output_indexes_use_as_objective.values())
|
|
388
|
+
add_parametric_results_as_objectives(
|
|
389
|
+
self,
|
|
390
|
+
indexes,
|
|
391
|
+
directions,
|
|
392
|
+
)
|
|
387
393
|
|
|
388
394
|
# actor の設定
|
|
389
395
|
self.status = OptimizationStatus(self.client)
|
pyfemtet/opt/_femopt_core.py
CHANGED
|
@@ -14,7 +14,7 @@ import numpy as np
|
|
|
14
14
|
import pandas as pd
|
|
15
15
|
from scipy.stats.qmc import LatinHypercube
|
|
16
16
|
from optuna._hypervolume import WFG
|
|
17
|
-
from dask.distributed import Lock
|
|
17
|
+
from dask.distributed import Lock, get_client
|
|
18
18
|
|
|
19
19
|
# win32com
|
|
20
20
|
from win32com.client import constants, Constants
|
|
@@ -532,7 +532,17 @@ class History:
|
|
|
532
532
|
|
|
533
533
|
return columns, metadata
|
|
534
534
|
|
|
535
|
-
def record(
|
|
535
|
+
def record(
|
|
536
|
+
self,
|
|
537
|
+
parameters,
|
|
538
|
+
objectives,
|
|
539
|
+
constraints,
|
|
540
|
+
obj_values,
|
|
541
|
+
cns_values,
|
|
542
|
+
message,
|
|
543
|
+
postprocess_func,
|
|
544
|
+
postprocess_args,
|
|
545
|
+
):
|
|
536
546
|
"""Records the optimization results in the history.
|
|
537
547
|
|
|
538
548
|
Record only. NOT save.
|
|
@@ -544,7 +554,8 @@ class History:
|
|
|
544
554
|
obj_values (list): The objective values.
|
|
545
555
|
cns_values (list): The constraint values.
|
|
546
556
|
message (str): Additional information or messages related to the optimization results.
|
|
547
|
-
|
|
557
|
+
postprocess_func (Callable): fem method to call after solving. i.e. save result file. Must take trial(int) for 1st argument.
|
|
558
|
+
postprocess_args (dict): arguments for `postprocess_func`. i.e. create binary data of result file in the worker process.
|
|
548
559
|
"""
|
|
549
560
|
|
|
550
561
|
# create row
|
|
@@ -591,6 +602,12 @@ class History:
|
|
|
591
602
|
self._calc_hypervolume(objectives) # update self.local_data
|
|
592
603
|
self.actor_data = self.local_data
|
|
593
604
|
|
|
605
|
+
# save file
|
|
606
|
+
if postprocess_args is not None:
|
|
607
|
+
trial = self.local_data['trial'].values[-1]
|
|
608
|
+
client = get_client() # always returns valid client
|
|
609
|
+
client.run_on_scheduler(postprocess_func, trial, **postprocess_args)
|
|
610
|
+
|
|
594
611
|
def _calc_non_domi(self, objectives):
|
|
595
612
|
|
|
596
613
|
# 目的関数の履歴を取り出してくる
|
|
@@ -107,6 +107,10 @@ if __name__ == '__main__':
|
|
|
107
107
|
fem = FemtetWithNXInterface(
|
|
108
108
|
prt_path='cad_ex01_NX.prt',
|
|
109
109
|
open_result_with_gui=False, # To calculate von Mises stress, set this argument to False. See Femtet Macro Help.
|
|
110
|
+
export_curves=False,
|
|
111
|
+
export_surfaces=False,
|
|
112
|
+
export_solids=True,
|
|
113
|
+
export_flattened_assembly=False,
|
|
110
114
|
)
|
|
111
115
|
|
|
112
116
|
# Initialize the FEMOpt object.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"{""femprj_path"": null, ""model_name"": ""ex58_UnLoad""}",prm,obj,obj_direction,,,,,
|
|
2
|
+
,,,,,,,,
|
|
3
|
+
trial,rot,final angle (degree),final angle (degree)_direction,non_domi,feasible,hypervolume,message,time
|
|
4
|
+
1,90.0,81.62540665669353,90,False,True,-1.0,initial,2024-06-11 12:19:15.494862
|
|
5
|
+
2,87.49080237694724,79.02571752958842,90,False,True,-1.0,,2024-06-11 12:19:19.728891
|
|
6
|
+
3,99.01428612819832,90.96145916607887,90,False,True,-1.0,,2024-06-11 12:19:23.959099
|
|
7
|
+
4,99.99999999999999,91.89033160850725,90,False,True,-1.0,,2024-06-11 12:19:29.210094
|
|
8
|
+
5,96.7613593526426,88.77003517126444,90,False,True,-1.0,,2024-06-11 12:19:33.556167
|
|
9
|
+
6,80.0,71.5309188581146,90,False,True,-1.0,,2024-06-11 12:19:37.894866
|
|
10
|
+
7,97.45535890878755,89.47178515828678,90,False,True,-1.0,,2024-06-11 12:19:42.314653
|
|
11
|
+
8,96.18747750627301,88.19831186499154,90,False,True,-1.0,,2024-06-11 12:19:46.867626
|
|
12
|
+
9,98.14241558949382,90.13165212114446,90,False,True,-1.0,,2024-06-11 12:19:51.352111
|
|
13
|
+
10,98.08002450883177,90.07026771243692,90,True,True,-1.0,,2024-06-11 12:19:55.861780
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"{""femprj_path"": null, ""model_name"": ""ex58_UnLoad""}",prm,obj,obj_direction,,,,,
|
|
2
|
+
,,,,,,,,
|
|
3
|
+
trial,rot,final angle (degree),final angle (degree)_direction,non_domi,feasible,hypervolume,message,time
|
|
4
|
+
1,90.0,81.62540665669353,90,False,True,-1.0,initial,2024-06-11 12:19:15.494862
|
|
5
|
+
2,87.49080237694724,79.02571752958842,90,False,True,-1.0,,2024-06-11 12:19:19.728891
|
|
6
|
+
3,99.01428612819832,90.96145916607887,90,False,True,-1.0,,2024-06-11 12:19:23.959099
|
|
7
|
+
4,99.99999999999999,91.89033160850725,90,False,True,-1.0,,2024-06-11 12:19:29.210094
|
|
8
|
+
5,96.7613593526426,88.77003517126444,90,False,True,-1.0,,2024-06-11 12:19:33.556167
|
|
9
|
+
6,80.0,71.5309188581146,90,False,True,-1.0,,2024-06-11 12:19:37.894866
|
|
10
|
+
7,97.45535890878755,89.47178515828678,90,False,True,-1.0,,2024-06-11 12:19:42.314653
|
|
11
|
+
8,96.18747750627301,88.19831186499154,90,False,True,-1.0,,2024-06-11 12:19:46.867626
|
|
12
|
+
9,98.14241558949382,90.13165212114446,90,False,True,-1.0,,2024-06-11 12:19:51.352111
|
|
13
|
+
10,98.08002450883177,90.07026771243692,90,True,True,-1.0,,2024-06-11 12:19:55.861780
|
|
Binary file
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"{""femprj_path"": null, ""model_name"": ""ex58_UnLoad""}",prm,obj,obj_direction,,,,,
|
|
2
|
+
,,,,,,,,
|
|
3
|
+
trial,rot,final angle (degree),final angle (degree)_direction,non_domi,feasible,hypervolume,message,time
|
|
4
|
+
1,90.0,81.62540665669353,90,False,True,-1.0,initial,2024-06-11 12:19:15.494862
|
|
5
|
+
2,87.49080237694724,79.02571752958842,90,False,True,-1.0,,2024-06-11 12:19:19.728891
|
|
6
|
+
3,99.01428612819832,90.96145916607887,90,False,True,-1.0,,2024-06-11 12:19:23.959099
|
|
7
|
+
4,99.99999999999999,91.89033160850725,90,False,True,-1.0,,2024-06-11 12:19:29.210094
|
|
8
|
+
5,96.7613593526426,88.77003517126444,90,False,True,-1.0,,2024-06-11 12:19:33.556167
|
|
9
|
+
6,80.0,71.5309188581146,90,False,True,-1.0,,2024-06-11 12:19:37.894866
|
|
10
|
+
7,97.45535890878755,89.47178515828678,90,False,True,-1.0,,2024-06-11 12:19:42.314653
|
|
11
|
+
8,96.18747750627301,88.19831186499154,90,False,True,-1.0,,2024-06-11 12:19:46.867626
|
|
12
|
+
9,98.14241558949382,90.13165212114446,90,False,True,-1.0,,2024-06-11 12:19:51.352111
|
|
13
|
+
10,98.08002450883177,90.07026771243692,90,True,True,-1.0,,2024-06-11 12:19:55.861780
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"{""femprj_path"": null, ""model_name"": ""ex8""}",prm,prm,prm,obj,obj_direction,,,,,
|
|
2
|
+
,,,,,,,,,,
|
|
3
|
+
trial,helical_pitch,coil_radius,n_turns,self-inductance (F),self-inductance (F)_direction,non_domi,feasible,hypervolume,message,time
|
|
4
|
+
1,6.0,10.0,5.0,2.2519131001598675e-07,1e-07,False,True,-1.0,initial,2024-06-11 12:02:57.767918
|
|
5
|
+
2,5.623252451619978,9.556428757689245,3.9279757672456204,1.5669600588107823e-07,1e-07,False,True,-1.0,,2024-06-11 12:03:01.879689
|
|
6
|
+
3,4.420717726239158,8.795585311974417,3.404460046972835,1.2486865567061983e-07,1e-07,False,True,-1.0,,2024-06-11 12:03:06.695218
|
|
7
|
+
4,6.890675795624973,1.185260448662222,4.879639408647977,1.1068853339253005e-08,1e-07,False,True,-1.0,,2024-06-11 12:03:09.810784
|
|
8
|
+
5,7.363282035041603,2.9110519961044856,1.7272998688284025,5.928345320407693e-09,1e-07,False,True,-1.0,,2024-06-11 12:03:12.620381
|
|
9
|
+
6,4.506659276939239,8.848248131255941,3.3689827006547204,1.223080407315596e-07,1e-07,False,True,-1.0,,2024-06-11 12:03:21.984837
|
|
10
|
+
7,4.766513095940718,9.009910692888063,3.2031623183171014,1.1395898205496435e-07,1e-07,False,True,-1.0,,2024-06-11 12:03:25.935771
|
|
11
|
+
8,4.952240014062343,9.147228346475954,2.923015991988623,1.0163581024783297e-07,1e-07,False,True,-1.0,,2024-06-11 12:03:29.971566
|
|
12
|
+
9,5.066580537443571,9.328659775516126,2.415616268398396,7.9346679307476e-08,1e-07,False,True,-1.0,,2024-06-11 12:03:33.843674
|
|
13
|
+
10,5.01255047733164,9.185738480635885,2.8492684510814064,9.909738207022439e-08,1e-07,False,True,-1.0,,2024-06-11 12:03:38.301538
|
|
14
|
+
11,5.00852993138919,9.181676469148485,2.8487833409683856,9.932809365733774e-08,1e-07,False,True,-1.0,,2024-06-11 12:03:42.927279
|
|
15
|
+
12,5.015372908010907,9.156507516160001,2.84363953399497,9.865521830979344e-08,1e-07,False,True,-1.0,,2024-06-11 12:03:47.695209
|
|
16
|
+
13,4.936583250613616,9.643690440100311,2.8584657253663925,1.101940126271035e-07,1e-07,False,True,-1.0,,2024-06-11 12:03:52.718947
|
|
17
|
+
14,5.102945083594629,8.690025958818417,2.845587386493274,8.937388292289982e-08,1e-07,False,True,-1.0,,2024-06-11 12:03:58.135407
|
|
18
|
+
15,4.991284994799307,9.188650804778193,2.8530392301069725,9.970815493825604e-08,1e-07,False,True,-1.0,,2024-06-11 12:04:05.138794
|
|
19
|
+
16,4.798136039813497,9.176815614734876,2.8229449492498473,9.890481643260465e-08,1e-07,False,True,-1.0,,2024-06-11 12:04:14.148550
|
|
20
|
+
17,4.930367618092964,9.199092260972836,2.8443627311061546,9.98421974076081e-08,1e-07,True,True,-1.0,,2024-06-11 12:04:28.793111
|
|
21
|
+
18,4.917692804276215,9.210004097072988,2.8402049456555583,1.0026551790777177e-07,1e-07,False,True,-1.0,,2024-06-11 12:04:53.890898
|
|
22
|
+
19,4.916044853968383,9.214647159558751,2.839933299380106,9.881932615643327e-08,1e-07,False,True,-1.0,,2024-06-11 12:05:39.178010
|
|
23
|
+
20,4.924334850336223,9.19023089875423,2.8409787839543563,9.883080340842676e-08,1e-07,False,True,-1.0,,2024-06-11 12:07:03.669665
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"{""femprj_path"": null, ""model_name"": ""Harm""}",prm,prm,prm,obj,obj_direction,,cns,cns_lb,cns_ub,cns,cns_lb,cns_ub,,,,
|
|
2
|
+
,,,,,,,,,,,,,,,,
|
|
3
|
+
trial,antenna_radius,substrate_w,port_x,first resonant frequency(Hz),first resonant frequency(Hz)_direction,non_domi,antenna and substrate clearance,antenna and substrate clearance_lower_bound,antenna and substrate clearance_upper_bound,antenna and port clearance,antenna and port clearance_lower_bound,antenna and port clearance_upper_bound,feasible,hypervolume,message,time
|
|
4
|
+
1,10.0,50.0,5.0,4289000000.0,3000000000.0,False,15.0,1,,5.0,1,,True,-1.0,initial,2024-06-11 12:08:26.664402
|
|
5
|
+
2,13.979877262955549,43.12037280884873,3.96389588638785,3050000000.0,3000000000.0,False,7.580309099999999,1,,10.01598141,1,,True,-1.0,,2024-06-11 12:08:45.888336
|
|
6
|
+
3,17.48663961200633,44.246782213565524,4.4546743769349115,2460000000.0,3000000000.0,False,4.636751499999999,1,,13.03196522,1,,True,-1.0,,2024-06-11 12:09:08.898036
|
|
7
|
+
4,11.841049763255539,55.70351922786027,4.793801861008835,3581000000.0,3000000000.0,False,16.0107098,1,,7.04724794,1,,True,-1.0,,2024-06-11 12:09:30.818053
|
|
8
|
+
5,12.713516576204174,51.84829137724085,1.8825578416799567,2932000000.0,3000000000.0,False,13.2106291,1,,10.83095876,1,,True,-1.0,,2024-06-11 12:09:46.800326
|
|
9
|
+
6,14.113172778521575,43.41048247374583,2.235980266720311,2991000000.0,3000000000.0,True,7.592068450000001,1,,11.877192529999999,1,,True,-1.0,,2024-06-11 12:10:06.872645
|
|
10
|
+
7,19.233283058799998,59.31264066149119,16.35954961421276,2283000000.0,3000000000.0,False,10.42303725,1,,2.8737335,1,,True,-1.0,,2024-06-11 12:10:40.123116
|
|
11
|
+
8,11.60228740609402,42.44076469689558,10.408361292114133,3758000000.0,3000000000.0,False,9.618094950000001,1,,1.1939261000000005,1,,True,-1.0,,2024-06-11 12:11:03.207759
|
|
12
|
+
9,14.93783426530973,46.23422152178822,10.881292402378406,2932000000.0,3000000000.0,False,8.179276449999998,1,,4.056541900000001,1,,True,-1.0,,2024-06-11 12:11:30.548731
|
|
13
|
+
10,13.968499682166277,58.437484700462335,2.6813575389864703,2991000000.0,3000000000.0,True,15.250242649999999,1,,11.28714216,1,,True,-1.0,,2024-06-11 12:11:50.050599
|
|
14
|
+
11,14.54315734982604,52.537550133941885,1.0,2932000000.0,3000000000.0,False,11.725617749999998,1,,13.5431573,1,,True,-1.0,,2024-06-11 12:12:12.701262
|
|
15
|
+
12,14.586861208706766,59.99999999999999,5.909396621050475,2932000000.0,3000000000.0,False,15.4131388,1,,8.677464579999999,1,,True,-1.0,,2024-06-11 12:12:34.168326
|
|
16
|
+
13,14.706782700305354,40.0,1.0,2814000000.0,3000000000.0,False,5.2932173,1,,13.7067827,1,,True,-1.0,,2024-06-11 12:13:37.839853
|
|
17
|
+
14,14.43570684403354,51.141218169528905,5.404811972123167,2932000000.0,3000000000.0,False,11.134902299999998,1,,9.030894830000001,1,,True,-1.0,,2024-06-11 12:14:39.583756
|
|
18
|
+
15,14.458054466363947,59.99999999999999,1.0,2932000000.0,3000000000.0,False,15.5419455,1,,13.4580545,1,,True,-1.0,,2024-06-11 12:14:58.872749
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"{""femprj_path"": null, ""model_name"": ""Ex1""}",prm,prm,prm,obj,obj_direction,obj,obj_direction,obj,obj_direction,,,,,
|
|
2
|
+
,,,,,,,,,,,,,,
|
|
3
|
+
trial,substrate_w,substrate_d,rot,max temp. of<br>MAINCHIP (degree),max temp. of<br>MAINCHIP (degree)_direction,max temp. of<br>SUBCHIP (degree),max temp. of<br>SUBCHIP (degree)_direction,substrate size (mm2),substrate size (mm2)_direction,non_domi,feasible,hypervolume,message,time
|
|
4
|
+
1,40.0,60.0,0.0,33.67695768582703,minimize,33.95371403110336,minimize,2400.0,minimize,True,True,0.0,initial,2024-06-11 12:17:25.110141
|
|
5
|
+
2,36.232524516199774,58.71857196665782,131.75890952605292,36.750613396557995,minimize,35.98760273557258,minimize,2127.522098595014,minimize,False,True,0.0,,2024-06-11 12:17:29.371084
|
|
6
|
+
3,44.74902239948739,38.05648465150335,28.079013660516477,37.661215802334205,minimize,37.688375728423864,minimize,1702.9904863055572,minimize,False,True,0.0,,2024-06-11 12:17:33.564289
|
|
7
|
+
4,24.20717726239158,56.52057979014832,108.20070211377758,38.03360975542378,minimize,37.132207739036424,minimize,1368.2036963173987,minimize,False,True,0.0,,2024-06-11 12:17:37.853520
|
|
8
|
+
5,48.90675795624973,34.53519685169086,174.58377338915898,35.8008561699603,minimize,35.41803365231452,minimize,1689.0045172706505,minimize,True,True,1.8564481859818923e-05,,2024-06-11 12:17:41.999764
|
|
9
|
+
6,53.632820350416026,39.520816877635184,32.72849409727811,36.27586854489045,minimize,36.24746978400414,minimize,2119.612874858985,minimize,False,True,1.8564481859818923e-05,,2024-06-11 12:17:46.239353
|
|
10
|
+
7,28.969371374430487,41.91029831694798,94.45615769380281,37.30507756114715,minimize,37.03664336271842,minimize,1214.1149969374887,minimize,True,True,0.0004588839992990786,,2024-06-11 12:17:50.385009
|
|
11
|
+
8,38.413910708400394,41.57195764514909,110.1335210500283,37.576825749490744,minimize,37.23183262975933,minimize,1596.9414668705863,minimize,False,True,0.0004588839992990786,,2024-06-11 12:17:54.833608
|
|
12
|
+
9,27.30076670477759,41.59576086191567,65.9451317928645,40.3319296385719,minimize,40.398458177958574,minimize,1135.596164039882,minimize,True,True,0.000640516961074097,,2024-06-11 12:17:59.016440
|
|
13
|
+
10,39.33065940024737,54.41457499621835,35.941280788504756,36.33478914713188,minimize,36.42436238628697,minimize,2140.161115720755,minimize,False,True,0.000640516961074097,,2024-06-11 12:18:03.281085
|
|
14
|
+
11,29.88951598161767,48.530123354694155,153.62497867846213,39.42958363258689,minimize,38.57020860420411,minimize,1450.5418998462744,minimize,False,True,0.000640516961074097,,2024-06-11 12:18:07.538199
|
|
15
|
+
12,31.485762571965203,47.06581165954471,80.23637941165202,36.63056881181441,minimize,36.53774341292369,minimize,1481.9029737625024,minimize,True,True,0.0006405332168774407,,2024-06-11 12:18:11.814563
|
|
16
|
+
13,22.592602387021333,51.59088187331228,6.2020220936995525,40.387965035487035,minimize,40.85943258832127,minimize,1165.5722822320565,minimize,False,True,0.0006405332168774407,,2024-06-11 12:18:16.222971
|
|
17
|
+
14,58.76493724495243,44.20401050976337,64.09642020029887,34.858239533999296,minimize,34.725797147945734,minimize,2597.645901020641,minimize,False,True,0.0006405332168774407,,2024-06-11 12:18:20.540597
|
|
18
|
+
15,32.86246372091377,44.383694428619314,102.63175919113127,37.1577717589319,minimize,36.7308460274431,minimize,1458.5575460918933,minimize,True,True,0.0006704802815873576,,2024-06-11 12:18:24.780506
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"{""femprj_path"": null, ""model_name"": ""Ex14""}",prm,prm,obj,obj_direction,obj,obj_direction,obj,obj_direction,,,,,
|
|
2
|
+
,,,,,,,,,,,,,
|
|
3
|
+
trial,substrate_w,substrate_d,max temp. of<br>MAINCHIP (degree),max temp. of<br>MAINCHIP (degree)_direction,max temp. of<br>SUBCHIP (degree),max temp. of<br>SUBCHIP (degree)_direction,substrate size,substrate size_direction,non_domi,feasible,hypervolume,message,time
|
|
4
|
+
1,40.0,60.0,37.52037094703595,minimize,37.219570759517936,minimize,2400.0,minimize,True,True,0.0,initial,2024-06-11 12:15:44.138912
|
|
5
|
+
2,28.741722139252524,58.66928627306774,39.9508830973249,minimize,39.599423416818745,minimize,1686.2563226399373,minimize,True,True,2.970229880317643e-05,,2024-06-11 12:15:48.376064
|
|
6
|
+
3,35.17589095260529,49.163779073319986,39.86737960935721,minimize,39.626434415381006,minimize,1729.3797347696782,minimize,True,True,0.000549159406835399,,2024-06-11 12:15:52.656210
|
|
7
|
+
4,24.808335527963855,37.21185204907747,45.61866728905813,minimize,45.454085110378436,minimize,923.164108992346,minimize,True,True,0.0005566073404974778,,2024-06-11 12:15:56.376449
|
|
8
|
+
5,23.04550501902759,56.38675593592325,42.04691673232563,minimize,41.64255082527148,minimize,1299.4612650272293,minimize,True,True,0.0005567909231334245,,2024-06-11 12:16:00.326849
|
|
9
|
+
6,32.82007021137776,52.11795960049323,39.9187861643026,minimize,39.65372077487905,minimize,1710.515092752764,minimize,True,True,0.0007091441422963771,,2024-06-11 12:16:04.696885
|
|
10
|
+
7,22.370520897324443,59.18756600837385,41.85766092262706,minimize,41.41235961737965,minimize,1324.0566822231292,minimize,True,True,0.0007092394191664859,,2024-06-11 12:16:08.614814
|
|
11
|
+
8,36.98396753440759,38.733155988313456,41.459966487020225,minimize,41.32468375000158,minimize,1432.50578267643,minimize,True,True,0.000726093206891994,,2024-06-11 12:16:12.849722
|
|
12
|
+
9,25.27284940972781,37.951921766042716,45.203996793500714,minimize,45.02945742624087,minimize,959.1532040919769,minimize,True,True,0.000740299173075068,,2024-06-11 12:16:16.595183
|
|
13
|
+
10,27.476360373271678,47.16842365407042,42.20017927506254,minimize,41.94996082930303,minimize,1296.0166090811015,minimize,True,True,0.0007432067663207338,,2024-06-11 12:16:20.601673
|
|
14
|
+
11,30.35761516871566,42.82064718778404,42.23879430266078,minimize,42.04418338920198,minimize,1299.9327303125576,minimize,False,True,0.0007432067663207338,,2024-06-11 12:16:24.664582
|
|
15
|
+
12,39.45166799418159,54.41754192649335,38.28305390496612,minimize,38.021101163274,minimize,2146.862796414889,minimize,True,True,0.0007445437960082572,,2024-06-11 12:16:29.231158
|
|
16
|
+
13,33.521593044416015,57.50694947262799,38.98990028232446,minimize,38.68463558069958,minimize,1927.7245558105535,minimize,True,True,0.0008565127001001895,,2024-06-11 12:16:33.869770
|
|
17
|
+
14,39.51381652632001,59.67156845010898,37.636491167600745,minimize,37.3320157660186,minimize,2357.85140797618,minimize,True,True,0.0009138674403261316,,2024-06-11 12:16:38.728862
|
|
18
|
+
15,27.034698907527144,51.95067544919728,41.46094657033741,minimize,41.16337804204099,minimize,1404.470867090637,minimize,True,True,0.0009230159948292316,,2024-06-11 12:16:42.930323
|
|
@@ -103,6 +103,10 @@ if __name__ == '__main__':
|
|
|
103
103
|
fem = FemtetWithNXInterface(
|
|
104
104
|
prt_path='cad_ex01_NX.prt',
|
|
105
105
|
open_result_with_gui=False,
|
|
106
|
+
export_curves=False,
|
|
107
|
+
export_surfaces=False,
|
|
108
|
+
export_solids=True,
|
|
109
|
+
export_flattened_assembly=False,
|
|
106
110
|
)
|
|
107
111
|
|
|
108
112
|
# FEMOpt オブジェクトの初期化 (最適化問題とFemtetとの接続を行います)
|
|
Binary file
|
pyfemtet/opt/interface/_base.py
CHANGED
|
@@ -63,6 +63,12 @@ class FEMInterface(ABC):
|
|
|
63
63
|
"""Preprocessing after launching a dask worker and before run optimization (if implemented in concrete class)."""
|
|
64
64
|
pass
|
|
65
65
|
|
|
66
|
+
def postprocess_func(self, trial: int, *args, dask_scheduler=None, **kwargs):
|
|
67
|
+
pass
|
|
68
|
+
|
|
69
|
+
def create_postprocess_args(self):
|
|
70
|
+
pass
|
|
71
|
+
|
|
66
72
|
|
|
67
73
|
class NoFEM(FEMInterface):
|
|
68
74
|
"""Interface with no FEM for debug."""
|