def copy(self, g): GenomeBase.copy(self, g) g.num_populated_areas = self.num_populated_areas g.num_power_plants = self.num_power_plants g.loss_network = self.loss_network if self.proposed_distribution is not None: g.proposed_distribution = clone_matrix(self.proposed_distribution)
def copy(self, g): """ Copy the contents to the destination g :param g: the GTree genome destination """ GenomeBase.copy(self, g) GTreeBase.copy(self, g)
def copy(self, g): """ Copy genome to 'g' """ GenomeBase.copy(self, g) g.ruleSet = self.ruleSet[:] #deep copy g.rulePartition = self.rulePartition[:] #deep copy g.ruleSetSize = self.ruleSetSize g.rule_length = self.rule_length g.examples = self.examples # only a ref to the examples is copied
def __init__(self, num_populated_areas, num_power_plants): GenomeBase.__init__(self) self.proposed_distribution = None self.num_populated_areas = num_populated_areas self.num_power_plants = num_power_plants self.initializator.set(proposed_distribution_initializator) self.mutator.set(proposed_distribution_mutator) self.crossover.set(proposed_distribution_crossover)
def __init__(self, loss_network): GenomeBase.__init__(self) self.proposed_distribution = None self.loss_network = loss_network self.num_populated_areas = len(loss_network) self.num_power_plants = len(loss_network[0]) self.initializator.set(proposed_distribution_initializator) self.mutator.set(proposed_distribution_mutator) self.crossover.set(proposed_distribution_crossover)
def __init__(self, size): """ The initializator of G1DListModified representation, size parameter must be specified """ GenomeBase.__init__(self) self.genomeList = [] self.listSize = size self.initializator.set(Consts.CDefG1DListInit) self.mutator.set(Consts.CDefG1DListMutator) self.crossover.set(Consts.CDefG1DListCrossover)
def __init__(self, height, width, depth): GenomeBase.__init__(self) self.gens = np.zeros((height, width, depth)) self.height = height self.width = width self.depth = depth
def __init__(self, keys, values, cloning=False, **kwargs): nstates = kwargs.get('nstates', o.ga.genomes.gmap.nstates) GenomeBase.__init__(self) GMapBase.__init__(self, keys, values, nstates) if not cloning: self.initializator.set(GMapInitializator) self.mutator.set(GMapMutator) self.crossover.set(GMapCrossoverSinglePoint) self.evaluator.set(GMapEvaluator)
def copy(self, g): """ Copy genome to 'g' Example: >>> genome_origin.copy(genome_destination) :param g: the destination G1DList instance """ GenomeBase.copy(self, g) G1DBase.copy(self, g)
def __init__(self,rule_length): GenomeBase.__init__(self) self.ruleSet = G1DBinaryString(0) self.rulePartition = [] self.ruleSetSize = 0 self.rule_length = rule_length self.examples = [] self.initializator.set(GD1BinaryStringSetInitializator) self.mutator.set(WG1DBinaryStringSetMutatorFlip) self.crossover.set(G1DBinaryStringSetXTwoPoint) self.accuracy = 0.0
def __init__(self, rule_length): GenomeBase.__init__(self) self.ruleSet = G1DBinaryString(0) self.rulePartition = [] self.ruleSetSize = 0 self.rule_length = rule_length self.examples = [] self.initializator.set(GD1BinaryStringSetInitializator) self.mutator.set(WG1DBinaryStringSetMutatorFlip) self.crossover.set(G1DBinaryStringSetXTwoPoint) self.accuracy = 0.0
def __init__(self, size=10, cloning=False): """ The initializator of G1DConnections representation, size parameter must be specified """ GenomeBase.__init__(self) G1DBase.__init__(self, size) genomeList=None # self.genomeList=np.empty((3,size),dtype=[('from','i'),('to','i'),('weight','f')]) if not cloning: self.initializator.set(GAnnConsts.CDefG1DConnInit) self.mutator.set(GAnnConsts.CDefG1DConnMutator) self.crossover.set(GAnnConsts.CDefG1DConnCrossover)
def copy(self, g): """ Copy genome to 'g' Example: >>> genome_origin.copy(genome_destination) :param g: the destination G1DConnections instance """ GenomeBase.copy(self, g) #G1DBase.copy(self, g) g.genomeSize=self.genomeSize g.genomeList=copy.deepcopy(self.genomeList)
def copy(self, g): """ Copy genome to 'g' Example: >>> genome_origin.copy(genome_destination) :param g: the destination G2DList instance """ GenomeBase.copy(self, g) g.height = self.height g.width = self.width for i in xrange(self.height): g.genomeList[i] = self.genomeList[i][:]
def __repr__(self): """ Return a string representation of Genome """ ret = GenomeBase.__repr__(self) ret += "- G1DConnections\n" ret += "\tList size:\t %s\n" % (self.getListSize(),) ret += "\tList:\t\t %s\n\n" % (self.genomeList,) return ret
def __repr__(self): """ Return a string representation of Genome """ ret = GenomeBase.__repr__(self) ret += "- G1DBinaryString\n" ret += "\tString length:\t %s\n" % (self.getListSize(),) ret += "\tString:\t\t %s\n\n" % (self.getBinary(),) return ret
def __repr__(self): """ Return a string representation of Genome """ ret = GenomeBase.__repr__(self) ret += "- G1DListModified\n" ret += "\tList size:\t %s\n" % (self.listSize,) ret += "\tList:\t\t %s\n\n" % (self.genomeList,) return ret
def __repr__(self): """ Return a string representation of Genome """ ret = GenomeBase.__repr__(self) ret += GTreeBase.__repr__(self) ret += "\n- GTreeGP\n" ret += "\tExpression: %s\n" % self.getPreOrderExpression() return ret
def __repr__(self): """ Return a string representation of Genome """ ret = GenomeBase.__repr__(self) ret += "- G1DList\n" ret += "\tList size:\t %s\n" % (self.getListSize(),) ret += "\tList:\t\t %s\n\n" % (self.genomeList,) return ret
def __repr__(self): """ Return a string representation of Genome """ ret = GenomeBase.__repr__(self) ret += "- G1DBinaryStringSet\n" ret += "\tString length:\t %s\n" % (self.ruleSetSize, ) ret += "\tString:\t\t %s\n" % (self.getBinary(), ) ret += "\tRule Partitions: %s\n\n" % (self.rulePartition, ) return ret
def copy(self, g): """ Copy genome to 'g' Example: >>> g1 = G1DBinaryString(2) >>> g1.append(0) >>> g1.append(1) >>> g2 = G1DBinaryString(2) >>> g1.copy(g2) >>> g2[1] 1 :param g: the destination genome """ GenomeBase.copy(self, g) G1DBase.copy(self, g)
def __repr__(self): """ Return a string representation of Genome """ ret = GenomeBase.__repr__(self) ret += "- G1DBinaryStringSet\n" ret += "\tString length:\t %s\n" % (self.ruleSetSize,) ret += "\tString:\t\t %s\n" % (self.getBinary(),) ret += "\tRule Partitions: %s\n\n" %(self.rulePartition,) return ret
def __repr__(self): """ Return a string representation of Genome """ ret = GenomeBase.__repr__(self) ret += "- G2DList\n" ret += "\tList size:\t %s\n" % (self.getSize(),) ret += "\tList:\n" for line in self.genomeList: ret += "\t\t\t" for item in line: ret += "[%s] " % (item) ret += "\n" ret += "\n" return ret
def __repr__(self): """ Return a string representation of Genome """ ret = GenomeBase.__repr__(self) ret += GTreeBase.__repr__(self) return ret
def copy(self, g): GenomeBase.copy(self, g) GMapBase.copy(self, g)
def copy(self, g): """ Copy genome to 'g' """ GenomeBase.copy(self, g) g.height = self.height g.width = self.width g.depth = self.depth
def copy(self, g): """Copy method required by pyevolve""" GenomeBase.copy(self, g) g.bg = self.bg g.shapes = self.shapes[:] g.target = self.target
def __repr__(self): r = GenomeBase.__repr__(self) r += "Polygons:\n" for t in self.shapes: r += '\t' + str(t) + '\n' return r
def __init__(self, target): GenomeBase.__init__(self) self.width, self.height = target.target.size self.target = target self.shapes= [] self.bg=(0,0,0)
def copy(self, g): GenomeBase.copy(self, g) g.listSize = self.listSize g.genomeList = self.genomeList[:]