pyfemtet 0.4.20__py3-none-any.whl → 0.4.23__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 +0 -2
- pyfemtet/message/locales/ja/LC_MESSAGES/messages.mo +0 -0
- pyfemtet/message/locales/ja/LC_MESSAGES/messages.po +107 -96
- pyfemtet/message/locales/messages.pot +104 -96
- pyfemtet/message/messages.py +15 -1
- pyfemtet/opt/_femopt.py +289 -230
- pyfemtet/opt/_femopt_core.py +118 -49
- pyfemtet/opt/femprj_sample/ParametricIF.py +0 -2
- pyfemtet/opt/femprj_sample/cad_ex01_NX.py +0 -8
- pyfemtet/opt/femprj_sample/cad_ex01_SW.py +0 -8
- pyfemtet/opt/femprj_sample/gal_ex58_parametric.py +0 -8
- pyfemtet/opt/femprj_sample/gau_ex08_parametric.py +0 -8
- pyfemtet/opt/femprj_sample/her_ex40_parametric.py +0 -8
- pyfemtet/opt/femprj_sample/paswat_ex1_parametric.py +0 -8
- pyfemtet/opt/femprj_sample/paswat_ex1_parametric_parallel.py +0 -8
- pyfemtet/opt/femprj_sample/wat_ex14_parametric.py +0 -8
- pyfemtet/opt/femprj_sample/wat_ex14_parametric_parallel.py +0 -8
- pyfemtet/opt/femprj_sample_jp/ParametricIF_jp.py +0 -2
- pyfemtet/opt/femprj_sample_jp/cad_ex01_NX_jp.py +0 -8
- pyfemtet/opt/femprj_sample_jp/cad_ex01_SW_jp.py +0 -8
- pyfemtet/opt/femprj_sample_jp/gal_ex58_parametric_jp.py +0 -8
- pyfemtet/opt/femprj_sample_jp/gau_ex08_parametric_jp.py +0 -8
- pyfemtet/opt/femprj_sample_jp/her_ex40_parametric_jp.py +0 -8
- pyfemtet/opt/femprj_sample_jp/paswat_ex1_parametric_jp.py +0 -8
- pyfemtet/opt/femprj_sample_jp/paswat_ex1_parametric_parallel_jp.py +0 -8
- pyfemtet/opt/femprj_sample_jp/wat_ex14_parametric_jp.py +0 -8
- pyfemtet/opt/femprj_sample_jp/wat_ex14_parametric_parallel_jp.py +0 -8
- pyfemtet/opt/interface/_femtet.py +77 -24
- pyfemtet/opt/opt/_base.py +25 -18
- pyfemtet/opt/opt/_optuna.py +53 -14
- pyfemtet/opt/opt/_optuna_botorch_helper.py +209 -0
- pyfemtet/opt/opt/_scipy.py +1 -1
- pyfemtet/opt/opt/_scipy_scalar.py +1 -1
- pyfemtet/opt/parameter.py +113 -0
- pyfemtet/opt/visualization/complex_components/main_graph.py +22 -5
- pyfemtet/opt/visualization/complex_components/pm_graph.py +77 -25
- pyfemtet/opt/visualization/complex_components/pm_graph_creator.py +7 -0
- pyfemtet/opt/visualization/process_monitor/application.py +10 -6
- pyfemtet/opt/visualization/process_monitor/pages.py +102 -0
- pyfemtet/opt/visualization/result_viewer/application.py +6 -0
- pyfemtet/opt/visualization/result_viewer/pages.py +1 -1
- {pyfemtet-0.4.20.dist-info → pyfemtet-0.4.23.dist-info}/METADATA +3 -4
- {pyfemtet-0.4.20.dist-info → pyfemtet-0.4.23.dist-info}/RECORD +47 -59
- pyfemtet/FemtetPJTSample/NX_ex01/NX_ex01.femprj +0 -0
- pyfemtet/FemtetPJTSample/NX_ex01/NX_ex01.prt +0 -0
- pyfemtet/FemtetPJTSample/NX_ex01/NX_ex01.py +0 -118
- pyfemtet/FemtetPJTSample/Sldworks_ex01/Sldworks_ex01.SLDPRT +0 -0
- pyfemtet/FemtetPJTSample/Sldworks_ex01/Sldworks_ex01.femprj +0 -0
- pyfemtet/FemtetPJTSample/Sldworks_ex01/Sldworks_ex01.py +0 -121
- pyfemtet/FemtetPJTSample/_her_ex40_parametric.py +0 -148
- pyfemtet/FemtetPJTSample/gau_ex08_parametric.femprj +0 -0
- pyfemtet/FemtetPJTSample/gau_ex08_parametric.py +0 -58
- pyfemtet/FemtetPJTSample/her_ex40_parametric.femprj +0 -0
- pyfemtet/FemtetPJTSample/her_ex40_parametric.py +0 -148
- pyfemtet/FemtetPJTSample/wat_ex14_parallel_parametric.py +0 -65
- pyfemtet/FemtetPJTSample/wat_ex14_parametric.femprj +0 -0
- pyfemtet/FemtetPJTSample/wat_ex14_parametric.py +0 -64
- {pyfemtet-0.4.20.dist-info → pyfemtet-0.4.23.dist-info}/LICENSE +0 -0
- {pyfemtet-0.4.20.dist-info → pyfemtet-0.4.23.dist-info}/WHEEL +0 -0
- {pyfemtet-0.4.20.dist-info → pyfemtet-0.4.23.dist-info}/entry_points.txt +0 -0
pyfemtet/opt/_femopt_core.py
CHANGED
|
@@ -13,6 +13,7 @@ import ctypes
|
|
|
13
13
|
import numpy as np
|
|
14
14
|
import pandas as pd
|
|
15
15
|
from scipy.stats.qmc import LatinHypercube
|
|
16
|
+
import optuna
|
|
16
17
|
from optuna._hypervolume import WFG
|
|
17
18
|
from dask.distributed import Lock, get_client
|
|
18
19
|
|
|
@@ -336,6 +337,25 @@ class Constraint(Function):
|
|
|
336
337
|
super().__init__(fun, name, args, kwargs)
|
|
337
338
|
|
|
338
339
|
|
|
340
|
+
# from pyfemtet.opt.opt import AbstractOptimizer
|
|
341
|
+
class ParameterConstraint(Constraint):
|
|
342
|
+
"""Variable のみを引数とする constraint 関数"""
|
|
343
|
+
|
|
344
|
+
def __init__(self, fun, name, lb, ub, opt: 'AbstractOptimizer'):
|
|
345
|
+
super().__init__(fun, name, lb, ub, strict=True, args=None, kwargs=None)
|
|
346
|
+
self.opt = opt
|
|
347
|
+
self.prm_args = [arg.name for arg in inspect.signature(self.fun).parameters.values()]
|
|
348
|
+
|
|
349
|
+
def calc(self, _):
|
|
350
|
+
# variables 全体から fun に対する引数を作成する
|
|
351
|
+
kwargs: dict = self.opt.get_parameter('dict')
|
|
352
|
+
keys = list(kwargs.keys())
|
|
353
|
+
for k in keys:
|
|
354
|
+
if k not in self.prm_args:
|
|
355
|
+
kwargs.pop(k)
|
|
356
|
+
return float(self.fun(**kwargs))
|
|
357
|
+
|
|
358
|
+
|
|
339
359
|
class _HistoryDfCore:
|
|
340
360
|
"""Class for managing a DataFrame object in a distributed manner."""
|
|
341
361
|
|
|
@@ -369,7 +389,6 @@ class History:
|
|
|
369
389
|
prm_names (str): User defined names of parameters.
|
|
370
390
|
obj_names (str): User defined names of objectives.
|
|
371
391
|
cns_names (str): User defined names of constraints.
|
|
372
|
-
local_data (pd.DataFrame): Local copy (on memory) of optimization history.
|
|
373
392
|
is_restart (bool): If the optimization process is a continuation of another process or not.
|
|
374
393
|
is_processing (bool): The optimization is running or not.
|
|
375
394
|
|
|
@@ -382,8 +401,9 @@ class History:
|
|
|
382
401
|
cns_names = []
|
|
383
402
|
is_restart = False
|
|
384
403
|
is_processing = False
|
|
385
|
-
|
|
386
|
-
|
|
404
|
+
_df = None # in case without client
|
|
405
|
+
_future = None # in case with client
|
|
406
|
+
_actor_data = None # in case with client
|
|
387
407
|
|
|
388
408
|
def __init__(
|
|
389
409
|
self,
|
|
@@ -402,9 +422,6 @@ class History:
|
|
|
402
422
|
self.cns_names = cns_names
|
|
403
423
|
self.additional_metadata = additional_metadata or ''
|
|
404
424
|
|
|
405
|
-
# 初期化
|
|
406
|
-
self.local_data = pd.DataFrame()
|
|
407
|
-
|
|
408
425
|
# 最適化実行中かどうか
|
|
409
426
|
self.is_processing = client is not None
|
|
410
427
|
|
|
@@ -425,12 +442,11 @@ class History:
|
|
|
425
442
|
# そうでなければ df を初期化
|
|
426
443
|
else:
|
|
427
444
|
columns, metadata = self.create_df_columns()
|
|
445
|
+
df = pd.DataFrame()
|
|
428
446
|
for c in columns:
|
|
429
|
-
|
|
447
|
+
df[c] = None
|
|
430
448
|
self.metadata = metadata
|
|
431
|
-
|
|
432
|
-
# actor_data の初期化
|
|
433
|
-
self.actor_data = self.local_data
|
|
449
|
+
self.set_df(df)
|
|
434
450
|
|
|
435
451
|
# 一時ファイルに書き込みを試み、UnicodeEncodeError が出ないかチェック
|
|
436
452
|
import tempfile
|
|
@@ -446,14 +462,14 @@ class History:
|
|
|
446
462
|
if not os.path.isfile(self.path):
|
|
447
463
|
raise FileNotFoundError(self.path)
|
|
448
464
|
|
|
449
|
-
# csv
|
|
465
|
+
# csv の読み込み
|
|
450
466
|
self.load()
|
|
451
467
|
|
|
452
468
|
def load(self):
|
|
453
469
|
"""Load existing result csv."""
|
|
454
470
|
|
|
455
471
|
# df を読み込む
|
|
456
|
-
|
|
472
|
+
df = pd.read_csv(self.path, encoding=self.ENCODING, header=self.HEADER_ROW)
|
|
457
473
|
|
|
458
474
|
# metadata を読み込む
|
|
459
475
|
with open(self.path, mode='r', encoding=self.ENCODING, newline='\n') as f:
|
|
@@ -461,7 +477,7 @@ class History:
|
|
|
461
477
|
self.metadata = reader.__next__()
|
|
462
478
|
|
|
463
479
|
# 最適化問題を読み込む
|
|
464
|
-
columns =
|
|
480
|
+
columns = df.columns
|
|
465
481
|
prm_names = [column for i, column in enumerate(columns) if self.metadata[i] == 'prm']
|
|
466
482
|
obj_names = [column for i, column in enumerate(columns) if self.metadata[i] == 'obj']
|
|
467
483
|
cns_names = [column for i, column in enumerate(columns) if self.metadata[i] == 'cns']
|
|
@@ -478,13 +494,19 @@ class History:
|
|
|
478
494
|
self.obj_names = obj_names
|
|
479
495
|
self.cns_names = cns_names
|
|
480
496
|
|
|
481
|
-
|
|
482
|
-
def actor_data(self):
|
|
483
|
-
return self._actor_data.get_df().result()
|
|
497
|
+
self.set_df(df)
|
|
484
498
|
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
499
|
+
def get_df(self) -> pd.DataFrame:
|
|
500
|
+
if self._actor_data is None:
|
|
501
|
+
return self._df
|
|
502
|
+
else:
|
|
503
|
+
return self._actor_data.get_df().result()
|
|
504
|
+
|
|
505
|
+
def set_df(self, df: pd.DataFrame):
|
|
506
|
+
if self._actor_data is None:
|
|
507
|
+
self._df = df
|
|
508
|
+
else:
|
|
509
|
+
self._actor_data.set_df(df).result()
|
|
488
510
|
|
|
489
511
|
def create_df_columns(self):
|
|
490
512
|
"""Create columns of history."""
|
|
@@ -569,8 +591,8 @@ class History:
|
|
|
569
591
|
# parameters
|
|
570
592
|
for i, _row in parameters.iterrows():
|
|
571
593
|
row.append(_row['value'])
|
|
572
|
-
row.append(_row['
|
|
573
|
-
row.append(_row['
|
|
594
|
+
row.append(_row['lower_bound'])
|
|
595
|
+
row.append(_row['upper_bound'])
|
|
574
596
|
|
|
575
597
|
# objectives and their direction
|
|
576
598
|
for (_, obj), obj_value in zip(objectives.items(), obj_values): # objectives, direction
|
|
@@ -594,29 +616,33 @@ class History:
|
|
|
594
616
|
row.append(datetime.datetime.now()) # time
|
|
595
617
|
|
|
596
618
|
with Lock('calc-history'):
|
|
619
|
+
|
|
620
|
+
df = self.get_df()
|
|
621
|
+
|
|
597
622
|
# append
|
|
598
|
-
if len(
|
|
599
|
-
|
|
623
|
+
if len(df) == 0:
|
|
624
|
+
df = pd.DataFrame([row], columns=df.columns)
|
|
600
625
|
else:
|
|
601
|
-
|
|
602
|
-
self.local_data.loc[len(self.local_data)] = row
|
|
626
|
+
df.loc[len(df)] = row
|
|
603
627
|
|
|
604
628
|
# calc
|
|
605
|
-
|
|
606
|
-
self._calc_non_domi(objectives) # update
|
|
607
|
-
self._calc_hypervolume(objectives) # update
|
|
608
|
-
|
|
629
|
+
df['trial'] = np.arange(len(df)) + 1 # 1 始まり
|
|
630
|
+
self._calc_non_domi(objectives, df) # update df
|
|
631
|
+
self._calc_hypervolume(objectives, df) # update df
|
|
632
|
+
|
|
633
|
+
self.set_df(df)
|
|
609
634
|
|
|
610
635
|
# save file
|
|
611
636
|
if postprocess_args is not None:
|
|
612
|
-
|
|
637
|
+
df = self.get_df()
|
|
638
|
+
trial = df['trial'].values[-1]
|
|
613
639
|
client = get_client() # always returns valid client
|
|
614
640
|
client.run_on_scheduler(postprocess_func, trial, **postprocess_args)
|
|
615
641
|
|
|
616
|
-
def _calc_non_domi(self, objectives):
|
|
642
|
+
def _calc_non_domi(self, objectives, df):
|
|
617
643
|
|
|
618
644
|
# 目的関数の履歴を取り出してくる
|
|
619
|
-
solution_set =
|
|
645
|
+
solution_set = df[self.obj_names]
|
|
620
646
|
|
|
621
647
|
# 最小化問題の座標空間に変換する
|
|
622
648
|
for obj_column, (_, objective) in zip(self.obj_names, objectives.items()):
|
|
@@ -628,15 +654,13 @@ class History:
|
|
|
628
654
|
non_domi.append((row > solution_set).product(axis=1).sum(axis=0) == 0)
|
|
629
655
|
|
|
630
656
|
# 非劣解の登録
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
def _calc_hypervolume(self, objectives):
|
|
657
|
+
df['non_domi'] = non_domi
|
|
634
658
|
|
|
635
|
-
|
|
636
|
-
df = self.local_data
|
|
659
|
+
def _calc_hypervolume(self, objectives, df):
|
|
637
660
|
|
|
638
|
-
#
|
|
661
|
+
# filter non-dominated and feasible solutions
|
|
639
662
|
idx = df['non_domi'].values
|
|
663
|
+
idx = idx * df['feasible'].values # *= を使うと non_domi 列の値が変わる
|
|
640
664
|
pdf = df[idx]
|
|
641
665
|
pareto_set = pdf[self.obj_names].values
|
|
642
666
|
n = len(pareto_set) # 集合の要素数
|
|
@@ -671,20 +695,29 @@ class History:
|
|
|
671
695
|
hvs.append(hv)
|
|
672
696
|
|
|
673
697
|
# 計算結果を履歴の一部に割り当て
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
#
|
|
677
|
-
|
|
698
|
+
# idx: [False, True, False, True, True, False, ...]
|
|
699
|
+
# hvs: [ 1, 2, 3, ...]
|
|
700
|
+
# want:[ 0, 1, 1, 2, 3, 3, ...]
|
|
701
|
+
hvs_index = -1
|
|
678
702
|
for i in range(len(df)):
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
703
|
+
|
|
704
|
+
# process hvs index
|
|
705
|
+
if idx[i]:
|
|
706
|
+
hvs_index += 1
|
|
707
|
+
|
|
708
|
+
# get hv
|
|
709
|
+
if hvs_index < 0:
|
|
710
|
+
hypervolume = 0.
|
|
711
|
+
else:
|
|
712
|
+
hypervolume = hvs[hvs_index]
|
|
713
|
+
|
|
714
|
+
df.loc[i, 'hypervolume'] = hypervolume
|
|
684
715
|
|
|
685
716
|
def save(self, _f=None):
|
|
686
717
|
"""Save csv file."""
|
|
687
718
|
|
|
719
|
+
df = self.get_df()
|
|
720
|
+
|
|
688
721
|
if _f is None:
|
|
689
722
|
# save df with columns with prefix
|
|
690
723
|
with open(self.path, 'w', encoding=self.ENCODING) as f:
|
|
@@ -692,9 +725,45 @@ class History:
|
|
|
692
725
|
writer.writerow(self.metadata)
|
|
693
726
|
for i in range(self.HEADER_ROW-1):
|
|
694
727
|
writer.writerow([''] * len(self.metadata))
|
|
695
|
-
|
|
728
|
+
df.to_csv(f, index=None, encoding=self.ENCODING, lineterminator='\n')
|
|
696
729
|
else: # test
|
|
697
|
-
|
|
730
|
+
df.to_csv(_f, index=None, encoding=self.ENCODING, lineterminator='\n')
|
|
731
|
+
|
|
732
|
+
def create_optuna_study(self):
|
|
733
|
+
# create study
|
|
734
|
+
kwargs = dict(
|
|
735
|
+
# storage='sqlite:///' + os.path.basename(self.path) + '_dummy.db',
|
|
736
|
+
sampler=None, pruner=None, study_name='dummy',
|
|
737
|
+
load_if_exists=True,
|
|
738
|
+
)
|
|
739
|
+
|
|
740
|
+
if len(self.obj_names) == 1:
|
|
741
|
+
kwargs.update(dict(direction='minimize'))
|
|
742
|
+
else:
|
|
743
|
+
kwargs.update(dict(directions=['minimize']*len(self.obj_names)))
|
|
744
|
+
|
|
745
|
+
study = optuna.create_study(**kwargs)
|
|
746
|
+
|
|
747
|
+
# add trial to study
|
|
748
|
+
df: pd.DataFrame = self.get_df()
|
|
749
|
+
for i, row in df.iterrows():
|
|
750
|
+
FD = optuna.distributions.FloatDistribution
|
|
751
|
+
kwargs = dict(
|
|
752
|
+
state=optuna.trial.TrialState.COMPLETE,
|
|
753
|
+
params={k: v for k, v in zip(self.prm_names, row[self.prm_names])},
|
|
754
|
+
distributions={k: FD(row[f'{k}_lower_bound'], row[f'{k}_upper_bound']) for k in self.prm_names},
|
|
755
|
+
user_attrs=None, # TODO: add constraint information by row['feasible']
|
|
756
|
+
)
|
|
757
|
+
|
|
758
|
+
# objective or objectives
|
|
759
|
+
if len(self.obj_names) == 1:
|
|
760
|
+
kwargs.update(dict(value=row[self.obj_names].values[0]))
|
|
761
|
+
else:
|
|
762
|
+
kwargs.update(dict(values=row[self.obj_names].values))
|
|
763
|
+
trial = optuna.create_trial(**kwargs)
|
|
764
|
+
study.add_trial(trial)
|
|
765
|
+
|
|
766
|
+
return study
|
|
698
767
|
|
|
699
768
|
|
|
700
769
|
class _OptimizationStatusActor:
|
|
@@ -133,11 +133,3 @@ if __name__ == '__main__':
|
|
|
133
133
|
# Run optimization.
|
|
134
134
|
femopt.set_random_seed(42)
|
|
135
135
|
femopt.optimize(n_trials=20)
|
|
136
|
-
|
|
137
|
-
# Stop script to keep process alive
|
|
138
|
-
# while you check the result in process monitor.
|
|
139
|
-
print('================================')
|
|
140
|
-
print('Finished. Press Enter to quit...')
|
|
141
|
-
print('================================')
|
|
142
|
-
input()
|
|
143
|
-
femopt.terminate_all()
|
|
@@ -129,11 +129,3 @@ if __name__ == '__main__':
|
|
|
129
129
|
# Run optimization.
|
|
130
130
|
femopt.set_random_seed(42)
|
|
131
131
|
femopt.optimize(n_trials=20)
|
|
132
|
-
|
|
133
|
-
# Stop script to keep process alive
|
|
134
|
-
# while you check the result in process monitor.
|
|
135
|
-
print('================================')
|
|
136
|
-
print('Finished. Press Enter to quit...')
|
|
137
|
-
print('================================')
|
|
138
|
-
input()
|
|
139
|
-
femopt.terminate_all()
|
|
@@ -72,11 +72,3 @@ if __name__ == '__main__':
|
|
|
72
72
|
# Run optimization.
|
|
73
73
|
femopt.set_random_seed(42)
|
|
74
74
|
femopt.optimize(n_trials=10)
|
|
75
|
-
|
|
76
|
-
# Stop script to keep process alive
|
|
77
|
-
# while you check the result in process monitor.
|
|
78
|
-
print('================================')
|
|
79
|
-
print('Finished. Press Enter to quit...')
|
|
80
|
-
print('================================')
|
|
81
|
-
input()
|
|
82
|
-
femopt.terminate_all()
|
|
@@ -56,11 +56,3 @@ if __name__ == '__main__':
|
|
|
56
56
|
# Run optimization.
|
|
57
57
|
femopt.set_random_seed(42)
|
|
58
58
|
femopt.optimize(n_trials=20)
|
|
59
|
-
|
|
60
|
-
# Stop script to keep process alive
|
|
61
|
-
# while you check the result in process monitor.
|
|
62
|
-
print('================================')
|
|
63
|
-
print('Finished. Press Enter to quit...')
|
|
64
|
-
print('================================')
|
|
65
|
-
input()
|
|
66
|
-
femopt.terminate_all()
|
|
@@ -134,11 +134,3 @@ if __name__ == '__main__':
|
|
|
134
134
|
|
|
135
135
|
femopt.set_random_seed(42)
|
|
136
136
|
femopt.optimize(n_trials=15)
|
|
137
|
-
|
|
138
|
-
# Stop script to keep process alive
|
|
139
|
-
# while you check the result in process monitor.
|
|
140
|
-
print('================================')
|
|
141
|
-
print('Finished. Press Enter to quit...')
|
|
142
|
-
print('================================')
|
|
143
|
-
input()
|
|
144
|
-
femopt.terminate_all()
|
|
@@ -58,11 +58,3 @@ if __name__ == '__main__':
|
|
|
58
58
|
# Run optimization.
|
|
59
59
|
femopt.set_random_seed(42)
|
|
60
60
|
femopt.optimize(n_trials=15)
|
|
61
|
-
|
|
62
|
-
# Stop script to keep process alive
|
|
63
|
-
# while you check the result in process monitor.
|
|
64
|
-
print('================================')
|
|
65
|
-
print('Finished. Press Enter to quit...')
|
|
66
|
-
print('================================')
|
|
67
|
-
input()
|
|
68
|
-
femopt.terminate_all()
|
|
@@ -59,11 +59,3 @@ if __name__ == '__main__':
|
|
|
59
59
|
femopt.set_random_seed(42)
|
|
60
60
|
# femopt.optimize(n_trials=15)
|
|
61
61
|
femopt.optimize(n_trials=30, n_parallel=3) # This line is the only difference with no parallel pattern.
|
|
62
|
-
|
|
63
|
-
# Stop script to keep process alive
|
|
64
|
-
# while you check the result in process monitor.
|
|
65
|
-
print('================================')
|
|
66
|
-
print('Finished. Press Enter to quit...')
|
|
67
|
-
print('================================')
|
|
68
|
-
input()
|
|
69
|
-
femopt.terminate_all()
|
|
@@ -56,11 +56,3 @@ if __name__ == '__main__':
|
|
|
56
56
|
# Run optimization.
|
|
57
57
|
femopt.set_random_seed(42)
|
|
58
58
|
femopt.optimize(n_trials=15)
|
|
59
|
-
|
|
60
|
-
# Stop script to keep process alive
|
|
61
|
-
# while you check the result in process monitor.
|
|
62
|
-
print('================================')
|
|
63
|
-
print('Finished. Press Enter to quit...')
|
|
64
|
-
print('================================')
|
|
65
|
-
input()
|
|
66
|
-
femopt.terminate_all()
|
|
@@ -56,11 +56,3 @@ if __name__ == '__main__':
|
|
|
56
56
|
# Run optimization.
|
|
57
57
|
femopt.set_random_seed(42)
|
|
58
58
|
femopt.optimize(n_trials=15, n_parallel=3) # This line is the only difference with no parallel pattern.
|
|
59
|
-
|
|
60
|
-
# Stop script to keep process alive
|
|
61
|
-
# while you check the result in process monitor.
|
|
62
|
-
print('================================')
|
|
63
|
-
print('Finished. Press Enter to quit...')
|
|
64
|
-
print('================================')
|
|
65
|
-
input()
|
|
66
|
-
femopt.terminate_all()
|
|
@@ -127,11 +127,3 @@ if __name__ == '__main__':
|
|
|
127
127
|
# 最適化を実行
|
|
128
128
|
femopt.set_random_seed(42)
|
|
129
129
|
femopt.optimize(n_trials=20)
|
|
130
|
-
|
|
131
|
-
# プロセスモニタで結果を確認するために
|
|
132
|
-
# Enter キーが押されるまで処理を停止します。
|
|
133
|
-
print('================================')
|
|
134
|
-
print('Finished. Press Enter to quit...')
|
|
135
|
-
print('================================')
|
|
136
|
-
input()
|
|
137
|
-
femopt.terminate_all()
|
|
@@ -123,11 +123,3 @@ if __name__ == '__main__':
|
|
|
123
123
|
# 最適化を実行
|
|
124
124
|
femopt.set_random_seed(42)
|
|
125
125
|
femopt.optimize(n_trials=20)
|
|
126
|
-
|
|
127
|
-
# プロセスモニタで結果を確認するために
|
|
128
|
-
# Enter キーが押されるまで処理を停止します。
|
|
129
|
-
print('================================')
|
|
130
|
-
print('Finished. Press Enter to quit...')
|
|
131
|
-
print('================================')
|
|
132
|
-
input()
|
|
133
|
-
femopt.terminate_all()
|
|
@@ -68,11 +68,3 @@ if __name__ == '__main__':
|
|
|
68
68
|
# 最適化を実行
|
|
69
69
|
femopt.set_random_seed(42)
|
|
70
70
|
femopt.optimize(n_trials=10)
|
|
71
|
-
|
|
72
|
-
# プロセスモニタで結果を確認するために
|
|
73
|
-
# Enter キーが押されるまで処理を停止します。
|
|
74
|
-
print('================================')
|
|
75
|
-
print('Finished. Press Enter to quit...')
|
|
76
|
-
print('================================')
|
|
77
|
-
input()
|
|
78
|
-
femopt.terminate_all()
|
|
@@ -55,11 +55,3 @@ if __name__ == '__main__':
|
|
|
55
55
|
# 最適化を実行
|
|
56
56
|
femopt.set_random_seed(42)
|
|
57
57
|
femopt.optimize(n_trials=20)
|
|
58
|
-
|
|
59
|
-
# プロセスモニタで結果を確認するために
|
|
60
|
-
# Enter キーが押されるまで処理を停止します。
|
|
61
|
-
print('================================')
|
|
62
|
-
print('Finished. Press Enter to quit...')
|
|
63
|
-
print('================================')
|
|
64
|
-
input()
|
|
65
|
-
femopt.terminate_all()
|
|
@@ -134,11 +134,3 @@ if __name__ == '__main__':
|
|
|
134
134
|
|
|
135
135
|
femopt.set_random_seed(42)
|
|
136
136
|
femopt.optimize(n_trials=15)
|
|
137
|
-
|
|
138
|
-
# プロセスモニタで結果を確認するために
|
|
139
|
-
# Enter キーが押されるまで処理を停止します。
|
|
140
|
-
print('================================')
|
|
141
|
-
print('Finished. Press Enter to quit...')
|
|
142
|
-
print('================================')
|
|
143
|
-
input()
|
|
144
|
-
femopt.terminate_all()
|
|
@@ -56,11 +56,3 @@ if __name__ == '__main__':
|
|
|
56
56
|
# 最適化を実行
|
|
57
57
|
femopt.set_random_seed(42)
|
|
58
58
|
femopt.optimize(n_trials=15)
|
|
59
|
-
|
|
60
|
-
# プロセスモニタで結果を確認するために
|
|
61
|
-
# Enter キーが押されるまで処理を停止します。
|
|
62
|
-
print('================================')
|
|
63
|
-
print('Finished. Press Enter to quit...')
|
|
64
|
-
print('================================')
|
|
65
|
-
input()
|
|
66
|
-
femopt.terminate_all()
|
|
@@ -57,11 +57,3 @@ if __name__ == '__main__':
|
|
|
57
57
|
femopt.set_random_seed(42)
|
|
58
58
|
# femopt.optimize(n_trials=15)
|
|
59
59
|
femopt.optimize(n_trials=30, n_parallel=3) # 並列計算しない場合との差はこの行のみです。
|
|
60
|
-
|
|
61
|
-
# プロセスモニタで結果を確認するために
|
|
62
|
-
# Enter キーが押されるまで処理を停止します。
|
|
63
|
-
print('================================')
|
|
64
|
-
print('Finished. Press Enter to quit...')
|
|
65
|
-
print('================================')
|
|
66
|
-
input()
|
|
67
|
-
femopt.terminate_all()
|
|
@@ -54,11 +54,3 @@ if __name__ == '__main__':
|
|
|
54
54
|
# 最適化を実行
|
|
55
55
|
femopt.set_random_seed(42)
|
|
56
56
|
femopt.optimize(n_trials=15)
|
|
57
|
-
|
|
58
|
-
# プロセスモニタで結果を確認するために
|
|
59
|
-
# Enter キーが押されるまで処理を停止します。
|
|
60
|
-
print('================================')
|
|
61
|
-
print('Finished. Press Enter to quit...')
|
|
62
|
-
print('================================')
|
|
63
|
-
input()
|
|
64
|
-
femopt.terminate_all()
|
|
@@ -54,11 +54,3 @@ if __name__ == '__main__':
|
|
|
54
54
|
# 最適化を実行
|
|
55
55
|
femopt.set_random_seed(42)
|
|
56
56
|
femopt.optimize(n_trials=15, n_parallel=3) # この部分のみ変更します
|
|
57
|
-
|
|
58
|
-
# プロセスモニタで結果を確認するために
|
|
59
|
-
# Enter キーが押されるまで処理を停止します。
|
|
60
|
-
print('================================')
|
|
61
|
-
print('Finished. Press Enter to quit...')
|
|
62
|
-
print('================================')
|
|
63
|
-
input()
|
|
64
|
-
femopt.terminate_all()
|