Skip to content

Commit

Permalink
paper
Browse files Browse the repository at this point in the history
  • Loading branch information
Freakwill committed Dec 8, 2023
1 parent 13480ae commit 0c497c3
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions paper/paper.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)```


Expand All @@ -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).
Expand Down

0 comments on commit 0c497c3

Please sign in to comment.