optuna / optuna-integration

Extended functionalities for Optuna in combination with third-party libraries.
https://optuna-integration.readthedocs.io/en/latest/index.html
MIT License
39 stars 30 forks source link

Pass two arguments to the forward of `ConstrainedMCObjective` to support `botorch=0.10.0` #106

Closed nzw0301 closed 8 months ago

nzw0301 commented 8 months ago

Motivation

Resolve #97.

Description of the changes

Revert https://github.com/optuna/optuna-integration/pull/96 and pass two arguments to ConstrainedMCObjective's forward that should take two arguments since v0.10.0 by https://github.com/pytorch/botorch/pull/2199 and older botorch supports both one and two arguments.

nzw0301 commented 8 months ago

The test seems fine with the oldest botorch version supported by optuna:

$ pip install "botorch<=0.8.1"
...
$ pytest tests/test_botorch.py
========================================================================== test session starts ===========================================================================
platform darwin -- Python 3.10.13, pytest-8.0.1, pluggy-1.4.0
rootdir: /Users/nzw0301/Documents/oss/optuna-integration
configfile: pyproject.toml
plugins: jaxtyping-0.2.28, anyio-4.3.0, typeguard-2.13.3
collected 40 items
...
============================================================== 39 passed, 1 skipped, 132 warnings in 41.40s ==============================================================
github-actions[bot] commented 8 months ago

This pull request has not seen any recent activity.