/** Sets up all parameters with target Graph target */ public MoleculeParameters(Molecule target) { // automatically set initial individuals size range int vertices = target.getVerticesSize(); verticesInterval.set(Math.max(2, vertices / 2), vertices * 2); cyclesInterval.set(0, target.getNumberOfCycles() * 2); // insure that all possible vertex and edge types are in initial population in roughly equal // quantities java.util.Hashtable elements = new java.util.Hashtable(); for (VertexIterator v = target.getVertexIterator(); v.more(); v.next()) { String s = v.vertex().toString(); if (!elements.containsKey(s)) { elements.put(s, s); try { provider.add((Vertex) v.vertex().clone()); } catch (CloneNotSupportedException e) { Error.fatal("can't clone vertex: " + e); } } } for (EdgeIterator e = target.getEdgeIterator(); e.more(); e.next()) { String s = e.edge().toString(); if (!elements.containsKey(s)) { elements.put(s, s); try { provider.add((Edge) e.edge().clone()); } catch (CloneNotSupportedException ee) { Error.fatal("can't clone edge: " + ee); } } } setParameters(target); }
private static void buildAtomicNumberTable() { elementHashtable = new Hashtable(223); // 223 is a nice prime number if (elementAr == null) { System.out.println("Error! elementAr has not been initialized!"); Error.fatal("Element: elementAr has not been initialized!"); } for (int i = 0; i < symbolAr.length; i++) { elementHashtable.put(symbolAr[i], new Element(i)); } }