mg-pso-gui 0.1.95__py3-none-any.whl → 0.1.97__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.1.95.dist-info → mg_pso_gui-0.1.97.dist-info}/METADATA +1 -1
- {mg_pso_gui-0.1.95.dist-info → mg_pso_gui-0.1.97.dist-info}/RECORD +6 -6
- mgpsogui/util/recosu/pso/pso.py +20 -6
- {mg_pso_gui-0.1.95.dist-info → mg_pso_gui-0.1.97.dist-info}/WHEEL +0 -0
- {mg_pso_gui-0.1.95.dist-info → mg_pso_gui-0.1.97.dist-info}/entry_points.txt +0 -0
- {mg_pso_gui-0.1.95.dist-info → mg_pso_gui-0.1.97.dist-info}/top_level.txt +0 -0
|
@@ -40,14 +40,14 @@ mgpsogui/util/CTkToolTip/ctk_tooltip.py,sha256=SZMovpQIGvdpDRbqCKl9SHs92DrFCO2MO
|
|
|
40
40
|
mgpsogui/util/recosu/__init__.py,sha256=T7_iigIlowGbPOHLO3hwihjw2kbwIg6olOMhFhNiL38,236
|
|
41
41
|
mgpsogui/util/recosu/pso/__init__.py,sha256=PQ548aEKVOk6MMzxxDg7yMO_1hHfoEoYLLkGLeij73Y,247
|
|
42
42
|
mgpsogui/util/recosu/pso/csip_access.py,sha256=jBli1MSShUUwQCMKOUvMaGuNwBViCrjXJi_FmSEJsZA,2721
|
|
43
|
-
mgpsogui/util/recosu/pso/pso.py,sha256=
|
|
43
|
+
mgpsogui/util/recosu/pso/pso.py,sha256=8tvrZIBNxvWv4AXgLYIYdGwvslFNr_fcQsg1Y3CSRjU,12821
|
|
44
44
|
mgpsogui/util/recosu/utils/__init__.py,sha256=TXz_TpNif2GeGu22pzTnkUQvaP-PmLQ9Sz4BgMIS6ig,196
|
|
45
45
|
mgpsogui/util/recosu/utils/trace_writer.py,sha256=V9BJlOjCbNYGoXGEk3CF5wjifBxvarrMRXJMbDBWqI8,3023
|
|
46
46
|
mgpsogui/util/recosu/utils/utils.py,sha256=QB8vftq3142ekG0ORjz0ZBHU5YknXbR0oTsrxrPAsF0,3951
|
|
47
47
|
mgpsogui/util/recosu/utils/plot/__init__.py,sha256=h1KjM7_tNDv351pcwt8A6Ibb1jhwWyx5Gbu-zj-sI3Q,71
|
|
48
48
|
mgpsogui/util/recosu/utils/plot/cost_steps.py,sha256=1Ce11AJyweWkmvjXPxEygzS-h8yVLmQEDLS53yjPLqQ,3779
|
|
49
|
-
mg_pso_gui-0.1.
|
|
50
|
-
mg_pso_gui-0.1.
|
|
51
|
-
mg_pso_gui-0.1.
|
|
52
|
-
mg_pso_gui-0.1.
|
|
53
|
-
mg_pso_gui-0.1.
|
|
49
|
+
mg_pso_gui-0.1.97.dist-info/METADATA,sha256=vAc6hAkrwVnkzpxa8mIafa61g-0oIv8mn1fI4iu_RQ4,9458
|
|
50
|
+
mg_pso_gui-0.1.97.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
51
|
+
mg_pso_gui-0.1.97.dist-info/entry_points.txt,sha256=jg82VOFjR1XDGrchs1wJSCqKYE4Ozv12aBcCSp--koA,117
|
|
52
|
+
mg_pso_gui-0.1.97.dist-info/top_level.txt,sha256=y7JuS9xJN5YdxUsQ3PSVjN8MzQAnR146bP3ZN3PYWdE,9
|
|
53
|
+
mg_pso_gui-0.1.97.dist-info/RECORD,,
|
mgpsogui/util/recosu/pso/pso.py
CHANGED
|
@@ -22,7 +22,7 @@ import datetime
|
|
|
22
22
|
import queue
|
|
23
23
|
import json
|
|
24
24
|
import os
|
|
25
|
-
from multiprocessing import Queue
|
|
25
|
+
from multiprocessing import Queue as MPQueue
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
def eval_cost(x, iteration, step_param_names, step_objfunc, calib_params, req_queue, files, url, param, conf: Dict, rnd,
|
|
@@ -82,7 +82,7 @@ def eval_cost(x, iteration, step_param_names, step_objfunc, calib_params, req_qu
|
|
|
82
82
|
def global_best(steps: Dict, rounds: Tuple, args: Dict, n_particles: int, iters: int, options: Dict,
|
|
83
83
|
oh_strategy: Dict = None, n_threads: int = 4, rtol: float = 0.001, ftol: float = -np.inf,
|
|
84
84
|
ftol_iter: int = 1, full_trace: List = None, rtol_iter: int = 1,
|
|
85
|
-
conf: Dict = None, metainfo: Dict = None, cost_target: float = -np.inf, result_queue:
|
|
85
|
+
conf: Dict = None, metainfo: Dict = None, cost_target: float = -np.inf, result_queue: MPQueue = None) -> Tuple:
|
|
86
86
|
"""Performs a stepwise particle swarm optimization PSO using a global best approach.
|
|
87
87
|
|
|
88
88
|
Parameters
|
|
@@ -182,11 +182,15 @@ def global_best(steps: Dict, rounds: Tuple, args: Dict, n_particles: int, iters:
|
|
|
182
182
|
with open(step_file, "w") as fo:
|
|
183
183
|
json.dump(step_trace, fo)
|
|
184
184
|
|
|
185
|
+
print("Wrote step trace")
|
|
186
|
+
|
|
185
187
|
# best round cost
|
|
186
188
|
best_round_cost = np.inf
|
|
187
189
|
|
|
188
190
|
# request queue for worker
|
|
189
191
|
req_queue = queue.Queue()
|
|
192
|
+
|
|
193
|
+
print("Created queue")
|
|
190
194
|
|
|
191
195
|
conf = conf or {}
|
|
192
196
|
done = False
|
|
@@ -199,6 +203,8 @@ def global_best(steps: Dict, rounds: Tuple, args: Dict, n_particles: int, iters:
|
|
|
199
203
|
thread_pool.append(worker)
|
|
200
204
|
worker.start()
|
|
201
205
|
|
|
206
|
+
print("Started worker threads")
|
|
207
|
+
|
|
202
208
|
r_below = 0
|
|
203
209
|
early_exit = False
|
|
204
210
|
start_time = datetime.datetime.now()
|
|
@@ -222,6 +228,8 @@ def global_best(steps: Dict, rounds: Tuple, args: Dict, n_particles: int, iters:
|
|
|
222
228
|
args['req_queue'] = req_queue
|
|
223
229
|
args['conf'] = conf
|
|
224
230
|
|
|
231
|
+
print("Calling global best..")
|
|
232
|
+
|
|
225
233
|
# create optimizer in the first round.
|
|
226
234
|
if optimizer[s] is None:
|
|
227
235
|
optimizer[s] = GlobalBestPSO(step.get('n_particles', n_particles),
|
|
@@ -232,21 +240,27 @@ def global_best(steps: Dict, rounds: Tuple, args: Dict, n_particles: int, iters:
|
|
|
232
240
|
ftol=step.get('ftol', ftol),
|
|
233
241
|
ftol_iter=step.get('ftol_iter', ftol_iter),
|
|
234
242
|
cost_target=step.get('cost_target', cost_target))
|
|
235
|
-
|
|
236
|
-
|
|
243
|
+
|
|
244
|
+
print('\n>>>>> R{}/S{} particle params: {} calibrated params: {}\n'.format(r + 1, s + 1, param_names, args['calib_params']))
|
|
237
245
|
|
|
238
|
-
if result_queue is not None:
|
|
239
|
-
|
|
246
|
+
#if result_queue is not None:
|
|
247
|
+
# result_queue.put('\n>>>>> R{}/S{} particle params: {} calibrated params: {}\n'.format(r + 1, s + 1, param_names, args['calib_params']))
|
|
248
|
+
|
|
249
|
+
print("Filled request queue...")
|
|
240
250
|
|
|
241
251
|
args['rnd'] = r + 1
|
|
242
252
|
args['step'] = s + 1
|
|
243
253
|
|
|
254
|
+
print("Evaluating cost...")
|
|
255
|
+
|
|
244
256
|
# perform optimization
|
|
245
257
|
cost, pos = optimizer[s].optimize(eval_cost, iters=step.get('iters', iters), **args)
|
|
246
258
|
if cost is None:
|
|
247
259
|
early_exit = True
|
|
248
260
|
break
|
|
249
261
|
|
|
262
|
+
print("Finished evaluation...")
|
|
263
|
+
|
|
250
264
|
# capture the best cost
|
|
251
265
|
# if cost < best_cost[s] and np.abs(cost - best_cost[s]) > rtol:
|
|
252
266
|
if cost < best_cost[s]:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|