Skip to content

Commit

Permalink
Fixing aposmm when the there are no initial starting point.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmlarson1 committed Nov 9, 2017
1 parent 7a8bf6b commit 5f5b1ee
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions code/examples/gen_funcs/aposmm_logic.py
Expand Up @@ -61,6 +61,11 @@ def aposmm_logic(H,gen_info,gen_specs,libE_info):
updated_inds = set()

else:
# Find the run number
if not np.any(H['started_run']):
gen_info['active_runs'] = set()
gen_info['run_order'] = {}

global x_new, pt_in_run, total_pts_in_run # Used to generate a next local opt point

updated_inds = update_history_dist(H, gen_specs, c_flag)
Expand All @@ -69,10 +74,6 @@ def aposmm_logic(H,gen_info,gen_specs,libE_info):
updated_inds.update(starting_inds)

for ind in starting_inds:
# Find the run number
if not np.any(H['started_run']):
gen_info['active_runs'] = set()
gen_info['run_order'] = {}

new_run_num = len(gen_info['run_order'])

Expand Down Expand Up @@ -215,9 +216,9 @@ def update_history_dist(H, gen_specs, c_flag):
H['known_to_aposmm'][new_ind] = True # These points are now known to APOSMM

# Compute distance to boundary
H['dist_to_unit_bounds'][new_ind] = min(min(np.ones(n) - H['x_on_cube'][new_ind]),min(H['x_on_cube'][new_ind] - np.zeros(n)))
H['dist_to_unit_bounds'][new_ind] = min(min(np.ones(n) - H['x_on_cube'][new_ind]),min(H['x_on_cube'][new_ind]))

dist_to_all = sp.spatial.distance.cdist(np.atleast_2d(H['x_on_cube'][new_ind]), H['x_on_cube'][p], 'euclidean').flatten()
dist_to_all = sp.spatial.distance.cdist([H['x_on_cube'][new_ind]], H['x_on_cube'][p], 'euclidean').flatten()
new_better_than = H['f'][new_ind] < H['f'][p]
new_worse_than = H['f'][new_ind] > H['f'][p]

Expand Down

0 comments on commit 5f5b1ee

Please sign in to comment.