Skip to content

Commit

Permalink
make synthetic constrained test functions subclass from SyntheticTest…
Browse files Browse the repository at this point in the history
…Function (#2029)

Summary:
Pull Request resolved: #2029

This is required to inherit `optimal_value` and `optimizers`.

Reviewed By: esantorella

Differential Revision: D49689060

fbshipit-source-id: 965a59119f086341caba7c0ab629797656d31c95
  • Loading branch information
sdaulton authored and facebook-github-bot committed Sep 27, 2023
1 parent 8274465 commit 2aef8e2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion botorch/test_functions/synthetic.py
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@ def evaluate_true(self, X: Tensor) -> Tensor:
# ------------ Constrained synthetic test functions ----------- #


class ConstrainedGramacy(ConstrainedBaseTestProblem):
class ConstrainedGramacy(ConstrainedBaseTestProblem, SyntheticTestFunction):
r"""Constrained Gramacy test function.
This problem comes from [Gramacy2016]_. The problem is defined
Expand Down
3 changes: 3 additions & 0 deletions test/test_functions/test_synthetic.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ class TestConstrainedGramacy(
BotorchTestCase,
BaseTestProblemTestCaseMixIn,
ConstrainedTestProblemTestCaseMixin,
SyntheticTestFunctionTestCaseMixin,
):

functions = [
Expand All @@ -334,6 +335,7 @@ class TestConstrainedGramacy(
class TestConstrainedHartmann(
BotorchTestCase,
BaseTestProblemTestCaseMixIn,
SyntheticTestFunctionTestCaseMixin,
ConstrainedTestProblemTestCaseMixin,
):

Expand All @@ -345,6 +347,7 @@ class TestConstrainedHartmann(
class TestConstrainedHartmannSmooth(
BotorchTestCase,
BaseTestProblemTestCaseMixIn,
SyntheticTestFunctionTestCaseMixin,
ConstrainedTestProblemTestCaseMixin,
):

Expand Down

0 comments on commit 2aef8e2

Please sign in to comment.