binghong-ml / retro_star

Retro*: Learning Retrosynthetic Planning with Neural Guided A* Search
MIT License
135 stars 32 forks source link

Question about tree search implementation #8

Closed SGenheden closed 3 years ago

SGenheden commented 4 years ago

In the _add_reaction_and_mol_nodes method of the retro_star.alg.mol_tree.MolTree class there is the following lines of code:

for mol in mols:
    if mol in ancestors:
        return

that seems to stop the expansion if any of the molecules in the new stub is already among the ancestors of the molecule node being expanded.

What is the rationale behind this logic? I can't seem to find this piece explained in your paper.

binghong-ml commented 3 years ago

Sorry for the late reply, I did not notice this thread before. The rationale here is to avoid expanding the tree in a loop, i.e., molecule A -> molecule B -> A -> B -> A -> B -> ... without ending. It makes no sense to synthesize A using A as one of the precursors.

SGenheden commented 3 years ago

Thanks @binghong-ml ! That was my guess.