def get_initial_evaluations(dim):

    if dim == 1:
        # Initial points used for figure 1 in the paper.
        train_x = torch.Tensor([[0.93452506], [0.18872502], [0.89790337],
                                [0.95841797], [0.82335255], [0.45000000],
                                [0.50000000]])
        train_y = torch.Tensor([
            -0.4532849, -0.66614552, -0.92803395, 0.08880341, -0.27683621,
            1.000000, 1.500000
        ])
    elif dim == 2:
        branin_fun = Branin(noise_std=None, negate=False)
        train_x = draw_sobol_samples(bounds=torch.Tensor(
            ([0.0] * dim, [1.0] * dim)),
                                     n=4,
                                     q=1).squeeze(1)
        train_y = branin_fun(train_x)
    elif dim == 6:
        hartman_fun = Hartmann()
        train_x = draw_sobol_samples(bounds=torch.Tensor(
            ([0.0] * dim, [1.0] * dim)),
                                     n=4,
                                     q=1).squeeze(1)
        train_y = hartman_fun(train_x)

    return train_x, train_y
def get_initial_evaluations(dim,eval_type=1):

	if dim == 1:
		if eval_type == 1:
			train_x = torch.tensor([[0.1],[0.3],[0.65],[0.7],[0.9]],device=device, dtype=torch.float32, requires_grad=False)
			train_y = torch.tensor([-0.5,2.0,1.0,INF,INF],device=device, dtype=torch.float32, requires_grad=False) # We place inf to emphasize the absence of measurement
			train_l = torch.tensor([+1, +1, +1, -1, -1],device=device, requires_grad=False, dtype=torch.float32)
		elif eval_type == 2:
			train_x = torch.tensor([[0.7],[0.9]],device=device, dtype=torch.float32, requires_grad=False)
			train_y = torch.tensor([INF,INF],device=device, dtype=torch.float32, requires_grad=False) # We place inf to emphasize the absence of measurement
			train_l = torch.tensor([-1, -1],device=device, requires_grad=False, dtype=torch.float32)
		else:
			train_x = torch.tensor([[0.7],[0.9]],device=device, dtype=torch.float32, requires_grad=False)
			train_y = torch.tensor([-0.5,2.0],device=device, dtype=torch.float32, requires_grad=False) # We place inf to emphasize the absence of measurement
			train_l = torch.tensor([+1, +1],device=device, requires_grad=False, dtype=torch.float32)

		# Put them together:
		train_yl = torch.cat([train_y[:,None], train_l[:,None]],dim=1)
	elif dim == 2:
		branin_fun = Branin(noise_std=None, negate=False)
		train_x = draw_sobol_samples(bounds=torch.tensor(([0.0]*dim,[1.0]*dim)),n=4,q=1).squeeze(1)
		train_y = branin_fun(train_x)
	elif dim == 6:
		hartman_fun = Hartmann()
		train_x = draw_sobol_samples(bounds=torch.tensor(([0.0]*dim,[1.0]*dim)),n=4,q=1).squeeze(1)
		train_y = hartman_fun(train_x)

	return train_x, train_yl
Beispiel #3
0
    def __init__(self, noise_std: Optional[float] = None, negate: bool = False) -> None:
        r"""Constructor for Branin-Currin.

        Arguments:
            noise_std: Standard deviation of the observation noise.
            negate: If True, negate the objectives.
        """
        super().__init__(noise_std=noise_std, negate=negate)
        self._branin = Branin()
def function_evaluate(xnext, model=None):

    dim = xnext.shape[1]

    if dim == 1:
        predictive = model(xnext)
        y_new = predictive.sample(torch.Size([1]))
    elif dim == 2:
        branin_fun = Branin(noise_std=None, negate=False)
        y_new = branin_fun(xnext)
    elif dim == 6:
        hartman_fun = Hartmann()
        y_new = hartman_fun(xnext)

    return y_new
Beispiel #5
0

from ax.benchmark.benchmark_problem import BenchmarkProblem, SimpleBenchmarkProblem
from ax.utils.measurement.synthetic_functions import from_botorch
from ax.utils.testing.core_stubs import (
    get_augmented_branin_optimization_config,
    get_augmented_hartmann_optimization_config,
    get_branin_search_space,
    get_hartmann_search_space,
)
from botorch.test_functions.synthetic import Ackley, Branin


# Initialize the single-fidelity problems
ackley = SimpleBenchmarkProblem(f=from_botorch(Ackley()), noise_sd=0.0, minimize=True)
branin = SimpleBenchmarkProblem(f=from_botorch(Branin()), noise_sd=0.0, minimize=True)
single_fidelity_problem_group = [ackley, branin]

# Initialize the multi-fidelity problems
augmented_branin = BenchmarkProblem(
    search_space=get_branin_search_space(with_fidelity_parameter=True),
    optimization_config=get_augmented_branin_optimization_config(),
)
augmented_hartmann = BenchmarkProblem(
    search_space=get_hartmann_search_space(with_fidelity_parameter=True),
    optimization_config=get_augmented_hartmann_optimization_config(),
)
multi_fidelity_problem_group = [augmented_branin, augmented_hartmann]

# Gather all of the problems
MODULAR_BOTORCH_PROBLEM_GROUPS = {
Beispiel #6
0
class TestBranin(SyntheticTestFunctionBaseTestCase, BotorchTestCase):

    functions = [Branin(), Branin(negate=True), Branin(noise_std=0.1)]
Beispiel #7
0
from ax.benchmark.benchmark_problem import BenchmarkProblem, SimpleBenchmarkProblem
from ax.utils.measurement.synthetic_functions import from_botorch
from ax.utils.testing.core_stubs import (
    get_augmented_branin_optimization_config,
    get_augmented_hartmann_optimization_config,
    get_branin_search_space,
    get_hartmann_search_space,
)
from botorch.test_functions.synthetic import Ackley, Branin

# Initialize the single-fidelity problems
ackley = SimpleBenchmarkProblem(f=from_botorch(Ackley()),
                                noise_sd=0.0,
                                minimize=True)
branin = SimpleBenchmarkProblem(f=from_botorch(Branin()),
                                noise_sd=0.0,
                                minimize=True)
single_fidelity_problem_group = [ackley, branin]

# Initialize the multi-fidelity problems
augmented_branin = BenchmarkProblem(
    search_space=get_branin_search_space(with_fidelity_parameter=True),
    optimization_config=get_augmented_branin_optimization_config(),
)
augmented_hartmann = BenchmarkProblem(
    search_space=get_hartmann_search_space(with_fidelity_parameter=True),
    optimization_config=get_augmented_hartmann_optimization_config(),
)
multi_fidelity_problem_group = [augmented_branin, augmented_hartmann]