def get_high_d_function_caller_from_low_d_func(domain_dim, low_d_func, low_d_domain_bounds, low_d_opt_val, low_d_opt_pt, **kwargs): """ Gets a low dimensional function caller from a high dimensional one. """ group_dim = len(low_d_domain_bounds) high_d_func, num_groups = get_high_d_function_from_low_d( domain_dim, group_dim, low_d_func) high_d_domain_bounds = np.tile( np.array(low_d_domain_bounds).T, num_groups + 1).T[0:domain_dim] high_d_opt_pt = None high_d_opt_val = None if low_d_opt_pt is not None: high_d_opt_pt = np.tile(low_d_opt_pt, num_groups + 1)[0:domain_dim] high_d_opt_val = high_d_func(high_d_opt_pt) elif low_d_opt_val is not None: high_d_opt_val = num_groups * low_d_opt_val # Return func_caller = get_euc_function_caller_from_function(high_d_func, high_d_domain_bounds, vectorised=False, opt_val=high_d_opt_val, opt_pt=high_d_opt_pt, **kwargs) return func_caller
def get_hartmann_high_d_function_caller(domain_dim, **kwargs): """ Constructs a higher dimensional Hartmann function. """ group_dim = 6 num_groups = int(domain_dim / group_dim) A, P, alpha, l_opt_pt, l_domain_bounds, l_max_val = _get_hartmann_data( group_dim) hartmann_func = lambda x: hartmann(x, alpha, A, P, l_max_val) def _eval_highd_hartmann_func(x): """ Evaluates the higher dimensional hartmann function. """ ret = 0 for j in range(num_groups): ret += hartmann_func(x[j * group_dim:(j + 1) * group_dim]) return ret opt_pt = np.tile(l_opt_pt, num_groups + 1)[0:domain_dim] opt_val = num_groups * l_max_val domain_bounds = np.tile(np.array(l_domain_bounds).T, num_groups + 1).T[0:domain_dim] return get_euc_function_caller_from_function(_eval_highd_hartmann_func, domain_bounds, vectorised=False, opt_pt=opt_pt, opt_val=opt_val, **kwargs)
def get_shekel_function_caller(**kwargs): """ Returns a FunctionCaller object for the hartmann function. """ C, beta, opt_pt, domain_bounds, opt_val = _get_shekel_data() shekel_func = lambda x: shekel(x, C, beta, opt_val) return get_euc_function_caller_from_function(shekel_func, domain_bounds, vectorised=False, opt_pt=opt_pt, opt_val=opt_val, **kwargs)
def get_hartmann_function_caller(domain_dim, **kwargs): """ Returns a FunctionCaller object for the hartmann function. """ A, P, alpha, opt_pt, domain_bounds, max_val = _get_hartmann_data( domain_dim) hartmann_func = lambda x: hartmann(x, alpha, A, P, max_val) return get_euc_function_caller_from_function(hartmann_func, domain_bounds, vectorised=False, opt_pt=opt_pt, opt_val=max_val, **kwargs)
def get_branin_function_caller(**kwargs): """ Returns a FunctionCaller object for the Branin function. """ a, b, c, r, s, t, opt_pt, domain_bounds = _get_branin_data() branin_func = lambda x: branin(x, a, b, c, r, s, t) opt_val = branin_func(opt_pt) return get_euc_function_caller_from_function(branin_func, domain_bounds=domain_bounds, vectorised=False, opt_val=opt_val, opt_pt=opt_pt, **kwargs)
def get_park2_function_caller(**kwargs): """ Returns function caller for park2. """ opt_val = 5.925698 opt_pt = None func = lambda x: park2(x, opt_val) domain_bounds = [[0, 1]] * 4 return get_euc_function_caller_from_function(func, domain_bounds, vectorised=False, opt_val=opt_val, opt_pt=opt_pt, **kwargs)
def get_park1_function_caller(**kwargs): """ Returns the park1 function caller. """ opt_val = 25.5872304 opt_pt = None func = lambda x: park1(x, opt_val) domain_bounds = [[0, 1]] * 4 return get_euc_function_caller_from_function(func, domain_bounds, vectorised=False, opt_val=opt_val, opt_pt=opt_pt, **kwargs)
def get_currin_exp_function_caller(**kwargs): """ Returns a FunctionCaller object for the Currin Exponential function. """ currin_exp_func = lambda x: currin_exp(x, 1) opt_val = 13.798650 opt_pt = None domain_bounds = np.array([[0, 1], [0, 1]]) return get_euc_function_caller_from_function(currin_exp_func, domain_bounds=domain_bounds, vectorised=False, opt_val=opt_val, opt_pt=opt_pt, **kwargs)
def get_borehole_function_caller(**kwargs): """ Returns a FunctionCaller object for the Borehold function. """ opt_val = 309.523221 opt_pt = None borehole_func = lambda x: borehole(x, 1, opt_val) domain_bounds = [[0.05, 0.15], [100, 50000], [63070, 115600], [990, 1110], [63.1, 116], [700, 820], [1120, 1680], [9855, 12045]] return get_euc_function_caller_from_function(borehole_func, domain_bounds, vectorised=False, opt_val=opt_val, opt_pt=opt_pt, **kwargs)
def get_branin_high_d_function_caller(domain_dim, **kwargs): """ Constructs a higher dimensional Hartmann function. """ group_dim = 2 num_groups = int(domain_dim / group_dim) a, b, c, r, s, t, opt_pt_2d, domain_bounds_2d = _get_branin_data() branin_func = lambda x: branin(x, a, b, c, r, s, t) def _eval_highd_branin_func(x): """ Evaluates higher dimensional branin function. """ ret = 0 for j in range(num_groups): ret += branin_func(x[j * group_dim:(j + 1) * group_dim]) return ret opt_pt = np.tile(opt_pt_2d, num_groups + 1)[0:domain_dim] opt_val = _eval_highd_branin_func(opt_pt) domain_bounds = np.tile(np.array(domain_bounds_2d).T, num_groups + 1).T[0:domain_dim] return get_euc_function_caller_from_function(_eval_highd_branin_func, domain_bounds, vectorised=False, opt_pt=opt_pt, opt_val=opt_val, **kwargs)