41 lines
2.3 KiB
Markdown
41 lines
2.3 KiB
Markdown
# it3708 - bio-inspired artificial intelligence
|
|
|
|
## what is this?
|
|
|
|
there are two parts of the assignment:
|
|
1. solving a binary knapsack problem (data given in `res/knapPI_12_500_1000_82.csv`)
|
|
2. solving a feature selection problem (data given in `res/dataset.csv`)
|
|
|
|
i built this genetic algorithm library for doing so. there is a report (assignment hand-in) in `report/` detailing methods used and results of my solving the problems.
|
|
|
|
## assignment 1
|
|
|
|
this project is written in [odin](https://odin-lang.org/) and [uiua](https://www.uiua.org/) ([uiua-plot](https://github.com/Omnikar/uiua-plot)) with [nix](https://nixos.org/) for dependency management.
|
|
|
|
with nix installed, just run
|
|
```
|
|
$ nix run
|
|
```
|
|
and it will run through the pipeline. it will generate data/image files in `output/`.
|
|
|
|
## how to use
|
|
|
|
in `src/common.odin` there are multiple (hyper)parameters that can be set to influence how the genetic algorithm will run. here i will go through the available options to set.
|
|
|
|
| parameter | possible values | note |
|
|
|---|---|---|
|
|
| `PROBLEM_TYPE` | `"knapsack"`, `"feature_selection"` | part 1 or part 2 of the task |
|
|
| `GENERATIONS` | int > 0 | how many generations to simulate for |
|
|
| `POPULATION_SIZE` | int > 0 | how many individuals in population. remains constant. |
|
|
| `ELITISM_COUNT` | unsigned int | how many elites to bypass selection pipeline |
|
|
| `SKEW` | unsigned int | reproductive skew, influences how many parents and children compete for selection |
|
|
| `TOURNAMENT_SIZE` | unsigned int | how many to participate in tournament, if tournament selection is used |
|
|
| `CROSSOVER_RATE` | [0, 1] | chance of performing crossover |
|
|
| `MUTATION_RATE` | [0, 1] | chance of random mutation occuring |
|
|
| `PARENT_SELECTION_POLICY` | `random_selection`, `roulette_selection`, `tournament_selection` | what operator to use |
|
|
| `CROSSOVER_POLICY` | `single_point_crossover`, `two_point_crossover`, `uniform_crossover` | |
|
|
| `MUTATION_POLICY` | `bit_flip_mutation`, `swap_mutation`, `inversion_mutation` | |
|
|
| `SURVIVOR_SELECTION_POLICY` | `generational_replacement`, `deterministic_crowding`, `probabilistic_crowding` | |
|
|
| `RANDOM_SEED` | unsigned int | random seed if set to 0 |
|
|
| `OUTPUT_FILE` | string path | where to store data. for simplicity, `plot.ua` expects `output/data.csv` as the output path. |
|