Class CrossoverMachine
- java.lang.Object
-
- org.openscience.cdk.structgen.stochastic.operator.CrossoverMachine
-
public class CrossoverMachine extends Object
Modified molecular structures by applying crossover operator on a pair of parent structures and generate a pair of offspring structures. Each of the two offspring structures inherits a certain fragments from both of its parents.- Source code:
- main
- Belongs to CDK module:
- structgen
-
-
Field Summary
Fields Modifier and Type Field Description static int
SPLIT_MODE_BREADTH_FIRST
Indicates thatcrossover
is using SPLIT_MODE_BREADTH_FIRST mode.static int
SPLIT_MODE_DEPTH_FIRST
Indicates thatcrossover
is using SPLIT_MODE_DEPTH_FIRST mode.static int
SPLIT_MODE_RADNDOM
Indicates thatcrossover
is using SPLIT_MODE_RADNDOM mode.
-
Constructor Summary
Constructors Constructor Description CrossoverMachine()
Constructs a new CrossoverMachine operator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<IAtomContainer>
doCrossover(IAtomContainer dad, IAtomContainer mom)
Performs the n point crossover of twoIAtomContainer
.
-
-
-
Field Detail
-
SPLIT_MODE_RADNDOM
public static final int SPLIT_MODE_RADNDOM
Indicates thatcrossover
is using SPLIT_MODE_RADNDOM mode.- See Also:
- Constant Field Values
-
SPLIT_MODE_DEPTH_FIRST
public static final int SPLIT_MODE_DEPTH_FIRST
Indicates thatcrossover
is using SPLIT_MODE_DEPTH_FIRST mode.- See Also:
- Constant Field Values
-
SPLIT_MODE_BREADTH_FIRST
public static final int SPLIT_MODE_BREADTH_FIRST
Indicates thatcrossover
is using SPLIT_MODE_BREADTH_FIRST mode.- See Also:
- Constant Field Values
-
-
Method Detail
-
doCrossover
public List<IAtomContainer> doCrossover(IAtomContainer dad, IAtomContainer mom) throws CDKException
Performs the n point crossover of twoIAtomContainer
. Precondition: The atoms in the molecules are ordered by properties to preserve (e. g. atom symbol). Due to its randomized nature, this method fails in around 3% of all cases. A CDKException with message "Could not mate these properly" will then be thrown.- Returns:
- The children.
- Throws:
CDKException
- if it was not possible to form offsprings.
-
-