Skip to content

Commit

Permalink
flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
jmlarson1 committed Sep 10, 2019
1 parent c705a85 commit 0bbf8d9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
3 changes: 1 addition & 2 deletions libensemble/alloc_funcs/persistent_aposmm_alloc.py
@@ -1,6 +1,6 @@
import numpy as np

from libensemble.alloc_funcs.support import avail_worker_ids, sim_work, gen_work, count_persis_gens
from libensemble.alloc_funcs.support import avail_worker_ids, sim_work, gen_work


def persistent_aposmm_alloc(W, H, sim_specs, gen_specs, alloc_specs, persis_info):
Expand All @@ -21,7 +21,6 @@ def persistent_aposmm_alloc(W, H, sim_specs, gen_specs, alloc_specs, persis_info
if 'next_to_give' not in persis_info:
persis_info['next_to_give'] = 0


# If any persistent worker's calculated values have returned, give them back.
for i in avail_worker_ids(W, persistent=True):
if persis_info.get('sample_done') or sum(H['returned']) >= gen_specs['initial_sample_size']:
Expand Down
4 changes: 2 additions & 2 deletions libensemble/gen_funcs/persistent_aposmm.py
Expand Up @@ -209,7 +209,7 @@ def aposmm(H, persis_info, gen_specs, libE_info):
# the alloc_func only returns when the initial sample has function values.
persis_info = add_k_sample_points_to_local_H(gen_specs['initial_sample_size'], gen_specs,
persis_info, n, c_flag, comm, local_H,
sim_id_to_child_indices)
sim_id_to_child_indices)
send_mgr_worker_msg(comm, local_H[:gen_specs['initial_sample_size']][[i[0] for i in gen_specs['out']]])

tag = None
Expand All @@ -223,7 +223,7 @@ def aposmm(H, persis_info, gen_specs, libE_info):
n_s = update_local_H_after_receiving(local_H, n, n_s, gen_specs, c_flag, Work, calc_in)

new_opt_inds_to_send_mgr = []
new_inds_to_send_mgr = []
new_inds_to_send_mgr = []
for row in calc_in:
if sim_id_to_child_indices.get(row['sim_id']):
# Point came from a child local opt run
Expand Down
Expand Up @@ -41,7 +41,7 @@
'out': [('f', float), ('grad', float, n)]}

gen_out = [('x', float, n), ('x_on_cube', float, n), ('sim_id', int),
('local_min', bool), ('local_pt',bool)]
('local_min', bool), ('local_pt', bool)]

gen_specs = {'gen_f': gen_f,
'in': [],
Expand Down Expand Up @@ -77,8 +77,7 @@
for m in minima:
# The minima are known on this test problem.
# We use their values to test APOSMM has identified all minima
print(np.min(np.sum((H[H['local_min']]['x'] - m)**2, 1)),flush=True)
if np.min(np.sum((H[H['local_min']]['x'] - m)**2, 1)) > tol:
libE_abort()
print(np.min(np.sum((H[H['local_min']]['x'] - m)**2, 1)), flush=True)
assert np.min(np.sum((H[H['local_min']]['x'] - m)**2, 1)) < tol

save_libE_output(H, persis_info, __file__, nworkers)

0 comments on commit 0bbf8d9

Please sign in to comment.