aizynthfinder.search.dfpn package¶
Submodules¶
aizynthfinder.search.dfpn.nodes module¶
Module containing a classes representation various tree nodes
- class aizynthfinder.search.dfpn.nodes.MoleculeNode(mol, config, owner, parent=None)¶
Bases:
aizynthfinder.search.dfpn.nodes._SuperNode
An OR node representing a molecule
- Variables
expandable – if True, this node is part of the frontier
mol – the molecule represented by the node
in_stock – if True the molecule is in stock and hence should not be expanded
parent – the parent of the node
pn – the proof number
dn – the disproof number
pn_threshold – the threshold for proof number
dn_threshold – the threshold for disproof number
- Parameters
mol (TreeMolecule) – the molecule to be represented by the node
config (Configuration) – the configuration of the search
parent (Optional[ReactionNode]) – the parent of the node, optional
owner (SearchTree) –
- Return type
None
- classmethod create_root(smiles, config, owner)¶
Create a root node for a tree using a SMILES.
- Parameters
smiles (str) – the SMILES representation of the root state
config (Configuration) – settings of the tree search algorithm
owner (SearchTree) –
- Returns
the created node
- Return type
- property prop: StrDict¶
Dictionary with publicly exposed properties
- expand()¶
Expand the molecule by utilising an expansion policy
- Return type
None
- promising_child()¶
Find and return the most promising child for exploration Updates the thresholds on that child
- Return type
Optional[ReactionNode]
- update()¶
Update the proof and disproof numbers
- Return type
None
- class aizynthfinder.search.dfpn.nodes.ReactionNode(reaction, config, owner, parent)¶
Bases:
aizynthfinder.search.dfpn.nodes._SuperNode
An AND node representing a reaction
- Variables
parent – the parent of the node
reaction – the reaction represented by the node
pn – the proof number
dn – the disproof number
pn_threshold – the threshold for proof number
dn_threshold – the threshold for disproof number
expandable – if the node is expandable
- Parameters
reaction (RetroReaction) – the reaction to be represented by the node
config (Configuration) – the configuration of the search
parent (MoleculeNode) – the parent of the node
owner (SearchTree) –
- Return type
None
- property children: List[MoleculeNode]¶
Gives the molecule children nodes
- property prop: StrDict¶
Dictionary with publicly exposed properties
- property proven: bool¶
Return if the node is proven
- property disproven: bool¶
Return if the node is disproven
- expand()¶
Expand the node by creating nodes for each reactant
- Return type
None
- promising_child()¶
Find and return the most promising child for exploration Updates the thresholds on that child
- Return type
Optional[MoleculeNode]
- update()¶
Update the proof and disproof numbers
- Return type
None
aizynthfinder.search.dfpn.search_tree module¶
Module containing a class that holds the tree search
- class aizynthfinder.search.dfpn.search_tree.SearchTree(config, root_smiles=None)¶
Bases:
aizynthfinder.search.andor_trees.AndOrSearchTreeBase
Encapsulation of the Depth-First Proof-Number (DFPN) search algorithm.
- This algorithm does not support:
Filter policy
Serialization and deserialization
- Variables
config – settings of the tree search algorithm
root – the root node
- Parameters
config (Configuration) – settings of the tree search algorithm
root_smiles (Optional[str]) – the root will be set to a node representing this molecule, defaults to None
- Return type
None
- property mol_nodes: Sequence[MoleculeNode]¶
Return the molecule nodes of the tree
- one_iteration()¶
Perform one iteration of expansion.
If possible expand the frontier node twice, i.e. expanding an OR node and then and AND node. If frontier not expandable step up in the tree and find a new frontier to expand.
If a solution is found, mask that tree for exploration and start over.
- Raises
StopIteration – if the search should be pre-maturely terminated
- Returns
if a solution was found
- Return type
bool
- routes()¶
Extracts and returns routes from the AND/OR tree
- Returns
the routes
- Return type
List[ReactionTree]
Module contents¶
Sub-package containing DFPN routines