mg-pso-gui 0.2.126__py3-none-any.whl → 0.2.128__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.
- {mg_pso_gui-0.2.126.dist-info → mg_pso_gui-0.2.128.dist-info}/METADATA +1 -1
- {mg_pso_gui-0.2.126.dist-info → mg_pso_gui-0.2.128.dist-info}/RECORD +8 -7
- mgpsogui/gui/SetupTab/BoundsList.py +9 -0
- mgpsogui/util/recosu/pso/csip_access.py +22 -53
- mgpsogui/util/recosu/pso/csip_access_new.py +106 -0
- {mg_pso_gui-0.2.126.dist-info → mg_pso_gui-0.2.128.dist-info}/WHEEL +0 -0
- {mg_pso_gui-0.2.126.dist-info → mg_pso_gui-0.2.128.dist-info}/entry_points.txt +0 -0
- {mg_pso_gui-0.2.126.dist-info → mg_pso_gui-0.2.128.dist-info}/top_level.txt +0 -0
@@ -14,7 +14,7 @@ mgpsogui/gui/RunTab/OptimalParameterView.py,sha256=nliUEWA840cPBQt7wjiZ-L7uBOp_o
|
|
14
14
|
mgpsogui/gui/RunTab/RunTab.py,sha256=_JWzDx5LT_uISw0Vnv-W2ypIeuKgoWqBnvFnvrLhNQA,5917
|
15
15
|
mgpsogui/gui/RunTab/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
16
16
|
mgpsogui/gui/SetupTab/BoundsEditorWindow.py,sha256=7Vic6AkBI2FStMlYyPH0-dNJJyqEckYJpwxknAqtp84,3403
|
17
|
-
mgpsogui/gui/SetupTab/BoundsList.py,sha256=
|
17
|
+
mgpsogui/gui/SetupTab/BoundsList.py,sha256=8yNV0p5tQY9YiSOTifIZn2Yhp3YtmwL4nSrNPdxjexY,16651
|
18
18
|
mgpsogui/gui/SetupTab/CustomFunctionEditorWindow.py,sha256=lZ9a20YucwhCDiUN3eGA6WXQK7laToB7FP4Zev4Zxnc,3417
|
19
19
|
mgpsogui/gui/SetupTab/CustomFunctionMetrics.py,sha256=vOJpElbTgz043m6JYwe9xz_2MBHg985S6KdbJkJERW4,5923
|
20
20
|
mgpsogui/gui/SetupTab/FunctionsList.py,sha256=wmYmppyB5y8QADe3X_FQ5mAYVDC0HAPQgqtkegNwmLA,7007
|
@@ -57,7 +57,8 @@ mgpsogui/util/CTkToolTip/__init__.py,sha256=G1jxV55hGtGgwyC1sR-uUUdasDdh0XZgcI-a
|
|
57
57
|
mgpsogui/util/CTkToolTip/ctk_tooltip.py,sha256=SZMovpQIGvdpDRbqCKl9SHs92DrFCO2MOYL2ifolvOE,6329
|
58
58
|
mgpsogui/util/recosu/__init__.py,sha256=pPR0lB6clIi6q73H1W8eT5u0dd3bIemwa9-XFmOaVVk,279
|
59
59
|
mgpsogui/util/recosu/pso/__init__.py,sha256=PQ548aEKVOk6MMzxxDg7yMO_1hHfoEoYLLkGLeij73Y,247
|
60
|
-
mgpsogui/util/recosu/pso/csip_access.py,sha256=
|
60
|
+
mgpsogui/util/recosu/pso/csip_access.py,sha256=jBli1MSShUUwQCMKOUvMaGuNwBViCrjXJi_FmSEJsZA,2721
|
61
|
+
mgpsogui/util/recosu/pso/csip_access_new.py,sha256=_oA71d6CSwhKSa3pgywIW7mXRJtgJTNu1X2DiBkQkuA,4152
|
61
62
|
mgpsogui/util/recosu/pso/pso modified.py,sha256=sFY1csASu5Os5SSheWWdpVcjpPwJeBqZKsv89DLXdxk,21648
|
62
63
|
mgpsogui/util/recosu/pso/pso.py,sha256=iPqT6aI1vi8LYuWmtxuHkLEM9sQwhUznPInBgps7ANI,13708
|
63
64
|
mgpsogui/util/recosu/pso/pso_new.py,sha256=qUwpp6gjhCTXA6twKGAda84HIeQebKGB6MJ4K9GfcdM,23181
|
@@ -75,8 +76,8 @@ mgpsogui/util/recosu/utils/trace_writer.py,sha256=V9BJlOjCbNYGoXGEk3CF5wjifBxvar
|
|
75
76
|
mgpsogui/util/recosu/utils/utils.py,sha256=6MIoJb0nhIa4tNv7qhBfZi-AtL3L95CgJf6eAf12NQs,4140
|
76
77
|
mgpsogui/util/recosu/utils/plot/__init__.py,sha256=h1KjM7_tNDv351pcwt8A6Ibb1jhwWyx5Gbu-zj-sI3Q,71
|
77
78
|
mgpsogui/util/recosu/utils/plot/cost_steps.py,sha256=1Ce11AJyweWkmvjXPxEygzS-h8yVLmQEDLS53yjPLqQ,3779
|
78
|
-
mg_pso_gui-0.2.
|
79
|
-
mg_pso_gui-0.2.
|
80
|
-
mg_pso_gui-0.2.
|
81
|
-
mg_pso_gui-0.2.
|
82
|
-
mg_pso_gui-0.2.
|
79
|
+
mg_pso_gui-0.2.128.dist-info/METADATA,sha256=RkvQhHnxpzqnXLmStczjLKtswOiQtnSe3aNb0RCG0dQ,9542
|
80
|
+
mg_pso_gui-0.2.128.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
81
|
+
mg_pso_gui-0.2.128.dist-info/entry_points.txt,sha256=jg82VOFjR1XDGrchs1wJSCqKYE4Ozv12aBcCSp--koA,117
|
82
|
+
mg_pso_gui-0.2.128.dist-info/top_level.txt,sha256=y7JuS9xJN5YdxUsQ3PSVjN8MzQAnR146bP3ZN3PYWdE,9
|
83
|
+
mg_pso_gui-0.2.128.dist-info/RECORD,,
|
@@ -7,6 +7,7 @@ from customtkinter import CTkOptionMenu
|
|
7
7
|
from customtkinter import CTkTextbox
|
8
8
|
from customtkinter import CTkImage
|
9
9
|
from .BoundsEditorWindow import BoundsEditorWindow as BEW
|
10
|
+
from .SamplingNameListWindow import SamplingNameListWindow as SNLW
|
10
11
|
from ...util.CTkToolTip import CTkToolTip as ctt
|
11
12
|
import tkinter as tk
|
12
13
|
import json
|
@@ -202,6 +203,14 @@ class BoundsList(CTkFrame):
|
|
202
203
|
expand_image = CTkImage(Image.open(os.path.join("./images", "expand.png")), size=(20, 20))
|
203
204
|
button = CTkButton(self.containerFrame, width=30, text=None, image=expand_image, command=open_window)
|
204
205
|
button.grid(row=row, column=6, padx=(5, 5), pady=(5, 5), sticky="new")
|
206
|
+
elif (bound_type == "list" and (mode == "Sampling: Random" or mode == "Sampling: Halton")):
|
207
|
+
def button_click_event_sampling(bound_index):
|
208
|
+
SNLW(title="Edit List Bound", step_index=self.step_index, bound_index=bound_index, option_manager=self.option_manager)
|
209
|
+
|
210
|
+
open_window = lambda event=None, bound_index=index: (button_click_event_sampling(bound_index))
|
211
|
+
expand_image = CTkImage(Image.open(os.path.join("./images", "expand.png")), size=(20, 20))
|
212
|
+
button = CTkButton(self.containerFrame, width=30, text=None, image=expand_image, command=open_window)
|
213
|
+
button.grid(row=row, column=6, padx=(5, 5), pady=(5, 5), sticky="new")
|
205
214
|
|
206
215
|
tt1 = ctt(bounds_min, delay=0.1, alpha=0.95, message="...")
|
207
216
|
tt2 = ctt(bounds_max, delay=0.1, alpha=0.95, message="...")
|
@@ -10,56 +10,25 @@ def csip_worker(reqq: queue.Queue, thread_no: int, stop, full_trace,
|
|
10
10
|
save_resp = conf.get('save_response_to', None) # save response, set it to a folder if responses should be saved.
|
11
11
|
|
12
12
|
while not stop():
|
13
|
+
|
13
14
|
try:
|
14
|
-
(rnd, step, iteration, particle, x,
|
15
|
+
(rnd, step, iteration, particle, x, step_param_names, calib_params, objfunc, resq) = reqq.get(True, 0.5)
|
15
16
|
# print(thread_no, particle)
|
16
|
-
|
17
|
+
|
17
18
|
c = Client(metainfo=metainfo)
|
18
19
|
|
19
|
-
all_params = {}
|
20
|
-
|
21
20
|
# static params (from args)
|
22
21
|
for param in arg_params:
|
23
22
|
c.add_data(param['name'], param['value'])
|
24
23
|
|
25
24
|
# particle params (generated from steps)
|
26
25
|
# for i, value in enumerate(x):
|
27
|
-
|
28
|
-
|
29
|
-
values = x[particle]
|
30
|
-
idx = 0
|
31
|
-
for p in step_param:
|
32
|
-
value_type = p.get('type', 'float')
|
33
|
-
if 'float' == value_type:
|
34
|
-
c.add_data(p['name'], values[idx])
|
35
|
-
all_params[p['name']] = values[idx]
|
36
|
-
idx = idx + 1
|
37
|
-
elif 'list' == value_type:
|
38
|
-
base_name = p['name']
|
39
|
-
calibration_strategy = p.get('calibration_strategy', 'mean')
|
40
|
-
|
41
|
-
if 'mean' == calibration_strategy:
|
42
|
-
mean = values[idx]
|
43
|
-
default_value = p['default_value']
|
44
|
-
value = [(1 + mean) * x for x in default_value]
|
45
|
-
c.add_data(base_name, value)
|
46
|
-
all_params[base_name] = value
|
47
|
-
idx = idx + 1
|
48
|
-
elif 'single' == calibration_strategy:
|
49
|
-
default_value = p['default_value']
|
50
|
-
sub_index = 0
|
51
|
-
value = default_value.copy()
|
52
|
-
while sub_index < len(default_value):
|
53
|
-
value[sub_index] = values[idx]
|
54
|
-
idx = idx + 1
|
55
|
-
sub_index = sub_index + 1
|
56
|
-
c.add_data(base_name, value)
|
57
|
-
all_params[base_name] = value
|
26
|
+
for idx, value in enumerate(x[particle, :]):
|
27
|
+
c.add_data(step_param_names[idx], value)
|
58
28
|
|
59
29
|
# other, previously calibrated params (other steps)
|
60
30
|
for name, value in calib_params.items():
|
61
31
|
c.add_data(name, value)
|
62
|
-
all_params[name] = value
|
63
32
|
|
64
33
|
# objective function info
|
65
34
|
for of in objfunc:
|
@@ -75,31 +44,31 @@ def csip_worker(reqq: queue.Queue, thread_no: int, stop, full_trace,
|
|
75
44
|
else:
|
76
45
|
res = c.execute(url, files=files, conf=conf)
|
77
46
|
|
78
|
-
|
47
|
+
if res.is_failed():
|
48
|
+
print(res)
|
79
49
|
|
80
50
|
if save_resp:
|
81
51
|
res.save_to(os.path.join(save_resp, 'r{}s{}i{}p{}.json'.format(rnd, step, iteration, particle)))
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
else:
|
88
|
-
# print(res)
|
89
|
-
# print(u'\u2714', end='', flush=True)
|
90
|
-
print(u'O', end='', flush=True)
|
91
|
-
cost = utils.calc_cost(res, objfunc)
|
92
|
-
resq.put((particle, cost))
|
93
|
-
# break
|
52
|
+
|
53
|
+
# print(res)
|
54
|
+
print('O', end='', flush=True)
|
55
|
+
|
56
|
+
cost = utils.calc_cost(res, objfunc)
|
94
57
|
|
95
58
|
if full_trace is not None:
|
59
|
+
all_params = {}
|
60
|
+
# for i, value in enumerate(x):
|
61
|
+
for idx, value in enumerate(x[particle, :]):
|
62
|
+
all_params[step_param_names[idx]] = value
|
63
|
+
|
64
|
+
for name, value in calib_params.items():
|
65
|
+
all_params[name] = value
|
96
66
|
full_trace.append((all_params, cost))
|
97
67
|
|
98
68
|
resq.put((particle, cost))
|
99
|
-
except:
|
100
|
-
print(
|
101
|
-
|
102
|
-
continue
|
69
|
+
except Exception as e:
|
70
|
+
print(res)
|
71
|
+
print(e)
|
103
72
|
|
104
73
|
reqq.task_done()
|
105
74
|
except queue.Empty:
|
@@ -0,0 +1,106 @@
|
|
1
|
+
from cosu import utils
|
2
|
+
from csip import Client
|
3
|
+
from typing import List, Dict, Tuple
|
4
|
+
import queue, os
|
5
|
+
|
6
|
+
|
7
|
+
def csip_worker(reqq: queue.Queue, thread_no: int, stop, full_trace,
|
8
|
+
url, files, arg_params, conf: Dict, metainfo: Dict) -> None:
|
9
|
+
async_call = conf.get('async_call', True) # default is async
|
10
|
+
save_resp = conf.get('save_response_to', None) # save response, set it to a folder if responses should be saved.
|
11
|
+
|
12
|
+
while not stop():
|
13
|
+
try:
|
14
|
+
(rnd, step, iteration, particle, x, step_param, calib_params, objfunc, resq) = reqq.get(True, 0.5)
|
15
|
+
# print(thread_no, particle)
|
16
|
+
|
17
|
+
c = Client(metainfo=metainfo)
|
18
|
+
|
19
|
+
all_params = {}
|
20
|
+
|
21
|
+
# static params (from args)
|
22
|
+
for param in arg_params:
|
23
|
+
c.add_data(param['name'], param['value'])
|
24
|
+
|
25
|
+
# particle params (generated from steps)
|
26
|
+
# for i, value in enumerate(x):
|
27
|
+
# for idx, value in enumerate(x[particle, :]):
|
28
|
+
# c.add_data(step_param_names[idx], value)
|
29
|
+
values = x[particle]
|
30
|
+
idx = 0
|
31
|
+
for p in step_param:
|
32
|
+
value_type = p.get('type', 'float')
|
33
|
+
if 'float' == value_type:
|
34
|
+
c.add_data(p['name'], values[idx])
|
35
|
+
all_params[p['name']] = values[idx]
|
36
|
+
idx = idx + 1
|
37
|
+
elif 'list' == value_type:
|
38
|
+
base_name = p['name']
|
39
|
+
calibration_strategy = p.get('calibration_strategy', 'mean')
|
40
|
+
|
41
|
+
if 'mean' == calibration_strategy:
|
42
|
+
mean = values[idx]
|
43
|
+
default_value = p['default_value']
|
44
|
+
value = [(1 + mean) * x for x in default_value]
|
45
|
+
c.add_data(base_name, value)
|
46
|
+
all_params[base_name] = value
|
47
|
+
idx = idx + 1
|
48
|
+
elif 'single' == calibration_strategy:
|
49
|
+
default_value = p['default_value']
|
50
|
+
sub_index = 0
|
51
|
+
value = default_value.copy()
|
52
|
+
while sub_index < len(default_value):
|
53
|
+
value[sub_index] = values[idx]
|
54
|
+
idx = idx + 1
|
55
|
+
sub_index = sub_index + 1
|
56
|
+
c.add_data(base_name, value)
|
57
|
+
all_params[base_name] = value
|
58
|
+
|
59
|
+
# other, previously calibrated params (other steps)
|
60
|
+
for name, value in calib_params.items():
|
61
|
+
c.add_data(name, value)
|
62
|
+
all_params[name] = value
|
63
|
+
|
64
|
+
# objective function info
|
65
|
+
for of in objfunc:
|
66
|
+
c.add_cosu(of['name'], of['of'], of['data'])
|
67
|
+
# c.add_data(of['name'], (of['data'][0], of['data'][1]))
|
68
|
+
|
69
|
+
print('.', end='', flush=True)
|
70
|
+
|
71
|
+
try:
|
72
|
+
# print(c)
|
73
|
+
if async_call:
|
74
|
+
res = c.execute_async(url, files=files, conf=conf)
|
75
|
+
else:
|
76
|
+
res = c.execute(url, files=files, conf=conf)
|
77
|
+
|
78
|
+
# run_string = 'r{}s{}i{}p{}.json'.format(rnd, step, iteration, particle)
|
79
|
+
|
80
|
+
if save_resp:
|
81
|
+
res.save_to(os.path.join(save_resp, 'r{}s{}i{}p{}.json'.format(rnd, step, iteration, particle)))
|
82
|
+
|
83
|
+
if res.is_failed():
|
84
|
+
print(u'F')
|
85
|
+
# print(res)
|
86
|
+
resq.put((particle, 100))
|
87
|
+
else:
|
88
|
+
# print(res)
|
89
|
+
# print(u'\u2714', end='', flush=True)
|
90
|
+
print(u'O', end='', flush=True)
|
91
|
+
cost = utils.calc_cost(res, objfunc)
|
92
|
+
resq.put((particle, cost))
|
93
|
+
# break
|
94
|
+
|
95
|
+
if full_trace is not None:
|
96
|
+
full_trace.append((all_params, cost))
|
97
|
+
|
98
|
+
resq.put((particle, cost))
|
99
|
+
except:
|
100
|
+
print(u'sF')
|
101
|
+
resq.put((particle, 100))
|
102
|
+
continue
|
103
|
+
|
104
|
+
reqq.task_done()
|
105
|
+
except queue.Empty:
|
106
|
+
continue
|
File without changes
|
File without changes
|
File without changes
|