Update README.md
This commit is contained in:
@ -20,17 +20,19 @@ import EasyGA
|
|||||||
import random
|
import random
|
||||||
import EasyGA
|
import EasyGA
|
||||||
|
|
||||||
|
# The user defined function
|
||||||
def user_gene_function():
|
def user_gene_function():
|
||||||
return random.randint(1, 100)
|
return random.randint(1, 100)
|
||||||
|
|
||||||
|
# Standard user size requirements
|
||||||
Population_size = 10
|
Population_size = 10
|
||||||
Chromosome_length = 10
|
Chromosome_length = 10
|
||||||
|
|
||||||
|
# Create the Genetic algorithm
|
||||||
ga = EasyGA.GA(Population_size, Chromosome_length,user_gene_function)
|
ga = EasyGA.GA(Population_size, Chromosome_length,user_gene_function)
|
||||||
|
|
||||||
# Setup the GA's population,chromosomes and genes
|
|
||||||
ga.initialize()
|
ga.initialize()
|
||||||
|
|
||||||
|
# Looking at the first chromosome in the population
|
||||||
print(ga.population.chromosomes[0].print_chromosome())
|
print(ga.population.chromosomes[0].print_chromosome())
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user