$darkmode
DENOPTIM
denoptim.ga.EAUtils Class Reference

Helper methods for the genetic algorithm. More...

Collaboration diagram for denoptim.ga.EAUtils:
[legend]

Classes

enum  CandidateSource
 A chosen method for generation of new Candidates. More...
 

Static Public Member Functions

static int chooseNumberOfSitesToMutate (double[] multiSiteMutationProb, double hit)
 Takes a decision on how many sites to mutate on a candidate. More...
 
static CandidateSource pickNewCandidateGenerationMode (double xoverWeight, double mutWeight, double newWeight, Randomizer randomizer)
 Takes a decision on which CandidateSource method to use for generating a new Candidate. More...
 
static Candidate buildCandidateByFragmentingMolecule (IAtomContainer mol, Monitor mnt, GAParameters settings, int index) throws DENOPTIMException
 Generates a candidate by fragmenting a molecule and generating the graph that reconnects all fragments to reform the original molecule. More...
 
static DGraph makeGraphFromFragmentationOfMol (IAtomContainer mol, List< CuttingRule > cuttingRules, Logger logger, ScaffoldingPolicy scaffoldingPolicy) throws DENOPTIMException
 Converts a molecule into a DGraph by fragmentation and re-assembling of the fragments. More...
 
static DGraph makeGraphFromFragmentationOfMol (IAtomContainer mol, List< CuttingRule > cuttingRules, Logger logger, ScaffoldingPolicy scaffoldingPolicy, double linearAngleLimit) throws DENOPTIMException
 Converts a molecule into a DGraph by fragmentation and re-assembling of the fragments. More...
 
static void outputPopulationDetails (Population population, String filename, GAParameters settings, boolean printpathNames) throws DENOPTIMException
 Write out summary for the current GA population. More...
 
static String getPathNameToGenerationFolder (int genID, GAParameters settings)
 
static String getPathNameToGenerationDetailsFile (int genID, GAParameters settings)
 
static String getPathNameToFinalPopulationFolder (GAParameters settings)
 
static String getPathNameToFinalPopulationDetailsFile (GAParameters settings)
 
static double getGrowthProbabilityAtLevel (int level, int scheme, double lambda, double sigmaOne, double sigmaTwo)
 Calculates the probability of adding a fragment to the given level. More...
 
static double getMolSizeProbability (DGraph graph, GAParameters settings)
 Calculated the probability of extending a graph based on the current size of the molecular representation contained in the graph and the given parameters. More...
 
static double getMolSizeProbability (DGraph graph, int scheme, double lambda, double sigmaOne, double sigmaTwo)
 Calculated the probability of extending a graph based on the current size of the molecular representation contained in the graph and the given parameters. More...
 
static double getProbability (double value, int scheme, double lambda, double sigmaOne, double sigmaTwo)
 Calculated a probability given parameters defining the shape of the probability function and a single input value. More...
 
static double getGrowthByLevelProbability (int level, GAParameters settings)
 Calculates the probability of adding a fragment to the given level. More...
 
static double getCrowdingProbability (AttachmentPoint ap, GAParameters settings)
 Calculated the probability of using and attachment point rooted on an atom that is holding other attachment points which have already been used. More...
 
static double getCrowdingProbability (int crowdedness, GAParameters settings)
 Calculated the probability of using and attachment point rooted on an atom that is holding other attachment points which have already been used. More...
 
static int getCrowdedness (AttachmentPoint ap)
 Calculate the current crowdedness of the given attachment point. More...
 
static int getCrowdedness (AttachmentPoint ap, boolean ignoreFreeRCVs)
 Calculate the current crowdedness of the given attachment point. More...
 
static double getCrowdingProbability (AttachmentPoint ap, int scheme, double lambda, double sigmaOne, double sigmaTwo)
 Calculated the probability of using and attachment point rooted on an atom that is holding other attachment points that have already been used. More...
 
static double getCrowdingProbabilityForCrowdedness (int crowdedness, int scheme, double lambda, double sigmaOne, double sigmaTwo)
 Calculated the crowding probability for a given level of crowdedness. More...
 
static AttachmentPoint searchForApSuitableToRingClosure (AttachmentPoint apA, SymmetricAPs symAPsA, GAParameters settings)
 

Static Protected Member Functions

static void createFolderForGeneration (int genId, GAParameters settings)
 Creates a folder meant to hold all the data generated during a generation. More...
 
static Population importInitialPopulation (SizeControlledSet uniqueIDsSet, GAParameters settings) throws DENOPTIMException, IOException
 Reads unique identifiers and initial population file according to the GAParameters. More...
 
static CandidateSource chooseGenerationMethod (GAParameters settings)
 Choose one of the methods to make new Candidates. More...
 
static List< CandidatebuildCandidatesByXOver (List< Candidate > eligibleParents, Population population, Monitor mnt, GAParameters settings) throws DENOPTIMException
 Generates a pair of new offspring by performing a crossover operation. More...
 
static Candidate buildCandidateByXOver (List< Candidate > eligibleParents, Population population, Monitor mnt, GAParameters settings) throws DENOPTIMException
 Generates a new offspring by performing a crossover operation. More...
 
static Candidate buildCandidateByXOver (List< Candidate > eligibleParents, Population population, Monitor mnt, int[] choiceOfParents, int choiceOfXOverSites, int choiceOfOffstring, GAParameters settings) throws DENOPTIMException
 Generates a new offspring by performing a crossover operation. More...
 
static List< CandidatebuildCandidatesByXOver (List< Candidate > eligibleParents, Population population, Monitor mnt, int[] choiceOfParents, int choiceOfXOverSites, int choiceOfOffstring, GAParameters settings, int maxCandidatesToReturn) throws DENOPTIMException
 Generates up to a pair of new offspring by performing a crossover operation. More...
 
static Candidate buildCandidateByMutation (List< Candidate > eligibleParents, Monitor mnt, GAParameters settings) throws DENOPTIMException
 
static Candidate readCandidateFromFile (File srcFile, Monitor mnt, GAParameters settings) throws DENOPTIMException
 
static Candidate buildCandidateFromScratch (Monitor mnt, GAParameters settings) throws DENOPTIMException
 
static Candidate[] selectBasedOnFitness (List< Candidate > eligibleParents, int number, GAParameters settings)
 Selects a number of members from the given population. More...
 
static Vertex selectNonScaffoldNonCapVertex (DGraph g, Randomizer randomizer)
 Chose randomly a vertex that is neither scaffold or capping group. More...
 
static XoverSite performFBCC (List< Candidate > eligibleParents, Population population, int[] choiceOfParents, int choiceOfXOverSites, GAParameters settings)
 Perform fitness-based, class-compatible selection of parents that can do crossover operations. More...
 
static void outputFinalResults (Population popln, GAParameters settings) throws DENOPTIMException
 Saves the final results to disk. More...
 
static void getPopulationFromFile (String filename, Population population, SizeControlledSet uniqueIDsSet, String genDir, GAParameters settings) throws DENOPTIMException, IOException
 Reconstruct the molecular population from the file. More...
 
static void writeUID (String outfile, HashSet< String > lstInchi, boolean append) throws DENOPTIMException
 
static void setVertexCounterValue (Population population) throws DENOPTIMException
 Set the Vertex counter value according to the largest value found in the given population. More...
 
static DGraph buildGraph (GAParameters settings) throws DENOPTIMException
 Graph construction starts with selecting a random core/scaffold. More...
 
static boolean setupRings (Object[] res, DGraph molGraph, GAParameters settings) throws DENOPTIMException
 Evaluates the possibility of closing rings in a given graph and if any ring can be closed, it chooses one of the combinations of ring closures that involves the highest number of new rings. More...
 
static boolean containsMolecule (Population mols, String molcode)
 Check if the population contains the specified InChi code. More...
 
static double[] getFitnesses (Population mols)
 Get the fitness values for the list of molecules. More...
 
static double getPopulationSD (Population molPopulation)
 Check if fitness values have significant standard deviation. More...
 
static boolean foundForbiddenEnd (DGraph molGraph, FragmentSpaceParameters fsParams)
 Check if there are forbidden ends: free attachment points that are not suitable for capping and not allowed to stay unused. More...
 
static void readUID (String infile, HashSet< String > lstInchi) throws DENOPTIMException
 

Static Protected Attributes

static HashMap< Integer, ArrayList< Integer > > fragmentPool
 
static HashMap< Integer, ArrayList< String > > lstFragmentClass
 

Static Private Member Functions

static DecimalFormat initialiseFormatter ()
 
static void appendVertexesToGraphFollowingEdges (DGraph graph, AtomicInteger vId, List< Vertex > vertexes) throws DENOPTIMException
 
static String getSummaryStatistics (Population popln, GAParameters settings)
 

Static Private Attributes

static Locale enUsLocale = new Locale("en", "US")
 Locale used to write reports. More...
 
static DecimalFormat df = initialiseFormatter()
 Format for decimal fitness numbers that overwrites Locale to en_US. More...
 
static final String NL =System.getProperty("line.separator")
 
static final String FSEP = System.getProperty("file.separator")
 

Detailed Description

Helper methods for the genetic algorithm.

Author
Vishwesh Venkatraman
Marco Foscato

Definition at line 92 of file EAUtils.java.

Member Function Documentation

◆ appendVertexesToGraphFollowingEdges()

static void denoptim.ga.EAUtils.appendVertexesToGraphFollowingEdges ( DGraph  graph,
AtomicInteger  vId,
List< Vertex vertexes 
) throws DENOPTIMException
staticprivate

◆ buildCandidateByFragmentingMolecule()

static Candidate denoptim.ga.EAUtils.buildCandidateByFragmentingMolecule ( IAtomContainer  mol,
Monitor  mnt,
GAParameters  settings,
int  index 
) throws DENOPTIMException
static

Generates a candidate by fragmenting a molecule and generating the graph that reconnects all fragments to reform the original molecule.

Essentially, it converts an IAtomContainer into a DGraph and makes a Candidate out of it.

Parameters
molthe molecule to convert.
cutRulesthe cutting rules to use in the fragmentation.
mntthe tool monitoring events for logging purposes.
settingsGA settings.
indexidentifies the given IAtomContainer in a collection of systems to work on. This is used only for logging.
Exceptions
DENOPTIMException

Definition at line 928 of file EAUtils.java.

References denoptim.graph.DGraph.checkConsistency(), denoptim.graph.DGraph.cleanup(), denoptim.logging.CounterID.CONVERTBYFRAGATTEMPTS, denoptim.graph.DGraph.embedPatternsInTemplates(), denoptim.programs.fragmenter.FragmenterParameters.embedRingsInTemplate, denoptim.logging.CounterID.FAILEDCONVERTBYFRAGATTEMPTS, denoptim.logging.CounterID.FAILEDCONVERTBYFRAGATTEMPTS_EVAL, denoptim.logging.CounterID.FAILEDCONVERTBYFRAGATTEMPTS_FRAGMENTATION, denoptim.logging.CounterID.FAILEDCONVERTBYFRAGATTEMPTS_TMPLEMBEDDING, denoptim.programs.RunTimeParameters.ParametersType.FRG_PARAMS, denoptim.programs.RunTimeParameters.ParametersType.FS_PARAMS, denoptim.programs.fragmenter.FragmenterParameters.getCuttingRules(), denoptim.programs.fragmenter.FragmenterParameters.getEmbeddedRingsContract(), denoptim.fragspace.FragmentSpaceParameters.getFragmentSpace(), denoptim.programs.fragmenter.FragmenterParameters.getLinearAngleLimit(), denoptim.utils.GeneralUtils.getPaddedString(), denoptim.programs.RunTimeParameters.getParameters(), denoptim.programs.fragmenter.FragmenterParameters.getScaffoldingPolicy(), denoptim.utils.GraphUtils.getUniqueMoleculeIndex(), denoptim.ga.EAUtils.makeGraphFromFragmentationOfMol(), denoptim.constants.DENOPTIMConstants.MOLDIGITS, denoptim.logging.CounterID.NEWCANDIDATEATTEMPTS, denoptim.fragmenter.FragmenterTools.prepareMolToFragmentation(), denoptim.graph.GraphPattern.RING, denoptim.graph.Candidate.setChemicalRepresentation(), denoptim.graph.DGraph.setLocalMsg(), denoptim.graph.Candidate.setName(), denoptim.graph.Candidate.setSmiles(), and denoptim.graph.Candidate.setUID().

Referenced by denoptim.ga.EvolutionaryAlgorithm.initializePopulation().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ buildCandidateByMutation()

static Candidate denoptim.ga.EAUtils.buildCandidateByMutation ( List< Candidate eligibleParents,
Monitor  mnt,
GAParameters  settings 
) throws DENOPTIMException
staticprotected

Definition at line 630 of file EAUtils.java.

References denoptim.graph.DGraph.addCappingGroups(), denoptim.graph.DGraph.checkConsistency(), denoptim.graph.DGraph.cleanup(), denoptim.graph.DGraph.clone(), denoptim.logging.CounterID.FAILEDMUTATTEMTS, denoptim.logging.CounterID.FAILEDMUTATTEMTS_EVAL, denoptim.logging.CounterID.FAILEDMUTATTEMTS_FORBENDS, denoptim.logging.CounterID.FAILEDMUTATTEMTS_PERFORM, denoptim.logging.CounterID.FAILEDMUTATTEMTS_SETUPRINGS, denoptim.programs.RunTimeParameters.ParametersType.FS_PARAMS, denoptim.fragspace.FragmentSpace.getCappingMap(), denoptim.fragspace.FragmentSpace.getForbiddenEndList(), denoptim.fragspace.FragmentSpaceParameters.getFragmentSpace(), denoptim.graph.DGraph.getFreeRCVertices(), denoptim.graph.Candidate.getGeneration(), denoptim.graph.Candidate.getGraph(), denoptim.graph.DGraph.getGraphId(), denoptim.graph.DGraph.getLocalMsg(), denoptim.utils.GeneralUtils.getPaddedString(), denoptim.programs.RunTimeParameters.getParameters(), denoptim.graph.Candidate.getSDFFile(), denoptim.utils.GraphUtils.getUniqueGraphIndex(), denoptim.utils.GraphUtils.getUniqueMoleculeIndex(), denoptim.constants.DENOPTIMConstants.MOLDIGITS, denoptim.logging.CounterID.MUTATTEMPTS, denoptim.logging.CounterID.MUTPARENTSEARCH, denoptim.logging.CounterID.NEWCANDIDATEATTEMPTS, denoptim.ga.GraphOperations.performMutation(), denoptim.graph.DGraph.renumberGraphVertices(), denoptim.ga.EAUtils.selectBasedOnFitness(), denoptim.graph.Candidate.setChemicalRepresentation(), denoptim.graph.DGraph.setGraphId(), denoptim.graph.DGraph.setLocalMsg(), denoptim.graph.Candidate.setName(), denoptim.graph.Candidate.setSmiles(), denoptim.graph.Candidate.setUID(), denoptim.ga.EAUtils.setupRings(), and denoptim.io.DenoptimIO.writeGraphToSDF().

Referenced by denoptim.ga.EvolutionaryAlgorithm.makeOffspringA(), and denoptim.ga.EvolutionaryAlgorithm.makeOffspringB().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ buildCandidateByXOver() [1/2]

static Candidate denoptim.ga.EAUtils.buildCandidateByXOver ( List< Candidate eligibleParents,
Population  population,
Monitor  mnt,
GAParameters  settings 
) throws DENOPTIMException
staticprotected

Generates a new offspring by performing a crossover operation.

Parameters
eligibleParentscandidates that can be used as parents of the offspring.
populationthe collection of candidates where eligible candidates are hosted.
mntmonitoring tool used to record events during the run of the evolutionary algorithm.
Returns
a candidate chosen in a stochastic manner.

Definition at line 299 of file EAUtils.java.

References denoptim.ga.EAUtils.buildCandidateByXOver().

Referenced by denoptim.ga.EAUtils.buildCandidateByXOver(), denoptim.ga.EAUtilsTest.testAvoidRedundantXOver(), denoptim.ga.EAUtilsTest.testBuildByXOver_Embedded_FixedStructure(), denoptim.ga.EAUtilsTest.testBuildByXOver_Embedded_Free(), denoptim.ga.EAUtilsTest.testBuildByXOver_Embedded_FreeBackwards(), and denoptim.ga.EAUtilsTest.testBuildByXOver_SubGraph().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ buildCandidateByXOver() [2/2]

static Candidate denoptim.ga.EAUtils.buildCandidateByXOver ( List< Candidate eligibleParents,
Population  population,
Monitor  mnt,
int[]  choiceOfParents,
int  choiceOfXOverSites,
int  choiceOfOffstring,
GAParameters  settings 
) throws DENOPTIMException
staticprotected

Generates a new offspring by performing a crossover operation.

Parameters
eligibleParentscandidates that can be used as parents of the offspring.
populationthe collection of candidates where eligible candidates are hosted.
mntmonitoring tool used to record events during the run of the evolutionary algorithm.
choiceOfParentsa pair of indexes dictating which ones among the eligible parents we should use as parents. This avoids randomized decision making in case of test that need to be reproducible, but can be null which means "use random choice".
choiceOfXOverSitesindex indicating which crossover site to use. This avoids randomized decision making in case of test that need to be reproducible, but can be null which means "use random choice".
choiceOfOffstringindex dictating which among the available two offspring (at most two, for now) is returned as result. This avoids randomized decision making in case of test that need to be reproducible, but can be null which means "use random choice".
Returns
the candidate or null if none was produced.
Exceptions
DENOPTIMException

Definition at line 333 of file EAUtils.java.

References denoptim.ga.EAUtils.buildCandidatesByXOver().

Here is the call graph for this function:

◆ buildCandidateFromScratch()

static Candidate denoptim.ga.EAUtils.buildCandidateFromScratch ( Monitor  mnt,
GAParameters  settings 
) throws DENOPTIMException
staticprotected

Definition at line 827 of file EAUtils.java.

References denoptim.logging.CounterID.BUILDANEWATTEMPTS, denoptim.ga.EAUtils.buildGraph(), denoptim.graph.DGraph.checkConsistency(), denoptim.graph.DGraph.cleanup(), denoptim.logging.CounterID.FAILEDBUILDATTEMPTS, denoptim.logging.CounterID.FAILEDBUILDATTEMPTS_EVAL, denoptim.logging.CounterID.FAILEDBUILDATTEMPTS_FORBIDENDS, denoptim.logging.CounterID.FAILEDBUILDATTEMPTS_GRAPHBUILD, denoptim.logging.CounterID.FAILEDBUILDATTEMPTS_SETUPRINGS, denoptim.programs.RunTimeParameters.ParametersType.FS_PARAMS, denoptim.fragspace.FragmentSpace.getCappingMap(), denoptim.fragspace.FragmentSpace.getForbiddenEndList(), denoptim.fragspace.FragmentSpaceParameters.getFragmentSpace(), denoptim.graph.DGraph.getFreeRCVertices(), denoptim.utils.GeneralUtils.getPaddedString(), denoptim.programs.RunTimeParameters.getParameters(), denoptim.utils.GraphUtils.getUniqueMoleculeIndex(), denoptim.constants.DENOPTIMConstants.MOLDIGITS, denoptim.logging.CounterID.NEWCANDIDATEATTEMPTS, denoptim.graph.Candidate.setChemicalRepresentation(), denoptim.graph.DGraph.setLocalMsg(), denoptim.graph.Candidate.setName(), denoptim.graph.Candidate.setSmiles(), denoptim.graph.Candidate.setUID(), and denoptim.ga.EAUtils.setupRings().

Referenced by denoptim.ga.EvolutionaryAlgorithm.initializePopulation(), denoptim.ga.EvolutionaryAlgorithm.makeOffspringA(), and denoptim.ga.EvolutionaryAlgorithm.makeOffspringB().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ buildCandidatesByXOver() [1/2]

static List< Candidate > denoptim.ga.EAUtils.buildCandidatesByXOver ( List< Candidate eligibleParents,
Population  population,
Monitor  mnt,
GAParameters  settings 
) throws DENOPTIMException
staticprotected

Generates a pair of new offspring by performing a crossover operation.

Parameters
eligibleParentscandidates that can be used as parents of the offspring.
populationthe collection of candidates where eligible candidates are hosted.
mntmonitoring tool used to record events during the run of the evolutionary algorithm.
settingsthe settings of the genetic algorithm.
Returns
a candidate chosen in a stochastic manner.

Definition at line 279 of file EAUtils.java.

References denoptim.ga.EAUtils.buildCandidatesByXOver().

Referenced by denoptim.ga.EAUtils.buildCandidateByXOver(), denoptim.ga.EAUtils.buildCandidatesByXOver(), denoptim.ga.EvolutionaryAlgorithm.makeOffspringA(), and denoptim.ga.EvolutionaryAlgorithm.makeOffspringB().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ buildCandidatesByXOver() [2/2]

static List< Candidate > denoptim.ga.EAUtils.buildCandidatesByXOver ( List< Candidate eligibleParents,
Population  population,
Monitor  mnt,
int[]  choiceOfParents,
int  choiceOfXOverSites,
int  choiceOfOffstring,
GAParameters  settings,
int  maxCandidatesToReturn 
) throws DENOPTIMException
staticprotected

Generates up to a pair of new offspring by performing a crossover operation.

Parameters
eligibleParentscandidates that can be used as parents of the offspring.
populationthe collection of candidates where eligible candidates are hosted.
mntmonitoring tool used to record events during the run of the evolutionary algorithm.
choiceOfParentsa pair of indexes dictating which ones among the eligible parents we should use as parents. This avoids randomized decision making in case of test that need to be reproducible, but can be null which means "use random choice".
choiceOfXOverSitesindex indicating which crossover site to use. This avoids randomized decision making in case of test that need to be reproducible, but can be null which means "use random choice".
choiceOfOffstringindex dictating which among the available two offspring (at most two, for now) is returned as result. This avoids randomized decision making in case of test that need to be reproducible, but can be null which means "use random choice".
maxCandidatesToReturnthe number of offspring to return in the list. Up to 2.
Returns
the list of candidates, or an empty list.
Exceptions
DENOPTIMException

Definition at line 378 of file EAUtils.java.

References denoptim.graph.DGraph.addCappingGroups(), denoptim.graph.DGraph.checkConsistency(), denoptim.graph.DGraph.cleanup(), denoptim.logging.CounterID.FAILEDXOVERATTEMPTS, denoptim.logging.CounterID.FAILEDXOVERATTEMPTS_EVAL, denoptim.logging.CounterID.FAILEDXOVERATTEMPTS_FINDPARENTS, denoptim.logging.CounterID.FAILEDXOVERATTEMPTS_FORBENDS, denoptim.logging.CounterID.FAILEDXOVERATTEMPTS_PERFORM, denoptim.logging.CounterID.FAILEDXOVERATTEMPTS_SETUPRINGS, denoptim.programs.RunTimeParameters.ParametersType.FS_PARAMS, denoptim.ga.XoverSite.getA(), denoptim.ga.XoverSite.getB(), denoptim.graph.DGraph.getCandidateOwner(), denoptim.fragspace.FragmentSpace.getCappingMap(), denoptim.graph.DGraph.getChildrenTree(), denoptim.fragspace.FragmentSpace.getForbiddenEndList(), denoptim.fragspace.FragmentSpaceParameters.getFragmentSpace(), denoptim.graph.DGraph.getFreeRCVertices(), denoptim.graph.Candidate.getGeneration(), denoptim.graph.Candidate.getGraph(), denoptim.graph.DGraph.getGraphId(), denoptim.graph.Vertex.getGraphOwner(), denoptim.graph.Candidate.getName(), denoptim.graph.DGraph.getOutermostGraphOwner(), denoptim.utils.GeneralUtils.getPaddedString(), denoptim.programs.RunTimeParameters.getParameters(), denoptim.utils.GraphUtils.getUniqueGraphIndex(), denoptim.utils.GraphUtils.getUniqueMoleculeIndex(), denoptim.constants.DENOPTIMConstants.MOLDIGITS, denoptim.logging.CounterID.NEWCANDIDATEATTEMPTS, denoptim.ga.EAUtils.NL, denoptim.ga.GraphOperations.performCrossover(), denoptim.ga.EAUtils.performFBCC(), denoptim.ga.XoverSite.projectToClonedGraphs(), denoptim.graph.DGraph.renumberGraphVertices(), denoptim.ga.EAUtils.selectBasedOnFitness(), denoptim.ga.EAUtils.selectNonScaffoldNonCapVertex(), denoptim.graph.Candidate.setChemicalRepresentation(), denoptim.graph.DGraph.setGraphId(), denoptim.graph.DGraph.setLocalMsg(), denoptim.graph.Candidate.setName(), denoptim.graph.Candidate.setSmiles(), denoptim.graph.Candidate.setUID(), denoptim.ga.EAUtils.setupRings(), denoptim.ga.XoverSite.toString(), denoptim.fragspace.FragmentSpace.useAPclassBasedApproach(), denoptim.io.DenoptimIO.writeGraphsToSDF(), denoptim.logging.CounterID.XOVERATTEMPTS, and denoptim.logging.CounterID.XOVERPARENTSEARCH.

Here is the call graph for this function:

◆ buildGraph()

static DGraph denoptim.ga.EAUtils.buildGraph ( GAParameters  settings) throws DENOPTIMException
staticprotected

Graph construction starts with selecting a random core/scaffold.

Returns
the molecular graph representation
Exceptions
DENOPTIMException

Definition at line 1678 of file EAUtils.java.

References denoptim.graph.DGraph.addCappingGroups(), denoptim.graph.DGraph.addVertex(), denoptim.graph.DGraph.containsOrEmbedsVertex(), denoptim.ga.GraphOperations.extendGraph(), denoptim.logging.CounterID.FAILEDMUTATTEMTS, denoptim.logging.CounterID.FAILEDMUTATTEMTS_PERFORM, denoptim.graph.Template.ContractLevel.FIXED, denoptim.programs.RunTimeParameters.ParametersType.FS_PARAMS, denoptim.graph.Vertex.getBuildingBlockId(), denoptim.graph.rings.RingClosuresArchive.getCCFromTurningPointId(), denoptim.fragspace.FragmentSpaceParameters.getFragmentSpace(), denoptim.graph.DGraph.getMutableSites(), denoptim.programs.RunTimeParameters.getParameters(), denoptim.graph.rings.RingClosureParameters.getRingClosuresArchive(), denoptim.utils.GraphUtils.getUniqueGraphIndex(), denoptim.graph.DGraph.getVertexCount(), denoptim.graph.Vertex.hasFreeAP(), denoptim.logging.Monitor.increase(), denoptim.fragspace.FragmentSpace.makeRandomScaffold(), denoptim.ga.GraphOperations.performMutation(), denoptim.programs.RunTimeParameters.ParametersType.RC_PARAMS, denoptim.graph.DGraph.setCandidateClosableChains(), denoptim.graph.DGraph.setGraphId(), and denoptim.graph.DGraph.setLocalMsg().

Referenced by denoptim.ga.EAUtils.buildCandidateFromScratch(), and denoptim.ga.EAUtilsTest.testBuildGraphFromTemplateScaffold().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ chooseGenerationMethod()

static CandidateSource denoptim.ga.EAUtils.chooseGenerationMethod ( GAParameters  settings)
staticprotected

Choose one of the methods to make new Candidates.

The choice is biased by the weights of the methods as defined in the GAParameters.

Parameters
thegenetic algorithm settings
Returns
one among the possible CandidateSource excluding {@value CandidateSource::MANUAL}.

Definition at line 193 of file EAUtils.java.

References denoptim.programs.denovo.GAParameters.getConstructionWeight(), denoptim.programs.denovo.GAParameters.getCrossoverWeight(), denoptim.programs.denovo.GAParameters.getMutationWeight(), denoptim.programs.RunTimeParameters.getRandomizer(), and denoptim.ga.EAUtils.pickNewCandidateGenerationMode().

Referenced by denoptim.ga.EvolutionaryAlgorithm.makeOffspringA().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ chooseNumberOfSitesToMutate()

static int denoptim.ga.EAUtils.chooseNumberOfSitesToMutate ( double[]  multiSiteMutationProb,
double  hit 
)
static

Takes a decision on how many sites to mutate on a candidate.

Parameters
multiSiteMutationProbthe probability (0-1) of multi-site mutation.
hita random real number between 0 and 1.
Returns
an integer indicating how many mutation to perform.

Definition at line 210 of file EAUtils.java.

Referenced by denoptim.ga.GraphOperations.performMutation(), and denoptim.ga.EAUtilsTest.testChooseNumberOfSitesToMutate().

Here is the caller graph for this function:

◆ containsMolecule()

static boolean denoptim.ga.EAUtils.containsMolecule ( Population  mols,
String  molcode 
)
staticprotected

Check if the population contains the specified InChi code.

Parameters
mols
molcode
Returns
true if found

Definition at line 1945 of file EAUtils.java.

◆ createFolderForGeneration()

static void denoptim.ga.EAUtils.createFolderForGeneration ( int  genId,
GAParameters  settings 
)
staticprotected

Creates a folder meant to hold all the data generated during a generation.

The folder is created under the work space.

Parameters
genIdthe generation's identity number
Exceptions
DENOPTIMException

Definition at line 134 of file EAUtils.java.

References denoptim.ga.EAUtils.getPathNameToGenerationFolder().

Referenced by denoptim.ga.EvolutionaryAlgorithm.evolvePopulation(), and denoptim.ga.EvolutionaryAlgorithm.run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ foundForbiddenEnd()

static boolean denoptim.ga.EAUtils.foundForbiddenEnd ( DGraph  molGraph,
FragmentSpaceParameters  fsParams 
)
staticprotected

Check if there are forbidden ends: free attachment points that are not suitable for capping and not allowed to stay unused.

Parameters
molGraphthe Graph representation of the molecule
Returns
true if a forbidden end is found

Definition at line 2274 of file EAUtils.java.

References denoptim.fragspace.FragmentSpace.getForbiddenEndList(), denoptim.fragspace.FragmentSpaceParameters.getFragmentSpace(), denoptim.programs.RunTimeParameters.getLogger(), and denoptim.graph.DGraph.getVertexList().

Here is the call graph for this function:

◆ getCrowdedness() [1/2]

static int denoptim.ga.EAUtils.getCrowdedness ( AttachmentPoint  ap)
static

Calculate the current crowdedness of the given attachment point.

Parameters
apthe attachment point to consider
Returns
the integer representing how many AP rooted on the same atom that holds the given attachment point are used by non-capping group building blocks.

Definition at line 2174 of file EAUtils.java.

References denoptim.ga.EAUtils.getCrowdedness().

Referenced by denoptim.ga.GraphOperations.extendGraph(), denoptim.ga.EAUtils.getCrowdedness(), denoptim.ga.EAUtils.getCrowdingProbability(), and denoptim.ga.EAUtils.setupRings().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCrowdedness() [2/2]

static int denoptim.ga.EAUtils.getCrowdedness ( AttachmentPoint  ap,
boolean  ignoreFreeRCVs 
)
static

Calculate the current crowdedness of the given attachment point.

Parameters
apthe attachment point to consider
ignoreFreeRCVsuse true to avoid counting unused ring-closing vertexes and actual connections.
Returns
the integer representing how many AP rooted on the same atom that holds the given attachment point are used by non-capping group building blocks. Returns zero for APs belonging to EmptyVertexs.

Definition at line 2190 of file EAUtils.java.

References denoptim.graph.Vertex.BBType.CAP, denoptim.graph.AttachmentPoint.getAtomPositionNumber(), denoptim.graph.Vertex.getAttachmentPoints(), denoptim.graph.Vertex.getGraphOwner(), denoptim.graph.AttachmentPoint.getOwner(), and denoptim.graph.DGraph.getUsedRCVertices().

Here is the call graph for this function:

◆ getCrowdingProbability() [1/3]

static double denoptim.ga.EAUtils.getCrowdingProbability ( AttachmentPoint  ap,
GAParameters  settings 
)
static

Calculated the probability of using and attachment point rooted on an atom that is holding other attachment points which have already been used.

Parameters
apthe attachment point candidate to be used.
Returns
probability of adding a new building block on the given attachment point.

Definition at line 2129 of file EAUtils.java.

References denoptim.programs.denovo.GAParameters.getCrowdingFactorMiddleSigma(), denoptim.programs.denovo.GAParameters.getCrowdingFactorSteepSigma(), denoptim.programs.denovo.GAParameters.getCrowdingMultiplier(), denoptim.ga.EAUtils.getCrowdingProbability(), and denoptim.programs.denovo.GAParameters.getCrowdingProbabilityScheme().

Referenced by denoptim.ga.GraphOperations.extendGraph(), denoptim.ga.EAUtils.getCrowdingProbability(), denoptim.ga.EAUtils.setupRings(), and denoptim.ga.EAUtilsTest.testCrowdingProbability().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCrowdingProbability() [2/3]

static double denoptim.ga.EAUtils.getCrowdingProbability ( AttachmentPoint  ap,
int  scheme,
double  lambda,
double  sigmaOne,
double  sigmaTwo 
)
static

Calculated the probability of using and attachment point rooted on an atom that is holding other attachment points that have already been used.

Parameters
apthe attachment point candidate to be used.
schemethe chosen shape of the probability function.
lambdaparameter used by scheme 0 and 1
sigmaOneparameter used by scheme 2 (steepness)
sigmaTwoparameter used by scheme 2 (middle point)
Returns
probability of adding a new building block on the given attachment point.

Definition at line 2232 of file EAUtils.java.

References denoptim.ga.EAUtils.getCrowdedness(), denoptim.ga.EAUtils.getCrowdingProbabilityForCrowdedness(), and denoptim.graph.AttachmentPoint.getOwner().

Here is the call graph for this function:

◆ getCrowdingProbability() [3/3]

static double denoptim.ga.EAUtils.getCrowdingProbability ( int  crowdedness,
GAParameters  settings 
)
static

Calculated the probability of using and attachment point rooted on an atom that is holding other attachment points which have already been used.

This method does not use the actual information on attachment point usage, but relies on a externally calculated values of the crowdedness. Use EAUtils#getCrowdingProbability(AttachmentPoint) to get the crowding probability for an actual attachment point. Use EAUtils#getCrowdedness(AttachmentPoint) to calculate the crowdedness for an attachment point.

Parameters
crowdednessthe level of crowdedness
Returns
probability of adding a new building block on an attachment point with the given crowdedness.

Definition at line 2154 of file EAUtils.java.

References denoptim.programs.denovo.GAParameters.getCrowdingFactorMiddleSigma(), denoptim.programs.denovo.GAParameters.getCrowdingFactorSteepSigma(), denoptim.programs.denovo.GAParameters.getCrowdingMultiplier(), denoptim.ga.EAUtils.getCrowdingProbabilityForCrowdedness(), and denoptim.programs.denovo.GAParameters.getCrowdingProbabilityScheme().

Here is the call graph for this function:

◆ getCrowdingProbabilityForCrowdedness()

static double denoptim.ga.EAUtils.getCrowdingProbabilityForCrowdedness ( int  crowdedness,
int  scheme,
double  lambda,
double  sigmaOne,
double  sigmaTwo 
)
static

Calculated the crowding probability for a given level of crowdedness.

Parameters
crowdednessthe level of crowdedness
schemethe chosen shape of the probability function.
lambdaparameter used by scheme 0 and 1
sigmaOneparameter used by scheme 2 (steepness)
sigmaTwoparameter used by scheme 2 (middle point)
Returns
the crowding probability.

Definition at line 2257 of file EAUtils.java.

References denoptim.ga.EAUtils.getProbability().

Referenced by denoptim.gui.GAParametersForm.createCrowdProbDataset(), and denoptim.ga.EAUtils.getCrowdingProbability().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getFitnesses()

static double[] denoptim.ga.EAUtils.getFitnesses ( Population  mols)
staticprotected

Get the fitness values for the list of molecules.

Parameters
mols
Returns
array of fitness values

Definition at line 1968 of file EAUtils.java.

Referenced by denoptim.ga.EAUtils.getPopulationSD(), and denoptim.ga.EAUtils.getSummaryStatistics().

Here is the caller graph for this function:

◆ getGrowthByLevelProbability()

static double denoptim.ga.EAUtils.getGrowthByLevelProbability ( int  level,
GAParameters  settings 
)
static

Calculates the probability of adding a fragment to the given level.

Used the settings defined by the GAParameters class.

Parameters
levellevel of the graph at which fragment is to be added
Returns
probability of adding a new fragment at this level.

Definition at line 2106 of file EAUtils.java.

References denoptim.programs.denovo.GAParameters.getGrowthFactorMiddleSigma(), denoptim.programs.denovo.GAParameters.getGrowthFactorSteepSigma(), denoptim.programs.denovo.GAParameters.getGrowthMultiplier(), denoptim.ga.EAUtils.getGrowthProbabilityAtLevel(), denoptim.programs.denovo.GAParameters.getGrowthProbabilityScheme(), and denoptim.programs.denovo.GAParameters.useLevelBasedProb.

Referenced by denoptim.ga.GraphOperations.extendGraph().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getGrowthProbabilityAtLevel()

static double denoptim.ga.EAUtils.getGrowthProbabilityAtLevel ( int  level,
int  scheme,
double  lambda,
double  sigmaOne,
double  sigmaTwo 
)
static

Calculates the probability of adding a fragment to the given level.

This will require a coin toss with the calculated probability. If a newly drawn random number is less than this value, a new fragment may be added.

Parameters
levellevel of the graph at which fragment is to be added
schemethe chosen scheme.
lambdaparameter used by scheme 0 and 1.
sigmaOneparameter used by scheme 2 (steepness).
sigmaTwoparameter used by scheme 2 (middle point).
Returns
probability of adding a new fragment at this level.

Definition at line 2009 of file EAUtils.java.

References denoptim.ga.EAUtils.getProbability().

Referenced by denoptim.gui.GAParametersForm.createLvlProbDataset(), and denoptim.ga.EAUtils.getGrowthByLevelProbability().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getMolSizeProbability() [1/2]

static double denoptim.ga.EAUtils.getMolSizeProbability ( DGraph  graph,
GAParameters  settings 
)
static

Calculated the probability of extending a graph based on the current size of the molecular representation contained in the graph and the given parameters.

Parameters
graphthe current graph for which to calculate the probability of extension.
schemethe chosen shape of the probability function.
lambdaparameter used by scheme 0 and 1
sigmaOneparameter used by scheme 2 (steepness)
sigmaTwoparameter used by scheme 2 (middle point)
Returns
the crowding probability.

Definition at line 2029 of file EAUtils.java.

References denoptim.programs.denovo.GAParameters.getMolGrowthFactorMiddleSigma(), denoptim.programs.denovo.GAParameters.getMolGrowthFactorSteepSigma(), denoptim.programs.denovo.GAParameters.getMolGrowthMultiplier(), denoptim.programs.denovo.GAParameters.getMolGrowthProbabilityScheme(), denoptim.ga.EAUtils.getMolSizeProbability(), and denoptim.programs.denovo.GAParameters.useMolSizeBasedProb.

Referenced by denoptim.ga.GraphOperations.extendGraph(), and denoptim.ga.EAUtils.getMolSizeProbability().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getMolSizeProbability() [2/2]

static double denoptim.ga.EAUtils.getMolSizeProbability ( DGraph  graph,
int  scheme,
double  lambda,
double  sigmaOne,
double  sigmaTwo 
)
static

Calculated the probability of extending a graph based on the current size of the molecular representation contained in the graph and the given parameters.

Parameters
graphthe current graph for which to calculate the probability of extension.
schemethe chosen shape of the probability function.
lambdaparameter used by scheme 0 and 1
sigmaOneparameter used by scheme 2 (steepness)
sigmaTwoparameter used by scheme 2 (middle point)
Returns
the crowding probability.

Definition at line 2055 of file EAUtils.java.

References denoptim.graph.DGraph.getHeavyAtomsCount(), and denoptim.ga.EAUtils.getProbability().

Here is the call graph for this function:

◆ getPathNameToFinalPopulationDetailsFile()

static String denoptim.ga.EAUtils.getPathNameToFinalPopulationDetailsFile ( GAParameters  settings)
static

Definition at line 1494 of file EAUtils.java.

References denoptim.ga.EAUtils.FSEP, and denoptim.programs.denovo.GAParameters.getDataDirectory().

Referenced by denoptim.ga.EAUtils.outputFinalResults().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPathNameToFinalPopulationFolder()

static String denoptim.ga.EAUtils.getPathNameToFinalPopulationFolder ( GAParameters  settings)
static

Definition at line 1485 of file EAUtils.java.

References denoptim.ga.EAUtils.FSEP, and denoptim.programs.denovo.GAParameters.getDataDirectory().

Referenced by denoptim.ga.EAUtils.outputFinalResults().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPathNameToGenerationDetailsFile()

static String denoptim.ga.EAUtils.getPathNameToGenerationDetailsFile ( int  genID,
GAParameters  settings 
)
static

Definition at line 1465 of file EAUtils.java.

References denoptim.ga.EAUtils.FSEP, denoptim.constants.DENOPTIMConstants.GAGENDIRNAMEROOT, denoptim.programs.denovo.GAParameters.getDataDirectory(), denoptim.programs.denovo.GAParameters.getNumberOfGenerations(), and denoptim.utils.GeneralUtils.getPaddedString().

Referenced by denoptim.ga.EvolutionaryAlgorithm.run(), and denoptim.io.DenoptimIOTest.testReadGenerationFromSummary().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPathNameToGenerationFolder()

static String denoptim.ga.EAUtils.getPathNameToGenerationFolder ( int  genID,
GAParameters  settings 
)
static

Definition at line 1449 of file EAUtils.java.

References denoptim.ga.EAUtils.FSEP, denoptim.constants.DENOPTIMConstants.GAGENDIRNAMEROOT, denoptim.programs.denovo.GAParameters.getDataDirectory(), denoptim.programs.denovo.GAParameters.getNumberOfGenerations(), and denoptim.utils.GeneralUtils.getPaddedString().

Referenced by denoptim.ga.EAUtils.createFolderForGeneration(), denoptim.ga.EvolutionaryAlgorithm.evolvePopulation(), denoptim.ga.EAUtils.importInitialPopulation(), denoptim.ga.EvolutionaryAlgorithm.processInitialPopCandidate(), and denoptim.io.DenoptimIOTest.testReadGenerationFromSummary().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPopulationFromFile()

static void denoptim.ga.EAUtils.getPopulationFromFile ( String  filename,
Population  population,
SizeControlledSet  uniqueIDsSet,
String  genDir,
GAParameters  settings 
) throws DENOPTIMException, IOException
staticprotected

Reconstruct the molecular population from the file.

Parameters
filenamethe pathname to read in.
populationthe collection of population members.
uniqueIDsSetcollection of unique identifiers.
Exceptions
DENOPTIMException
IOException

Definition at line 1573 of file EAUtils.java.

References denoptim.constants.DENOPTIMConstants.FITFILENAMEEXTOUT, denoptim.utils.GeneralUtils.getPaddedString(), denoptim.utils.GraphUtils.getUniqueGraphIndex(), denoptim.utils.GraphUtils.getUniqueMoleculeIndex(), denoptim.io.DenoptimIO.readCandidates(), denoptim.ga.EAUtils.setVertexCounterValue(), and denoptim.io.DenoptimIO.writeCandidateToFile().

Referenced by denoptim.ga.EAUtils.importInitialPopulation().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPopulationSD()

static double denoptim.ga.EAUtils.getPopulationSD ( Population  molPopulation)
staticprotected

Check if fitness values have significant standard deviation.

Parameters
molPopulation
Returns
true if population standard deviation of fitness values exceeds 0.0001

Definition at line 1989 of file EAUtils.java.

References denoptim.ga.EAUtils.getFitnesses(), and denoptim.utils.StatUtils.stddev().

Referenced by denoptim.ga.EvolutionaryAlgorithm.run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getProbability()

static double denoptim.ga.EAUtils.getProbability ( double  value,
int  scheme,
double  lambda,
double  sigmaOne,
double  sigmaTwo 
)
static

Calculated a probability given parameters defining the shape of the probability function and a single input value.

Parameters
valuethe value x for which we calculate f(x).
schemethe chosen shape of the probability function.
lambdaparameter used by scheme 0 and 1
sigmaOneparameter used by scheme 2 (steepness)
sigmaTwoparameter used by scheme 2 (middle point)
Returns
the probability.

Definition at line 2074 of file EAUtils.java.

Referenced by denoptim.gui.GAParametersForm.createMolSizeProbDataset(), denoptim.ga.EAUtils.getCrowdingProbabilityForCrowdedness(), denoptim.ga.EAUtils.getGrowthProbabilityAtLevel(), and denoptim.ga.EAUtils.getMolSizeProbability().

Here is the caller graph for this function:

◆ getSummaryStatistics()

static String denoptim.ga.EAUtils.getSummaryStatistics ( Population  popln,
GAParameters  settings 
)
staticprivate

Definition at line 1285 of file EAUtils.java.

References denoptim.ga.EAUtils.df, denoptim.ga.EAUtils.getFitnesses(), denoptim.programs.denovo.GAParameters.getPrecisionLevel(), denoptim.utils.StatUtils.max(), denoptim.utils.StatUtils.mean(), denoptim.utils.StatUtils.median(), denoptim.utils.StatUtils.min(), denoptim.ga.EAUtils.NL, denoptim.utils.StatUtils.skewness(), and denoptim.utils.StatUtils.stddev().

Referenced by denoptim.ga.EAUtils.outputPopulationDetails().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ importInitialPopulation()

static Population denoptim.ga.EAUtils.importInitialPopulation ( SizeControlledSet  uniqueIDsSet,
GAParameters  settings 
) throws DENOPTIMException, IOException
staticprotected

Reads unique identifiers and initial population file according to the GAParameters.

Exceptions
IOException

Definition at line 148 of file EAUtils.java.

References denoptim.ga.EAUtils.getPathNameToGenerationFolder(), denoptim.ga.EAUtils.getPopulationFromFile(), and denoptim.ga.EAUtils.readUID().

Referenced by denoptim.ga.EvolutionaryAlgorithm.run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initialiseFormatter()

static DecimalFormat denoptim.ga.EAUtils.initialiseFormatter ( )
staticprivate

Definition at line 106 of file EAUtils.java.

References denoptim.ga.EAUtils.df, and denoptim.ga.EAUtils.enUsLocale.

◆ makeGraphFromFragmentationOfMol() [1/2]

static DGraph denoptim.ga.EAUtils.makeGraphFromFragmentationOfMol ( IAtomContainer  mol,
List< CuttingRule cuttingRules,
Logger  logger,
ScaffoldingPolicy  scaffoldingPolicy 
) throws DENOPTIMException
static

Converts a molecule into a DGraph by fragmentation and re-assembling of the fragments.

Parameters
molthe molecule to convert
cuttingRulesthe cutting rules defining how to do fragmentation.
loggertool managing log.
scaffoldingPolicythe policy for deciding which vertex should be given the role of scaffold.
Returns
the graph.
Exceptions
DENOPTIMException

Definition at line 1028 of file EAUtils.java.

References denoptim.ga.EAUtils.makeGraphFromFragmentationOfMol().

Referenced by denoptim.gui.GUIGraphHandler.appendGraphsFromConvertingMolecule(), denoptim.ga.EAUtils.buildCandidateByFragmentingMolecule(), denoptim.ga.EAUtils.makeGraphFromFragmentationOfMol(), denoptim.ga.EAUtilsTest.testMakeGraphFromFragmentationOfMol(), denoptim.ga.EAUtilsTest.testMakeGraphFromFragmentationOfMol_linearities(), denoptim.ga.EAUtilsTest.testMakeGraphFromFragmentationOfMol_ScaffoldingPolicy(), denoptim.ga.EAUtilsTest.testMakeGraphFromFragmentationOfMol_Symmetry(), and denoptim.ga.EAUtilsTest.testMakeGraphFromFragmentationOfMol_symmetry().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ makeGraphFromFragmentationOfMol() [2/2]

static DGraph denoptim.ga.EAUtils.makeGraphFromFragmentationOfMol ( IAtomContainer  mol,
List< CuttingRule cuttingRules,
Logger  logger,
ScaffoldingPolicy  scaffoldingPolicy,
double  linearAngleLimit 
) throws DENOPTIMException
static

Converts a molecule into a DGraph by fragmentation and re-assembling of the fragments.

Parameters
molthe molecule to convert
cuttingRulesthe cutting rules defining how to do fragmentation.
loggertool managing log.
scaffoldingPolicythe policy for deciding which vertex should be given the role of scaffold.
linearAngleLimitthe max bond angle before we start considering the angle linear and add a linearity-breaking dummy atom.
Returns
the graph.
Exceptions
DENOPTIMException

Definition at line 1053 of file EAUtils.java.

References denoptim.utils.DummyAtomHandler.addDummiesOnLinearities(), denoptim.graph.DGraph.addVertex(), denoptim.ga.EAUtils.appendVertexesToGraphFollowingEdges(), denoptim.graph.DGraph.detectSymVertexSets(), denoptim.fragmenter.FragmenterTools.fragmentation(), denoptim.graph.Vertex.getHeavyAtomsCount(), denoptim.graph.Vertex.getIAtomContainer(), denoptim.utils.MoleculeUtils.getSymbolOrLabel(), denoptim.graph.Vertex.BBType.SCAFFOLD, denoptim.graph.Vertex.setBuildingBlockType(), denoptim.graph.Vertex.setVertexId(), and denoptim.graph.Fragment.updateAPs().

Here is the call graph for this function:

◆ outputFinalResults()

static void denoptim.ga.EAUtils.outputFinalResults ( Population  popln,
GAParameters  settings 
) throws DENOPTIMException
staticprotected

Saves the final results to disk.

If the files for each candidate have been saved on disk along the way, then it copies them from their location into the folder for final results, which is defined based on the GA settings.

Parameters
poplnthe final list of best molecules
settingsthe GS settings containing defaults and parameters given by the user.

Definition at line 1515 of file EAUtils.java.

References denoptim.programs.RunTimeParameters.ParametersType.FIT_PARAMS, denoptim.constants.DENOPTIMConstants.FITFILENAMEEXTOUT, denoptim.graph.Candidate.getImageFile(), denoptim.graph.Candidate.getName(), denoptim.ga.EAUtils.getPathNameToFinalPopulationDetailsFile(), denoptim.ga.EAUtils.getPathNameToFinalPopulationFolder(), denoptim.graph.Candidate.getSDFFile(), denoptim.ga.EAUtils.outputPopulationDetails(), denoptim.graph.Candidate.setSDFFile(), and denoptim.io.DenoptimIO.writeCandidateToFile().

Referenced by denoptim.ga.EvolutionaryAlgorithm.run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ outputPopulationDetails()

static void denoptim.ga.EAUtils.outputPopulationDetails ( Population  population,
String  filename,
GAParameters  settings,
boolean  printpathNames 
) throws DENOPTIMException
static

Write out summary for the current GA population.

Parameters
population
filenamethe pathname of the file where we write the details of the population. If required by the GAParameters, we use this also to define a pathname where to write all the members of the population.
Exceptions
DENOPTIMException

Definition at line 1226 of file EAUtils.java.

References denoptim.ga.EAUtils.df, denoptim.constants.DENOPTIMConstants.GAGENSUMMARYHEADER, denoptim.graph.Candidate.getFitness(), denoptim.graph.Candidate.getGraph(), denoptim.graph.DGraph.getGraphId(), denoptim.graph.Candidate.getName(), denoptim.graph.Candidate.getSDFFile(), denoptim.ga.EAUtils.getSummaryStatistics(), denoptim.graph.Candidate.getUID(), denoptim.ga.EAUtils.NL, denoptim.io.DenoptimIO.writeCandidatesToFile(), and denoptim.io.DenoptimIO.writeData().

Referenced by denoptim.ga.EAUtils.outputFinalResults(), denoptim.ga.EvolutionaryAlgorithm.run(), and denoptim.io.DenoptimIOTest.testReadGenerationFromSummary().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ performFBCC()

static XoverSite denoptim.ga.EAUtils.performFBCC ( List< Candidate eligibleParents,
Population  population,
int[]  choiceOfParents,
int  choiceOfXOverSites,
GAParameters  settings 
)
staticprotected

Perform fitness-based, class-compatible selection of parents that can do crossover operations.

Parameters
eligibleParentslist of candidates among which to choose.
populationthe dynamic population containing the eligible parents.
choiceOfParentsthe integers dictating the selection of parents. Use this only to ensure reproducibility in tests, otherwise use null
choiceOfXOverSitesthe integers dictating the selection of crossover sites. Use this only to ensure reproducibility in tests, otherwise use negative
Returns
returns the definition of the crossover in terms of subgraphs to swap.

Definition at line 1399 of file EAUtils.java.

References denoptim.programs.RunTimeParameters.containsParameters(), denoptim.programs.RunTimeParameters.ParametersType.FS_PARAMS, denoptim.fragspace.FragmentSpaceParameters.getFragmentSpace(), denoptim.programs.RunTimeParameters.getParameters(), denoptim.programs.RunTimeParameters.getRandomizer(), denoptim.ga.Population.getXoverPartners(), denoptim.ga.Population.getXoverSites(), denoptim.utils.Randomizer.randomlyChooseOne(), and denoptim.ga.EAUtils.selectBasedOnFitness().

Referenced by denoptim.ga.EAUtils.buildCandidatesByXOver().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pickNewCandidateGenerationMode()

static CandidateSource denoptim.ga.EAUtils.pickNewCandidateGenerationMode ( double  xoverWeight,
double  mutWeight,
double  newWeight,
Randomizer  randomizer 
)
static

Takes a decision on which CandidateSource method to use for generating a new Candidate.

The choice is made according to the weights given as arguments, and shooting a random number over a weighted score range.

Parameters
xoverWeightweight of crossover between existing population members.
mutWeightweight of mutation of existing population members.
newWeightweight of construction from scratch.
Returns
one among the possible CandidateSource excluding {@value CandidateSource::MANUAL}.

Definition at line 249 of file EAUtils.java.

References denoptim.ga.EAUtils.CandidateSource.CONSTRUCTION, denoptim.ga.EAUtils.CandidateSource.CROSSOVER, denoptim.ga.EAUtils.CandidateSource.MUTATION, and denoptim.utils.Randomizer.nextDouble().

Referenced by denoptim.ga.EAUtils.chooseGenerationMethod(), denoptim.ga.EvolutionaryAlgorithm.makeOffspringB(), denoptim.ga.EAUtilsTest.testCandidateGenerationMethod(), and denoptim.ga.EAUtilsTest.testCandidateGenerationMethodReproducibility().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readCandidateFromFile()

◆ readUID()

static void denoptim.ga.EAUtils.readUID ( String  infile,
HashSet< String >  lstInchi 
) throws DENOPTIMException
staticprotected

Definition at line 2307 of file EAUtils.java.

References denoptim.io.DenoptimIO.readList().

Referenced by denoptim.ga.EAUtils.importInitialPopulation().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ searchForApSuitableToRingClosure()

static AttachmentPoint denoptim.ga.EAUtils.searchForApSuitableToRingClosure ( AttachmentPoint  apA,
SymmetricAPs  symAPsA,
GAParameters  settings 
)
static

Definition at line 2318 of file EAUtils.java.

◆ selectBasedOnFitness()

static Candidate[] denoptim.ga.EAUtils.selectBasedOnFitness ( List< Candidate eligibleParents,
int  number,
GAParameters  settings 
)
staticprotected

Selects a number of members from the given population.

The selection method is what specified by the configuration of the genetic algorithm (GAParameters).

Parameters
eligibleParentsthe list of candidates to chose from.
numberhow many candidate to pick.
Returns
indexes of the selected members of the given population.

Definition at line 1342 of file EAUtils.java.

References denoptim.programs.denovo.GAParameters.getSelectionStrategyType(), denoptim.ga.SelectionHelper.performRandomSelection(), denoptim.ga.SelectionHelper.performRWS(), denoptim.ga.SelectionHelper.performSUS(), and denoptim.ga.SelectionHelper.performTournamentSelection().

Referenced by denoptim.ga.EAUtils.buildCandidateByMutation(), denoptim.ga.EAUtils.buildCandidatesByXOver(), and denoptim.ga.EAUtils.performFBCC().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ selectNonScaffoldNonCapVertex()

static Vertex denoptim.ga.EAUtils.selectNonScaffoldNonCapVertex ( DGraph  g,
Randomizer  randomizer 
)
staticprotected

Chose randomly a vertex that is neither scaffold or capping group.

Definition at line 1371 of file EAUtils.java.

References denoptim.graph.Vertex.BBType.CAP, denoptim.graph.DGraph.getVertexList(), denoptim.utils.Randomizer.randomlyChooseOne(), and denoptim.graph.Vertex.BBType.SCAFFOLD.

Referenced by denoptim.ga.EAUtils.buildCandidatesByXOver(), and denoptim.ga.EAUtilsTest.testSelectNonScaffoldNonCapVertex().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setupRings()

static boolean denoptim.ga.EAUtils.setupRings ( Object[]  res,
DGraph  molGraph,
GAParameters  settings 
) throws DENOPTIMException
staticprotected

Evaluates the possibility of closing rings in a given graph and if any ring can be closed, it chooses one of the combinations of ring closures that involves the highest number of new rings.

Parameters
resan object array containing the inchi code, the smiles string and the 2D representation of the molecule. This object can be null if inchi/smiles/2D conversion fails.
molGraphthe DENOPTIMGraph on which rings are to be identified
Returns
true unless no ring can be set up even if required

Definition at line 1773 of file EAUtils.java.

References denoptim.graph.rings.RingClosureParameters.allowRingClosures(), denoptim.graph.rings.RingClosureParameters.buildChelatesMode, denoptim.graph.rings.CyclicGraphHandler.checkChelatesGraph(), denoptim.molecularmodeling.ThreeDimTreeBuilder.convertGraphTo3DAtomContainer(), denoptim.utils.RotationalSpaceUtils.defineRotatableBonds(), denoptim.programs.RunTimeParameters.ParametersType.FS_PARAMS, denoptim.ga.EAUtils.getCrowdedness(), denoptim.ga.EAUtils.getCrowdingProbability(), denoptim.fragspace.FragmentSpaceParameters.getFragmentSpace(), denoptim.utils.MoleculeUtils.getInChIKeyForMolecule(), denoptim.graph.rings.RingClosureParameters.getMaxRingClosures(), denoptim.programs.RunTimeParameters.getParameters(), denoptim.graph.rings.CyclicGraphHandler.getPossibleCombinationOfRings(), denoptim.graph.rings.CyclicGraphHandler.getRandomCombinationOfRings(), denoptim.utils.MoleculeUtils.getSMILESForMolecule(), denoptim.programs.RunTimeParameters.ParametersType.RC_PARAMS, denoptim.molecularmodeling.ThreeDimTreeBuilder.setAlignBBsIn3D(), and denoptim.fragspace.FragmentSpace.useAPclassBasedApproach().

Referenced by denoptim.ga.EAUtils.buildCandidateByMutation(), denoptim.ga.EAUtils.buildCandidateFromScratch(), and denoptim.ga.EAUtils.buildCandidatesByXOver().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setVertexCounterValue()

static void denoptim.ga.EAUtils.setVertexCounterValue ( Population  population) throws DENOPTIMException
staticprotected

Set the Vertex counter value according to the largest value found in the given population.

Parameters
populationthe collection of candidates to analyse.
Exceptions
DENOPTIMException

Definition at line 1657 of file EAUtils.java.

References denoptim.utils.GraphUtils.ensureVertexIDConsistency(), and denoptim.graph.DGraph.getMaxVertexId().

Referenced by denoptim.ga.EAUtils.getPopulationFromFile().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ writeUID()

static void denoptim.ga.EAUtils.writeUID ( String  outfile,
HashSet< String >  lstInchi,
boolean  append 
) throws DENOPTIMException
staticprotected

Definition at line 1624 of file EAUtils.java.

References denoptim.ga.EAUtils.NL, and denoptim.io.DenoptimIO.writeData().

Here is the call graph for this function:

Member Data Documentation

◆ df

DecimalFormat denoptim.ga.EAUtils.df = initialiseFormatter()
staticprivate

Format for decimal fitness numbers that overwrites Locale to en_US.

Definition at line 105 of file EAUtils.java.

Referenced by denoptim.ga.EAUtils.getSummaryStatistics(), denoptim.ga.EAUtils.initialiseFormatter(), and denoptim.ga.EAUtils.outputPopulationDetails().

◆ enUsLocale

Locale denoptim.ga.EAUtils.enUsLocale = new Locale("en", "US")
staticprivate

Locale used to write reports.

Definition at line 100 of file EAUtils.java.

Referenced by denoptim.ga.EAUtils.initialiseFormatter().

◆ fragmentPool

HashMap<Integer, ArrayList<Integer> > denoptim.ga.EAUtils.fragmentPool
staticprotected

Definition at line 95 of file EAUtils.java.

◆ FSEP

◆ lstFragmentClass

HashMap<Integer, ArrayList<String> > denoptim.ga.EAUtils.lstFragmentClass
staticprotected

Definition at line 114 of file EAUtils.java.

◆ NL

final String denoptim.ga.EAUtils.NL =System.getProperty("line.separator")
staticprivate

The documentation for this class was generated from the following file: