Crossover2 and weightmapping#52
Open
AndrewLouw wants to merge 9 commits intonature-of-code:masterfrom
Open
Conversation
Crossover 2 takes a random city and finds it's position in the parent's order vector, then choses one parent randomly but weighted based on their performance and places thic city in the output vector in this position. If the first choice parent's position is taken alread the second choice is used, if both are taken it is placed randomly at the end. Mutations prevent the whole population becoming identical and introduce new samples occasionall. Works well with weightmapping - replaces crossover in sketch.
the whole population is displayed at once in the upper figure. The thickness of the lines are proportional to how many networks take that route. Making it easy to see if the population is evolving or randomly guessing.
Mutate function wasn't running in DNA but works in skech, more features have been added and some values fiddled.
Mutate was being called but not returning a value, ultimately leading to crasthes but more annoyingly not actually modifying the order. also now every1000 generations there are 5 generataions of extream mutation to help keep things progressing. The best ever is always in the population now also
used the wrong variable name in one place
Member
|
Wow, these are wonderful improvements! I like to keep my examples simple -- this one, for example, is meant to just demonstrate a GA without any crossover at all. I see two options:
Do you have a preference? |
Author
|
I don't have a preference, but your Github gets much more traffic and I'm only just learning how to use mine, so I think it's best if you make a new example. Thanks for the videos! |
Author
|
I don't know if you ever do followup videos, or if I've anything new enough to make it worth it but feel free to use this code. |
Added 10000th roor parenting this very mild bias towards the better parent means slightly inefficent networks can form a breeding population allowing improvements which require muliple mutations to be found - anything is better than equal parenting however. apocalypse spelling correction... and happens more often with more mutations but is shorter. Maximum stack exceeded error prevented (was low probability) Now 'solves' for 50 cities in about 5 minutes
Author
|
These last couple look at the parenting selection and vastly improve performance by increasing the propagation of mildly inefficient DNA |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
All finifhed everything works as intended