From 0ccc606ee1f3601f21ab3300274810bbb6ee7237 Mon Sep 17 00:00:00 2001 From: danielwilczak101 <44122838+danielwilczak101@users.noreply.github.com> Date: Sun, 20 Sep 2020 18:52:11 -0400 Subject: [PATCH 01/15] Update README.md --- README.md | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index dff82bf..ba5f145 100644 --- a/README.md +++ b/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] -``` \ No newline at end of file +$ pip install -e .[devel] +``` From 907753f6bfe50b81a62f7e88c55824c9ea2210ed Mon Sep 17 00:00:00 2001 From: danielwilczak101 <44122838+danielwilczak101@users.noreply.github.com> Date: Sun, 20 Sep 2020 18:53:44 -0400 Subject: [PATCH 02/15] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ba5f145..94208bb 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,9 @@ print(ga.population.chromosomes[0].print_chromosome()) # Developing EasyGA Download the repository to some folder - +``` +git clone +``` Then install the repositroy using this command: ``` pip install -e . From d6c440bc77ba14347961e5e3f3fb7b1c59fc1eeb Mon Sep 17 00:00:00 2001 From: danielwilczak101 <44122838+danielwilczak101@users.noreply.github.com> Date: Sun, 20 Sep 2020 18:54:10 -0400 Subject: [PATCH 03/15] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 94208bb..fe979cf 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ print(ga.population.chromosomes[0].print_chromosome()) # Developing EasyGA Download the repository to some folder ``` -git clone +git clone https://github.com/danielwilczak101/EasyGA.git ``` Then install the repositroy using this command: ``` From 73904f2c32ee4de306c00e2e0bb499d7560ed412 Mon Sep 17 00:00:00 2001 From: danielwilczak101 <44122838+danielwilczak101@users.noreply.github.com> Date: Sun, 20 Sep 2020 18:54:55 -0400 Subject: [PATCH 04/15] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fe979cf..a185d3f 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ print(ga.population.chromosomes[0].print_chromosome()) ``` # Developing EasyGA -Download the repository to some folder +Download the repository to some folder - If you never used git. Look up a youtube tutorial. It will all make sense. ``` git clone https://github.com/danielwilczak101/EasyGA.git ``` From 226d9f044e10b9bddcad6c9220b7e8d04fd43883 Mon Sep 17 00:00:00 2001 From: danielwilczak101 <44122838+danielwilczak101@users.noreply.github.com> Date: Sun, 20 Sep 2020 18:56:38 -0400 Subject: [PATCH 05/15] Update README.md --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a185d3f..c927e28 100644 --- a/README.md +++ b/README.md @@ -20,17 +20,19 @@ import EasyGA import random import EasyGA +# The user defined function def user_gene_function(): return random.randint(1, 100) +# Standard user size requirements Population_size = 10 Chromosome_length = 10 +# Create the Genetic algorithm ga = EasyGA.GA(Population_size, Chromosome_length,user_gene_function) - -# Setup the GA's population,chromosomes and genes ga.initialize() +# Looking at the first chromosome in the population print(ga.population.chromosomes[0].print_chromosome()) ``` From b1a7751f25af539e5b557f9d523cb57ef8f811e7 Mon Sep 17 00:00:00 2001 From: danielwilczak101 <44122838+danielwilczak101@users.noreply.github.com> Date: Sun, 20 Sep 2020 18:56:59 -0400 Subject: [PATCH 06/15] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c927e28..6b280fd 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ import EasyGA import random import EasyGA -# The user defined function +# The user defined gene function def user_gene_function(): return random.randint(1, 100) From 451092187de46d9d3b5ff04981069dd066019d00 Mon Sep 17 00:00:00 2001 From: danielwilczak101 <44122838+danielwilczak101@users.noreply.github.com> Date: Mon, 21 Sep 2020 01:46:12 -0400 Subject: [PATCH 07/15] Add files via upload --- MANIFEST.in | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 MANIFEST.in diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..cc2fdc5 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,19 @@ +graft docs +graft src +graft ci +graft tests + +include .bumpversion.cfg +include .coveragerc +include .cookiecutterrc +include .editorconfig + +include AUTHORS.rst +include CHANGELOG.rst +include CONTRIBUTING.rst +include LICENSE +include README.rst + +include tox.ini .travis.yml .appveyor.yml .readthedocs.yml .pre-commit-config.yaml + +global-exclude *.py[cod] __pycache__/* *.so *.dylib From df1dae29646c34b7b7913a3797874193b5fb63a6 Mon Sep 17 00:00:00 2001 From: danielwilczak101 <44122838+danielwilczak101@users.noreply.github.com> Date: Mon, 21 Sep 2020 01:47:00 -0400 Subject: [PATCH 08/15] Update setup.py --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 0bd3e91..157dce4 100644 --- a/setup.py +++ b/setup.py @@ -5,10 +5,11 @@ with open("README.md", "r") as fh: setup( name='EasyGA', - version='0.0.7', + version='0.0.8', description='A ubiquitous or general purpuse GA', py_modules=["EasyGA"], package_dir={'':'src'}, + python_requires='>=3.6', url="https://github.com/danielwilczak101/EasyGA", author="Daniel Wilczak", author_email="danielwilczak101@gmail.com", From 42e058b9eaf81a00dbe46730ecefeb2b98d6fd37 Mon Sep 17 00:00:00 2001 From: danielwilczak101 <44122838+danielwilczak101@users.noreply.github.com> Date: Mon, 21 Sep 2020 01:58:00 -0400 Subject: [PATCH 09/15] Added comments --- src/example.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/example.py b/src/example.py index 1f1ab53..343a35e 100644 --- a/src/example.py +++ b/src/example.py @@ -1,15 +1,17 @@ import random import EasyGA +# The user defined gene function def user_gene_function(): return random.randint(1, 100) +# Standard user size requirements Population_size = 10 Chromosome_length = 10 +# Create the Genetic algorithm ga = EasyGA.GA(Population_size, Chromosome_length,user_gene_function) - -# Setup the GA's population,chromosomes and genes ga.initialize() +# Looking at the first chromosome in the population print(ga.population.chromosomes[0].print_chromosome()) From 59b670f44e69de56fa7204f93fb5e46f14fe5eed Mon Sep 17 00:00:00 2001 From: danielwilczak101 <44122838+danielwilczak101@users.noreply.github.com> Date: Mon, 21 Sep 2020 02:05:26 -0400 Subject: [PATCH 10/15] Testing --- src/EasyGA.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/EasyGA.py b/src/EasyGA.py index 88e5914..8ab959d 100644 --- a/src/EasyGA.py +++ b/src/EasyGA.py @@ -1,6 +1,7 @@ from initialization.random_initialization import random_initialization def check_gene(value): + #Check to make sure the gene is not empty assert value != "" , "Gene can not be empty" return value @@ -36,11 +37,15 @@ class chromosome: def print_chromosome(self): for i in range(len(self.genes)): - print(f"[{self.genes[i].get_value()}],", end = '') + # Print the gene one by one. + if(i == range(len(self.genes))): + print(f"[{self.genes[i].get_value()}]", end = '') + else: + print(f"[{self.genes[i].get_value()}],", end = '') class population: - # chromosomes = [chromosome,chromosome,etc] + # population = [chromosome,chromosome,etc] def __init__(self): self.chromosomes = [] From 85ba32803f5f84b6143857444598ec7da6f53b27 Mon Sep 17 00:00:00 2001 From: danielwilczak101 <44122838+danielwilczak101@users.noreply.github.com> Date: Mon, 21 Sep 2020 02:20:08 -0400 Subject: [PATCH 11/15] Fixed bugs --- src/EasyGA.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EasyGA.py b/src/EasyGA.py index 8ab959d..3d5b6d5 100644 --- a/src/EasyGA.py +++ b/src/EasyGA.py @@ -38,7 +38,7 @@ class chromosome: def print_chromosome(self): for i in range(len(self.genes)): # Print the gene one by one. - if(i == range(len(self.genes))): + if(i == len(self.genes)): print(f"[{self.genes[i].get_value()}]", end = '') else: print(f"[{self.genes[i].get_value()}],", end = '') From 358d93dfa4583d53b4254d7b7290008b6a0f329c Mon Sep 17 00:00:00 2001 From: danielwilczak101 <44122838+danielwilczak101@users.noreply.github.com> Date: Mon, 21 Sep 2020 02:20:25 -0400 Subject: [PATCH 12/15] Fixed bugs --- src/EasyGA.py | 2 +- src/example.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/EasyGA.py b/src/EasyGA.py index 3d5b6d5..e8d2d85 100644 --- a/src/EasyGA.py +++ b/src/EasyGA.py @@ -38,7 +38,7 @@ class chromosome: def print_chromosome(self): for i in range(len(self.genes)): # Print the gene one by one. - if(i == len(self.genes)): + if(i == len(self.genes) - 1): print(f"[{self.genes[i].get_value()}]", end = '') else: print(f"[{self.genes[i].get_value()}],", end = '') diff --git a/src/example.py b/src/example.py index 343a35e..f0ce9d9 100644 --- a/src/example.py +++ b/src/example.py @@ -14,4 +14,4 @@ ga = EasyGA.GA(Population_size, Chromosome_length,user_gene_function) ga.initialize() # Looking at the first chromosome in the population -print(ga.population.chromosomes[0].print_chromosome()) +ga.population.chromosomes[0].print_chromosome() From e4930a02752788944eedbffac3876ba9e0b0563f Mon Sep 17 00:00:00 2001 From: danielwilczak101 <44122838+danielwilczak101@users.noreply.github.com> Date: Mon, 21 Sep 2020 02:21:37 -0400 Subject: [PATCH 13/15] Removed print --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6b280fd..44b23b3 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ ga = EasyGA.GA(Population_size, Chromosome_length,user_gene_function) ga.initialize() # Looking at the first chromosome in the population -print(ga.population.chromosomes[0].print_chromosome()) +ga.population.chromosomes[0].print_chromosome() ``` From 70be50a7f2c2dee2e3d07370d4fa2481d7d2cd7a Mon Sep 17 00:00:00 2001 From: danielwilczak101 <44122838+danielwilczak101@users.noreply.github.com> Date: Mon, 21 Sep 2020 13:37:54 -0400 Subject: [PATCH 14/15] Full rewrite to update functionality --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 44b23b3..528682c 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ import EasyGA def user_gene_function(): return random.randint(1, 100) -# Standard user size requirements +# Standard user size requirements: Population_size = 10 Chromosome_length = 10 @@ -32,7 +32,7 @@ Chromosome_length = 10 ga = EasyGA.GA(Population_size, Chromosome_length,user_gene_function) ga.initialize() -# Looking at the first chromosome in the population +# Looking at the first chromosome in the population: ga.population.chromosomes[0].print_chromosome() ``` From 306f98d8664024828f5d094268f3da852e904262 Mon Sep 17 00:00:00 2001 From: danielwilczak101 <44122838+danielwilczak101@users.noreply.github.com> Date: Mon, 21 Sep 2020 13:47:05 -0400 Subject: [PATCH 15/15] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 528682c..be8a5ce 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # EasyGA - A general solution to Genetic Algorithms -The projects has just started +The project has just started ## Installation