facebook / Ax

Adaptive Experimentation Platform
https://ax.dev
MIT License
2.36k stars 307 forks source link

Optimization of analytic functions #935

Closed sgbaird closed 1 year ago

sgbaird commented 2 years ago

In Section S.3.B of:

Hickman, R. J.; Aldeghi, M.; Häse, F.; Aspuru-Guzik, A. Bayesian Optimization with Known Experimental and Design Constraints for Chemistry Applications. arXiv:2203.17241 [cond-mat] 2022. https://dx.doi.org/10.48550/arXiv.2203.17241

they performed a multi-objective optimization with one objective as a black box and another objective (cost) that is analytically calculated, but that I think was also represented as a black box. A quick search led me to:

Olofsson, S.; Mehrian, M.; Calandra, R.; Geris, L.; Deisenroth, M. P.; Misener, R. Bayesian Multiobjective Optimisation With Mixed Analytical and Black-Box Functions: Application to Tissue Engineering. IEEE Trans. Biomed. Eng. 2019, 66 (3), 727–739. https://doi.org/10.1109/TBME.2018.2855404.

where they rederived a few multi-objective acquisition functions to consider one black box objective and one analytic objective.

This topic is related to https://github.com/facebook/Ax/issues/745, except that the analytic objective is actually an objective to be optimized rather than a non-linear constraint on the input parameters. This idea of mixed analytical and black box functions is pretty common in the physical sciences, where one seeks a tradeoff between increasing (often several) difficult-to-model performance metrics and lowering monetary cost. Monetary cost as part of a multi-objective optimization is something that's been on my mind, and now I am realizing some of the difficulties of efficiently implementing it.

I've considered a few things:

Any thoughts/suggestions?

Balandat commented 2 years ago

Yeah this is something that has come up in our own research also (cc @dme65, @qingfeng10).

On the BoTorch end, we have the DeterministicModel abstraction. You can e.g. use a GenericDeterministicModel that allows you to use a generic callable mapping inputs X out "DeterministicPosterior" objects (which are really just a lightweight container wrapping the function value so we can use existing machinery to combine them with other probabilistically modeled outcomes.

Unfortunately, we currently don't have a way to easily expose this on the top level Ax API. Ultimately, the correct solution is a refactor of our Modelbridge & Model APIs, and BoTorch interface that will make specifying such analytic functions (to be used both as objectives and as constraints) in Ax possible. But this is a rather comprehensive refactor that will take some thinking (and more coding).

There are probably some hacky ways to make things work in the meantime - maybe @dme65 has an example for this?

lena-kashtelyan commented 2 years ago

We're working towards enabling this, so I'll label this as "in-progress". Also cc @dme65 for a potential hacky example @Balandat asked for above : )

sgbaird commented 2 years ago

@dme65 any thoughts for a workaround?

lena-kashtelyan commented 1 year ago

I think it will realistically be a bit before we can release a good DeterministicModel setup and relevant documentation, so I'm wishlisting this for now.