Commit Graph

13 Commits

Author SHA1 Message Date
cameel
2291cf78ac [yul-phaser] Population: Add constructors to Individual to simplify initialization 2020-02-19 17:26:34 +01:00
cameel
cef01c961a [yul-phaser] Population: Keep the individuals always sorted 2020-02-19 17:26:34 +01:00
cameel
76842ac3fd [yul-phaser] Population: Evaluate fitness immediately when an individual is added or modified
- This removes the explicit evaluation phase.
- Fitness is no longer optional in Individual
2020-02-19 17:26:34 +01:00
cameel
66fdc1c374 [yul-phaser] Population: Store fitness metric rather than program directly
- In the console app use ProgramSize metric when creating the population.
2020-02-19 17:03:35 +01:00
cameel
d9c5e2dc9f [yul-phaser] Population: Add operator+() 2020-02-18 19:40:37 +01:00
Kamil Śliwak
ecb30c670f [yul-phaser] Population: Make ordering of individuals with same fitness deterministic and prioritise shorter chromosomes
- Before this change the order of chromosomes with the same fitness in a population depended on the initial order set when the population was first created. Now it only depends on the individual.
- The length comparison is not strictly necessary (lexicographical order covers that) but it makes the intention clear and the comparison slightly faster when chromosomes have different lengths.
2020-02-18 19:40:37 +01:00
Kamil Śliwak
40a6669538 [yul-phaser] Population: Extract a function for comparing fitness of individuals
- Mostly for readability and convenience. This significantly shortens calls to sort().
- I could define it as Individual::operator< instead but it would be inconsistent with operator== because it does not compare the chromosomes, only fitness. It could result in an unintuitive situation where (a <= b <= a) does not necessarily imply (a == b).
2020-02-18 19:40:37 +01:00
Kamil Śliwak
823e715902 [yul-phaser] Population+Chromosome: Better tests for makeRandom() 2020-02-18 19:40:37 +01:00
Kamil Śliwak
806891f494 [yul-phaser] Population: Customizable chromosome length in makeRandom() 2020-02-18 19:40:37 +01:00
Kamil Śliwak
e771f00971 [yul-phaser] Population: Extract Program construction in tests into a fixture 2020-02-18 19:38:55 +01:00
Kamil Śliwak
d22c59aa0e [yul-phaser] Chromosome: Add a constructor that reads steps from an abbreviation string 2020-02-18 19:38:55 +01:00
cameel
e4c7b73897 [yul-phaser] Store already loaded program in Population and make copies when computing fitness
- Until now the source code was being parsed during every fitness computation. Now the parsed program is reused and only the optimisation steps are applied each time.
2020-02-06 09:01:10 +01:00
cameel
33cf4e4769 [yul-phaser] Tests for Population class 2020-02-05 18:13:30 +01:00