def yacht_hydrodynamics(dtype=tf.float64):
    filename = 'yacht_data/gp_hyperparameters.pkl'
    with open(filename, 'rb') as readfile:
        yacht = pickle.load(readfile)
        X = yacht['X']
        Y = yacht['Y']
        gp_hyper = yacht['gp_hyper']
    NK = utils.computeNKmm(X, gp_hyper['lengthscale'], gp_hyper['signal_var'], gp_hyper['noise_var'], dtype=dtype, kernel_type='se')
    NKInv = utils.chol2inv(NK, dtype=dtype)
    NKInvs = tf.expand_dims(NKInv, axis=0)
    input_dim = X.shape[1]
    zdim = 1
    xdim = (input_dim - zdim)
    xmin = 0.0
    xmax = 1.0
    zmin = 0.0
    zmax = 1.0
    xs = get_meshgrid(xmin, xmax, 4, xdim)

    def f(x):
        x = x.reshape((- 1), input_dim)
        mean_f = (utils.compute_mean_f_np(x, X, (Y - gp_hyper['meanf']), gp_hyper['lengthscale'], gp_hyper['signal_var'], gp_hyper['noise_var'], kernel_type='se') + gp_hyper['meanf'])
        return (- mean_f.reshape((- 1), 1))

    def f_tf(x):
        x = tf.reshape(x, ((- 1), input_dim))
        mean_f = (utils.compute_mean_f(x, input_dim, 1, X, (Y - gp_hyper['meanf']), gp_hyper['lengthscale'].reshape(1, input_dim), gp_hyper['signal_var'].reshape(1, 1), gp_hyper['noise_var'].reshape(1, 1), NKInvs, dtype=dtype, kernel_type='se') + gp_hyper['meanf'])
        return (- mean_f)
    zmid = 0.0
    z_values = np.linspace(zmin, zmax, 15).reshape((- 1), 1)
    z_probs = (np.ones(z_values.shape[0]) / z_values.shape[0])
    z_lprobs = np.log(z_probs)
    return {'function': f, 'function_tf': f_tf, 'name': 'yacht_hydrodynamics', 'xdim': xdim, 'zdim': zdim, 'xmin': xmin, 'xmax': xmax, 'zmin': zmin, 'zmax': zmax, 'zvalues': z_values, 'zlprobs': z_lprobs, 'zprobs': z_probs, 'lengthscale': gp_hyper['lengthscale'], 'signal_variance': gp_hyper['signal_var'], 'likelihood_variance': 0.0001, 'rand_opt_init_x': xs, 'max_cvar_discrete': (- 1.009)}
def yacht_hydrodynamics(dtype=tf.float64):
    filename = 'yacht_data/gp_hyperparameters.pkl'
    with open(filename, 'rb') as readfile:
        yacht = pickle.load(readfile)
        X = yacht['X']
        Y = yacht['Y']
        gp_hyper = yacht['gp_hyper']
    NK = utils.computeNKmm(X, gp_hyper['lengthscale'], gp_hyper['signal_var'], gp_hyper['noise_var'], dtype=dtype, kernel_type='se')
    NKInv = utils.chol2inv(NK, dtype=dtype)
    NKInvs = tf.expand_dims(NKInv, axis=0)
    input_dim = X.shape[1]
    zdim = 1
    xdim = (input_dim - zdim)
    xmin = 0.0
    xmax = 1.0
    zmin = 0.0
    zmax = 1.0
    xs = get_meshgrid(xmin, xmax, 4, xdim)

    def f(x):
        x = x.reshape((- 1), input_dim)
        mean_f = (utils.compute_mean_f_np(x, X, (Y - gp_hyper['meanf']), gp_hyper['lengthscale'], gp_hyper['signal_var'], gp_hyper['noise_var'], kernel_type='se') + gp_hyper['meanf'])
        return (- mean_f.reshape((- 1), 1))

    def f_tf(x):
        x = tf.reshape(x, ((- 1), input_dim))
        mean_f = (utils.compute_mean_f(x, input_dim, 1, X, (Y - gp_hyper['meanf']), gp_hyper['lengthscale'].reshape(1, input_dim), gp_hyper['signal_var'].reshape(1, 1), gp_hyper['noise_var'].reshape(1, 1), NKInvs, dtype=dtype, kernel_type='se') + gp_hyper['meanf'])
        return (- mean_f)
    zmid = 0.0
    z_values = np.linspace(zmin, zmax, 15).reshape((- 1), 1)
    z_probs = (np.ones(z_values.shape[0]) / z_values.shape[0])
    z_lprobs = np.log(z_probs)
    return {'function': f, 'function_tf': f_tf, 'name': 'yacht_hydrodynamics', 'xdim': xdim, 'zdim': zdim, 'xmin': xmin, 'xmax': xmax, 'zmin': zmin, 'zmax': zmax, 'zvalues': z_values, 'zlprobs': z_lprobs, 'zprobs': z_probs, 'lengthscale': gp_hyper['lengthscale'], 'signal_variance': gp_hyper['signal_var'], 'likelihood_variance': 0.0001, 'rand_opt_init_x': xs, 'max_cvar_discrete': (- 1.009)}