09-3sat_project/src/algorithms.py
def crossover(parent_a: Chromosome, parent_b: Chromosome) -> Chromosome:
        """ randomly returns a child from crossover of parent_a and parent_b """

        if len(parent_a) == 2:
            index = 1
        else:
            index = random.randint(0, len(parent_a) - 2)

        genes = parent_a[:index] + parent_b[index:]
        return Chromosome(parent_a.equation, genes)
 randomly returns a child from crossover of parent_a and parent_b 
randomly returns a child from crossover of parent_a and parent_b
randomly returns a child from crossover of parent_a and parent_b
def crossover(parent_a: Chromosome, parent_b: Chromosome) -> Chromosome:
        if len(parent_a) == 2:
            index = 1
        else:
            index = random.randint(0, len(parent_a) - 2)
        genes = parent_a[:index] + parent_b[index:]
        return Chromosome(parent_a.equation, genes)
def crossover ( parent_a : Chromosome , parent_b : Chromosome ) -> Chromosome : if len ( parent_a ) == 2 : index = 1 else : index = random . randint ( 0 , len ( parent_a ) - 2 ) genes = parent_a [ : index ] + parent_b [ index : ] return Chromosome ( parent_a . equation , genes )
randomly returns a child from crossover of parent_a and parent_b
randomly returns a child from crossover of parent_a and parent_b
""" randomly returns a child from crossover of parent_a and parent_b """
parent_a
Chromosome
parent_b
Chromosome