diff --git a/paper/paper.md b/paper/paper.md index 20716b9..c0d1a2e 100644 --- a/paper/paper.md +++ b/paper/paper.md @@ -169,16 +169,19 @@ UserIndividual = MonoIndividual[BinaryChromosome // n].set_fitness(lambda o: _ev or with the helper: UserIndividual = makeIndividual(n_chromosomes=1, size=n).set_fitness(lambda o: _evaluate(o.chromosome)) - -or let the individual be a chromosome: -UserIndividual = (BinaryChromosome // n).set_fitness(lambda o: _evaluate(o.chromosome)) """ UserPopulation = StandardPopulation[UserIndividual] // 20 -""" ``` -We can collect all the codes to one line: +You also see that the equivalent expressions no longer explicitly depends on class inheritance, making the code more concise and similar to algebraic operation. + +We can also consider chromosomes as the elements of the population, and define an individual as follows: +``` +UserIndividual = (BinaryChromosome // n).set_fitness(lambda o: _evaluate(o.chromosome)) +``` + +To further streamline the code, we integrate all the components into a single line: ```UserPopulation = StandardPopulation[BinaryChromosome // n].set_fitness(_evaluate)``` @@ -189,9 +192,6 @@ pop = UserPopulation.random() pop.evolve(n_iter=100) ``` -You also see that the equivalent expressions no longer explicitly depends on class inheritance, making the code more concise and similar to algebraic operation. - - # Visualization Instead of implementing visualization methods, `pyrimidine` yields a `pandas.DataFrame` object that encapsulates statistical results for each generation by setting `history=True` in `evolve` method. Users can harness this object to plot the performance curves. Generally, users are required to furnish a "statistic dictionary" whose keys are the names of the statistics, and values are functions mapping the population to numerical values (strings are confined to pre-defined methods or attributes of the population).