Skip to content

Commit

Permalink
Testing new alloc_f capabilities
Browse files Browse the repository at this point in the history
  • Loading branch information
jmlarson1 committed Nov 16, 2018
1 parent cdc281a commit efa0cf0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
from libensemble.sim_funcs.chwirut1 import chwirut_eval

# Import gen_func
from libensemble.gen_funcs.aposmm import aposmm_logic, queue_update_function
from libensemble.gen_funcs.aposmm import aposmm_logic

# Import alloc_func
from libensemble.alloc_funcs.fast_alloc_to_aposmm import give_sim_work_first as alloc_f
from libensemble.alloc_funcs.fast_alloc_and_pausing import give_sim_work_first as alloc_f

script_name = os.path.splitext(os.path.basename(__file__))[0]

Expand Down Expand Up @@ -75,20 +75,23 @@
'combine_component_func': lambda x: np.sum(np.power(x,2)),
'num_active_gens': 1,
'batch_mode': True,
'stop_on_NaNs': True,
'stop_partial_fvec_eval': True,
}

np.random.RandomState(0)
gen_specs['sample_points'] = np.random.uniform(0,1,(max_sim_budget,n))*(gen_specs['ub']-gen_specs['lb'])+gen_specs['lb']

exit_criteria = {'sim_max': max_sim_budget, # must be provided
}
alloc_specs = {'out':[('allocated',bool)], 'alloc_f':alloc_f}

libE_specs = {'queue_update_function': queue_update_function}
alloc_specs = {'out':[('allocated',bool)],
'alloc_f':alloc_f,
'stop_on_NaNs': True,
'stop_partial_fvec_eval': True,
}

np.random.seed(1)
persis_info = {'next_to_give':0}
persis_info = {}
persis_info['need_to_give'] = set()
persis_info['total_gen_calls'] = 0
persis_info['complete'] = set()
persis_info['has_nan'] = set()
Expand All @@ -104,7 +107,7 @@
'total_runs': 0,
'rand_stream': np.random.RandomState(1)}
# Perform the run
H, persis_info, flag = libE(sim_specs, gen_specs, exit_criteria, persis_info, alloc_specs, libE_specs)
H, persis_info, flag = libE(sim_specs, gen_specs, exit_criteria, persis_info, alloc_specs)

if MPI.COMM_WORLD.Get_rank() == 0:
assert len(H) >= max_sim_budget
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
from libensemble.sim_funcs.chwirut1 import chwirut_eval

# Import gen_func
from libensemble.gen_funcs.aposmm import aposmm_logic, queue_update_function
from libensemble.gen_funcs.aposmm import aposmm_logic
from libensemble.gen_funcs.uniform_sampling import uniform_random_sample_obj_components

# Import alloc_func
from libensemble.alloc_funcs.fast_alloc_to_aposmm import give_sim_work_first as alloc_f
from libensemble.alloc_funcs.fast_alloc_and_pausing import give_sim_work_first as alloc_f

script_name = os.path.splitext(os.path.basename(__file__))[0]

Expand Down Expand Up @@ -58,18 +58,20 @@
'combine_component_func': lambda x: np.sum(np.power(x,2)),
'num_active_gens': 1,
'batch_mode': True,
'stop_on_NaNs': True,
'stop_partial_fvec_eval': True,
}

exit_criteria = {'sim_max': max_sim_budget, # must be provided
}

alloc_specs = {'out':[('allocated',bool)], 'alloc_f':alloc_f}
alloc_specs = {'out':[('allocated',bool)],
'alloc_f':alloc_f,
'stop_on_NaNs': True,
'stop_partial_fvec_eval': True,
}

libE_specs = {'queue_update_function': queue_update_function}
np.random.seed(1)
persis_info = {'next_to_give':0}
persis_info = {}
persis_info['need_to_give'] = set()
persis_info['total_gen_calls'] = 0
persis_info['complete'] = set()
persis_info['has_nan'] = set()
Expand All @@ -85,7 +87,7 @@
'total_runs': 0,
'rand_stream': np.random.RandomState(1)}
# Perform the run
H, persis_info, flag = libE(sim_specs, gen_specs, exit_criteria, persis_info, alloc_specs, libE_specs)
H, persis_info, flag = libE(sim_specs, gen_specs, exit_criteria, persis_info, alloc_specs)

if MPI.COMM_WORLD.Get_rank() == 0:
assert flag == 0
Expand Down

0 comments on commit efa0cf0

Please sign in to comment.