branin

Branin objective function, relying on the botorch implementation.

This code is based on the implementation by Nikita Saxena (nikita-0209) in https://github.com/alexhernandezgarcia/activelearning

The implementation assumes by default that the inputs will be on [-1, 1] x [-1, 1] and will be mapped to the standard domain of the Branin function (see X1_DOMAIN and X2_DOMAIN). Setting do_domain_map to False will prevent the mapping.

Branin function is typically used as a minimization problem, with the minima around zero but positive. By default, proxy values remain in this range and the reward is mapped to (~0, UPPER_BOUND_IN_DOMAIN). The user should carefully select the reward function in order to stick to the conventional use of the Branin function.

Attributes

X1_DOMAIN

X1_LENGTH

X2_DOMAIN

X2_LENGTH

UPPER_BOUND_IN_DOMAIN

OPTIMUM

MODES

Classes

Branin

Module Contents

branin.X1_DOMAIN[source]
branin.X1_LENGTH = 15[source]
branin.X2_DOMAIN = [0, 15][source]
branin.X2_LENGTH = 15[source]
branin.UPPER_BOUND_IN_DOMAIN = 309[source]
branin.OPTIMUM = 0.397887[source]
branin.MODES = [[12.4, 81.833], [54.266, 15.16], [94.98, 16.5]][source]
class branin.Branin(fidelity=1.0, do_domain_map=True, negate=False, reward_function=lambda x: ..., **kwargs)[source]

Bases: gflownet.proxy.base.Proxy

Parameters:
  • fidelity (float) – Fidelity of the Branin oracle. 1.0 corresponds to the original Branin. Smaller values (up to 0.0) reduce the fidelity of the oracle.

  • do_domain_map (bool) – If True, the states are assumed to be in [-1, 1] x [-1, 1] and are re-mapped to the standard domain before calling the botorch method. If False, the botorch method is called directly on the states values.

  • negate (bool) – If True, proxy values are multiplied by -1.

  • reward_function (str or Callable) – The transformation applied to the proxy outputs to obtain a GFlowNet reward. By default, proxy values are shifted by UPPER_BOUND_IN_DOMAIN and multiplied by minus one, in order to make them positive and the higher the better.

  • See (https://botorch.org/api/test_functions.html)

fidelity = 1.0[source]
do_domain_map = True[source]
function_mf_botorch[source]
domain_left[source]
domain_length[source]
__call__(states)[source]

Implement this function to call the get_reward method of the appropriate Proxy Class (EI, UCB, Proxy, Oracle etc).

Parameters:

states (ndarray)

Return type:

torchtyping.TensorType[batch]

map_to_standard_domain(states)[source]

Maps a batch of input states onto the domain typically used to evaluate the Branin function. See X1_DOMAIN and X2_DOMAIN. It assumes that the inputs are on [-1, 1] x [-1, 1].

Parameters:

states (torchtyping.TensorType[batch, 2])

Return type:

torchtyping.TensorType[batch, 2]