def negative_branin_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)
        x = ((15.0 * x) - np.array([5.0, 0.0]))
        val = (((- 1.0) / 51.95) * ((((((x[:, 1] - ((5.1 * (x[:, 0] ** 2)) / (4 * (np.pi ** 2)))) + ((5.0 * x[:, 0]) / np.pi)) - 6.0) ** 2) + ((10.0 - (10.0 / (8.0 * np.pi))) * np.cos(x[:, 0]))) - 44.81))
        return val

    def f_tf(x):
        x = tf.reshape(x, shape=((- 1), input_dim))
        x = ((tf.cast(15.0, dtype) * x) - tf.cast([5.0, 0.0], dtype))
        val = ((tf.cast((- 1.0), dtype) / tf.cast(51.95, dtype)) * ((tf.math.pow((((x[:, 1] - (((tf.cast(5.1, dtype) * x[:, 0]) * x[:, 0]) / tf.cast((4 * (np.pi ** 2)), dtype))) + ((tf.cast(5.0, dtype) * x[:, 0]) / tf.cast(np.pi, dtype))) - tf.cast(6.0, dtype)), 2) + ((tf.cast(10.0, dtype) - (tf.cast(10.0, dtype) / tf.cast((8.0 * np.pi), dtype))) * tf.cos(x[:, 0]))) - tf.cast(44.81, 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, 30).reshape((- 1), 1)
    z_probs = (np.ones(30) / 30.0)
    z_lprobs = np.log(z_probs)
    return {'function': f, 'function_tf': f_tf, 'name': 'negative_branin_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([12.14689435, 0.3134626]), 'signal_variance': 1.5294688560240726, 'likelihood_variance': 0.01, 'rand_opt_init_x': xs, 'max_var_discrete': 0.7324786070977395, 'max_var_continuous': 0.64118695, 'max_cvar_discrete': (- 0.2899622792949111)}
def negative_branin_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)
        x = ((15.0 * x) - np.array([5.0, 0.0]))
        val = (((- 1.0) / 51.95) * ((((((x[:, 1] - ((5.1 * (x[:, 0] ** 2)) / (4 * (np.pi ** 2)))) + ((5.0 * x[:, 0]) / np.pi)) - 6.0) ** 2) + ((10.0 - (10.0 / (8.0 * np.pi))) * np.cos(x[:, 0]))) - 44.81))
        return val

    def f_tf(x):
        x = tf.reshape(x, shape=((- 1), input_dim))
        x = ((tf.cast(15.0, dtype) * x) - tf.cast([5.0, 0.0], dtype))
        val = ((tf.cast((- 1.0), dtype) / tf.cast(51.95, dtype)) * ((tf.math.pow((((x[:, 1] - (((tf.cast(5.1, dtype) * x[:, 0]) * x[:, 0]) / tf.cast((4 * (np.pi ** 2)), dtype))) + ((tf.cast(5.0, dtype) * x[:, 0]) / tf.cast(np.pi, dtype))) - tf.cast(6.0, dtype)), 2) + ((tf.cast(10.0, dtype) - (tf.cast(10.0, dtype) / tf.cast((8.0 * np.pi), dtype))) * tf.cos(x[:, 0]))) - tf.cast(44.81, 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, 30).reshape((- 1), 1)
    z_probs = (np.ones(30) / 30.0)
    z_lprobs = np.log(z_probs)
    return {'function': f, 'function_tf': f_tf, 'name': 'negative_branin_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([12.14689435, 0.3134626]), 'signal_variance': 1.5294688560240726, 'likelihood_variance': 0.01, 'rand_opt_init_x': xs, 'max_var_discrete': 0.7324786070977395, 'max_var_continuous': 0.64118695, 'max_cvar_discrete': (- 0.2899622792949111)}