Commit Graph

114 Commits

Author SHA1 Message Date
665062fdf1 Updated Implementation Framework
Updated to cover changes made by Dan to Master regarding general design changes

Also added remove_two_worst survivor selection method
2020-10-05 20:46:25 -04:00
e05aa7f62b Changed implementation framework
Instead of a nested approach, selection/crossover/mutation are all called separately and directly by the GA. selection_impl was also separated into parent_selection_impl and survivor_selection_impl, as both are needed separately.
2020-10-04 17:59:59 -04:00
c18a531034 Updated selection implementation, added with/without replacement variation 2020-10-04 15:54:38 -04:00
89df506469 Fixed more github upstream stuff
why v2
2020-10-04 14:38:41 -04:00
4b375659bb Removed weird github thing with old implementation
Why
2020-10-04 14:35:19 -04:00
7e587d48d0 Test Implementation for selection/crossover/mutation
The current test implementation includes random mutation, single point crossover, and tournament selection. The implementation, in short, is a nested approach. The selection method is the only thing actually called by the GA. Both crossover and mutation occur within the selection method. As long as these three systems all follow a standard input/output system, any implementation we build, as well as any user implementations, will work perfectly. The selection function must take GA as a parameter and output a new population. Crossover takes in GA and outputs a population. Mutation takes a chromosome set and outputs a new chromosome set.

Many of the changes in this commit are regarding this test implementation. I have also changed many of the file names from "x_examples" to "x_types" and updated the class names to follow capitalziation standards. I did this because I feel personally like the built-in mutation, crossover, and selection implementations are less "examples" and more just already built implementations to make the code required from the user smaller.
2020-10-04 08:00:33 -04:00
6aec9770b6 Further optimizations, error-checking, user-input conversions
1) The initialization now accepts "general" inputs that should apply to each gene. For example, rather than a gene input of [1,100] being interpreted to mean gene 1 hsould be 1 and gene 2 should be 100, it will apply a range of [1,100] to each gene.
2) The initialization now accepts "general" gene_input_types. For example, if the user had a set of index-dependent number values, they could just say ga.gene_input_type = "domain" and the package will propagate that across all genes in the chromosome. The user still has the option of defining the entire array or just defining a specific element if they so choose. For later commits, the general gene_input_type will have to be checked for validity; for example, a string can never be a range.
3) Fixed an issue in the ordering of the initialization function call.
4) Added comments surrounding the signfiicant changes to the initialization.
5) Added example tests to the testing file.
2020-09-25 18:02:45 -04:00
922d046b72 Code optimizations, float-range implementation
Random gene initialization now supports float ranges (assumed by default if gene input includes float). Backend was also optimized and cleaned up greatly.
2020-09-25 16:10:28 -04:00
ed1b2bbe03 Updated gene input checks
Updated the check of incoming data to ensure validity - if the user enters a single digit, say "5", it will automatically be converted to a list like [5,5]. This already worked before with range, but it now works with domain as well.
2020-09-25 11:24:47 -04:00
129925bbdd Cleaned up backend & user interaction with EasyGA
In the initial commit, string inputs would implicitly be seen as domain, and all integer inputs would be seen as range. If the user wanted to assign any integer inputs as domain, they would have to call the entire gene_input_type, even if only to change a single element to domain. It has now been updated to where the user can specifically call the element they want to update. The testing file new_initialization_method_testing.py reflects this.
2020-09-25 11:14:09 -04:00
5821e709a3 New Initialization Method
This is a test implementation of a potential new initialization method. A testing file - new_initialization_method_testing.py - is included to allow for quick testing.

In summary here is are the major points:
1) Two new attributes of GA were created - gene_input and gene_input_type. gene_input holds the user's custom range(s)/domain(s) after it gets passed to the initialize() function. gene_input_type holds an array with the same length as the chromosomes that holds the input type of the user's gene_input on a gene-by-gene basis. It does this in the same exact way that index-dependent gene ranges/domains are handled. By making the gene_input_type array the same size as the chromosome, the elements can be paired very easily. The acceptable values for this are either "range" or "domain". With a range, any value between the two can be generated; with domain, only the two elements included can be selected from randomly.
2) As mentioned in change 1, the user now has to pass their range(s)/domain(s) to the initialize() function.
3) The package is capable of implicitly determining if a certain input from the user is a range or domain. Strings can only ever be a domain – if given an element that only includes integers, the program assumes range.
4) If the user wishes to use numbers only as a domain, they can specify this by directly interacting with the ga.gene_input_type (or through a setter function).
5) the initialize() function in the GA object determines the implicit range/domain assignments if the user doesn’t do so themselves.
6) The random_initialization() function is effectively the same, except there is now an if/else to determine if the user is using the built-in gene creation function or not. If they are, then pass the gene_input, gene_input_type, and current gene index as arguments to the gene function. If they are using their own function, random_initialization() functions exactly the same way as it does in the current master branch.
7) Based on all the settings mentioned above, the random_gene() function will create a value before passing it back to random_initialization().
2020-09-25 01:15:53 -04:00
99066e924b Merge branch 'master' of https://github.com/danielwilczak101/EasyGA 2020-09-24 22:48:03 -04:00
4daec6574d Removed globals and fixed a few small print issues 2020-09-24 22:47:12 -04:00
5846c2c3f9 Merge branch 'master' of https://github.com/danielwilczak101/EasyGA 2020-09-24 22:43:43 -04:00
45638ad4eb Fixed data structures
Fixed constructors with default arguments as well as the adders with default arguments.
2020-09-24 18:13:44 -04:00
c4ead43d6d Updated genes,chromosme,population prints 2020-09-24 15:02:58 -04:00
9c5092525a Fixed file and everything 2020-09-23 22:12:42 -04:00
994bdb164c Fixed all jacks code 2020-09-23 21:58:48 -04:00
88366e928b Update README.md 2020-09-23 20:30:44 -04:00
eaa90ecd2a Fixed to explain 2020-09-23 20:29:50 -04:00
70bb03bc96 blaww 2020-09-23 18:23:29 -04:00
b0b502c697 Did stuff 2020-09-23 18:09:29 -04:00
7359ef1268 file changes 2020-09-23 16:53:43 -04:00
91c318ba64 Removed unnessaery file 2020-09-23 16:49:22 -04:00
2322a186e3 Major structural changes 2020-09-23 16:46:59 -04:00
cd15a85b71 testing 2020-09-23 13:23:07 -04:00
c2ebec6be2 Testing happened 2020-09-22 20:12:28 -04:00
2c3ef3f589 rewrote test fitness funciton 2020-09-22 18:54:03 -04:00
7aee6b9c8a changed name for readability 2020-09-22 18:34:34 -04:00
4803b1ee69 Changed readme 2020-09-22 15:39:02 -04:00
420d0286bb Update README.md 2020-09-22 15:34:17 -04:00
ff57c2764e Update README.md 2020-09-22 15:34:01 -04:00
361e04b3b8 Update README.md 2020-09-22 15:31:26 -04:00
6ab18500a1 Update README.md 2020-09-22 15:27:07 -04:00
036fcd134f Changed name to help with understanding of where to run sample code 2020-09-22 15:21:18 -04:00
ba62846d4b File structure change, added tests into major folders. 2020-09-22 15:18:37 -04:00
6503a320ae file structure changes and testing files added. 2020-09-22 14:37:55 -04:00
73042b8cc4 New change 2020-09-22 00:01:18 -04:00
b24e915af1 Adding for main 2020-09-21 23:52:15 -04:00
4c0090a9ed Added files for all the main classes inside of EasyGA 2020-09-21 23:39:15 -04:00
1af16cd0d3 Changed name 2020-09-21 23:25:50 -04:00
083294ed21 Added file structure 2020-09-21 23:24:07 -04:00
1d5cbb6a5e Text changes 2020-09-21 20:27:08 -04:00
e84483cf8b Major chnages to structure 2020-09-21 20:26:21 -04:00
5c4dd96427 Update README.md 2020-09-21 18:54:00 -04:00
17f8ea5a87 Update README.md 2020-09-21 18:53:39 -04:00
6620378afe Update README.md 2020-09-21 18:53:01 -04:00
3e41c553e0 Update README.md 2020-09-21 17:17:25 -04:00
0530908598 Update README.md 2020-09-21 17:16:47 -04:00
5b7965c7c4 Update README.md 2020-09-21 17:02:38 -04:00