def mutate(self, x_pos, y_pos): """Make small random changes in x- and y-position. post: len(__return__) == 2 """ xp = x_pos + model_random.jitter(0.2) xp = (2.0 * xp + random.gauss(0.5, 0.1)) / 3.0 yp = y_pos + model_random.jitter(0.2) yp = (2.0 * yp + random.gauss(0.5, 0.1)) / 3.0 return xp, yp
def mutate(self): """Mutate transformations.""" cpool = model_constraintpool.ConstraintPool.get_pool() #TODO self.pol_transf polar coordinaten mutieren if model_random.is_mutating(): symmetry_constraint = cpool.get(self, SYMMETRY_CONSTRAINT) self.symmetry = model_random.jitter_discret_constrained(self.symmetry, symmetry_constraint) if model_random.is_mutating(): Dn_constraint = cpool.get(self, DN_CONSTRAINT) self.Dn = model_random.jitter_discret_constrained(self.Dn, Dn_constraint) if model_random.is_mutating(): orbit_constraint = cpool.get(self, ORBIT_CONSTRAINT) self.orbits = model_random.jitter_discret_constrained(self.Dn, orbit_constraint) self.random_seed = random.randint(1, 65535) for tix in range(self.num_transformations): #translation -2.0, 2.0 self.pol_transf[tix][0] = model_random.jitter_constrained(self.pol_transf[tix][0], [-2.0, 2.0]) self.pol_transf[tix][1] = model_random.jitter_constrained(self.pol_transf[tix][1], [-2.0, 2.0]) #rotation -math.pi, math.pi radian = self.pol_transf[tix][2] + model_random.jitter(0.1) self.pol_transf[tix][2] = model_random.radian_limit(radian) radian = self.pol_transf[tix][3] + model_random.jitter(0.1) self.pol_transf[tix][3] = model_random.radian_limit(radian) #scaling 0.0, 1.0 self.pol_transf[tix][4] = model_random.jitter_constrained(self.pol_transf[tix][4], [-1.0, 1.0]) self.pol_transf[tix][5] = model_random.jitter_constrained(self.pol_transf[tix][5], [-1.0, 1.0]) # self._prepare_transient_members() if model_random.is_mutating(): x_stamp_size_constraint = cpool.get(self, X_STAMP_SIZE_CONSTRAINT) self.x_stamp_size = model_random.jitter_constrained(self.x_stamp_size, x_stamp_size_constraint) if model_random.is_mutating(): y_stamp_size_constraint = cpool.get(self, Y_STAMP_SIZE_CONSTRAINT) self.y_stamp_size = model_random.jitter_constrained(self.y_stamp_size, y_stamp_size_constraint)
def mutate(self): """Make random changes to the layers components.""" super(MarkovChainLayer, self).mutate() cpool = model_constraintpool.ConstraintPool.get_pool() number_of_states_constraint = cpool.get(self, NUMBER_OF_STATES_CONSTRAINT) changed = self._init_states( model_random.jitter_discret_constrained( self.states, number_of_states_constraint)) if not changed: for row, row_probabilities in enumerate(self.probability): for col in range(len(row_probabilities)): self.probability[row][col] += \ model_random.jitter(1.0 / self.states) self._normalize_row(row) self.sampler.mutate() self.stamp.mutate() self.colorgamut.mutate() for cix in range(len(self.cell_colors)): self.colorgamut.adjust_color(self.cell_colors[cix])
def mutate(self): """Make small random changes in hue. """ self.hue = model_random.cyclic_limit(self.hue + model_random.jitter(0.1)) self.hue_deviate += model_random.jitter(0.1)
def mutate(self, x_pos, y_pos): """Make small random changes in x- and y-position. post: len(__return__) == 2 """ return x_pos + model_random.jitter(0.2), y_pos + model_random.jitter( 0.2)