s320168/ComputationalIntelligence

Review for LAB 9 by S299525

Closed this issue · 0 comments

LAB 9 code review

hi, here are my comments:

  • code runs, no error
  • for unpacking you don't need to put them in a list, this will work fine:
 first, second = sorted([ind1, ind2], key=lambda i: i.fitness)
  • for crossover, you pass one parent 70% of the time and the other 30%, but actually there is no recombination, as in mixing the genotypes of the two parents to make an offspring.
  • you haven't done any specific method for reducing the calls to fitness, for example, saving fitness values in a memory.

what I like about your code is that it is very short and still there is some output, and also the way xover function is wriiten is nice and pythonic:

 genotype=[
            f if .7 > r else s
            for f, s, r in zip(
                first.genotype,
                second.genotype,
                np.random.random(size=GENOME_SIZE),
            )

keep up the good work,

cheers