def parEI(gp1, gp2, X_sample, Y_sample, EI=True, truth=False, MD=False, PAR_RES=100): if MD: # create ND grid x = np.linspace(XL, XU, PAR_RES) ins = np.stack(np.meshgrid(*[x] * MD), axis=-1).reshape(MD, -1) if X_sample is not None: ins = np.append(ins, X_sample, 1) else: # create 1D grid ins = np.linspace(XL, XU, PAR_RES) if EI: # compute EI front eis = expected_improvement(ins, X_sample, Y_sample[:, 0], gpf1) eis2 = expected_improvement(ins, X_sample, Y_sample[:, 1], gpf2) pars = is_pareto_efficient_simple(np.array([eis, eis2]).T) return (ins, np.array([eis, eis2]), pars) else: if not truth: # compute mu_GP front if MD: a = gp1(ins.T) b = gp2(ins.T) else: a = [gp1(np.atleast_2d(np.array([xc])))[0] for xc in ins.T] b = [gp2(np.atleast_2d(np.array([xc])))[0] for xc in ins.T] else: # compute truth front if MD: a = [turbF([i], MD=MD) for i in ins.T] else: a = [turbF(i, MD=MD) for i in ins.T] b = [g(i) for i in ins.T] pars = is_pareto_efficient_simple(np.array([a, b]).T) return (ins, np.array([a, b]), pars)
def f(x, lf=False): return [turbF(x, lf=lf), g(x, lf=lf)]
def delta(x): return (np.array([turbF(x, lf=False), g(x, lf=False)]) - np.array([turbF(x, lf=True), g(x, lf=True)]))
def f(x, lf=False): return [turbF(x, lf=lf, MD=True), g(x, lf=lf)]