|
22 | 22 | algorithms through the use of dominance-based tournament selection.
|
23 | 23 | Advanced Engineering Informatics, 16(3):193–203, 2002.
|
24 | 24 |
|
| 25 | +.. [Gramacy2016] |
| 26 | + R. Gramacy, G. Gray, S. Le Digabel, H. Lee, P. Ranjan, G. Wells & S. Wild. |
| 27 | + Modeling an Augmented Lagrangian for Blackbox Constrained Optimization, |
| 28 | + Technometrics, 2016. |
| 29 | +
|
25 | 30 | .. [Hedar2006derivfree]
|
26 | 31 | A.-R. Hedar and M. Fukushima. Derivative-free filter simulated annealing
|
27 | 32 | method for constrained continuous global optimization. Journal of Global
|
|
43 | 48 | Particle Swarm and the Differential Evolution Methods (May 1, 2007).
|
44 | 49 | Available at SSRN: https://ssrn.com/abstract=983836.
|
45 | 50 |
|
46 |
| -.. [Gramacy2016] |
47 |
| - R. Gramacy, G. Gray, S. Le Digabel, H. Lee, P. Ranjan, G. Wells & S. Wild. |
48 |
| - Modeling an Augmented Lagrangian for Blackbox Constrained Optimization, |
49 |
| - Technometrics, 2016. |
| 51 | +.. [Packebusch2016] |
| 52 | + T. Packebusch, S. Mertens. Low autocorrelation binary sequences. Journal of |
| 53 | + Physics A: Mathematical and Theoretical 49.16 (2016). |
50 | 54 | """
|
51 | 55 |
|
52 | 56 | from __future__ import annotations
|
@@ -917,6 +921,68 @@ def _evaluate_true(self, X: Tensor) -> Tensor:
|
917 | 921 | return self._ackley.evaluate_true((X - self.x_opt).abs())
|
918 | 922 |
|
919 | 923 |
|
| 924 | +class Labs(SyntheticTestFunction): |
| 925 | + r"""Low Auto-correlation Binary Sequences (LABS) problem. |
| 926 | +
|
| 927 | + This input space is binary and the goal is to maximize the Merit factor. |
| 928 | + [Packebusch2016]_ provides optimal values and optimizers attained through |
| 929 | + brute-force for dim <= 66. We include these for dim = 10, 20, 30, 40, 50, 60. |
| 930 | + """ |
| 931 | + |
| 932 | + _check_grad_at_opt = False |
| 933 | + |
| 934 | + def __init__( |
| 935 | + self, |
| 936 | + dim: int = 30, |
| 937 | + noise_std: float | None = None, |
| 938 | + negate: bool = False, |
| 939 | + dtype: torch.dtype = torch.double, |
| 940 | + ) -> None: |
| 941 | + r""" |
| 942 | + Args: |
| 943 | + dim: The (input) dimension. |
| 944 | + noise_std: Standard deviation of the observation noise. |
| 945 | + negate: If True, negate the function. |
| 946 | + bounds: Custom bounds for the function specified as (lower, upper) pairs. |
| 947 | + dtype: The dtype that is used for the bounds of the function. |
| 948 | + """ |
| 949 | + self.dim = dim |
| 950 | + self.discrete_inds = list(range(dim)) |
| 951 | + bounds = [(0.0, 1.0) for _ in range(dim)] |
| 952 | + optvals = {10: 3.846, 20: 7.692, 30: 7.627, 40: 7.407, 50: 8.170, 60: 8.257} |
| 953 | + optimizers = { |
| 954 | + 10: "42211", |
| 955 | + 20: "5113112321", |
| 956 | + 30: "551212111113231", |
| 957 | + 40: "44412112131121313131", |
| 958 | + 50: "215131311224112241141142", |
| 959 | + 60: "761112141111131124211322211222", |
| 960 | + } |
| 961 | + self._optimal_value = optvals.get(self.dim) |
| 962 | + _optimizers = optimizers.get(self.dim) |
| 963 | + if _optimizers is not None: |
| 964 | + _optimizers = self._optimizer_from_binary_seq(_optimizers) |
| 965 | + self._optimizers = _optimizers |
| 966 | + super().__init__(noise_std=noise_std, negate=negate, bounds=bounds, dtype=dtype) |
| 967 | + |
| 968 | + def _optimizer_from_binary_seq(self, seq: str) -> list[tuple[float]]: |
| 969 | + """Converts a binary sequence into a an array.""" |
| 970 | + arr, val = [], 0 |
| 971 | + for s in seq: |
| 972 | + arr += [val for _ in range(int(s))] |
| 973 | + val = 1 - val # alternate between 0 and 1 |
| 974 | + return [tuple(arr)] |
| 975 | + |
| 976 | + def _evaluate_true(self, X: Tensor) -> Tensor: |
| 977 | + X = 2 * X - 1 # Map from {0, 1}^d to {-1, 1}^d |
| 978 | + energy = torch.zeros(X.shape[:-1], dtype=X.dtype, device=X.device) |
| 979 | + for k in range(1, self.dim): |
| 980 | + energy += ( |
| 981 | + (X[..., 0 : self.dim - k] * X[..., k : self.dim]).sum(dim=-1).pow(2) |
| 982 | + ) |
| 983 | + return (self.dim**2) / (2.0 * energy) |
| 984 | + |
| 985 | + |
920 | 986 | # ------------ Constrained synthetic test functions ----------- #
|
921 | 987 |
|
922 | 988 |
|
|
0 commit comments