def negative_goldstein_uniform(dtype=tf.float64):
    xdim = 1
    zdim = 1
    input_dim = (xdim + zdim)
    xmin = 0.0
    xmax = 1.0
    zmin = 0.0
    zmax = 1.0
    xs = get_meshgrid(xmin, xmax, 50, xdim)

    def f(x):
        x = x.reshape((- 1), input_dim)
        xb = ((x * 4.0) - 2.0)
        val = (- (np.log(((1 + ((((xb[:, 0] + xb[:, 1]) + 1.0) ** 2) * (((((19 - (14 * xb[:, 0])) + (3 * (xb[:, 0] ** 2))) - (14 * xb[:, 1])) + ((6 * xb[:, 0]) * xb[:, 1])) + (3 * (xb[:, 1] ** 2))))) * (30 + ((((2 * xb[:, 0]) - (3 * xb[:, 1])) ** 2) * (((((18 - (32 * xb[:, 0])) + (12 * (xb[:, 0] ** 2))) + (48 * xb[:, 1])) - ((36 * xb[:, 0]) * xb[:, 1])) + (27 * (xb[:, 1] ** 2))))))) - 8.693))
        return val

    def f_tf(x):
        x = tf.reshape(x, shape=((- 1), input_dim))
        xb = ((x * tf.cast(4.0, dtype)) - tf.cast(2.0, dtype))
        val = (- (tf.log(((tf.cast(1.0, dtype) + (tf.math.pow(((xb[:, 0] + xb[:, 1]) + tf.cast(1.0, dtype)), 2) * (((((tf.cast(19.0, dtype) - (tf.cast(14.0, dtype) * xb[:, 0])) + ((tf.cast(3.0, dtype) * xb[:, 0]) * xb[:, 0])) - (tf.cast(14.0, dtype) * xb[:, 1])) + ((tf.cast(6.0, dtype) * xb[:, 0]) * xb[:, 1])) + ((tf.cast(3.0, dtype) * xb[:, 1]) * xb[:, 1])))) * (tf.cast(30.0, dtype) + (tf.math.pow(((tf.cast(2.0, dtype) * xb[:, 0]) - (tf.cast(3.0, dtype) * xb[:, 1])), 2) * (((((tf.cast(18.0, dtype) - (tf.cast(32.0, dtype) * xb[:, 0])) + ((tf.cast(12.0, dtype) * xb[:, 0]) * xb[:, 0])) + (tf.cast(48.0, dtype) * xb[:, 1])) - ((tf.cast(36.0, dtype) * xb[:, 0]) * xb[:, 1])) + ((tf.cast(27.0, dtype) * xb[:, 1]) * xb[:, 1])))))) - tf.cast(8.693, dtype)))
        return val
    mean_tnorm = ((zmin + zmax) / 2.0)
    std_tnorm = ((zmax - zmin) / 8.0)
    low_tnorm = (mean_tnorm - (2.0 * std_tnorm))
    high_tnorm = (mean_tnorm + (2.0 * std_tnorm))
    truncated_normal = tfp.distributions.TruncatedNormal(loc=tf.cast(mean_tnorm, dtype=tf.float64), scale=tf.cast(std_tnorm, dtype=tf.float64), low=tf.cast(low_tnorm, dtype=tf.float64), high=tf.cast(high_tnorm, dtype=tf.float64), name='branin_truncated_normal')

    def z_tnorm_generator(n):
        return truncated_normal.sample(sample_shape=(n, zdim))

    def z_lpdf(z):
        return tf.reduce_sum(truncated_normal.log_prob(z), axis=1)
    zmid = ((zmin + zmax) / 2.0)
    z_values = np.linspace(zmin, zmax, 50).reshape((- 1), 1)
    z_probs = (np.ones(50) / 50.0)
    z_lprobs = np.log(z_probs)
    return {'function': f, 'function_tf': f_tf, 'name': 'negative_goldstein_uniform', 'xdim': xdim, 'zdim': zdim, 'xmin': xmin, 'xmax': xmax, 'zmin': zmin, 'zmax': zmax, 'z_generator': z_tnorm_generator, 'z_lpdf': z_lpdf, 'zvalues': z_values, 'zlprobs': z_lprobs, 'zprobs': z_probs, 'lengthscale': np.array([81.1012626, 83.22416009]), 'signal_variance': 0.02584212360067521, 'likelihood_variance': 0.01, 'rand_opt_init_x': xs, 'max_var_discrete': 1.7992384381492217, 'max_var_continuous': 1.50360403, 'max_cvar_discrete': (- 2.394406754560626)}
def negative_goldstein_uniform(dtype=tf.float64):
    xdim = 1
    zdim = 1
    input_dim = (xdim + zdim)
    xmin = 0.0
    xmax = 1.0
    zmin = 0.0
    zmax = 1.0
    xs = get_meshgrid(xmin, xmax, 50, xdim)

    def f(x):
        x = x.reshape((- 1), input_dim)
        xb = ((x * 4.0) - 2.0)
        val = (- (np.log(((1 + ((((xb[:, 0] + xb[:, 1]) + 1.0) ** 2) * (((((19 - (14 * xb[:, 0])) + (3 * (xb[:, 0] ** 2))) - (14 * xb[:, 1])) + ((6 * xb[:, 0]) * xb[:, 1])) + (3 * (xb[:, 1] ** 2))))) * (30 + ((((2 * xb[:, 0]) - (3 * xb[:, 1])) ** 2) * (((((18 - (32 * xb[:, 0])) + (12 * (xb[:, 0] ** 2))) + (48 * xb[:, 1])) - ((36 * xb[:, 0]) * xb[:, 1])) + (27 * (xb[:, 1] ** 2))))))) - 8.693))
        return val

    def f_tf(x):
        x = tf.reshape(x, shape=((- 1), input_dim))
        xb = ((x * tf.cast(4.0, dtype)) - tf.cast(2.0, dtype))
        val = (- (tf.log(((tf.cast(1.0, dtype) + (tf.math.pow(((xb[:, 0] + xb[:, 1]) + tf.cast(1.0, dtype)), 2) * (((((tf.cast(19.0, dtype) - (tf.cast(14.0, dtype) * xb[:, 0])) + ((tf.cast(3.0, dtype) * xb[:, 0]) * xb[:, 0])) - (tf.cast(14.0, dtype) * xb[:, 1])) + ((tf.cast(6.0, dtype) * xb[:, 0]) * xb[:, 1])) + ((tf.cast(3.0, dtype) * xb[:, 1]) * xb[:, 1])))) * (tf.cast(30.0, dtype) + (tf.math.pow(((tf.cast(2.0, dtype) * xb[:, 0]) - (tf.cast(3.0, dtype) * xb[:, 1])), 2) * (((((tf.cast(18.0, dtype) - (tf.cast(32.0, dtype) * xb[:, 0])) + ((tf.cast(12.0, dtype) * xb[:, 0]) * xb[:, 0])) + (tf.cast(48.0, dtype) * xb[:, 1])) - ((tf.cast(36.0, dtype) * xb[:, 0]) * xb[:, 1])) + ((tf.cast(27.0, dtype) * xb[:, 1]) * xb[:, 1])))))) - tf.cast(8.693, dtype)))
        return val
    mean_tnorm = ((zmin + zmax) / 2.0)
    std_tnorm = ((zmax - zmin) / 8.0)
    low_tnorm = (mean_tnorm - (2.0 * std_tnorm))
    high_tnorm = (mean_tnorm + (2.0 * std_tnorm))
    truncated_normal = tfp.distributions.TruncatedNormal(loc=tf.cast(mean_tnorm, dtype=tf.float64), scale=tf.cast(std_tnorm, dtype=tf.float64), low=tf.cast(low_tnorm, dtype=tf.float64), high=tf.cast(high_tnorm, dtype=tf.float64), name='branin_truncated_normal')

    def z_tnorm_generator(n):
        return truncated_normal.sample(sample_shape=(n, zdim))

    def z_lpdf(z):
        return tf.reduce_sum(truncated_normal.log_prob(z), axis=1)
    zmid = ((zmin + zmax) / 2.0)
    z_values = np.linspace(zmin, zmax, 50).reshape((- 1), 1)
    z_probs = (np.ones(50) / 50.0)
    z_lprobs = np.log(z_probs)
    return {'function': f, 'function_tf': f_tf, 'name': 'negative_goldstein_uniform', 'xdim': xdim, 'zdim': zdim, 'xmin': xmin, 'xmax': xmax, 'zmin': zmin, 'zmax': zmax, 'z_generator': z_tnorm_generator, 'z_lpdf': z_lpdf, 'zvalues': z_values, 'zlprobs': z_lprobs, 'zprobs': z_probs, 'lengthscale': np.array([81.1012626, 83.22416009]), 'signal_variance': 0.02584212360067521, 'likelihood_variance': 0.01, 'rand_opt_init_x': xs, 'max_var_discrete': 1.7992384381492217, 'max_var_continuous': 1.50360403, 'max_cvar_discrete': (- 2.394406754560626)}