mg-pso-gui 0.1.106__tar.gz → 0.1.108__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.
Files changed (59) hide show
  1. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/PKG-INFO +1 -1
  2. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/mg_pso_gui.egg-info/PKG-INFO +1 -1
  3. mg-pso-gui-0.1.108/mgpsogui/util/PSORunner.py +123 -0
  4. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/mgpsogui/util/recosu/pso/pso.py +4 -3
  5. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/setup.py +1 -1
  6. mg-pso-gui-0.1.106/mgpsogui/util/PSORunner.py +0 -119
  7. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/mg_pso_gui.egg-info/SOURCES.txt +0 -0
  8. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/mg_pso_gui.egg-info/dependency_links.txt +0 -0
  9. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/mg_pso_gui.egg-info/entry_points.txt +0 -0
  10. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/mg_pso_gui.egg-info/requires.txt +0 -0
  11. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/mg_pso_gui.egg-info/top_level.txt +0 -0
  12. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/mgpsogui/__init__.py +0 -0
  13. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/mgpsogui/gui/HomePage.py +0 -0
  14. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/mgpsogui/gui/OptionManager.py +0 -0
  15. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/mgpsogui/gui/PlatformTab/PlatformTab.py +0 -0
  16. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/mgpsogui/gui/PlatformTab/__init__.py +0 -0
  17. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/mgpsogui/gui/RunTab/RunTab.py +0 -0
  18. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/mgpsogui/gui/RunTab/__init__.py +0 -0
  19. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/mgpsogui/gui/SetupTab/BoundsEditorWindow.py +0 -0
  20. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/mgpsogui/gui/SetupTab/BoundsList.py +0 -0
  21. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/mgpsogui/gui/SetupTab/CalibrationParametersView.py +0 -0
  22. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/mgpsogui/gui/SetupTab/FunctionsList.py +0 -0
  23. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/mgpsogui/gui/SetupTab/ListParametersView.py +0 -0
  24. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/mgpsogui/gui/SetupTab/OptimalParameterView.py +0 -0
  25. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/mgpsogui/gui/SetupTab/SetupTab.py +0 -0
  26. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/mgpsogui/gui/SetupTab/StaticParameterView.py +0 -0
  27. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/mgpsogui/gui/SetupTab/StepView.py +0 -0
  28. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/mgpsogui/gui/SetupTab/__init__.py +0 -0
  29. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/mgpsogui/gui/VisualizeTab/SideBar.py +0 -0
  30. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/mgpsogui/gui/VisualizeTab/VisualizeTab.py +0 -0
  31. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/mgpsogui/gui/VisualizeTab/__init__.py +0 -0
  32. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/mgpsogui/gui/__init__.py +0 -0
  33. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/mgpsogui/gui/images/IGOW 4 Logo.png +0 -0
  34. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/mgpsogui/gui/images/collapse.png +0 -0
  35. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/mgpsogui/gui/images/down.png +0 -0
  36. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/mgpsogui/gui/images/expand.png +0 -0
  37. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/mgpsogui/gui/images/play.png +0 -0
  38. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/mgpsogui/gui/images/refresh.png +0 -0
  39. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/mgpsogui/gui/images/refresh_hd.png +0 -0
  40. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/mgpsogui/gui/images/stop.png +0 -0
  41. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/mgpsogui/gui/images/test.png +0 -0
  42. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/mgpsogui/gui/images/trash.png +0 -0
  43. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/mgpsogui/gui/images/up.png +0 -0
  44. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/mgpsogui/mgpsogui.py +0 -0
  45. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/mgpsogui/start.yaml +0 -0
  46. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/mgpsogui/util/CTkToolTip/__init__.py +0 -0
  47. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/mgpsogui/util/CTkToolTip/ctk_tooltip.py +0 -0
  48. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/mgpsogui/util/GraphGenerator.py +0 -0
  49. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/mgpsogui/util/__init__.py +0 -0
  50. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/mgpsogui/util/debug.py +0 -0
  51. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/mgpsogui/util/recosu/__init__.py +0 -0
  52. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/mgpsogui/util/recosu/pso/__init__.py +0 -0
  53. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/mgpsogui/util/recosu/pso/csip_access.py +0 -0
  54. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/mgpsogui/util/recosu/utils/__init__.py +0 -0
  55. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/mgpsogui/util/recosu/utils/plot/__init__.py +0 -0
  56. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/mgpsogui/util/recosu/utils/plot/cost_steps.py +0 -0
  57. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/mgpsogui/util/recosu/utils/trace_writer.py +0 -0
  58. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/mgpsogui/util/recosu/utils/utils.py +0 -0
  59. {mg-pso-gui-0.1.106 → mg-pso-gui-0.1.108}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mg-pso-gui
3
- Version: 0.1.106
3
+ Version: 0.1.108
4
4
  Summary: GUI for MG-PSO
5
5
  Author: Robert Cordingly
6
6
  Author-email: <rcording@uw.ed>
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mg-pso-gui
3
- Version: 0.1.106
3
+ Version: 0.1.108
4
4
  Summary: GUI for MG-PSO
5
5
  Author: Robert Cordingly
6
6
  Author-email: <rcording@uw.ed>
@@ -0,0 +1,123 @@
1
+
2
+ import sys
3
+ from multiprocessing import Process, Queue
4
+ from queue import Empty
5
+ import threading
6
+ import time
7
+ import os
8
+
9
+ #from cosu.pso import global_best
10
+ from .recosu.pso import global_best
11
+
12
+ def enqueue_output(out, queue):
13
+ for line in iter(out.readline, b''):
14
+ queue.put(line)
15
+ out.close()
16
+
17
+ def run_process(stdout_queue, stderr_queue, results_queue, cosu_queue, data, folder):
18
+ steps = data['steps']
19
+ args = data['arguments']
20
+ calib = data['calibration_parameters']
21
+
22
+ # If "mode" in args remove it
23
+ if "mode" in args:
24
+ del args["mode"]
25
+
26
+ calibration_map = {}
27
+ for param in calib:
28
+ param_name = param['name']
29
+ param_value = param['value']
30
+ calibration_map[param_name] = param_value
31
+
32
+ if not os.path.exists(folder):
33
+ os.makedirs(folder)
34
+
35
+ if (os.path.exists(os.path.join(folder, 'output.txt'))):
36
+ os.remove(os.path.join(folder, 'output.txt'))
37
+
38
+ if (os.path.exists(os.path.join(folder, 'error.txt'))):
39
+ os.remove(os.path.join(folder, 'error.txt'))
40
+
41
+ old_stdout = sys.stdout
42
+ old_stderr = sys.stderr
43
+
44
+ read_stdout, write_stdout = os.pipe()
45
+ read_stderr, write_stderr = os.pipe()
46
+
47
+ sys.stdout = os.fdopen(write_stdout, 'w')
48
+ sys.stderr = os.fdopen(write_stderr, 'w')
49
+
50
+ stdout_thread = threading.Thread(target=enqueue_output, args=(os.fdopen(read_stdout, 'r'), stdout_queue))
51
+ stderr_thread = threading.Thread(target=enqueue_output, args=(os.fdopen(read_stderr, 'r'), stderr_queue))
52
+ stdout_thread.daemon = True
53
+ stderr_thread.daemon = True
54
+ stdout_thread.start()
55
+ stderr_thread.start()
56
+
57
+ try:
58
+
59
+ options = {}
60
+ oh_strategy = {}
61
+
62
+ for key in calibration_map.keys():
63
+ if "options_" in key:
64
+ options[key.replace("options_", "")] = float(calibration_map[key])
65
+ if "strategy_" in key:
66
+ oh_strategy[key.replace("strategy_", "")] = calibration_map[key]
67
+
68
+ config = {
69
+ 'service_timeout': int(calibration_map['service_timeout']),
70
+ 'http_retry': int(calibration_map['http_retry']),
71
+ 'http_allow_redirects': True if calibration_map['allow_redirects'] == "True" else False,
72
+ 'async_call': True if calibration_map['async_call'] == "True" else False,
73
+ 'http_conn_timeout': int(calibration_map['conn_timeout']),
74
+ 'http_read_timeout': int(calibration_map['read_timeout']),
75
+ 'particles_fail': int(calibration_map['particles_fail']),
76
+ 'step_trace': os.path.join(folder, 'step_trace.json')
77
+ }
78
+
79
+ print("\n")
80
+ print(steps)
81
+ print("\n")
82
+ print(args)
83
+ print("\n")
84
+ print(calibration_map)
85
+ print("\n")
86
+ print(options)
87
+ print("\n")
88
+ print(oh_strategy)
89
+ print("\n")
90
+ print(config)
91
+ print("\n")
92
+
93
+ print("Running global_best...\n")
94
+
95
+ optimizer, trace = global_best(steps,
96
+ rounds=(int(calibration_map['min_rounds']), int(calibration_map['max_rounds'])),
97
+ args=args,
98
+ n_particles=int(calibration_map['n_particles']),
99
+ iters=int(calibration_map['iters']),
100
+ n_threads=int(calibration_map['n_threads']),
101
+ # ftol=0.00000001,
102
+ options=options,
103
+ oh_strategy=oh_strategy,
104
+ conf=config
105
+ )
106
+
107
+ results_queue.put(trace)
108
+ print(trace)
109
+
110
+ print("Finishing up...")
111
+ time.sleep(5)
112
+ except Exception as e:
113
+ print("An exception occurred: ")
114
+ print(str(e))
115
+ # Print stack trace
116
+ import traceback
117
+ traceback.print_exc()
118
+ finally:
119
+ stdout_thread.join()
120
+ stderr_thread.join()
121
+
122
+ sys.stdout = old_stdout
123
+ sys.stderr = old_stderr
@@ -276,7 +276,8 @@ def global_best(steps: Dict, rounds: Tuple, args: Dict, n_particles: int, iters:
276
276
  key = "r{}s{}".format(r + 1, s + 1)
277
277
  step_trace[key] = {}
278
278
  step_trace[key]['time'] = str(datetime.datetime.now())
279
- step_trace[key]['best_costs'] = str(best_cost)
279
+
280
+ step_trace[key]['best_costs'] = best_cost.tolist() # BUG
280
281
  step_trace[key]['steps'] = copy.deepcopy(steps)
281
282
 
282
283
  if step_file is not None:
@@ -313,8 +314,8 @@ def global_best(steps: Dict, rounds: Tuple, args: Dict, n_particles: int, iters:
313
314
  step_trace[key] = {}
314
315
  step_trace[key]['time'] = str(datetime.datetime.now())
315
316
  step_trace[key]['round_cost'] = round_cost
316
- step_trace[key]['best_costs'] = best_cost
317
- step_trace[key]['improvements'] = no_improvement
317
+ step_trace[key]['best_costs'] = best_cost.tolist()
318
+ step_trace[key]['improvements'] = no_improvement.tolist()
318
319
  if step_file is not None:
319
320
  with open(step_file, "w") as fo:
320
321
  json.dump(step_trace, fo)
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
  import codecs
3
3
  import os
4
4
 
5
- VERSION = '0.1.106'
5
+ VERSION = '0.1.108'
6
6
  DESCRIPTION = 'GUI for MG-PSO'
7
7
  LONG_DESCRIPTION = open('../README.md').read()
8
8
 
@@ -1,119 +0,0 @@
1
-
2
- import sys
3
- from multiprocessing import Process, Queue
4
- from queue import Empty
5
- import threading
6
- import time
7
- import os
8
-
9
- #from cosu.pso import global_best
10
- from .recosu.pso import global_best
11
-
12
- def enqueue_output(out, queue):
13
- for line in iter(out.readline, b''):
14
- queue.put(line)
15
- out.close()
16
-
17
- def run_process(stdout_queue, stderr_queue, results_queue, cosu_queue, data, folder):
18
- steps = data['steps']
19
- args = data['arguments']
20
- calib = data['calibration_parameters']
21
-
22
- # If "mode" in args remove it
23
- if "mode" in args:
24
- del args["mode"]
25
-
26
- calibration_map = {}
27
- for param in calib:
28
- param_name = param['name']
29
- param_value = param['value']
30
- calibration_map[param_name] = param_value
31
-
32
- if not os.path.exists(folder):
33
- os.makedirs(folder)
34
-
35
- if (os.path.exists(os.path.join(folder, 'output.txt'))):
36
- os.remove(os.path.join(folder, 'output.txt'))
37
-
38
- if (os.path.exists(os.path.join(folder, 'error.txt'))):
39
- os.remove(os.path.join(folder, 'error.txt'))
40
-
41
- old_stdout = sys.stdout
42
- old_stderr = sys.stderr
43
-
44
- read_stdout, write_stdout = os.pipe()
45
- read_stderr, write_stderr = os.pipe()
46
-
47
- sys.stdout = os.fdopen(write_stdout, 'w')
48
- sys.stderr = os.fdopen(write_stderr, 'w')
49
-
50
- stdour_thread = threading.Thread(target=enqueue_output, args=(os.fdopen(read_stdout, 'r'), stdout_queue))
51
- stderr_thread = threading.Thread(target=enqueue_output, args=(os.fdopen(read_stderr, 'r'), stderr_queue))
52
- stdour_thread.daemon = True
53
- stderr_thread.daemon = True
54
- stdour_thread.start()
55
- stderr_thread.start()
56
-
57
- options = {}
58
- oh_strategy = {}
59
-
60
- for key in calibration_map.keys():
61
- if "options_" in key:
62
- options[key.replace("options_", "")] = float(calibration_map[key])
63
- if "strategy_" in key:
64
- oh_strategy[key.replace("strategy_", "")] = calibration_map[key]
65
-
66
- config = {
67
- 'service_timeout': int(calibration_map['service_timeout']),
68
- 'http_retry': int(calibration_map['http_retry']),
69
- 'http_allow_redirects': True if calibration_map['allow_redirects'] == "True" else False,
70
- 'async_call': True if calibration_map['async_call'] == "True" else False,
71
- 'http_conn_timeout': int(calibration_map['conn_timeout']),
72
- 'http_read_timeout': int(calibration_map['read_timeout']),
73
- 'particles_fail': int(calibration_map['particles_fail']),
74
- 'step_trace': os.path.join(folder, 'step_trace.json')
75
- }
76
-
77
- print("\n")
78
- print(steps)
79
- print("\n")
80
- print(args)
81
- print("\n")
82
- print(calibration_map)
83
- print("\n")
84
- print(options)
85
- print("\n")
86
- print(oh_strategy)
87
- print("\n")
88
- print(config)
89
- print("\n")
90
-
91
-
92
-
93
- print("Running global_best...\n")
94
-
95
-
96
-
97
- optimizer, trace = global_best(steps,
98
- rounds=(int(calibration_map['min_rounds']), int(calibration_map['max_rounds'])),
99
- args=args,
100
- n_particles=int(calibration_map['n_particles']),
101
- iters=int(calibration_map['iters']),
102
- n_threads=int(calibration_map['n_threads']),
103
- # ftol=0.00000001,
104
- options=options,
105
- oh_strategy=oh_strategy,
106
- conf=config
107
- )
108
-
109
- results_queue.put(trace)
110
- print(trace)
111
-
112
- print("Finishing up...")
113
- time.sleep(5)
114
-
115
- stdour_thread.join()
116
- stderr_thread.join()
117
-
118
- sys.stdout = old_stdout
119
- sys.stderr = old_stderr
File without changes