Skip to content

Constraint for batch proposal #583

@StefanPSchmid

Description

@StefanPSchmid

Dear baybe team,

I am coming to you with a question and/or improvement suggestion.

In my current project, I have the required constraint that for every experiment in my proposed batch, all values should be the same for one category. As an example, I have two possible temperatures (50°C and 100°C), but across my batch, I can only select 50°C or 100°C for all experiments. This paper also discusses it in Section 2.5: https://chemrxiv.org/engage/api-gateway/chemrxiv/assets/orp/resource/item/66f976b5cec5d6c142981e4e/original/highly-parallel-optimisation-of-nickel-catalysed-suzuki-reactions-through-automation-and-machine-intelligence.pdf

How I solved this problem within baybe is that for every possible value (temperature), I set a DiscreteExcludeConstraint so that the campaign is only able to recommend that temperature, let the campaign propose a batch of experiments and then determine the joint acqf value across this batch. Finally, I take this temperature with the best joint acqf value. Pseudo-code wise it roughly looks like this:

batch_size = 96
joint_acqf_value = -np.inf
proposed_experiments = None

for temperature in all_temperatures:
    temp_excluded = [x in x if x!= temperature]
    constraint = DiscreteExcludeConstraint(
            parameters=["temperature"],
            conditions=[
                SubSelectionCondition(selection=temp_excluded)
            ]
        )
    campaign.toggle_discrete_candidates(constraints=[constraint], exclude = True, complement = True)
    experiments = campaign.recommend(batch_size = batch_size)
    if campaign_tmp.joint_acquisition_value(experiments) > joint_acqf_value:
            joint_acqf_value = campaign_tmp.joint_acquisition_value(experiments)
            proposed_experiments = experiments

As far as I can tell, this corresponds roughly to what the above paper describes. Now to my question / improvement suggestion:

Do you know of a more elegant way to do this within baybe? If not, do you think it is a constraint worth implementing. If you give me a starter where this could fit, I would be interested in helping you out with this, as I think it might be suitable for hopefully more people (cannot work on it right now though, I have to admit).

Thanks for your answer,
Stefan

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions