Skip to content

Crossover2 and weightmapping#52

Open
AndrewLouw wants to merge 9 commits intonature-of-code:masterfrom
AndrewLouw:crossover2-and-weightmapping
Open

Crossover2 and weightmapping#52
AndrewLouw wants to merge 9 commits intonature-of-code:masterfrom
AndrewLouw:crossover2-and-weightmapping

Conversation

@AndrewLouw
Copy link
Copy Markdown

All finifhed everything works as intended

AndrewLouw added 7 commits May 4, 2017 02:22
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.
comparison now squares to give better one a bigger advantage, mutation
is now recursive to increase double mutation chance.
mutate is a random swap not shuffle, testing more cities and different
probabilities.
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
@shiffman
Copy link
Copy Markdown
Member

shiffman commented May 5, 2017

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:

  1. Create a new example (separate from my first two) with this code in this repo (03_TSP. . )
  2. Create a new example in your own repo with this code and I'll link outwards from my README.

Do you have a preference?

@AndrewLouw
Copy link
Copy Markdown
Author

AndrewLouw commented May 5, 2017

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!

@AndrewLouw
Copy link
Copy Markdown
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.

AndrewLouw added 2 commits May 5, 2017 12:22
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
@AndrewLouw
Copy link
Copy Markdown
Author

These last couple look at the parenting selection and vastly improve performance by increasing the propagation of mildly inefficient DNA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants