$darkmode
DENOPTIM
|
Collection of operators meant to alter graphs and associated utilities. More...
Classes | |
class | FragForClosabChains |
Private class representing a selected closable chain of fragments. More... | |
Static Public Member Functions | |
static List< XoverSite > | locateCompatibleXOverPoints (DGraph graphA, DGraph graphB, FragmentSpace fragSpace, int maxSizeXoverSubGraph) throws DENOPTIMException |
Identify crossover sites, i.e., subgraphs that can be swapped between two graphs (i.e., the parents). More... | |
static boolean | extendLink (Vertex vertex, int chosenAPId, Monitor mnt, FragmentSpace fragSpace) throws DENOPTIMException |
Inserts a vertex in between two connected vertexes that are identified by the one vertex holding the "source" end of the edge, and the identifier of the attachment point used by that edge. More... | |
static boolean | extendLink (Vertex vertex, int chosenAPId, int chosenNewVrtxId, Monitor mnt, FragmentSpace fragSpace) throws DENOPTIMException |
Inserts a vertex in between two connected vertexes that are identified by the one vertex holding the "source" end of the edge, and the identifier of the attachment point used by that edge. More... | |
static boolean | extendLink (Edge edge, int chosenBBIdx, Monitor mnt, FragmentSpace fragSpace) throws DENOPTIMException |
Replace an edge with two edges with a new vertex in between, thus inserting a vertex in between two directly connected vertexes, which will no longer be directly connected. More... | |
static boolean | performCrossover (XoverSite site, FragmentSpace fragSpace) throws DENOPTIMException |
Performs the crossover that swaps the two subgraphs defining the given XoverSite . More... | |
static boolean | performMutation (DGraph graph, Monitor mnt, GAParameters settings) throws DENOPTIMException |
Tries to do mutate the given graph. More... | |
static boolean | performMutation (Vertex vertex, Monitor mnt, GAParameters settings) throws DENOPTIMException |
Tries to do mutate the given vertex. More... | |
static boolean | performMutation (Vertex vertex, MutationType mType, Monitor mnt, GAParameters settings) throws DENOPTIMException |
Mutates the given vertex according to the given mutation type, if possible. More... | |
static boolean | performMutation (Vertex vertex, MutationType mType, boolean force, int chosenVrtxIdx, int chosenApId, Monitor mnt, GAParameters settings) throws DENOPTIMException |
Mutates the given vertex according to the given mutation type, if possible. More... | |
Static Protected Member Functions | |
static boolean | deleteLink (Vertex vertex, int chosenVrtxIdx, Monitor mnt, FragmentSpace fragSpace) throws DENOPTIMException |
Removes a vertex while merging as many of the child branches into the parent vertex. More... | |
static boolean | substituteLink (Vertex vertex, int chosenVrtxIdx, Monitor mnt, FragmentSpace fragSpace) throws DENOPTIMException |
Substitutes a vertex while keeping its surrounding. More... | |
static boolean | rebuildBranch (Vertex vertex, boolean force, int chosenVrtxIdx, int chosenApId, GAParameters settings) throws DENOPTIMException |
Substitutes a vertex and any child branch. More... | |
static boolean | deleteFragment (Vertex vertex) throws DENOPTIMException |
Deletion mutation removes the vertex and also the symmetric partners on its parent. More... | |
static boolean | deleteChain (Vertex vertex, Monitor mnt, FragmentSpace fragSpace) throws DENOPTIMException |
Deletes the given vertex and all other vertexes that are not connected to more than 2 non-capping group vertexes. More... | |
static boolean | addRing (Vertex vertex, Monitor mnt, boolean force, FragmentSpace fragSpace, GAParameters settings) throws DENOPTIMException |
Tries to use any free AP of the given vertex to close ring in the graph by adding a chord. More... | |
static boolean | extendGraph (Vertex curVertex, boolean extend, boolean symmetryOnAps, GAParameters settings) throws DENOPTIMException |
function that will keep extending the graph according to the growth/substitution probability. More... | |
static boolean | extendGraph (Vertex curVrtx, boolean extend, boolean symmetryOnAps, boolean force, int chosenVrtxIdx, int chosenApId, GAParameters settings) throws DENOPTIMException |
function that will keep extending the graph. More... | |
static IdFragmentAndAP | getFrgApForSrcAp (Vertex curVertex, int dapidx, FragmentSpace fragSpace) throws DENOPTIMException |
Select a compatible fragment for the given attachment point. More... | |
static IdFragmentAndAP | getFrgApForSrcAp (Vertex curVertex, int dapidx, int chosenVrtxIdx, int chosenApId, FragmentSpace fragSpace) throws DENOPTIMException |
Select a compatible fragment for the given attachment point. More... | |
static IdFragmentAndAP | getRCVForSrcAp (Vertex curVertex, int dapidx, FragmentSpace fragSpace) throws DENOPTIMException |
Select a compatible ring-closing vertex for the given attachment point. More... | |
static boolean | attachFragmentInClosableChain (Vertex curVertex, int dapidx, DGraph molGraph, ArrayList< Long > addedVertices, GAParameters settings) throws DENOPTIMException |
static ArrayList< FragForClosabChains > | getFragmentForClosableChain (Vertex curVertex, int dapidx, DGraph molGraph) throws DENOPTIMException |
Method to select fragments that increase the likeliness of generating closable chains. More... | |
static boolean | applySymmetry (boolean apclassImposed, double symmetryProbability, Randomizer randomizer) |
Decides whether to apply constitutional symmetry or not. More... | |
Static Private Member Functions | |
static void | processCombinationOfEndPoints (Vertex[] pair, List< Vertex[]> cominationOfEnds, List< XoverSite > collector, FragmentSpace fragSpace) |
Given a pair of seed vertexes that define where a pair of subgraphs stars in the corresponding original graphs, this method evaluates the use of a given list of candidate subgraph end points. More... | |
static void | processPermutationOfEndPoints (Vertex[] pair, List< Vertex[]> chosenSequenceOfEndpoints, List< XoverSite > collector, FragmentSpace fragSpace) |
Given a pair of seed vertexes that define where a pair of subgraphs stars in the corresponding original graphs, this method evaluates the use of a given ordered list of candidate subgraph end points. More... | |
static void | checkAndAddXoverSites (FragmentSpace fragSpace, List< Vertex > subGraphA, List< Vertex > subGraphB, CrossoverType xoverType, List< XoverSite > collector) |
Here we check that the given subgraphs have a mapping that allows to swap them, and full fill any other requirement other than not being isomorphic (which is done in parent methods calling this one). More... | |
static boolean | isCrossoverPossible (Edge eA, Edge eB, FragmentSpace fragSpace) |
Evaluate AP class-compatibility of a pair of edges with respect to crossover. More... | |
Collection of operators meant to alter graphs and associated utilities.
Definition at line 76 of file GraphOperations.java.
|
staticprotected |
Tries to use any free AP of the given vertex to close ring in the graph by adding a chord.
vertex | the vertex on which we start to close a the ring. |
mnt | monitoring tool to keep count of events. |
force | use true to by-pass random decisions and force the creation of rings. |
fragSpace | the fragment space controlling how we put together building blocks. |
settings | the GA settings controlling how we work. |
true
when at least one ring was added to the graph. DENOPTIMException |
Definition at line 966 of file GraphOperations.java.
References denoptim.graph.DGraph.addRing(), denoptim.graph.DGraph.appendVertexOnAP(), denoptim.graph.DGraph.clone(), denoptim.graph.Vertex.clone(), denoptim.molecularmodeling.ThreeDimTreeBuilder.convertGraphTo3DAtomContainer(), denoptim.graph.APClass.equals(), denoptim.logging.CounterID.FAILEDMUTATTEMTS_PERFORM_NOADDRING_NOFREEAP, denoptim.logging.CounterID.FAILEDMUTATTEMTS_PERFORM_NOADDRING_NORINGCOMB, denoptim.graph.Vertex.getAP(), denoptim.graph.AttachmentPoint.getAPClass(), denoptim.graph.DGraph.getAvailableAPsThroughout(), denoptim.graph.Vertex.getFreeAPThroughout(), denoptim.programs.RunTimeParameters.getParameters(), denoptim.utils.GraphUtils.getUniqueVertexIndex(), denoptim.graph.DGraph.getVertexAtPosition(), denoptim.graph.DGraph.indexOf(), denoptim.graph.rings.RandomCombOfRingsIterator.next(), denoptim.utils.Randomizer.randomlyChooseOne(), denoptim.programs.RunTimeParameters.ParametersType.RC_PARAMS, denoptim.graph.rings.RingClosingAttractor.RCAAPCMAP, denoptim.graph.DGraph.removeVertex(), denoptim.molecularmodeling.ThreeDimTreeBuilder.setAlignBBsIn3D(), and denoptim.graph.Vertex.setVertexId().
Referenced by denoptim.ga.GraphOperations.performMutation(), and denoptim.ga.GraphOperationsTest.testAddRing().
|
staticprotected |
Decides whether to apply constitutional symmetry or not.
Application of this type of symmetry implies that the operation on the graph/molecule is to be performed on all the attachment point/vertices related to each other by "constitutional symmetry". Such type symmetry is defined by getMatchingAP
for a single fragment, and symmetric vertices in a graph are found by getSymmetricVertices
. This method takes into account the effect of the symmetric substitution probability, and the symmetry-related keywords.
true
if symmetry is to be applied Definition at line 2110 of file GraphOperations.java.
References denoptim.utils.Randomizer.nextBoolean().
Referenced by denoptim.ga.GraphOperations.attachFragmentInClosableChain(), and denoptim.ga.GraphOperations.extendGraph().
|
staticprotected |
Definition at line 1624 of file GraphOperations.java.
References denoptim.ga.GraphOperations.applySymmetry(), denoptim.programs.RunTimeParameters.ParametersType.FS_PARAMS, denoptim.graph.Vertex.getAP(), denoptim.ga.GraphOperations.FragForClosabChains.getFragIDs(), denoptim.ga.GraphOperations.getFragmentForClosableChain(), denoptim.fragspace.FragmentSpaceParameters.getFragmentSpace(), denoptim.ga.GraphOperations.FragForClosabChains.getIncompatibleCC(), denoptim.programs.RunTimeParameters.getParameters(), denoptim.programs.RunTimeParameters.getRandomizer(), denoptim.utils.GraphUtils.getUniqueVertexIndex(), denoptim.fragspace.FragmentSpace.imposeSymmetryOnAPsOfClass(), denoptim.graph.Vertex.newVertexFromLibrary(), and denoptim.graph.Vertex.BBType.parseInt().
Referenced by denoptim.ga.GraphOperations.extendGraph().
|
staticprivate |
Here we check that the given subgraphs have a mapping that allows to swap them, and full fill any other requirement other than not being isomorphic (which is done in parent methods calling this one).
Then, we create the corresponding crossover site and place it in the collector of such sites.
NB: This method assumes that no crossover can involve seed of the spanning tree (whether scaffold, of anything else).
Definition at line 493 of file GraphOperations.java.
References denoptim.utils.CrossoverType.BRANCH, denoptim.graph.DGraph.extractSubgraph(), denoptim.graph.Template.ContractLevel.FIXED_STRUCT, denoptim.fragspace.APMapFinder.foundMapping(), denoptim.graph.Template.getContractLevel(), denoptim.graph.DGraph.getDeepestAmongThese(), denoptim.graph.Vertex.getEdgeToParent(), denoptim.graph.DGraph.getInterfaceAPs(), denoptim.graph.DGraph.getRingsInvolvingVertex(), denoptim.graph.DGraph.getSubgraphAPs(), denoptim.graph.DGraph.getTemplateJacket(), denoptim.graph.Edge.getTrgAP(), and denoptim.graph.DGraph.isIsostructuralTo().
Referenced by denoptim.ga.GraphOperations.locateCompatibleXOverPoints(), and denoptim.ga.GraphOperations.processPermutationOfEndPoints().
|
staticprotected |
Deletes the given vertex and all other vertexes that are not connected to more than 2 non-capping group vertexes.
Effectively, it removes an entire branch (in acyclic graphs) or the part of a cyclic graph between two branching points (in a ring, thus opening the ring wide). The same is done on symmetric partners on its parent.
vertex | the vertex at which the deletion begins. |
mnt | monitoring tool to keep count of events. |
true
if deletion is successful DENOPTIMException |
Definition at line 921 of file GraphOperations.java.
References denoptim.utils.MutationType.DELETECHAIN, denoptim.graph.DGraph.getSymSetForVertex(), denoptim.graph.DGraph.getVertexCount(), denoptim.graph.DGraph.getVertexWithId(), denoptim.graph.DGraph.hasSymmetryInvolvingVertex(), and denoptim.graph.DGraph.removeChainUpToBranching().
Referenced by denoptim.ga.GraphOperations.performMutation().
|
staticprotected |
Deletion mutation removes the vertex and also the symmetric partners on its parent.
vertex |
true
if deletion is successful DENOPTIMException |
Definition at line 881 of file GraphOperations.java.
References denoptim.graph.DGraph.getSymSetForVertex(), denoptim.graph.DGraph.getVertexCount(), denoptim.graph.DGraph.getVertexWithId(), denoptim.graph.DGraph.hasSymmetryInvolvingVertex(), and denoptim.graph.DGraph.removeBranchStartingAt().
Referenced by denoptim.ga.GraphOperations.performMutation(), and denoptim.ga.GraphOperations.rebuildBranch().
|
staticprotected |
Removes a vertex while merging as many of the child branches into the parent vertex.
vertex | the vertex to remove. |
mnt | the monitor keeping track of what happens in EA operations. This does not affect the mutation. It only measures how many attempts and failures occur. |
true
if the mutation is successful. DENOPTIMException |
Definition at line 626 of file GraphOperations.java.
References denoptim.logging.CounterID.FAILEDMUTATTEMTS_PERFORM_NODELLINK_EDIT, and denoptim.graph.DGraph.removeVertexAndWeld().
Referenced by denoptim.ga.GraphOperations.performMutation().
|
staticprotected |
function that will keep extending the graph according to the growth/substitution probability.
curVertex | vertex to which further fragments will be appended |
extend | if true , then the graph will be grown further (recursive mode) |
symmetryOnAps | if true , then symmetry will be applied on the APs, no matter what. This is mostly needed to retain symmetry when performing mutations on the root vertex of a symmetric graph. |
DENOPTIMException |
true
if the graph has been modified Definition at line 1180 of file GraphOperations.java.
References denoptim.ga.GraphOperations.extendGraph().
Referenced by denoptim.ga.EAUtils.buildGraph(), denoptim.ga.GraphOperations.extendGraph(), denoptim.ga.GraphOperations.performMutation(), denoptim.ga.GraphOperations.rebuildBranch(), and denoptim.ga.GraphOperationsTest.testExtendGraph().
|
staticprotected |
function that will keep extending the graph.
The probability of addition depends on the growth probability scheme.
curVrtx | vertex to which further fragments will be appended |
extend | if true , then the graph will be grown further (recursive mode) |
symmetryOnAps | if true , then symmetry will be applied on the APs, no matter what. This is mostly needed to retain symmetry when performing mutations on the root vertex of a symmetric graph. |
force | set to true to ignore growth probability. |
chosenVrtxIdx | if greater than or equals to zero, sets the choice of the vertex to the given index. This selection applies only to the first extension, not to further recursions. |
chosenApId | if greater than or equals to zero, sets the choice of the AP to the given index. This selection applies only to the first extension, not to further recursions. |
maxHeavyAtoms | maximum number of heavy atoms. |
DENOPTIMException |
true
if the graph has been modified Definition at line 1215 of file GraphOperations.java.
References denoptim.graph.SymmetricSet< T >.add(), denoptim.graph.DGraph.addSymmetricSetOfVertices(), denoptim.graph.rings.RingClosureParameters.allowRingClosures(), denoptim.graph.DGraph.appendVertexOnAP(), denoptim.ga.GraphOperations.applySymmetry(), denoptim.ga.GraphOperations.attachFragmentInClosableChain(), denoptim.utils.GraphUtils.ensureVertexIDConsistency(), denoptim.ga.GraphOperations.extendGraph(), denoptim.graph.Vertex.BBType.FRAGMENT, denoptim.programs.RunTimeParameters.ParametersType.FS_PARAMS, denoptim.graph.Vertex.getAP(), denoptim.graph.AttachmentPoint.getAPClass(), denoptim.fragspace.IdFragmentAndAP.getApId(), denoptim.ga.EAUtils.getCrowdedness(), denoptim.ga.EAUtils.getCrowdingProbability(), denoptim.fragspace.FragmentSpaceParameters.getFragmentSpace(), denoptim.ga.GraphOperations.getFrgApForSrcAp(), denoptim.ga.EAUtils.getGrowthByLevelProbability(), denoptim.graph.Vertex.getHeavyAtomsCount(), denoptim.graph.AttachmentPoint.getIndexInOwner(), denoptim.graph.DGraph.getLevel(), denoptim.fragspace.FragmentSpaceParameters.getMaxHeavyAtom(), denoptim.graph.DGraph.getMaxVertexId(), denoptim.ga.EAUtils.getMolSizeProbability(), denoptim.programs.RunTimeParameters.getParameters(), denoptim.programs.RunTimeParameters.getRandomizer(), denoptim.ga.GraphOperations.getRCVForSrcAp(), denoptim.graph.DGraph.getSymSetForVertex(), denoptim.utils.GraphUtils.getUniqueVertexIndex(), denoptim.fragspace.IdFragmentAndAP.getVertexMolId(), denoptim.graph.DGraph.getVertexWithId(), denoptim.graph.DGraph.hasSymmetryInvolvingVertex(), denoptim.fragspace.FragmentSpace.imposeSymmetryOnAPsOfClass(), denoptim.graph.AttachmentPoint.isAvailable(), denoptim.graph.Vertex.newVertexFromLibrary(), denoptim.programs.RunTimeParameters.ParametersType.RC_PARAMS, and denoptim.graph.rings.RingClosureParameters.selectFragmentsFromClosableChains().
|
static |
Replace an edge with two edges with a new vertex in between, thus inserting a vertex in between two directly connected vertexes, which will no longer be directly connected.
vertex | holding the "source" end of the edge to |
chosenBBIdx | the identifier of the building block to insert. |
mnt | the monitor keeping track of what happens in EA operations. This does not affect the mutation. It only measures how many attempts and failures occur. |
true
if the mutation is successful. DENOPTIMException |
Definition at line 774 of file GraphOperations.java.
References denoptim.logging.CounterID.FAILEDMUTATTEMTS_PERFORM_NOADDLINK_EDIT, denoptim.logging.CounterID.FAILEDMUTATTEMTS_PERFORM_NOADDLINK_FIND, denoptim.fragspace.GraphLinkFinder.foundAlternativeLink(), denoptim.graph.Vertex.getBuildingBlockId(), denoptim.graph.Vertex.getBuildingBlockType(), denoptim.fragspace.GraphLinkFinder.getChosenAlternativeLink(), denoptim.fragspace.GraphLinkFinder.getChosenAPMapping(), and denoptim.graph.DGraph.insertVertex().
|
static |
Inserts a vertex in between two connected vertexes that are identified by the one vertex holding the "source" end of the edge, and the identifier of the attachment point used by that edge.
Effectively, this method asks to replace an edge with two edges with a new vertex in between.
vertex | holding the "source" end of the edge to |
chosenAPId | the identifier of the AP on the vertex. |
chosenNewVrtxId | the identifier of the new building block to insert in the list. |
mnt | the monitor keeping track of what happens in EA operations. This does not affect the mutation. It only measures how many attempts and failures occur. |
true
if the mutation is successful. DENOPTIMException | if the request cannot be performed because the vertex is not the source of an edge at the given AP, or because such AP does not exist on the given vertex. |
Definition at line 735 of file GraphOperations.java.
References denoptim.ga.GraphOperations.extendLink(), denoptim.graph.AttachmentPoint.getEdgeUserThroughout(), denoptim.graph.AttachmentPoint.getOwner(), and denoptim.graph.Edge.getSrcAP().
|
static |
Inserts a vertex in between two connected vertexes that are identified by the one vertex holding the "source" end of the edge, and the identifier of the attachment point used by that edge.
Effectively, this method asks to replace an edge with two edges with a new vertex in between.
vertex | holding the "source" end of the edge to |
chosenAPId | the identifier of the AP on the vertex. |
mnt | the monitor keeping track of what happens in EA operations. This does not affect the mutation. It only measures how many attempts and failures occur. |
true
if the mutation is successful. DENOPTIMException | if the request cannot be performed because the vertex is not the source of an edge at the given AP, or because such AP does not exist on the given vertex. |
Definition at line 709 of file GraphOperations.java.
References denoptim.ga.GraphOperations.extendLink().
Referenced by denoptim.ga.GraphOperations.extendLink(), and denoptim.ga.GraphOperations.performMutation().
|
staticprotected |
Method to select fragments that increase the likeliness of generating closable chains.
Only works for scaffold.
Definition at line 1758 of file GraphOperations.java.
References denoptim.ga.GraphOperations.FragForClosabChains.addCompatibleCC(), denoptim.graph.rings.ChainLink.getApIdToLeft(), denoptim.graph.rings.ChainLink.getApIdToRight(), denoptim.graph.Vertex.getBuildingBlockId(), denoptim.graph.Vertex.getBuildingBlockType(), denoptim.graph.rings.ChainLink.getFragType(), denoptim.graph.rings.ChainLink.getIdx(), denoptim.graph.Vertex.getParent(), denoptim.graph.Edge.getSrcAPID(), denoptim.graph.Edge.getTrgAPID(), denoptim.graph.Vertex.BBType.parseInt(), denoptim.graph.Vertex.BBType.SCAFFOLD, denoptim.graph.Vertex.BBType.toOldInt(), and denoptim.graph.Vertex.BBType.UNDEFINED.
Referenced by denoptim.ga.GraphOperations.attachFragmentInClosableChain().
|
staticprotected |
Select a compatible fragment for the given attachment point.
Compatibility can either be class based or based on the free connections
curVertex | the source graph vertex |
dapidx | the attachment point index on the src vertex |
DENOPTIMException |
Definition at line 1521 of file GraphOperations.java.
References denoptim.ga.GraphOperations.getFrgApForSrcAp().
Referenced by denoptim.ga.GraphOperations.extendGraph(), and denoptim.ga.GraphOperations.getFrgApForSrcAp().
|
staticprotected |
Select a compatible fragment for the given attachment point.
Compatibility can either be class based or based on the free connections
curVertex | the source graph vertex |
dapidx | the attachment point index on the src vertex |
chosenVrtxIdx | if greater than or equals to zero, sets the choice of the incoming vertex to the given index. |
chosenApId | if greater than or equals to zero, sets the choice of the AP (of the incoming vertex) to the given index. |
DENOPTIMException |
Definition at line 1546 of file GraphOperations.java.
References denoptim.graph.Vertex.BBType.FRAGMENT, and denoptim.graph.AttachmentPoint.getAPClass().
|
staticprotected |
Select a compatible ring-closing vertex for the given attachment point.
curVertex | the source graph vertex |
dapidx | the attachment point index on the src vertex |
fragSpace | the space of building blocks with all the settings. |
DENOPTIMException |
Definition at line 1595 of file GraphOperations.java.
References denoptim.graph.AttachmentPoint.getAPClass(), denoptim.graph.Vertex.getBuildingBlockId(), denoptim.graph.Vertex.getBuildingBlockType(), and denoptim.utils.Randomizer.randomlyChooseOne().
Referenced by denoptim.ga.GraphOperations.extendGraph().
|
staticprivate |
Evaluate AP class-compatibility of a pair of edges with respect to crossover.
The condition for performing AP class-compatible crossover is that the AP class on source vertex of edge A is compatible with the AP class on target vertex of edge B, and that AP class on source vertex of edgeB is compatible with the AP class on target vertex of edge A.
eA | first edge of the pair. |
eB | second edge of the pair. |
true
if the condition is satisfied. Definition at line 595 of file GraphOperations.java.
References denoptim.graph.Edge.getSrcAPClass(), denoptim.graph.Edge.getTrgAPClass(), and denoptim.graph.APClass.isCPMapCompatibleWith().
Referenced by denoptim.ga.GraphOperations.locateCompatibleXOverPoints().
|
static |
Identify crossover sites, i.e., subgraphs that can be swapped between two graphs (i.e., the parents).
This method will try to locate as many as possible crossover sites without falling into combinatorial explosion.
gA | one of the parent graphs. |
gB | the other of the parent graphs. |
fragSpace | the space of building blocks defining how to generate graphs. |
maxSizeXoverSubGraph | the limit to the size of subgraphs that can can be exchanged by crossover. |
DENOPTIMException |
Definition at line 94 of file GraphOperations.java.
References denoptim.utils.CrossoverType.BRANCH, denoptim.graph.Vertex.BBType.CAP, denoptim.ga.GraphOperations.checkAndAddXoverSites(), denoptim.graph.DGraph.clone(), denoptim.graph.DGraph.extractSubgraph(), denoptim.graph.Template.ContractLevel.FIXED, denoptim.graph.Template.ContractLevel.FIXED_STRUCT, denoptim.graph.DGraph.getBranchIdOfVertexAsStr(), denoptim.graph.Vertex.getBuildingBlockType(), denoptim.graph.DGraph.getChildrenTree(), denoptim.graph.Template.getContractLevel(), denoptim.graph.Vertex.getGraphOwner(), denoptim.graph.Template.getInnerGraph(), denoptim.graph.Vertex.getParent(), denoptim.graph.rings.PathSubGraph.getPathLength(), denoptim.graph.DGraph.getTemplateJacket(), denoptim.graph.DGraph.getVertexCount(), denoptim.graph.DGraph.indexOf(), denoptim.ga.GraphOperations.isCrossoverPossible(), denoptim.graph.DGraph.isIsomorphicTo(), denoptim.ga.GraphOperations.locateCompatibleXOverPoints(), and denoptim.ga.GraphOperations.processCombinationOfEndPoints().
Referenced by denoptim.ga.Population.getXoverPartners(), denoptim.ga.GraphOperations.locateCompatibleXOverPoints(), denoptim.programs.genetweeker.GeneOpsRunner.runXOver(), and denoptim.ga.GraphOperationsTest.testLocateCompatibleXOverPoints().
|
static |
Performs the crossover that swaps the two subgraphs defining the given XoverSite
.
The operation is performed on the graphs that own the vertexes referred in the XoverSite
, so the original version of the graphs is lost. We expect the graphs to have an healthy set of vertex IDs. This can be ensured by running DGraph#renumberGraphVertices()
.
site | the definition of the crossover site. |
DENOPTIMException |
Definition at line 1985 of file GraphOperations.java.
References denoptim.graph.DGraph.extractSubgraph(), denoptim.fragspace.APMapFinder.foundMapping(), denoptim.graph.Vertex.getAP(), denoptim.fragspace.APMapFinder.getChosenAPMapping(), denoptim.graph.AttachmentPoint.getIndexInOwner(), denoptim.graph.AttachmentPoint.getOwner(), denoptim.graph.DGraph.getSubgraphAPs(), denoptim.graph.Vertex.getVertexId(), denoptim.graph.DGraph.getVertexWithId(), and denoptim.graph.DGraph.replaceSubGraph().
Referenced by denoptim.ga.EAUtils.buildCandidatesByXOver(), and denoptim.programs.genetweeker.GeneOpsRunner.runXOver().
|
static |
Tries to do mutate the given graph.
The mutation site and type are chosen randomly according to the possibilities declared by the graph. The graph that owns the vertex will be altered and the original structure and content of the graph will be lost.
graph | the graph to mutate. |
mnt | the monitor keeping track of what happens in EA operations. This does not affect the mutation. It only measures how many attempts and failures occur. |
true
if the mutation is successful. DENOPTIMException |
Definition at line 2139 of file GraphOperations.java.
References denoptim.ga.EAUtils.chooseNumberOfSitesToMutate(), denoptim.logging.CounterID.FAILEDMUTATTEMTS_PERFORM_NOMUTSITE, and denoptim.ga.GraphOperations.performMutation().
Referenced by denoptim.ga.EAUtils.buildCandidateByMutation(), denoptim.ga.EAUtils.buildGraph(), denoptim.ga.GraphOperations.performMutation(), and denoptim.programs.genetweeker.GeneOpsRunner.runMutation().
|
static |
Tries to do mutate the given vertex.
We assume the vertex belongs to a graph, if not no mutation is done. The mutation type is chosen randomly according to the possibilities declared by the vertex. The graph that owns the vertex will be altered and the original structure and content of the graph will be lost.
vertex | the vertex to mutate. |
mnt | the monitor keeping track of what happens in EA operations. This does not affect the mutation. It only measures how many attempts and failures occur. |
true
if the mutation is successful. DENOPTIMException |
Definition at line 2188 of file GraphOperations.java.
References denoptim.ga.GraphOperations.performMutation().
|
static |
Mutates the given vertex according to the given mutation type, if possible.
Vertex that do not belong to any graph or that do not allow the requested kind of mutation, are not mutated. The graph that owns the vertex will be altered and the original structure and content of the graph will be lost.
vertex | the vertex to mutate. |
mType | the type of mutation to perform. |
force | set to true to ignore growth probability. |
chosenVrtxIdx | if greater than or equals to zero, sets the choice of the incoming vertex to the given index. This parameter is ignored for mutation types that do not define an incoming vertex (i.e., MutationType#DELETE ). |
chosenApId | if greater than or equals to zero, sets the choice of the AP to the given index. Depending on the type of mutation, the AP can be on the incoming vertex (i.e., the vertex that will be added to the graph) or on the target vertex (i.e., the vertex that already belongs to the graph and that is the focus of the mutation). This parameter is ignored for mutation types that do not define an incoming vertex (i.e., MutationType#DELETE ). |
true
if the mutation is successful. DENOPTIMException |
Definition at line 2264 of file GraphOperations.java.
References denoptim.ga.GraphOperations.addRing(), denoptim.graph.Template.clearIAtomContainer(), denoptim.ga.GraphOperations.deleteChain(), denoptim.ga.GraphOperations.deleteFragment(), denoptim.ga.GraphOperations.deleteLink(), denoptim.ga.GraphOperations.extendGraph(), denoptim.ga.GraphOperations.extendLink(), denoptim.logging.CounterID.FAILEDMUTATTEMTS_PERFORM_BADMUTTYPE, denoptim.logging.CounterID.FAILEDMUTATTEMTS_PERFORM_NOADDLINK, denoptim.logging.CounterID.FAILEDMUTATTEMTS_PERFORM_NOADDRING, denoptim.logging.CounterID.FAILEDMUTATTEMTS_PERFORM_NOCHANGEBRANCH, denoptim.logging.CounterID.FAILEDMUTATTEMTS_PERFORM_NOCHANGELINK, denoptim.logging.CounterID.FAILEDMUTATTEMTS_PERFORM_NODELETE, denoptim.logging.CounterID.FAILEDMUTATTEMTS_PERFORM_NODELETECHAIN, denoptim.logging.CounterID.FAILEDMUTATTEMTS_PERFORM_NOEXTEND, denoptim.logging.CounterID.FAILEDMUTATTEMTS_PERFORM_NOOWNER, denoptim.programs.RunTimeParameters.ParametersType.FS_PARAMS, denoptim.graph.Vertex.getChilddren(), denoptim.fragspace.FragmentSpaceParameters.getFragmentSpace(), denoptim.graph.DGraph.getGraphId(), denoptim.graph.DGraph.getLocalMsg(), denoptim.programs.RunTimeParameters.getParameters(), denoptim.graph.DGraph.getTemplateJacket(), denoptim.graph.DGraph.indexOf(), denoptim.ga.GraphOperations.rebuildBranch(), denoptim.graph.DGraph.setLocalMsg(), denoptim.constants.DENOPTIMConstants.STOREDVID, and denoptim.ga.GraphOperations.substituteLink().
|
static |
Mutates the given vertex according to the given mutation type, if possible.
Vertex that do not belong to any graph or that do not allow the requested kind of mutation, are not mutated. The graph that owns the vertex ill be altered and the original structure and content of the graph will be lost.
vertex | the vertex to mutate. |
mType | the type of mutation to perform. |
true
if the mutation is successful. DENOPTIMException |
Definition at line 2214 of file GraphOperations.java.
References denoptim.graph.DGraph.clone(), denoptim.graph.DGraph.indexOf(), denoptim.ga.GraphOperations.performMutation(), and denoptim.io.DenoptimIO.writeGraphToSDF().
|
staticprivate |
Given a pair of seed vertexes that define where a pair of subgraphs stars in the corresponding original graphs, this method evaluates the use of a given list of candidate subgraph end points.
When it finds a pair of subgraphs that can be used to do crossover it stores them as a XoverSite
in the given collector.
pair | the seed vertexes in each of the graph |
cominationOfEnds | the combination of subgraph end points to be evaluated. The order of the entries does not matter as we will consider the permutations of this list. |
collector | this is where the crossover sites are stored. |
Definition at line 356 of file GraphOperations.java.
References denoptim.ga.GraphOperations.processPermutationOfEndPoints().
Referenced by denoptim.ga.GraphOperations.locateCompatibleXOverPoints().
|
staticprivate |
Given a pair of seed vertexes that define where a pair of subgraphs stars in the corresponding original graphs, this method evaluates the use of a given ordered list of candidate subgraph end points.
When it finds a pair of subgraphs that can be used to do crossover it stores them as a XoverSite
in the given collector.
pair | the seed vertexes in each of the graph |
chosenSequenceOfEndpoints | the specific permutation of subgraph end points to be evaluated. |
collector | this is where the crossover sites are stored. |
Definition at line 405 of file GraphOperations.java.
References denoptim.ga.GraphOperations.checkAndAddXoverSites(), denoptim.graph.DGraph.extractSubgraph(), denoptim.graph.DGraph.getChildTreeLimited(), denoptim.graph.Vertex.getGraphOwner(), denoptim.graph.rings.PathSubGraph.getVertecesPath(), denoptim.graph.DGraph.isIsomorphicTo(), and denoptim.utils.CrossoverType.SUBGRAPH.
Referenced by denoptim.ga.GraphOperations.processCombinationOfEndPoints().
|
staticprotected |
Substitutes a vertex and any child branch.
Deletes the given vertex from the graph that owns it, and removes any child vertex (i.e., reachable from the given vertex by a directed path). Then it tries to extent the graph from the parent vertex (i.e., the one that was originally holding the given vertex). Moreover, additional extension may occur on any available attachment point of the parent vertex.
vertex | to mutate (the given vertex). |
force | set to true to ignore growth probability. |
chosenVrtxIdx | if greater than or equals to zero, sets the choice of the vertex to the given index. |
chosenApId | if greater than or equals to zero, sets the choice of the AP to the given index. |
maxHeavyAtoms | maximum number of heavy atoms. |
true
if substitution is successful DENOPTIMException |
Definition at line 840 of file GraphOperations.java.
References denoptim.ga.GraphOperations.deleteFragment(), denoptim.ga.GraphOperations.extendGraph(), denoptim.graph.Edge.getSrcVertex(), denoptim.graph.DGraph.getVertexWithId(), and denoptim.graph.DGraph.hasSymmetryInvolvingVertex().
Referenced by denoptim.ga.GraphOperations.performMutation().
|
staticprotected |
Substitutes a vertex while keeping its surrounding.
Does not replace with same vertex (i.e., new vertex will have different building block ID, but might look the same wrt content and properties).
vertex | the vertex to replace with another one. |
chosenVrtxIdx | if greater than or equals to zero, sets the choice of the incoming vertex to the given index. AP mapping between old and new vertex is not controllable in this method. |
mnt | the monitor keeping track of what happens in EA operations. This does not affect the mutation. It only measures how many attempts and failures occur. |
true
if the mutation is successful. DENOPTIMException |
Definition at line 657 of file GraphOperations.java.
References denoptim.logging.CounterID.FAILEDMUTATTEMTS_PERFORM_NOCHANGELINK_EDIT, denoptim.logging.CounterID.FAILEDMUTATTEMTS_PERFORM_NOCHANGELINK_FIND, denoptim.fragspace.GraphLinkFinder.foundAlternativeLink(), denoptim.graph.Vertex.getBuildingBlockId(), denoptim.graph.Vertex.getBuildingBlockType(), denoptim.fragspace.GraphLinkFinder.getChosenAlternativeLink(), denoptim.fragspace.GraphLinkFinder.getChosenAPMapping(), denoptim.graph.DGraph.replaceVertex(), and denoptim.graph.APMapping.toIntMappig().
Referenced by denoptim.ga.GraphOperations.performMutation().