Update README.md
This commit is contained in:
36
README.md
36
README.md
@ -12,34 +12,40 @@ pip3 install EasyGA
|
||||
|
||||
To use the package
|
||||
```python
|
||||
import EasyGA as ga
|
||||
import EasyGA
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```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
|
||||
for i in range(10):
|
||||
gene_value = f"Gene Number {i}"
|
||||
new_gene = ga.gene("gene_value")
|
||||
chromosome.add_gene(new_gene)
|
||||
Population_size = 10
|
||||
Chromosome_length = 10
|
||||
|
||||
# Chromosome has 10 genes in it
|
||||
print(len(chromosome.genes))
|
||||
ga = EasyGA.GA(Population_size, Chromosome_length,user_gene_function)
|
||||
|
||||
# Get the first genes value
|
||||
print(chromosome.genes[0].get_value())
|
||||
# Setup the GA's population,chromosomes and genes
|
||||
ga.initialize()
|
||||
|
||||
print(ga.population.chromosomes[0].print_chromosome())
|
||||
|
||||
```
|
||||
|
||||
# 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:
|
||||
|
||||
```bash
|
||||
$ pip install -e .[dev]
|
||||
```
|
||||
$ pip install -e .[devel]
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user