def cmpt_Y(): Y = np.zeros((Ma, Mb, Mc, N)) for i in range(Ma): for k in range (Mb): for m in range(Mc): Y[i, k, m, :] = evaluate(param_values, delta, np.array([alpha[0, i], alpha[1, k], alpha[2, m]]), np.array([a[0, i], a[1, k], a[2, m]])) return Y
def cmpt_Y_C(N): print('Computing system output...') # Sampling from the stratum using LHS251 problem = { 'nvars': 3, 'names': ['x1', 'y1', 'z1'], 'bounds': [[0, 1], [0, 1], [0, 1]], 'dists': ['UNIFORM', 'UNIFORM', 'UNIFORM'] } param_values = lhs(problem, N, seed=933090934) Y = np.zeros((Ma, Mb, N, Mc, N), dtype=np.float32) for i in range(Ma): for k in range(Mb): if (i == 0 and k == 0): theta_non_K_set = param_values[:, [0, 1]] for j in range(N): for m in range(Mc): if m == 0: theta_K_set = param_values[:, 0] else: theta_K_set = param_values[:, 0] values = np.hstack( (np.repeat(theta_non_K_set[j, :].reshape(1, -1), N, axis=0), theta_K_set.reshape(-1, 1))) Y[i, k, j, m, :] = evaluate( values, delta, np.array([alpha[0, i], alpha[1, k], alpha[2, m]]), np.array([a[0, i], a[1, k], a[2, m]])) if (i == 0 and k == 1): theta_non_K_set = param_values[:, [0, 1]] for j in range(N): for m in range(Mc): if m == 0: theta_K_set = param_values[:, 0] else: theta_K_set = param_values[:, 0] values = np.hstack( (np.repeat(theta_non_K_set[j, :].reshape(1, -1), N, axis=0), theta_K_set.reshape(-1, 1))) Y[i, k, j, m, :] = evaluate( values, delta, np.array([alpha[0, i], alpha[1, k], alpha[2, m]]), np.array([a[0, i], a[1, k], a[2, m]])) if (i == 1 and k == 0): theta_non_K_set = param_values[:, [0, 1]] for j in range(N): for m in range(Mc): if m == 0: theta_K_set = param_values[:, 0] else: theta_K_set = param_values[:, 0] values = np.hstack( (np.repeat(theta_non_K_set[j, :].reshape(1, -1), N, axis=0), theta_K_set.reshape(-1, 1))) Y[i, k, j, m, :] = evaluate( values, delta, np.array([alpha[0, i], alpha[1, k], alpha[2, m]]), np.array([a[0, i], a[1, k], a[2, m]])) if (i == 1 and k == 1): theta_non_K_set = param_values[:, [0, 1]] for j in range(N): for m in range(Mc): if m == 0: theta_K_set = param_values[:, 0] else: theta_K_set = param_values[:, 0] values = np.hstack( (np.repeat(theta_non_K_set[j, :].reshape(1, -1), N, axis=0), theta_K_set.reshape(-1, 1))) Y[i, k, j, m, :] = evaluate( values, delta, np.array([alpha[0, i], alpha[1, k], alpha[2, m]]), np.array([a[0, i], a[1, k], a[2, m]])) print('Numerical mean Y =', np.mean(Y)) return Y
for imb in range(Mb): for imc in range(Mc): print('Current system model: ima=%d, imb=%d, imc=%d' % (ima, imb, imc)) Y1 = np.zeros((N, N, N)) for i in range(N): for j in range(N): for k in range(N): values = np.array([ param_values[i][0], param_values[j][1], param_values[k][2] ]).reshape(1, 3) Y1[i, j, k] = evaluate( values, delta, np.array( [alpha[0, ima], alpha[1, imb], alpha[2, imc]]), np.array([a[0, ima], a[1, imb], a[2, imc]])) # Save the model outputs # np.save('D:\Y1_500.npy', Y1) # Calculate the mean and variance of the differences for g1* diffA = np.zeros(N * N * N * N) it = 0 for j in range(N): for k in range(N): for i1 in range(N): for i2 in range(N): diffA[it] = Y1[i1, j, k] - Y1[i2, j, k] it = it + 1