mg-pso-gui 0.1.40__py3-none-any.whl → 0.2.76__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- {mg_pso_gui-0.1.40.dist-info → mg_pso_gui-0.2.76.dist-info}/METADATA +10 -11
- mg_pso_gui-0.2.76.dist-info/RECORD +76 -0
- {mg_pso_gui-0.1.40.dist-info → mg_pso_gui-0.2.76.dist-info}/WHEEL +1 -1
- mgpsogui/gui/General/ParameterView.py +110 -0
- mgpsogui/gui/General/__init__.py +0 -0
- mgpsogui/gui/HomePage.py +234 -238
- mgpsogui/gui/OptionManager.py +333 -145
- mgpsogui/gui/OptionManager_backup.py +443 -0
- mgpsogui/gui/PlatformTab/PlatformTab.py +15 -6
- mgpsogui/gui/RunTab/OptimalParameterView.py +47 -0
- mgpsogui/gui/RunTab/RunTab.py +90 -17
- mgpsogui/gui/SetupTab/BoundsEditorWindow.py +1 -1
- mgpsogui/gui/SetupTab/BoundsList.py +97 -34
- mgpsogui/gui/SetupTab/CustomFunctionEditorWindow.py +74 -0
- mgpsogui/gui/SetupTab/CustomFunctionMetrics.py +156 -0
- mgpsogui/gui/SetupTab/FunctionsList.py +60 -6
- mgpsogui/gui/SetupTab/{StaticParameterView.py → ListEditor.py} +27 -16
- mgpsogui/gui/SetupTab/ListParametersView.py +7 -6
- mgpsogui/gui/SetupTab/{CalibrationParametersView.py → OverrideParameterMetrics.py} +35 -9
- mgpsogui/gui/SetupTab/OverrideParameterWindow.py +40 -0
- mgpsogui/gui/SetupTab/SetupTab.py +31 -11
- mgpsogui/gui/SetupTab/StepView.py +93 -22
- mgpsogui/gui/VisualizeTab/MatrixEditor.py +68 -0
- mgpsogui/gui/VisualizeTab/SideBar.py +358 -61
- mgpsogui/gui/VisualizeTab/VisualizeTab.py +69 -8
- mgpsogui/gui/defaults/__init__.py +0 -0
- mgpsogui/gui/defaults/optimization.json +176 -0
- mgpsogui/gui/defaults/sampling.json +111 -0
- mgpsogui/gui/defaults/sensitivity.json +20 -0
- mgpsogui/gui/images/plus.png +0 -0
- mgpsogui/util/GraphGenerator.py +721 -50
- mgpsogui/util/PSORunner.py +615 -86
- mgpsogui/util/debug.py +559 -0
- mgpsogui/util/helpers.py +95 -0
- mgpsogui/util/recosu/__init__.py +2 -1
- mgpsogui/util/recosu/pso/pso.py +55 -11
- mgpsogui/util/recosu/sampling/__init__.py +16 -0
- mgpsogui/util/recosu/sampling/halton/__init__.py +0 -0
- mgpsogui/util/recosu/sampling/halton/halton.py +45 -0
- mgpsogui/util/recosu/sampling/halton/prime.py +82 -0
- mgpsogui/util/recosu/sampling/random/__init__.py +0 -0
- mgpsogui/util/recosu/sampling/random/random_sampler.py +34 -0
- mgpsogui/util/recosu/sampling/sample_trace_writer.py +47 -0
- mgpsogui/util/recosu/sampling/sampler_task.py +75 -0
- mgpsogui/util/recosu/sampling/sampling.py +99 -0
- mgpsogui/util/sampler_test_driver.py +129 -0
- mg_pso_gui-0.1.40.dist-info/RECORD +0 -52
- mgpsogui/gui/images/IGOW 4 Logo.png +0 -0
- {mg_pso_gui-0.1.40.dist-info → mg_pso_gui-0.2.76.dist-info}/entry_points.txt +0 -0
- {mg_pso_gui-0.1.40.dist-info → mg_pso_gui-0.2.76.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,443 @@
|
|
1
|
+
from tkinter import StringVar as sv
|
2
|
+
from tkinter import IntVar as iv
|
3
|
+
from tkinter import BooleanVar as bv
|
4
|
+
from tkinter import DoubleVar as dv
|
5
|
+
import json
|
6
|
+
|
7
|
+
class OptionManager():
|
8
|
+
|
9
|
+
def __init__(self):
|
10
|
+
|
11
|
+
self.project_data = {"name": "", "path": ""}
|
12
|
+
self.arguments = {"param": [],
|
13
|
+
"url": sv(),
|
14
|
+
"urls": {},
|
15
|
+
"mode": sv(),
|
16
|
+
"files": {},
|
17
|
+
"calibration_parameters": [],
|
18
|
+
"service_parameters": [],
|
19
|
+
"figure_parameters": [],
|
20
|
+
"sensitivity_parameters": [],
|
21
|
+
"sensitivity_positiveBestMetrics": [],
|
22
|
+
"sensitivity_negativeBestMetrics": []}
|
23
|
+
|
24
|
+
self.steps = []
|
25
|
+
self.service_parameters = {}
|
26
|
+
|
27
|
+
self.service_modes = ["Sampling: Halton", "Sampling: Random", "Sensitivity Analysis", "Optimization"]
|
28
|
+
for mode in self.service_modes:
|
29
|
+
self.arguments["urls"][mode] = sv()
|
30
|
+
|
31
|
+
|
32
|
+
def clear(self):
|
33
|
+
self.arguments['param'].clear()
|
34
|
+
self.arguments['url'].set("")
|
35
|
+
for mode in self.service_modes:
|
36
|
+
self.arguments["urls"][mode].set("")
|
37
|
+
self.arguments['mode'].set("Optimization")
|
38
|
+
self.arguments['files'] = {}
|
39
|
+
self.arguments['calibration_parameters'].clear()
|
40
|
+
self.arguments['service_parameters'].clear()
|
41
|
+
self.arguments['figure_parameters'].clear()
|
42
|
+
self.arguments['sensitivity_parameters'].clear()
|
43
|
+
self.arguments['sensitivity_positiveBestMetrics'].clear()
|
44
|
+
self.arguments['sensitivity_negativeBestMetrics'].clear()
|
45
|
+
self.steps = []
|
46
|
+
self.service_parameters = {}
|
47
|
+
|
48
|
+
def add_arguments(self, arguments):
|
49
|
+
|
50
|
+
if ("mode" in arguments):
|
51
|
+
self.arguments["mode"].set(arguments["mode"])
|
52
|
+
|
53
|
+
if ("url" in arguments):
|
54
|
+
self.arguments["urls"][self.arguments["mode"].get()].set(arguments["url"])
|
55
|
+
|
56
|
+
if ("files" in arguments):
|
57
|
+
for file in arguments["files"]:
|
58
|
+
name = file["name"]
|
59
|
+
value = file["value"]
|
60
|
+
obj = {"name": sv(), "value": sv()}
|
61
|
+
obj["name"].set(name)
|
62
|
+
obj["value"].set(value)
|
63
|
+
self.arguments["files"][name] = obj
|
64
|
+
|
65
|
+
for param in arguments["param"]:
|
66
|
+
name = param["name"]
|
67
|
+
value = param["value"]
|
68
|
+
obj = {"name": sv(), "value": sv()}
|
69
|
+
obj["name"].set(name)
|
70
|
+
obj["value"].set(value)
|
71
|
+
self.arguments["param"].append(obj)
|
72
|
+
|
73
|
+
for param in arguments["calibration_parameters"]:
|
74
|
+
name = param["name"]
|
75
|
+
value = param["value"]
|
76
|
+
obj = {"name": sv(), "value": sv()}
|
77
|
+
obj["name"].set(name)
|
78
|
+
obj["value"].set(value)
|
79
|
+
self.arguments["calibration_parameters"].append(obj)
|
80
|
+
|
81
|
+
for param in arguments["service_parameters"]:
|
82
|
+
name = param["name"]
|
83
|
+
value = param["value"]
|
84
|
+
obj = {"name": sv(), "value": sv()}
|
85
|
+
obj["name"].set(name)
|
86
|
+
obj["value"].set(value)
|
87
|
+
self.arguments["service_parameters"].append(obj)
|
88
|
+
|
89
|
+
def add_steps(self, steps):
|
90
|
+
for step in steps:
|
91
|
+
obj = {"param": [],
|
92
|
+
"overrideparam": [],
|
93
|
+
"objfunc": [],
|
94
|
+
"name": sv(),
|
95
|
+
"open": False}
|
96
|
+
obj["name"].set("Group " + str(len(self.steps) + 1))
|
97
|
+
|
98
|
+
if "param" in step:
|
99
|
+
for param in step["param"]:
|
100
|
+
param_obj = {
|
101
|
+
"name": sv(),
|
102
|
+
"bounds": (sv(), sv()),
|
103
|
+
"default_value": sv(),
|
104
|
+
"optimal_value": sv(),
|
105
|
+
"type": sv(),
|
106
|
+
"calibration_strategy": sv()
|
107
|
+
}
|
108
|
+
param_obj["name"].set(param["name"])
|
109
|
+
if "bounds" in param:
|
110
|
+
param_obj["bounds"][0].set(param["bounds"][0])
|
111
|
+
param_obj["bounds"][1].set(param["bounds"][1])
|
112
|
+
else:
|
113
|
+
param_obj["bounds"][0].set(0)
|
114
|
+
param_obj["bounds"][1].set(1)
|
115
|
+
|
116
|
+
if "type" in param:
|
117
|
+
param_obj["type"].set(param["type"])
|
118
|
+
else:
|
119
|
+
param_obj["type"].set("float")
|
120
|
+
|
121
|
+
if "default_value" in param:
|
122
|
+
param_obj["default_value"].set(param["default_value"])
|
123
|
+
else:
|
124
|
+
param_obj["default_value"].set(1)
|
125
|
+
|
126
|
+
if "optimal_value" in param:
|
127
|
+
param_obj["optimal_value"].set(param["optimal_value"])
|
128
|
+
else:
|
129
|
+
param_obj["optimal_value"].set(0)
|
130
|
+
|
131
|
+
if "calibration_strategy" in param:
|
132
|
+
param_obj["calibration_strategy"].set(param["calibration_strategy"])
|
133
|
+
else:
|
134
|
+
param_obj["calibration_strategy"].set("none")
|
135
|
+
|
136
|
+
obj["param"].append(param_obj)
|
137
|
+
|
138
|
+
if "overrideparam" in step:
|
139
|
+
for override in step["overrideparam"]:
|
140
|
+
override_obj = {"name": sv(), "value": sv()}
|
141
|
+
override_obj['name'].set(override['name'])
|
142
|
+
override_obj['value'].set(override['value'])
|
143
|
+
obj['overrideparam'].append(override_obj)
|
144
|
+
|
145
|
+
if "objfunc" in step:
|
146
|
+
for objfunc in step["objfunc"]:
|
147
|
+
objfunc_obj = {"name": sv(),
|
148
|
+
"of": sv(),
|
149
|
+
"weight": sv(),
|
150
|
+
"custom_function": sv(),
|
151
|
+
"custom_function_goal": sv(),
|
152
|
+
"custom_function_value": sv(),
|
153
|
+
"data": (sv(), sv())}
|
154
|
+
objfunc_obj["name"].set(objfunc["name"])
|
155
|
+
objfunc_obj["of"].set(objfunc["of"])
|
156
|
+
objfunc_obj["custom_function_goal"].set("Positive Best")
|
157
|
+
|
158
|
+
if ("weight" in objfunc):
|
159
|
+
objfunc_obj["weight"].set(objfunc["weight"])
|
160
|
+
else:
|
161
|
+
objfunc_obj["weight"].set(1)
|
162
|
+
|
163
|
+
if ("custom_function" in objfunc):
|
164
|
+
objfunc_obj["custom_function"].set(objfunc["custom_function"])
|
165
|
+
if ("custom_function_goal" in objfunc):
|
166
|
+
objfunc_obj["custom_function_goal"].set(objfunc["custom_function_goal"])
|
167
|
+
if ("custom_function_value" in objfunc):
|
168
|
+
objfunc_obj["custom_function_value"].set(objfunc["custom_function_value"])
|
169
|
+
|
170
|
+
objfunc_obj["data"][0].set(objfunc["data"][0])
|
171
|
+
objfunc_obj["data"][1].set(objfunc["data"][1])
|
172
|
+
obj["objfunc"].append(objfunc_obj)
|
173
|
+
|
174
|
+
self.steps.append(obj)
|
175
|
+
|
176
|
+
def add_function(self, step_index):
|
177
|
+
obj = {"name": sv(),
|
178
|
+
"of": sv(),
|
179
|
+
"weight": sv(),
|
180
|
+
"custom_function": sv(),
|
181
|
+
"custom_function_goal": sv(),
|
182
|
+
"custom_function_value": sv(),
|
183
|
+
"data": (sv(), sv())}
|
184
|
+
obj["name"].set("ns")
|
185
|
+
obj["of"].set("ns")
|
186
|
+
obj["weight"].set(1)
|
187
|
+
obj["data"][0].set("")
|
188
|
+
obj["data"][1].set("")
|
189
|
+
obj["custom_function"].set("")
|
190
|
+
obj["custom_function_goal"].set("")
|
191
|
+
obj["custom_function_value"].set("")
|
192
|
+
|
193
|
+
self.steps[step_index]["objfunc"].append(obj)
|
194
|
+
|
195
|
+
def remove_function(self, step_index, index):
|
196
|
+
self.steps[step_index]["objfunc"].pop(index)
|
197
|
+
|
198
|
+
def dupe_function(self, step_index, index):
|
199
|
+
my_func = self.steps[step_index]["objfunc"][index]
|
200
|
+
|
201
|
+
new_object = {"name": sv(),
|
202
|
+
"of": sv(),
|
203
|
+
"weight": sv(),
|
204
|
+
"custom_function": sv(),
|
205
|
+
"custom_function_goal": sv(),
|
206
|
+
"custom_function_value": sv(),
|
207
|
+
"data": (sv(), sv())}
|
208
|
+
new_object["name"].set(my_func["name"].get())
|
209
|
+
new_object["of"].set(my_func["of"].get())
|
210
|
+
new_object["weight"].set(my_func["weight"].get())
|
211
|
+
new_object["data"][0].set(my_func["data"][0].get())
|
212
|
+
new_object["data"][1].set(my_func["data"][1].get())
|
213
|
+
new_object["custom_function"].set(my_func["custom_function"].get())
|
214
|
+
new_object["custom_function_goal"].set(my_func["custom_function_goal"].get())
|
215
|
+
new_object["custom_function_value"].set(my_func["custom_function_value"].get())
|
216
|
+
|
217
|
+
self.steps[step_index]["objfunc"].append(new_object)
|
218
|
+
|
219
|
+
def add_bound(self, step_index,
|
220
|
+
name="name",
|
221
|
+
min=0,
|
222
|
+
max=1,
|
223
|
+
type="float",
|
224
|
+
default_value=1,
|
225
|
+
optimal_value=0,
|
226
|
+
calibration_strategy="none"):
|
227
|
+
obj = {
|
228
|
+
"name": sv(),
|
229
|
+
"bounds": (sv(), sv()),
|
230
|
+
"default_value": sv(),
|
231
|
+
"optimal_value": sv(),
|
232
|
+
"type": sv(),
|
233
|
+
"calibration_strategy": sv()
|
234
|
+
}
|
235
|
+
obj["name"].set(name)
|
236
|
+
obj["type"].set(type)
|
237
|
+
obj["default_value"].set(default_value)
|
238
|
+
obj["optimal_value"].set(optimal_value)
|
239
|
+
obj["calibration_strategy"].set(calibration_strategy)
|
240
|
+
obj["bounds"][0].set(min)
|
241
|
+
obj["bounds"][1].set(max)
|
242
|
+
self.steps[step_index]["param"].append(obj)
|
243
|
+
|
244
|
+
def remove_bound(self, step_index, index):
|
245
|
+
self.steps[step_index]["param"].pop(index)
|
246
|
+
|
247
|
+
def add_override(self, step_index, name, value):
|
248
|
+
obj = {"name": sv(), "value": sv()}
|
249
|
+
obj["name"].set(name)
|
250
|
+
obj["value"].set(value)
|
251
|
+
self.steps[step_index]["overrideparam"].append(obj)
|
252
|
+
|
253
|
+
def remove_override(self, step_index, index):
|
254
|
+
self.steps[step_index]["overrideparam"].pop(index)
|
255
|
+
|
256
|
+
def get_override(self, step_index):
|
257
|
+
return self.steps[step_index]["overrideparam"]
|
258
|
+
|
259
|
+
def add_argument(self, key, value):
|
260
|
+
obj = {"name": sv(), "value": sv()}
|
261
|
+
obj["name"].set(key)
|
262
|
+
obj["value"].set(value)
|
263
|
+
self.arguments["param"].append(obj)
|
264
|
+
|
265
|
+
def add_calibration_param(self, key, value):
|
266
|
+
obj = {"name": sv(), "value": sv()}
|
267
|
+
obj["name"].set(key)
|
268
|
+
obj["value"].set(value)
|
269
|
+
self.arguments["calibration_parameters"].append(obj)
|
270
|
+
|
271
|
+
def add_service_param(self, key, value):
|
272
|
+
obj = {"name": sv(), "value": sv()}
|
273
|
+
obj["name"].set(key)
|
274
|
+
obj["value"].set(value)
|
275
|
+
self.arguments["service_parameters"].append(obj)
|
276
|
+
|
277
|
+
def add_figure_param(self, key, value):
|
278
|
+
obj = {"name": sv(), "value": sv()}
|
279
|
+
obj["name"].set(key)
|
280
|
+
obj["value"].set(value)
|
281
|
+
self.arguments["figure_parameters"].append(obj)
|
282
|
+
|
283
|
+
def add_sensitivity_param(self, key, value):
|
284
|
+
obj = {"name": sv(), "value": sv()}
|
285
|
+
obj["name"].set(key)
|
286
|
+
obj["value"].set(value)
|
287
|
+
self.arguments["sensitivity_parameters"].append(obj)
|
288
|
+
|
289
|
+
def add_sensitivity_positiveBestMetrics(self, key, value):
|
290
|
+
obj = {"name": sv(), "value": sv()}
|
291
|
+
obj["name"].set(key)
|
292
|
+
obj["value"].set(value)
|
293
|
+
self.arguments["sensitivity_positiveBestMetrics"].append(obj)
|
294
|
+
|
295
|
+
def add_sensitivity_negativeBestMetrics(self, key, value):
|
296
|
+
obj = {"name": sv(), "value": sv()}
|
297
|
+
obj["name"].set(key)
|
298
|
+
obj["value"].set(value)
|
299
|
+
self.arguments["sensitivity_negativeBestMetrics"].append(obj)
|
300
|
+
|
301
|
+
def move_argument_up(self, index):
|
302
|
+
if index > 0:
|
303
|
+
self.arguments["param"][index], self.arguments["param"][index - 1] = self.arguments["param"][index - 1], self.arguments["param"][index]
|
304
|
+
|
305
|
+
def move_argument_down(self, index):
|
306
|
+
if index < len(self.arguments["param"]) - 1:
|
307
|
+
self.arguments["param"][index], self.arguments["param"][index + 1] = self.arguments["param"][index + 1], self.arguments["param"][index]
|
308
|
+
|
309
|
+
def move_step_up(self, index):
|
310
|
+
if index > 0:
|
311
|
+
self.steps[index], self.steps[index - 1] = self.steps[index - 1], self.steps[index]
|
312
|
+
|
313
|
+
def move_step_down(self, index):
|
314
|
+
if index < len(self.steps) - 1:
|
315
|
+
self.steps[index], self.steps[index + 1] = self.steps[index + 1], self.steps[index]
|
316
|
+
|
317
|
+
def toggle_step_open(self, index):
|
318
|
+
self.steps[index]["open"] = not self.steps[index]["open"]
|
319
|
+
|
320
|
+
def remove_argument(self, index):
|
321
|
+
self.arguments["param"].pop(index)
|
322
|
+
|
323
|
+
def remove_calibration_parameter(self, index):
|
324
|
+
self.arguments["calibration_parameters"].pop(index)
|
325
|
+
|
326
|
+
def remove_service_parameter(self, index):
|
327
|
+
self.arguments["service_parameters"].pop(index)
|
328
|
+
|
329
|
+
def remove_figure_parameter(self, index):
|
330
|
+
self.arguments["figure_parameters"].pop(index)
|
331
|
+
|
332
|
+
def remove_sensitivity_parameter(self, index):
|
333
|
+
self.arguments["sensitivity_parameters"].pop(index)
|
334
|
+
|
335
|
+
def remove_sensitivity_positiveBestMetrics(self, index):
|
336
|
+
self.arguments["sensitivity_positiveBestMetrics"].pop(index)
|
337
|
+
|
338
|
+
def remove_sensitivity_negativeBestMetrics(self, index):
|
339
|
+
self.arguments["sensitivity_negativeBestMetrics"].pop(index)
|
340
|
+
|
341
|
+
def remove_step(self, index):
|
342
|
+
self.steps.pop(index)
|
343
|
+
|
344
|
+
def get_project_data(self):
|
345
|
+
return self.project_data
|
346
|
+
|
347
|
+
def set_path(self, filename):
|
348
|
+
file_name = filename.split("/")[-1].replace(".json", "")
|
349
|
+
path = filename.replace(file_name + ".json", "")
|
350
|
+
self.project_data["path"] = path
|
351
|
+
self.project_data["name"] = file_name
|
352
|
+
|
353
|
+
def get_arguments(self):
|
354
|
+
return self.arguments
|
355
|
+
|
356
|
+
def get_steps(self):
|
357
|
+
return self.steps
|
358
|
+
|
359
|
+
def get_all_as_json(self):
|
360
|
+
obj = {"arguments": self.arguments, "steps": self.steps}
|
361
|
+
return obj
|
362
|
+
|
363
|
+
def set_service_parameters(self, service_parameters):
|
364
|
+
self.service_parameters = service_parameters
|
365
|
+
|
366
|
+
def get_service_parameters(self):
|
367
|
+
return self.service_parameters
|
368
|
+
|
369
|
+
def get_metrics(self):
|
370
|
+
|
371
|
+
self.arguments["url"].set(self.arguments["urls"][self.arguments["mode"].get()].get())
|
372
|
+
|
373
|
+
result = {}
|
374
|
+
result['arguments'] = {}
|
375
|
+
result['calibration_parameters'] = []
|
376
|
+
result['service_parameters'] = []
|
377
|
+
result['service_parameters'] = {}
|
378
|
+
result['project_data'] = self.project_data
|
379
|
+
for key, value in self.arguments.items():
|
380
|
+
if key == 'url' or key == 'mode':
|
381
|
+
result['arguments'][key] = value.get()
|
382
|
+
elif key == 'files':
|
383
|
+
result['arguments'][key] = {}
|
384
|
+
#for name, obj in value.items():
|
385
|
+
# result['arguments'][key].append({'name': obj['name'].get(), 'value': obj['value'].get()})
|
386
|
+
elif key == 'param':
|
387
|
+
result['arguments'][key] = []
|
388
|
+
for obj in value:
|
389
|
+
result['arguments'][key].append({'name': obj['name'].get(), 'value': obj['value'].get()})
|
390
|
+
elif key == "calibration_parameters":
|
391
|
+
#result['calibration_parameters'][key] = []
|
392
|
+
for obj in value:
|
393
|
+
result['calibration_parameters'].append({'name': obj['name'].get(), 'value': obj['value'].get()})
|
394
|
+
elif key == "service_parameters":
|
395
|
+
#result['service_parameters'][key] = []
|
396
|
+
for obj in value:
|
397
|
+
result['service_parameters'].append({'name': obj['name'].get(), 'value': obj['value'].get()})
|
398
|
+
result['steps'] = []
|
399
|
+
for step in self.steps:
|
400
|
+
step_result = {}
|
401
|
+
#step_result['name'] = step['name'].get()
|
402
|
+
#step_result['open'] = step['open']
|
403
|
+
step_result['param'] = []
|
404
|
+
for param in step['param']:
|
405
|
+
# try converting the bounds to numbers
|
406
|
+
#try:
|
407
|
+
if param['type'].get() == 'float':
|
408
|
+
step_result['param'].append(
|
409
|
+
{
|
410
|
+
'name': param['name'].get(),
|
411
|
+
'bounds': (float(param['bounds'][0].get()),
|
412
|
+
float(param['bounds'][1].get())),
|
413
|
+
'default_value': float(param['default_value'].get()),
|
414
|
+
'optimal_value': float(param['optimal_value'].get()),
|
415
|
+
'type': 'float',
|
416
|
+
'calibration_strategy': param['calibration_strategy'].get()
|
417
|
+
}
|
418
|
+
)
|
419
|
+
elif param['type'].get() == 'list':
|
420
|
+
step_result['param'].append(
|
421
|
+
{
|
422
|
+
'name': param['name'].get(),
|
423
|
+
'bounds': (float(param['bounds'][0].get()),
|
424
|
+
float(param['bounds'][1].get())),
|
425
|
+
'default_value': param['default_value'].get(),
|
426
|
+
'optimal_value': param['optimal_value'].get(),
|
427
|
+
'type': 'list',
|
428
|
+
'calibration_strategy': param['calibration_strategy'].get()
|
429
|
+
}
|
430
|
+
)
|
431
|
+
#except ValueError:
|
432
|
+
# step_result['param'].append(
|
433
|
+
# {
|
434
|
+
# 'name': param['name'].get(),
|
435
|
+
# 'bounds': (param['bounds'][0].get(),
|
436
|
+
# param['bounds'][1].get())
|
437
|
+
# }
|
438
|
+
# )
|
439
|
+
step_result['objfunc'] = []
|
440
|
+
for objfunc in step['objfunc']:
|
441
|
+
step_result['objfunc'].append({'name': objfunc['name'].get(), 'of': objfunc['of'].get(), 'weight': float(objfunc['weight'].get()), 'data': (objfunc['data'][0].get(), objfunc['data'][1].get())})
|
442
|
+
result['steps'].append(step_result)
|
443
|
+
return result
|
@@ -5,6 +5,8 @@ import subprocess
|
|
5
5
|
import customtkinter
|
6
6
|
import platform
|
7
7
|
|
8
|
+
from ..General import ParameterView as pv
|
9
|
+
|
8
10
|
import tkinter as tk
|
9
11
|
|
10
12
|
def create_tab(self, tab):
|
@@ -16,7 +18,7 @@ def create_tab(self, tab):
|
|
16
18
|
response_json = json.loads(response.text)
|
17
19
|
status = response.status_code
|
18
20
|
|
19
|
-
self.option_manager.
|
21
|
+
self.option_manager.set_data(response_json)
|
20
22
|
self.tabview.configure(state="enabled")
|
21
23
|
|
22
24
|
self.service_status.delete('0.0', tk.END)
|
@@ -67,7 +69,7 @@ def create_tab(self, tab):
|
|
67
69
|
|
68
70
|
|
69
71
|
def open_terminal_and_run_cluster():
|
70
|
-
full_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'start.yaml'))
|
72
|
+
full_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', 'start.yaml'))
|
71
73
|
command = "minikube kubectl -- create -f " + full_path + " ; sleep 60 ; minikube service pf8087-csu-csip-oms -n csip"
|
72
74
|
#command = "minikube kubectl -- create -f " + full_path + " ; until [[ $(minikube kubectl -- get pods -l app=pf8087-csu-csip-oms -n csip -o \\'jsonpath={..status.conditions[?(@.type==\\\"Ready\\\")].status}\\') == \\\"True\\\" ]]; do echo \\\"waiting for pod\\\" && sleep 1; done ; minikube service pf8087-csu-csip-oms -n csip"
|
73
75
|
|
@@ -114,6 +116,7 @@ def create_tab(self, tab):
|
|
114
116
|
|
115
117
|
tab.grid_columnconfigure(0, weight=1)
|
116
118
|
tab.grid_columnconfigure(1, weight=1)
|
119
|
+
tab.grid_columnconfigure(2, weight=1)
|
117
120
|
tab.grid_rowconfigure(0, weight=1)
|
118
121
|
|
119
122
|
"""
|
@@ -131,9 +134,15 @@ def create_tab(self, tab):
|
|
131
134
|
self.load_parameters.grid(row=0, column=2, padx=(20, 20), pady=(20, 20), sticky="nsew")
|
132
135
|
|
133
136
|
"""
|
137
|
+
|
138
|
+
self.service_param_frame = pv.ParameterView(tab, option_manager=self.option_manager, list_name="service_parameters", label_text="Service Parameters")
|
139
|
+
self.service_param_frame.grid(row=0, column=0, padx=(20, 20), pady=(20, 20), sticky="nsew")
|
140
|
+
self.service_param_frame.grid_columnconfigure(0, weight=1)
|
141
|
+
self.service_param_frame.grid_rowconfigure(0, weight=1)
|
142
|
+
|
134
143
|
|
135
|
-
self.service_editor = customtkinter.CTkScrollableFrame(tab, label_text="Service
|
136
|
-
self.service_editor.grid(row=0, column=
|
144
|
+
self.service_editor = customtkinter.CTkScrollableFrame(tab, label_text="Service Status")
|
145
|
+
self.service_editor.grid(row=0, column=1, padx=(20, 20), pady=(20, 20), sticky="nsew")
|
137
146
|
self.service_editor.grid_columnconfigure(0, weight=1)
|
138
147
|
self.service_editor.grid_rowconfigure(0, weight=1)
|
139
148
|
|
@@ -161,8 +170,8 @@ def create_tab(self, tab):
|
|
161
170
|
self.service_details = customtkinter.CTkTextbox(self.service_editor, height=480)
|
162
171
|
self.service_details.grid(row=8, column=0, padx=(20, 20), pady=(5, 5), sticky="ew")
|
163
172
|
|
164
|
-
self.environment_editor = customtkinter.CTkScrollableFrame(tab, label_text="Environment Editor")
|
165
|
-
self.environment_editor.grid(row=0, column=
|
173
|
+
self.environment_editor = customtkinter.CTkScrollableFrame(tab, label_text="Minikube Environment Editor")
|
174
|
+
self.environment_editor.grid(row=0, column=2, padx=(20, 20), pady=(20, 20), sticky="nsew")
|
166
175
|
self.environment_editor.grid_columnconfigure(0, weight=1)
|
167
176
|
self.environment_editor.grid_rowconfigure(0, weight=1)
|
168
177
|
|
@@ -0,0 +1,47 @@
|
|
1
|
+
from customtkinter import CTkScrollableFrame
|
2
|
+
from customtkinter import CTkFrame
|
3
|
+
from customtkinter import CTkLabel
|
4
|
+
from customtkinter import CTkButton
|
5
|
+
from customtkinter import CTkEntry
|
6
|
+
import tkinter as tk
|
7
|
+
|
8
|
+
class OptimalParameterView(CTkScrollableFrame):
|
9
|
+
def __init__(self, *args,
|
10
|
+
option_manager: None,
|
11
|
+
**kwargs):
|
12
|
+
super().__init__(*args, **kwargs)
|
13
|
+
|
14
|
+
self.option_manager = option_manager
|
15
|
+
|
16
|
+
self.render()
|
17
|
+
|
18
|
+
def clear(self):
|
19
|
+
self.containerFrame.destroy()
|
20
|
+
|
21
|
+
def render(self):
|
22
|
+
row = 0
|
23
|
+
|
24
|
+
self.containerFrame = CTkFrame(self)
|
25
|
+
self.containerFrame.grid(row=0, column=0, padx=(5, 5), pady=(5, 5), sticky="nsew")
|
26
|
+
self.containerFrame.grid_columnconfigure((0, 1), weight=1)
|
27
|
+
|
28
|
+
self.mode = self.option_manager.get_mode()
|
29
|
+
self.steps = self.option_manager.get_steps()
|
30
|
+
|
31
|
+
for step in self.steps:
|
32
|
+
|
33
|
+
if self.mode != "Sampling: Random" and self.mode != "Sampling: Halton":
|
34
|
+
name = step['name'].get()
|
35
|
+
CTkLabel(self.containerFrame, text=name).grid(row=row, column=0, columnspan=1, padx=5, pady=5, sticky="")
|
36
|
+
row += 1
|
37
|
+
|
38
|
+
for param in step['parameter_objects']:
|
39
|
+
CTkEntry(self.containerFrame, textvariable=param['name']).grid(row=row, column=0, padx=(5, 5), pady=(5, 5), sticky="ew")
|
40
|
+
|
41
|
+
bb = CTkEntry(self.containerFrame)
|
42
|
+
bb.grid(row=row, column=1, padx=(5, 5), pady=(5, 5), sticky="ew")
|
43
|
+
bb.configure(textvariable=param['optimal_value'])
|
44
|
+
row += 1
|
45
|
+
|
46
|
+
if self.mode != "Optimization":
|
47
|
+
break
|