(pr)
return DrasticMutationGene
Gene representing incompatible categories.
Gene representing incompatible categories.
Gene representing incompatible categories .
def make_drastic_mutation_gene(pr):
    '''Gene representing incompatible categories.'''
    class DrasticMutationGene(Gene):
        min_cap = 0
        max_cap = 100
        def gen_perturb(self):
            if random.random() < pr:
                return 1 if random.random() < 0.5 else -1
            else:
                return 0
    return DrasticMutationGene
def make_drastic_mutation_gene ( pr ) : class DrasticMutationGene ( Gene ) : min_cap = 0 max_cap = 100 def gen_perturb ( self ) : if random . random ( ) < pr : return 1 if random . random ( ) < 0.5 else - 1 else : return 0 return DrasticMutationGene