21import static org.junit.jupiter.api.Assertions.assertEquals;
22import static org.junit.jupiter.api.Assertions.assertFalse;
23import static org.junit.jupiter.api.Assertions.assertNotNull;
24import static org.junit.jupiter.api.Assertions.assertTrue;
27import java.util.ArrayList;
28import java.util.Arrays;
29import java.util.HashMap;
30import java.util.HashSet;
31import java.util.Iterator;
33import java.util.stream.Collectors;
35import org.junit.jupiter.api.Test;
36import org.junit.jupiter.api.io.TempDir;
37import org.openscience.cdk.interfaces.IAtom;
38import org.openscience.cdk.interfaces.IAtomContainer;
39import org.openscience.cdk.interfaces.IChemObjectBuilder;
40import org.openscience.cdk.layout.StructureDiagramGenerator;
41import org.openscience.cdk.silent.SilentChemObjectBuilder;
42import org.openscience.cdk.smiles.SmilesParser;
44import denoptim.constants.DENOPTIMConstants;
45import denoptim.exception.DENOPTIMException;
46import denoptim.fragmenter.ScaffoldingPolicy;
47import denoptim.fragspace.FragmentSpace;
48import denoptim.fragspace.FragmentSpaceParameters;
49import denoptim.ga.EAUtils.CandidateSource;
50import denoptim.graph.APClass;
51import denoptim.graph.AttachmentPoint;
52import denoptim.graph.Candidate;
53import denoptim.graph.DGraph;
54import denoptim.graph.DGraphTest;
55import denoptim.graph.Edge.BondType;
56import denoptim.graph.EmptyVertex;
57import denoptim.graph.GraphPattern;
58import denoptim.graph.SymmetricVertexes;
59import denoptim.graph.Template;
60import denoptim.graph.Template.ContractLevel;
61import denoptim.graph.Vertex;
62import denoptim.graph.Vertex.BBType;
63import denoptim.io.DenoptimIO;
64import denoptim.logging.Monitor;
65import denoptim.programs.denovo.GAParameters;
66import denoptim.programs.fragmenter.CuttingRule;
67import denoptim.utils.MoleculeUtils;
68import denoptim.utils.Randomizer;
80 private static String
a=
"A",
b=
"B",
c=
"C";
82 private static final String
SEP = System.getProperty(
"file.separator");
83 private static final String
NL = System.getProperty(
"line.separator");
88 private IChemObjectBuilder
builder = SilentChemObjectBuilder.getInstance();
101 HashMap<APClass,ArrayList<APClass>> cpMap =
102 new HashMap<APClass,ArrayList<APClass>>();
103 ArrayList<APClass> lstA =
new ArrayList<APClass>();
105 cpMap.put(
APCA, lstA);
106 ArrayList<APClass> lstB =
new ArrayList<APClass>();
109 cpMap.put(
APCB, lstB);
110 ArrayList<APClass> lstC =
new ArrayList<APClass>();
113 cpMap.put(
APCC, lstC);
127 HashMap<APClass,APClass> capMap =
new HashMap<APClass,APClass>();
128 HashSet<APClass> forbEnds =
new HashSet<APClass>();
132 new ArrayList<Vertex>(),
133 new ArrayList<Vertex>(),
134 new ArrayList<Vertex>(),
135 cpMap, capMap, forbEnds, cpMap);
160 for (
int i=1; i<6; i++)
175 graphForTemplate.
addRing(rcv1, rcv2);
178 template.setInnerGraph(graphForTemplate);
197 assertTrue(
false,
"faild construction of graph");
207 boolean foundChange =
false;
210 if (v.getBuildingBlockId() != 0)
213 assertTrue(foundChange,
"The initial inner graph has changed.");
243 ArrayList<Candidate> eligibleParents =
new ArrayList<Candidate>();
244 eligibleParents.add(c1);
245 eligibleParents.add(c2);
252 population, mnt, gaParams);
254 assertTrue(offspring==
null,
"Redundat xover is not done");
281 ArrayList<Candidate> eligibleParents =
new ArrayList<Candidate>();
282 eligibleParents.add(cA);
283 eligibleParents.add(cE);
288 population, mnt,
new int[]{0,1}, 3, 0, gaparams);
291 population, mnt,
new int[]{0,1}, 3, 1, gaparams);
299 ArrayList<Vertex> childTree =
new ArrayList<Vertex>();
301 if (childTree.size()>maxLength)
303 maxLength = childTree.size();
306 assertEquals(3,maxLength);
314 ArrayList<Vertex> childTree =
new ArrayList<Vertex>();
316 if (childTree.size()>maxLength)
318 maxLength = childTree.size();
321 assertEquals(7,maxLength);
356 ArrayList<Candidate> eligibleParents =
new ArrayList<Candidate>();
357 eligibleParents.add(cA);
358 eligibleParents.add(cB);
363 population, mnt,
new int[]{0,1}, 8, 0, gaparams);
366 population, mnt,
new int[]{0,1}, 8, 1, gaparams);
372 DGraph expected0 = expectedPair[0];
373 DGraph expected1 = expectedPair[1];
379 assertTrue(expected0.
sameAs(g0xo,
new StringBuilder()));
380 assertTrue(expected1.
sameAs(g1xo,
new StringBuilder()));
415 ArrayList<Candidate> eligibleParents =
new ArrayList<Candidate>();
416 eligibleParents.add(cA);
417 eligibleParents.add(cB);
422 population, mnt,
new int[]{0,1}, 17, 0, gaparams);
425 population, mnt,
new int[]{0,1}, 17, 1, gaparams);
431 DGraph expected0 = expectedPair[0];
432 DGraph expected1 = expectedPair[1];
438 assertTrue(expected0.
sameAs(g0xo,
new StringBuilder()));
439 assertTrue(expected1.
sameAs(g1xo,
new StringBuilder()));
462 String propName =
"uniquefier";
466 v.setUniquefyingProperty(propName);
467 v.setProperty(propName, i);
475 ArrayList<Candidate> eligibleParents =
new ArrayList<Candidate>();
476 eligibleParents.add(cA);
477 eligibleParents.add(cB);
480 boolean embeddedGraphHasBeenAlteredA =
false;
481 boolean embeddedGraphHasBeenAlteredB =
false;
482 for (
int ixo=0; ixo<11; ixo++)
489 population, mnt,
new int[]{0,1}, ixo, 0, gaparams);
491 population, mnt,
new int[]{0,1}, ixo, 1, gaparams);
492 }
catch (IndexOutOfBoundsException e)
494 if (e.getMessage().contains(
"Index 10 out of bounds"))
533 embeddedGraphHasBeenAlteredA =
true;
538 embeddedGraphHasBeenAlteredB =
true;
547 assertTrue(embeddedGraphHasBeenAlteredA);
548 assertTrue(embeddedGraphHasBeenAlteredB);
556 int ix = 0, im=0, ic=0, tot=1000;
557 double wx = 2, wm = 0.6, wc=0.05;
558 double wtot = wx + wm + wc;
560 for (
int i=0; i<tot; i++)
576 assertTrue(
false,
"Unexpected generation mode "+mode);
580 double x = ((double)ix) / tot;
581 double m = ((double)im) / tot;
582 double c = ((double)ic) / tot;
586 assertTrue(Math.abs(x-(wx/wtot)) < thld,
"#Xover cases are off!");
587 assertTrue(Math.abs(m-(wm/wtot)) < thld,
"#Mutation cases are off!");
588 assertTrue(Math.abs(
c-(wc/wtot)) < thld,
"#Built cases are off!");
598 long otherSeed = 987654321;
599 double wx = 2, wm = 0.6, wc=0.05;
602 List<CandidateSource> resultsA =
new ArrayList<CandidateSource>();
603 for (
int i=0; i<tot; i++)
609 List<CandidateSource> resultsB =
new ArrayList<CandidateSource>();
610 for (
int i=0; i<tot; i++)
616 List<CandidateSource> resultsC =
new ArrayList<CandidateSource>();
617 for (
int i=0; i<tot; i++)
622 boolean different =
false;
623 for (
int i=0; i<tot; i++)
625 if (resultsA.get(i) != resultsB.get(i))
631 assertTrue(different);
633 for (
int i=0; i<tot; i++)
635 assertEquals(resultsA.get(i),resultsC.get(i),
636 "Inconsistent sequence of random decisions");
651 assertTrue(Math.abs(1.0 - p)<t,
652 "Scheme 3 should return always 1.0 but was "+p);
656 assertTrue(Math.abs(1.0 - p)<t,
"Scheme 0 on ap3: 1.0 != "+p);
658 assertTrue(Math.abs(1.0 - p)<t,
"Scheme 1 on ap3: 1.0 != "+p);
660 assertTrue(Math.abs(1.0 - p)<t,
"Scheme 2 on ap3: 1.0 != "+p);
664 assertTrue(Math.abs(0.5 - p)<t,
"Scheme 2 on ap2");
710 for (
int i=0; i<5; i++)
713 assertEquals(expected, chosen,
"Index of the only choosable vertex");
722 double[] weights =
new double[] {0,0,0,0,1};
726 weights =
new double[] {1,0,0,0,1};
730 weights =
new double[] {1,1,1,1,1};
749 assertTrue(
tempDir.isDirectory(),
"Should be a directory ");
750 String structureFile =
tempDir.getAbsolutePath() +
SEP +
"mol.sdf";
753 +
" OpenBabel03302310043D" +
NL
755 +
" 33 35 0 0 0 0 0 0 0 0999 V2000" +
NL
756 +
" -1.5455 1.4965 3.4529 O 0 0 0 0 0 0 0 0 0 0 0 0" +
NL
757 +
" -1.1783 1.0876 2.3182 C 0 0 0 0 0 0 0 0 0 0 0 0" +
NL
758 +
" -1.8597 -0.0221 1.6796 N 0 0 0 0 0 0 0 0 0 0 0 0" +
NL
759 +
" -3.0535 -0.6083 2.2978 C 0 0 0 0 0 0 0 0 0 0 0 0" +
NL
760 +
" 0.0153 1.7383 1.6547 C 0 0 0 0 0 0 0 0 0 0 0 0" +
NL
761 +
" -0.1038 1.5947 0.1342 C 0 0 1 0 0 0 0 0 0 0 0 0" +
NL
762 +
" 0.9646 2.2439 -0.5585 O 0 0 0 0 0 0 0 0 0 0 0 0" +
NL
763 +
" 2.0315 1.3700 -0.8940 C 0 0 2 0 0 0 0 0 0 0 0 0" +
NL
764 +
" 3.0842 2.1330 -1.6910 C 0 0 0 0 0 0 0 0 0 0 0 0" +
NL
765 +
" 3.5659 3.1894 -0.9391 F 0 0 0 0 0 0 0 0 0 0 0 0" +
NL
766 +
" 4.1344 1.2898 -2.0067 F 0 0 0 0 0 0 0 0 0 0 0 0" +
NL
767 +
" 2.5295 2.6237 -2.8597 F 0 0 0 0 0 0 0 0 0 0 0 0" +
NL
768 +
" 1.5529 0.2692 -1.6691 O 0 0 0 0 0 0 0 0 0 0 0 0" +
NL
769 +
" 0.4699 -0.4528 -1.1881 C 0 0 0 0 0 0 0 0 0 0 0 0" +
NL
770 +
" -0.3192 0.1414 -0.2151 C 0 0 0 0 0 0 0 0 0 0 0 0" +
NL
771 +
" -1.2683 -0.6053 0.4932 C 0 0 0 0 0 0 0 0 0 0 0 0" +
NL
772 +
" -1.5222 -1.9320 0.0906 C 0 0 0 0 0 0 0 0 0 0 0 0" +
NL
773 +
" -0.8092 -2.5038 -0.9766 C 0 0 0 0 0 0 0 0 0 0 0 0" +
NL
774 +
" -1.1169 -3.8201 -1.3518 O 0 0 0 0 0 0 0 0 0 0 0 0" +
NL
775 +
" -0.4725 -4.5263 -2.4070 C 0 0 0 0 0 0 0 0 0 0 0 0" +
NL
776 +
" 0.2040 -1.7556 -1.6127 C 0 0 0 0 0 0 0 0 0 0 0 0" +
NL
777 +
" -3.7666 -0.9444 1.5155 H 0 0 0 0 0 0 0 0 0 0 0 0" +
NL
778 +
" -3.5865 0.1389 2.9228 H 0 0 0 0 0 0 0 0 0 0 0 0" +
NL
779 +
" -2.7606 -1.4709 2.9321 H 0 0 0 0 0 0 0 0 0 0 0 0" +
NL
780 +
" 0.9449 1.2474 2.0144 H 0 0 0 0 0 0 0 0 0 0 0 0" +
NL
781 +
" 0.0550 2.8163 1.9227 H 0 0 0 0 0 0 0 0 0 0 0 0" +
NL
782 +
" -1.0337 2.1265 -0.1667 H 0 0 0 0 0 0 0 0 0 0 0 0" +
NL
783 +
" 2.5075 0.9860 0.0372 H 0 0 0 0 0 0 0 0 0 0 0 0" +
NL
784 +
" -2.2462 -2.5403 0.6157 H 0 0 0 0 0 0 0 0 0 0 0 0" +
NL
785 +
" -0.6162 -3.9902 -3.3689 H 0 0 0 0 0 0 0 0 0 0 0 0" +
NL
786 +
" -0.9204 -5.5374 -2.4930 H 0 0 0 0 0 0 0 0 0 0 0 0" +
NL
787 +
" 0.6107 -4.6349 -2.1878 H 0 0 0 0 0 0 0 0 0 0 0 0" +
NL
788 +
" 0.8117 -2.1861 -2.3969 H 0 0 0 0 0 0 0 0 0 0 0 0" +
NL
789 +
" 1 2 2 0 0 0 0" +
NL
790 +
" 2 3 1 0 0 0 0" +
NL
791 +
" 2 5 1 0 0 0 0" +
NL
792 +
" 3 4 1 0 0 0 0" +
NL
793 +
" 4 22 1 0 0 0 0" +
NL
794 +
" 4 23 1 0 0 0 0" +
NL
795 +
" 4 24 1 0 0 0 0" +
NL
796 +
" 5 6 1 0 0 0 0" +
NL
797 +
" 5 25 1 0 0 0 0" +
NL
798 +
" 5 26 1 0 0 0 0" +
NL
799 +
" 6 7 1 0 0 0 0" +
NL
800 +
" 6 27 1 6 0 0 0" +
NL
801 +
" 7 8 1 0 0 0 0" +
NL
802 +
" 8 9 1 0 0 0 0" +
NL
803 +
" 8 13 1 0 0 0 0" +
NL
804 +
" 8 28 1 1 0 0 0" +
NL
805 +
" 9 10 1 0 0 0 0" +
NL
806 +
" 9 11 1 0 0 0 0" +
NL
807 +
" 9 12 1 0 0 0 0" +
NL
808 +
" 13 14 1 0 0 0 0" +
NL
809 +
" 14 15 2 0 0 0 0" +
NL
810 +
" 15 16 1 0 0 0 0" +
NL
811 +
" 15 6 1 0 0 0 0" +
NL
812 +
" 16 17 2 0 0 0 0" +
NL
813 +
" 16 3 1 0 0 0 0" +
NL
814 +
" 17 18 1 0 0 0 0" +
NL
815 +
" 17 29 1 0 0 0 0" +
NL
816 +
" 18 19 1 0 0 0 0" +
NL
817 +
" 18 21 2 0 0 0 0" +
NL
818 +
" 19 20 1 0 0 0 0" +
NL
819 +
" 20 30 1 0 0 0 0" +
NL
820 +
" 20 31 1 0 0 0 0" +
NL
821 +
" 20 32 1 0 0 0 0" +
NL
822 +
" 21 14 1 0 0 0 0" +
NL
823 +
" 21 33 1 0 0 0 0" +
NL
829 List<CuttingRule> cuttingRules =
new ArrayList<CuttingRule>();
830 cuttingRules.add(
new CuttingRule(
"cC",
"[c]",
"[C]",
"~", 0,
831 new ArrayList<String>()));
832 cuttingRules.add(
new CuttingRule(
"cN",
"[c]",
"[#7]",
"~", 1,
833 new ArrayList<String>()));
834 cuttingRules.add(
new CuttingRule(
"cO",
"[c]",
"[#8]",
"~", 2,
835 new ArrayList<String>()));
836 cuttingRules.add(
new CuttingRule(
"OC",
"[O]",
"[C]",
"-", 3,
837 new ArrayList<String>()));
838 cuttingRules.add(
new CuttingRule(
"CF",
"[C]",
"[F]",
"-", 4,
839 new ArrayList<String>()));
840 cuttingRules.add(
new CuttingRule(
"NC",
"[N]",
"[C]",
"-", 5,
841 new ArrayList<String>()));
864 .collect(Collectors.toList());
865 assertEquals(1, templates.size());
878 SmilesParser p =
new SmilesParser(
builder);
879 IAtomContainer mol = p.parseSmiles(
"c1ccccc1OCN(CC)(C)[Ru](N)(N)C#O");
889 List<CuttingRule> cuttingRules =
new ArrayList<CuttingRule>();
890 cuttingRules.add(
new CuttingRule(
"C-O",
"[#6]",
"[#8]",
"-", 2,
891 new ArrayList<String>()));
892 cuttingRules.add(
new CuttingRule(
"N-C",
"[#7]",
"[#6]",
"-", 5,
893 new ArrayList<String>()));
894 cuttingRules.add(
new CuttingRule(
"Ru-Any",
"[Ru]",
"[$([*])]",
"~", 5,
895 new ArrayList<String>()));
907 .collect(Collectors.toList());
908 assertEquals(1, scaffolds.size());
909 Vertex scaffold = scaffolds.get(0);
911 assertEquals(6, iacScaffold.getAtomCount());
917 cuttingRules, settings.
getLogger(), policy);
925 .collect(Collectors.toList());
926 assertEquals(1, scaffolds.size());
927 scaffold = scaffolds.get(0);
929 assertEquals(1, iacScaffold.getAtomCount());
930 assertEquals(
"Ru", iacScaffold.getAtom(0).getSymbol());
938 SmilesParser p =
new SmilesParser(
builder);
939 IAtomContainer mol = p.parseSmiles(
940 "Oc1cc(O)cc(O)c1CN(CC)(CC)[Ru](N)(Nc1c(F)cc(F)cc1(Cl))C#O");
950 List<CuttingRule> cuttingRules =
new ArrayList<CuttingRule>();
951 cuttingRules.add(
new CuttingRule(
"C-F",
"[#6]",
"[#9]",
"-", 1,
952 new ArrayList<String>()));
953 cuttingRules.add(
new CuttingRule(
"C-O",
"[#6]",
"[#8]",
"-", 2,
954 new ArrayList<String>()));
955 cuttingRules.add(
new CuttingRule(
"N-C",
"[#7]",
"[#6]",
"-", 5,
956 new ArrayList<String>()));
957 cuttingRules.add(
new CuttingRule(
"Ru-Any",
"[Ru]",
"[$([*])]",
"~", 5,
958 new ArrayList<String>()));
968 boolean foundO =
false;
969 boolean foundF =
false;
971 while (iter.hasNext())
974 String el = ss.get(0).getIAtomContainer().getAtom(0).getSymbol();
977 else if (
"F".equals(el))
987 cuttingRules, settings.
getLogger(), policy);
996 while (iter.hasNext())
999 String el = ss.get(0).getIAtomContainer().getAtom(0).getSymbol();
1002 else if (
"F".equals(el))
1013 cuttingRules, settings.
getLogger(), policy);
1022 while (iter.hasNext())
1025 String el = ss.get(0).getIAtomContainer().getAtom(0).getSymbol();
1028 else if (
"F".equals(el))
1032 assertFalse(foundF);
1041 SmilesParser p =
new SmilesParser(
builder);
1042 IAtomContainer mol = p.parseSmiles(
"C#C-C#C-C#N");
1045 StructureDiagramGenerator sdg =
new StructureDiagramGenerator();
1046 sdg.generateCoordinates(mol);
1050 List<CuttingRule> cuttingRules =
new ArrayList<CuttingRule>();
1051 cuttingRules.add(
new CuttingRule(
"C-C",
"[#6]",
"[#6]",
"-", 2,
1052 new ArrayList<String>()));
1053 cuttingRules.add(
new CuttingRule(
"C-X",
"[#6]",
"[#9,#17,#35,#53]",
"~",
1054 3,
new ArrayList<String>()));
1067 for (IAtom
a : v.getIAtomContainer().atoms())
1075 assertEquals(4, duAtmCount);
1078 IAtomContainer molNonLinear = p.parseSmiles(
"C(Cl)(F)Br");
1079 sdg.generateCoordinates(molNonLinear);
1091 for (IAtom
a : v.getIAtomContainer().atoms())
1099 assertEquals(0, duAtmCount);
1113 for (IAtom
a : v.getIAtomContainer().atoms())
1121 assertEquals(0, duAtmCount);
1137 SmilesParser p =
new SmilesParser(
builder);
1138 IAtomContainer mol = p.parseSmiles(
1139 "P123C(OC[SiH2]O1)(OC[SiH2]O2)OC[SiH2]O3");
1149 List<CuttingRule> cuttingRules =
new ArrayList<CuttingRule>();
1150 cuttingRules.add(
new CuttingRule(
"PC-O",
"[$(CP)]",
"[O]",
"-", -1,
1151 new ArrayList<String>()));
1152 cuttingRules.add(
new CuttingRule(
"C-O",
"[C]",
"[O]",
"-", 0,
1153 new ArrayList<String>()));
1154 cuttingRules.add(
new CuttingRule(
"C-Si",
"[C]",
"[Si]",
"-", 1,
1155 new ArrayList<String>()));
1156 cuttingRules.add(
new CuttingRule(
"Si-O",
"[Si]",
"[O]",
"-", 2,
1157 new ArrayList<String>()));
1158 cuttingRules.add(
new CuttingRule(
"P-C",
"[P]",
"[C]",
"-", 3,
1159 new ArrayList<String>()));
1160 cuttingRules.add(
new CuttingRule(
"P-O",
"[P]",
"[O]",
"-", 4,
1161 new ArrayList<String>()));
1164 scaffoldOnP.label =
"P";
1170 List<List<Integer>> expected =
new ArrayList<List<Integer>>();
1171 expected.add(Arrays.asList(2, 8, 14));
1172 expected.add(Arrays.asList(3, 9, 15));
1173 expected.add(Arrays.asList(4, 10, 16));
1174 expected.add(Arrays.asList(5, 11, 17));
1175 expected.add(Arrays.asList(6, 12, 18));
1176 expected.add(Arrays.asList(7, 13, 19));
1177 for (List<Integer> vrtxIDs : expected)
1181 assertFalse(sv0.isEmpty());
1182 for (
int i=1; i<vrtxIDs.size(); i++)
1186 assertTrue(sv0 == svI);
General set of constants used in DENOPTIM.
static final String DUMMYATMSYMBOL
Symbol of dummy atom.
Class defining a space of building blocks.
void appendVertexToLibrary(Vertex v, Vertex.BBType bbt, ArrayList< Vertex > library)
Takes a vertex and add it to a given library.
void setAPclassBasedApproach(boolean useAPC)
Set the fragment space to behave according to APClass-based approach.
ArrayList< Vertex > getScaffoldLibrary()
ArrayList< Vertex > getFragmentLibrary()
Parameters defining the fragment space.
Helper methods for the genetic algorithm.
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.
static int chooseNumberOfSitesToMutate(double[] multiSiteMutationProb, double hit)
Takes a decision on how many sites to mutate on a candidate.
static Candidate buildCandidateByXOver(List< Candidate > eligibleParents, Population population, Monitor mnt, GAParameters settings)
Generates a new offspring by performing a crossover operation.
static DGraph makeGraphFromFragmentationOfMol(IAtomContainer mol, List< CuttingRule > cuttingRules, Logger logger, ScaffoldingPolicy scaffoldingPolicy)
Converts a molecule into a DGraph by fragmentation and re-assembling of the fragments.
static double getCrowdingProbability(AttachmentPoint ap, GAParameters settings)
Calculated the probability of using and attachment point rooted on an atom that is holding other atta...
static DGraph buildGraph(GAParameters settings)
Graph construction starts with selecting a random core/scaffold.
static Vertex selectNonScaffoldNonCapVertex(DGraph g, Randomizer randomizer)
Chose randomly a vertex that is neither scaffold or capping group.
void testMakeGraphFromFragmentationOfMol()
void testCandidateGenerationMethodReproducibility()
FragmentSpaceParameters prepare()
void testBuildByXOver_SubGraph()
void testCrowdingProbability()
void testSelectNonScaffoldNonCapVertex()
void testMakeGraphFromFragmentationOfMol_symmetry()
Test the detection of "some" symmetry.
void testCandidateGenerationMethod()
void testMakeGraphFromFragmentationOfMol_linearities()
void testMakeGraphFromFragmentationOfMol_Symmetry()
IChemObjectBuilder builder
Private builder of atom containers.
void testAvoidRedundantXOver()
void testChooseNumberOfSitesToMutate()
void testBuildGraphFromTemplateScaffold()
void testMakeGraphFromFragmentationOfMol_ScaffoldingPolicy()
void testBuildByXOver_Embedded_Free()
NB: the graphs from methods getPairOfTestGraphsB() and getPairOfTestGraphsBxo() and getPairOfTestGr...
void testBuildByXOver_Embedded_FixedStructure()
void testBuildByXOver_Embedded_FreeBackwards()
NB: the graphs from methods getPairOfTestGraphsB() and getPairOfTestGraphsBxo() and getPairOfTestGr...
A collection of candidates.
static GAParameters prepare()
static DGraph[] getPairOfTestGraphsBxoxo()
Builds a pair of graphs that contain templates with ContractLevel#FREE contract.
static DGraph makeGraphE()
Produced a graph like this:
static DGraph[] getPairOfTestGraphsB()
Builds a pair of graphs that contain templates with ContractLevel#FREE contract.
static DGraph[] getPairOfTestGraphsBxo()
Builds a pair of graphs that contain templates with ContractLevel#FREE contract.
static DGraph makeGraphA()
Produced a graph like this:
static APClass make(String ruleAndSubclass)
Creates an APClass if it does not exist already, or returns the reference to the existing instance.
An attachment point (AP) is a possibility to attach a Vertex onto the vertex holding the AP (i....
A candidate is the combination of a denoptim graph with molecular representation and may include also...
void setFitness(double fitness)
Container for the list of vertices and the edges that connect them.
Vertex getVertexWithId(long vid)
Searches for a vertex with the given identifier.
int getSymmetricSetCount()
Returns the number of symmetric sets of vertices.
ArrayList< AttachmentPoint > getAttachmentPoints()
Returns the list of all attachment points contained in this graph.
boolean isIsomorphicTo(DGraph other)
Checks if this graph is "DENOPTIM-isomorphic" to the other one given.
void addVertex(Vertex vertex)
Appends a vertex to this graph without creating any edge.
DGraph embedPatternsInTemplates(GraphPattern pattern, FragmentSpace fragSpace)
Searches for the given pattern type and generated a new graph where each set of (clones of) vertexes ...
void getChildrenTree(Vertex vertex, List< Vertex > children)
Gets all the children of the current vertex recursively.
Iterator< SymmetricVertexes > getSymSetsIterator()
Get an iterator for the sets of symmetrically related vertices.
Vertex getVertexAtPosition(int pos)
Returns the vertex that is in the given position of the list of vertices belonging to this graph.
void appendVertexOnAP(AttachmentPoint srcAP, AttachmentPoint trgAP)
Append a vertex to this graph: adds the new vertex to the list of vertices belonging to the graph,...
List< Vertex > getVertexList()
DGraph clone()
Returns almost "deep-copy" of this graph.
boolean sameAs(DGraph other, StringBuilder reason)
Compare this and another graph ignoring the vertex IDs.
SymmetricVertexes getSymSetForVertex(Vertex v)
Returns the set of vertexes symmetric to the given one.
boolean isIsostructuralTo(DGraph other)
Checks if this graph is "DENOPTIM-isostructural" to the other one given.
Unit test for DENOPTIMGraph.
static DGraph makeTestGraphA()
Build a graph meant to be used in unit tests.
An empty vertex has the behaviors of a vertex, but has no molecular structure.
void addAP()
Adds an attachment point with no APClass or other attribute.
A collection of Vertexs that are related by a relation that we call "symmetry", even though this clas...
ContractLevel getContractLevel()
Returns the contract level of this template, i.e., to what extent the content of this template can be...
List< Vertex > getMutationSites(List< MutationType > ignoredTypes)
A list of mutation sites from within this vertex.
void setContractLevel(ContractLevel contract)
Imposes the given contract to this template.
A vertex is a data structure that has an identity and holds a list of AttachmentPoints.
Vertex.BBType getBuildingBlockType()
void setAsRCV(boolean isRCV)
void setBuildingBlockType(Vertex.BBType buildingBlockType)
abstract IAtomContainer getIAtomContainer()
AttachmentPoint getAP(int i)
Get attachment point i on this vertex.
static Vertex newVertexFromLibrary(int bbId, Vertex.BBType bbt, FragmentSpace fragSpace)
Builds a new molecular fragment kind of vertex.
Utility methods for input/output.
static ArrayList< IAtomContainer > readSDFFile(String fileName)
Reads a file containing multiple molecules (multiple SD format))
static void writeData(String fileName, String data, boolean append)
Write text-like data file.
A collection of counters user to count actions taken by the evolutionary algorithm.
void setParameters(RunTimeParameters otherParams)
Logger getLogger()
Get the name of the program specific logger.
Parameters for genetic algorithm.
A cutting rule with three SMARTS queries (atom 1, bond, atom2) and options.
Utilities for molecule conversion.
static String getSymbolOrLabel(IAtom atm)
Gets either the elemental symbol (for standard atoms) of the label (for pseudo-atoms).
Tool to generate random numbers and random decisions.
Defines how to define the scaffold vertex of a graph.
A chosen method for generation of new Candidates.
Possible chemical bond types an edge can represent.
Enum specifying to what extent the template's inner graph can be changed.
FREE
Inner graphs are free to change within the confines of the required AttachmentPoints.
FIXED
Inner graphs are effectively equivalent to the Fragment class, as no change in the inner structure is...
FIXED_STRUCT
Inner graph keep the same structure, but the identify of vertices can change.
The type of building block.