Commit Graph

11 Commits

Author SHA1 Message Date
cameel
85074e7a8a [yul-phaser] Population: Extract sorting from doSelection() into sortIndividuals() in Population class 2020-02-19 17:03:35 +01:00
cameel
41f36f421d [yul-phaser] Population: Extract conversion from chromosomes to individuals into a separate function 2020-02-19 17:03:35 +01:00
Kamil Śliwak
31d8d5930a [yul-phaser] Population: Equality operators for populations and individuals 2020-02-18 19:40:37 +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
806891f494 [yul-phaser] Population: Customizable chromosome length in makeRandom() 2020-02-18 19:40:37 +01:00
Kamil Śliwak
b3f595ce9d [yul-phaser] Population: Remove unused include for <iostream> 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
785f65d0f5 [yul-phaser] Make Program and Population classes accept source code rather than file path
- I need some sample .yul files for testing but I see that existing tests generally have source code hard-coded in them rather than in standalone .yul files. There are lots of .yul files but they seem to be automatically processed by a special test case rather loaded ad-hoc by manually created tests.
- Program and Population required a file name until now. I'm making them accept loaded source code to be able to give them data hard-coded in a test.
2020-02-05 18:13:30 +01:00
cameel
7b7c88ae95 [yul-phaser] Add Population class 2020-02-05 18:13:30 +01:00