pyfemtet 0.5.1__tar.gz → 0.5.3__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.5.1 → pyfemtet-0.5.3}/PKG-INFO +3 -3
- pyfemtet-0.5.3/pyfemtet/__init__.py +1 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/_femopt.py +12 -3
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/_femopt_core.py +82 -26
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/optimizer/_optuna_botorchsampler_parameter_constraint_helper.py +12 -3
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyproject.toml +6 -5
- pyfemtet-0.5.1/pyfemtet/__init__.py +0 -1
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/LICENSE +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/README.md +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/core.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/dispatch_extensions.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/logger.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/message/1. make_pot.bat +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/message/2. make_mo.bat +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/message/__init__.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/message/babel.cfg +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/message/locales/ja/LC_MESSAGES/messages.mo +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/message/locales/ja/LC_MESSAGES/messages.po +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/message/locales/messages.pot +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/message/messages.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/__init__.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/_test_utils/__init__.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/_test_utils/control_femtet.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/_test_utils/hyper_sphere.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/_test_utils/record_history.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/interface/__init__.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/interface/_base.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/interface/_femtet.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/interface/_femtet_parametric.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/interface/_femtet_with_nx/__init__.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/interface/_femtet_with_nx/_interface.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/interface/_femtet_with_nx/update_model.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/interface/_femtet_with_sldworks.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/optimizer/__init__.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/optimizer/_base.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/optimizer/_optuna.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/optimizer/_scipy.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/optimizer/_scipy_scalar.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/parameter.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/prediction/__init__.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/prediction/base.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/prediction/single_task_gp.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample/.gitignore +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample/ParametricIF.femprj +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample/ParametricIF.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample/ParametricIF_test_result.reccsv +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample/cad_ex01_NX.femprj +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample/cad_ex01_NX.prt +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample/cad_ex01_NX.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample/cad_ex01_NX_test_result.reccsv +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample/cad_ex01_SW.SLDPRT +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample/cad_ex01_SW.femprj +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample/cad_ex01_SW.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample/cad_ex01_SW_test_result.reccsv +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample/constrained_pipe.femprj +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample/constrained_pipe.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample/constrained_pipe_test_result.reccsv +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample/gal_ex58_parametric.femprj +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample/gal_ex58_parametric.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample/gal_ex58_parametric_test_result.reccsv +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample/gau_ex08_parametric.femprj +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample/gau_ex08_parametric.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample/gau_ex08_parametric_test_result.reccsv +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample/her_ex40_parametric.femprj +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample/her_ex40_parametric.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample/her_ex40_parametric_test_result.reccsv +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample/paswat_ex1_parametric.femprj +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample/paswat_ex1_parametric.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample/paswat_ex1_parametric_parallel.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample/paswat_ex1_parametric_test_result.reccsv +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample/wat_ex14_parametric.femprj +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample/wat_ex14_parametric.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample/wat_ex14_parametric_parallel.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample/wat_ex14_parametric_test_result.reccsv +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample_jp/ParametricIF_jp.femprj +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample_jp/ParametricIF_jp.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample_jp/cad_ex01_NX_jp.femprj +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample_jp/cad_ex01_NX_jp.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample_jp/cad_ex01_SW_jp.femprj +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample_jp/cad_ex01_SW_jp.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample_jp/constrained_pipe_jp.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample_jp/gal_ex58_parametric_jp.femprj +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample_jp/gal_ex58_parametric_jp.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample_jp/gau_ex08_parametric_jp.femprj +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample_jp/gau_ex08_parametric_jp.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample_jp/her_ex40_parametric_jp.femprj +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample_jp/her_ex40_parametric_jp.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample_jp/paswat_ex1_parametric_jp.femprj +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample_jp/paswat_ex1_parametric_jp.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample_jp/paswat_ex1_parametric_parallel_jp.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample_jp/wat_ex14_parametric_jp.femprj +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample_jp/wat_ex14_parametric_jp.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample_jp/wat_ex14_parametric_parallel_jp.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/visualization/__init__.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/visualization/_create_wrapped_components.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/visualization/base.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/visualization/complex_components/__init__.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/visualization/complex_components/alert_region.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/visualization/complex_components/control_femtet.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/visualization/complex_components/main_figure_creator.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/visualization/complex_components/main_graph.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/visualization/complex_components/pm_graph.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/visualization/complex_components/pm_graph_creator.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/visualization/process_monitor/__init__.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/visualization/process_monitor/application.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/visualization/process_monitor/pages.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/visualization/result_viewer/.gitignore +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/visualization/result_viewer/__init__.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/visualization/result_viewer/application.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/visualization/result_viewer/pages.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/visualization/wrapped_components/__init__.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/visualization/wrapped_components/dbc.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/visualization/wrapped_components/dcc.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/visualization/wrapped_components/html.py +0 -0
- {pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/visualization/wrapped_components/str_enum.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pyfemtet
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.3
|
|
4
4
|
Summary: Design parameter optimization using Femtet.
|
|
5
5
|
Home-page: https://github.com/pyfemtet/pyfemtet
|
|
6
6
|
License: BSD-3-Clause
|
|
@@ -22,8 +22,8 @@ Requires-Dist: distributed (>=2023.12.1,<2024.0.0)
|
|
|
22
22
|
Requires-Dist: femtetutils (>=1.0.0,<2.0.0)
|
|
23
23
|
Requires-Dist: numpy (>=1.26.2,<2.0.0)
|
|
24
24
|
Requires-Dist: openpyxl (>=3.1.2,<4.0.0)
|
|
25
|
-
Requires-Dist: optuna (>=3.4.0,<
|
|
26
|
-
Requires-Dist: optuna-integration (>=3.6.0,<
|
|
25
|
+
Requires-Dist: optuna (>=3.4.0,<5.0.0)
|
|
26
|
+
Requires-Dist: optuna-integration (>=3.6.0,<5.0.0)
|
|
27
27
|
Requires-Dist: pandas (>=2.1.3,<3.0.0)
|
|
28
28
|
Requires-Dist: plotly (>=5.22.0,<6.0.0)
|
|
29
29
|
Requires-Dist: psutil (>=5.9.6,<6.0.0)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.5.3"
|
|
@@ -12,7 +12,7 @@ from traceback import print_exception
|
|
|
12
12
|
# 3rd-party
|
|
13
13
|
import numpy as np
|
|
14
14
|
import pandas as pd
|
|
15
|
-
from dask.distributed import LocalCluster, Client
|
|
15
|
+
from dask.distributed import LocalCluster, Client, Worker
|
|
16
16
|
|
|
17
17
|
# pyfemtet relative
|
|
18
18
|
from pyfemtet.opt.interface import FEMInterface, FemtetInterface
|
|
@@ -452,10 +452,16 @@ class FEMOpt:
|
|
|
452
452
|
else:
|
|
453
453
|
# ローカルクラスターを構築
|
|
454
454
|
logger.info('Launching single machine cluster. This may take tens of seconds.')
|
|
455
|
-
cluster = LocalCluster(
|
|
456
|
-
|
|
455
|
+
cluster = LocalCluster(
|
|
456
|
+
processes=True,
|
|
457
|
+
n_workers=n_parallel, # n_parallel = n_parallel - 1 + 1; main 分減らし、monitor 分増やす
|
|
458
|
+
threads_per_worker=1,
|
|
459
|
+
worker_class=Worker,
|
|
460
|
+
)
|
|
461
|
+
logger.info('LocalCluster launched successfully.')
|
|
457
462
|
self.client = Client(cluster, direct_to_workers=False)
|
|
458
463
|
self.scheduler_address = self.client.scheduler.address
|
|
464
|
+
logger.info('Client launched successfully.')
|
|
459
465
|
|
|
460
466
|
# 最適化タスクを振り分ける worker を指定
|
|
461
467
|
subprocess_indices = list(range(n_parallel))[1:]
|
|
@@ -487,6 +493,7 @@ class FEMOpt:
|
|
|
487
493
|
indexes,
|
|
488
494
|
directions,
|
|
489
495
|
)
|
|
496
|
+
logger.info('Femtet loaded successfully.')
|
|
490
497
|
|
|
491
498
|
# actor の設定
|
|
492
499
|
self.status = OptimizationStatus(_client)
|
|
@@ -500,6 +507,7 @@ class FEMOpt:
|
|
|
500
507
|
_client,
|
|
501
508
|
metadata,
|
|
502
509
|
)
|
|
510
|
+
logger.info('Status Actor initialized successfully.')
|
|
503
511
|
|
|
504
512
|
# launch monitor
|
|
505
513
|
self.monitor_process_future = _client.submit(
|
|
@@ -516,6 +524,7 @@ class FEMOpt:
|
|
|
516
524
|
workers=self.monitor_process_worker_name,
|
|
517
525
|
allow_other_workers=False
|
|
518
526
|
)
|
|
527
|
+
logger.info('Process monitor initialized successfully.')
|
|
519
528
|
|
|
520
529
|
# fem
|
|
521
530
|
self.fem._setup_before_parallel(_client)
|
|
@@ -8,13 +8,20 @@ import inspect
|
|
|
8
8
|
import ast
|
|
9
9
|
import csv
|
|
10
10
|
import ctypes
|
|
11
|
+
from packaging import version
|
|
11
12
|
|
|
12
13
|
# 3rd-party
|
|
13
14
|
import numpy as np
|
|
14
15
|
import pandas as pd
|
|
15
16
|
from scipy.stats.qmc import LatinHypercube
|
|
16
17
|
import optuna
|
|
17
|
-
|
|
18
|
+
if version.parse(optuna.version.__version__) < version.parse('4.0.0'):
|
|
19
|
+
from optuna._hypervolume import WFG
|
|
20
|
+
wfg = WFG()
|
|
21
|
+
compute_hypervolume = wfg.compute
|
|
22
|
+
else:
|
|
23
|
+
from optuna._hypervolume import wfg
|
|
24
|
+
compute_hypervolume = wfg.compute_hypervolume
|
|
18
25
|
from dask.distributed import Lock, get_client
|
|
19
26
|
|
|
20
27
|
# win32com
|
|
@@ -150,9 +157,7 @@ def _remove_indent(source: str, indent: int) -> str: # returns source
|
|
|
150
157
|
return edited_source
|
|
151
158
|
|
|
152
159
|
|
|
153
|
-
def
|
|
154
|
-
if target is None:
|
|
155
|
-
target = ''
|
|
160
|
+
def _check_access_femtet_objects(fun, target: str = 'Femtet'):
|
|
156
161
|
|
|
157
162
|
# 関数fのソースコードを取得
|
|
158
163
|
source = inspect.getsource(fun)
|
|
@@ -162,36 +167,88 @@ def _check_accsess_femtet_objects(fun, target: str = None):
|
|
|
162
167
|
# instanceメソッドなどの場合を想定してインデントを削除
|
|
163
168
|
source = _remove_indent(source, _get_scope_indent(source))
|
|
164
169
|
tree = ast.parse(source)
|
|
165
|
-
|
|
170
|
+
|
|
171
|
+
except Exception:
|
|
166
172
|
return False # パースに失敗するからと言ってエラーにするまででもない
|
|
167
173
|
|
|
168
|
-
#
|
|
174
|
+
# if function or staticmethod, 1st argument is Femtet. Find the name.
|
|
175
|
+
varname_contains_femtet = '' # invalid variable name
|
|
169
176
|
for node in ast.walk(tree):
|
|
170
177
|
if isinstance(node, ast.FunctionDef):
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
#
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
178
|
+
all_arguments: ast.arguments = node.args
|
|
179
|
+
|
|
180
|
+
args: list[ast.arg] = all_arguments.args
|
|
181
|
+
# args.extend(all_arguments.posonlyargs) # 先にこっちを入れるべきかも
|
|
182
|
+
|
|
183
|
+
target_arg = args[0]
|
|
184
|
+
|
|
185
|
+
# if class method or instance method, 2nd argument is it.
|
|
186
|
+
# In this implementation, we cannot detect the FunctionDef is
|
|
187
|
+
# method or not because the part of source code is unindented and parsed.
|
|
188
|
+
if target_arg.arg == 'self' or target_arg.arg == 'cls':
|
|
189
|
+
if len(args) > 1:
|
|
190
|
+
target_arg = args[1]
|
|
191
|
+
else:
|
|
192
|
+
target_arg = None
|
|
193
|
+
|
|
194
|
+
if target_arg is not None:
|
|
195
|
+
varname_contains_femtet = target_arg.arg
|
|
196
|
+
|
|
197
|
+
# check Femtet access
|
|
198
|
+
if target == 'Femtet':
|
|
199
|
+
for node in ast.walk(tree):
|
|
200
|
+
|
|
201
|
+
# by accessing argument directory
|
|
202
|
+
if isinstance(node, ast.Name):
|
|
203
|
+
# found local variables
|
|
204
|
+
node: ast.Name
|
|
205
|
+
if node.id == varname_contains_femtet:
|
|
206
|
+
# found Femtet
|
|
207
|
+
return True
|
|
208
|
+
|
|
209
|
+
# by accessing inside method
|
|
210
|
+
elif isinstance(node, ast.Attribute):
|
|
211
|
+
# found attribute of something
|
|
212
|
+
node: ast.Attribute
|
|
213
|
+
if node.attr == 'Femtet':
|
|
214
|
+
# found **.Femtet.**
|
|
215
|
+
return True
|
|
216
|
+
|
|
217
|
+
# check Gogh access
|
|
218
|
+
elif target == 'Gogh':
|
|
219
|
+
for node in ast.walk(tree):
|
|
220
|
+
if isinstance(node, ast.Attribute):
|
|
221
|
+
if node.attr == 'Gogh':
|
|
222
|
+
# found **.Gogh.**
|
|
223
|
+
node: ast.Attribute
|
|
224
|
+
parent = node.value
|
|
225
|
+
|
|
226
|
+
# by accessing argument directory
|
|
227
|
+
if isinstance(parent, ast.Name):
|
|
228
|
+
# found *.Gogh.**
|
|
229
|
+
parent: ast.Name
|
|
230
|
+
if parent.id == varname_contains_femtet:
|
|
231
|
+
# found Femtet.Gogh.**
|
|
232
|
+
return True
|
|
233
|
+
|
|
234
|
+
# by accessing inside method
|
|
235
|
+
if isinstance(parent, ast.Attribute):
|
|
236
|
+
# found **.*.Gogh.**
|
|
237
|
+
parent: ast.Attribute
|
|
238
|
+
if parent.attr == 'Femtet':
|
|
239
|
+
# found **.Femtet.Gogh.**
|
|
240
|
+
return True
|
|
241
|
+
|
|
242
|
+
# ここまで来たならば target へのアクセスはおそらくない
|
|
243
|
+
return False
|
|
187
244
|
|
|
188
245
|
|
|
189
246
|
def _is_access_gogh(fun):
|
|
190
|
-
return
|
|
247
|
+
return _check_access_femtet_objects(fun, target='Gogh')
|
|
191
248
|
|
|
192
249
|
|
|
193
250
|
def _is_access_femtet(fun):
|
|
194
|
-
return
|
|
251
|
+
return _check_access_femtet_objects(fun, target='Femtet')
|
|
195
252
|
|
|
196
253
|
|
|
197
254
|
def is_feasible(value, lb, ub):
|
|
@@ -703,10 +760,9 @@ class History:
|
|
|
703
760
|
reference_point = r * (maximum - minimum) + minimum
|
|
704
761
|
|
|
705
762
|
#### hv 履歴の計算
|
|
706
|
-
wfg = WFG()
|
|
707
763
|
hvs = []
|
|
708
764
|
for i in range(n):
|
|
709
|
-
hv =
|
|
765
|
+
hv = compute_hypervolume(pareto_set[:i], reference_point)
|
|
710
766
|
if np.isnan(hv):
|
|
711
767
|
hv = 0
|
|
712
768
|
hvs.append(hv)
|
|
@@ -39,12 +39,22 @@ def do_patch(
|
|
|
39
39
|
opt (OptunaOptimizer): OptunaOptimizer.
|
|
40
40
|
"""
|
|
41
41
|
import optuna_integration
|
|
42
|
-
|
|
42
|
+
|
|
43
|
+
from optuna_integration import version
|
|
44
|
+
if int(version.__version__.split('.')[0]) >= 4:
|
|
45
|
+
target_fun = optuna_integration.botorch.botorch.optimize_acqf
|
|
46
|
+
else:
|
|
47
|
+
target_fun = optuna_integration.botorch.optimize_acqf
|
|
48
|
+
|
|
43
49
|
new_fun: callable = OptimizeReplacedACQF(target_fun)
|
|
44
50
|
new_fun.set_constraints(list(constraints.values()))
|
|
45
51
|
new_fun.set_study(study)
|
|
46
52
|
new_fun.set_opt(opt)
|
|
47
|
-
|
|
53
|
+
|
|
54
|
+
if int(version.__version__.split('.')[0]) >= 4:
|
|
55
|
+
optuna_integration.botorch.botorch.optimize_acqf = new_fun
|
|
56
|
+
else:
|
|
57
|
+
optuna_integration.botorch.optimize_acqf = new_fun
|
|
48
58
|
|
|
49
59
|
|
|
50
60
|
class GeneralFunctionWithForwardDifference(torch.autograd.Function):
|
|
@@ -173,7 +183,6 @@ class NonlinearInequalityConstraints:
|
|
|
173
183
|
item = (lambda x: GeneralFunctionWithForwardDifference.apply(cns_botorch, x), True)
|
|
174
184
|
self._nonlinear_inequality_constraints.append(item)
|
|
175
185
|
|
|
176
|
-
|
|
177
186
|
def _filter_feasible_conditions(self, ic_batch):
|
|
178
187
|
# List to store feasible initial conditions
|
|
179
188
|
feasible_ic_list = []
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "pyfemtet"
|
|
3
|
-
version = "0.5.
|
|
3
|
+
version = "0.5.3" # 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"
|
|
@@ -29,8 +29,8 @@ numpy = ">=1.26.2, <2.0.0"
|
|
|
29
29
|
pandas = "^2.1.3"
|
|
30
30
|
openpyxl = "^3.1.2"
|
|
31
31
|
scipy = "^1.11.4"
|
|
32
|
-
optuna =
|
|
33
|
-
optuna-integration = "
|
|
32
|
+
optuna = ">=3.4.0, <5.0.0"
|
|
33
|
+
optuna-integration = ">=3.6.0, <5.0.0"
|
|
34
34
|
botorch = "==0.9.5"
|
|
35
35
|
torch = "~2.3.0"
|
|
36
36
|
|
|
@@ -42,8 +42,9 @@ sphinx = "==7.2.6"
|
|
|
42
42
|
myst-parser = "==2.0.0"
|
|
43
43
|
sphinx-rtd-theme = "==2.0.0"
|
|
44
44
|
sphinx-autobuild = "==2021.3.14"
|
|
45
|
-
sphinx-design = "
|
|
46
|
-
sphinx-intl = "
|
|
45
|
+
sphinx-design = "==0.5.0"
|
|
46
|
+
sphinx-intl = "==2.2.0"
|
|
47
|
+
argostranslate = "^1.9.6"
|
|
47
48
|
# debug
|
|
48
49
|
bokeh = "^3.3.3"
|
|
49
50
|
# test
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.5.1"
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample/ParametricIF_test_result.reccsv
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyfemtet-0.5.1 → pyfemtet-0.5.3}/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.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample/cad_ex01_SW_test_result.reccsv
RENAMED
|
File without changes
|
{pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample/constrained_pipe.femprj
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample/gal_ex58_parametric.femprj
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample/gau_ex08_parametric.femprj
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample/her_ex40_parametric.femprj
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample/paswat_ex1_parametric.femprj
RENAMED
|
File without changes
|
{pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample/paswat_ex1_parametric.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample/wat_ex14_parametric.femprj
RENAMED
|
File without changes
|
|
File without changes
|
{pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample/wat_ex14_parametric_parallel.py
RENAMED
|
File without changes
|
|
File without changes
|
{pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample_jp/ParametricIF_jp.femprj
RENAMED
|
File without changes
|
|
File without changes
|
{pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample_jp/cad_ex01_NX_jp.femprj
RENAMED
|
File without changes
|
|
File without changes
|
{pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample_jp/cad_ex01_SW_jp.femprj
RENAMED
|
File without changes
|
|
File without changes
|
{pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample_jp/constrained_pipe_jp.py
RENAMED
|
File without changes
|
|
File without changes
|
{pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample_jp/gal_ex58_parametric_jp.py
RENAMED
|
File without changes
|
|
File without changes
|
{pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample_jp/gau_ex08_parametric_jp.py
RENAMED
|
File without changes
|
|
File without changes
|
{pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample_jp/her_ex40_parametric_jp.py
RENAMED
|
File without changes
|
|
File without changes
|
{pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample_jp/paswat_ex1_parametric_jp.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/samples/femprj_sample_jp/wat_ex14_parametric_jp.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/visualization/complex_components/alert_region.py
RENAMED
|
File without changes
|
{pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/visualization/complex_components/control_femtet.py
RENAMED
|
File without changes
|
|
File without changes
|
{pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/visualization/complex_components/main_graph.py
RENAMED
|
File without changes
|
|
File without changes
|
{pyfemtet-0.5.1 → pyfemtet-0.5.3}/pyfemtet/opt/visualization/complex_components/pm_graph_creator.py
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
|