Update README.md

This commit is contained in:
danielwilczak101
2020-09-20 18:52:11 -04:00
committed by GitHub
parent 0affbf4bf4
commit 0ccc606ee1

View File

@ -12,34 +12,40 @@ pip3 install EasyGA
To use the package To use the package
```python ```python
import EasyGA as ga import EasyGA
``` ```
## Usage ## Usage
```python ```python
import EasyGA as ga import random
import EasyGA
chromosome = ga.chromosome() def user_gene_function():
return random.randint(1, 100)
# Fill the chromosome with genes with Gene Number i'th number Population_size = 10
for i in range(10): Chromosome_length = 10
gene_value = f"Gene Number {i}"
new_gene = ga.gene("gene_value")
chromosome.add_gene(new_gene)
# Chromosome has 10 genes in it ga = EasyGA.GA(Population_size, Chromosome_length,user_gene_function)
print(len(chromosome.genes))
# Get the first genes value # Setup the GA's population,chromosomes and genes
print(chromosome.genes[0].get_value()) ga.initialize()
print(ga.population.chromosomes[0].print_chromosome())
``` ```
# Developing EasyGA # Developing EasyGA
Download the repository to some folder
Then install the repositroy using this command:
```
pip install -e .
```
# Working on developing a devel branch
To install EASY, along with the tools you need to develop and run tests, run the following in your virtual env: To install EASY, along with the tools you need to develop and run tests, run the following in your virtual env:
```bash ```bash
$ pip install -e .[dev] $ pip install -e .[devel]
``` ```