KonradLinkowski / GeneticDrawer

image evolution algorithm
https://konradlinkowski.github.io/GeneticDrawer/
10 stars 10 forks source link

Revision on genetic algorithm implementation #16

Open pupupulp opened 3 years ago

pupupulp commented 3 years ago

Hi @KonradLinkowski ,

I have implemented a different approach for genetic algorithm in this pull request.

Here is a screenshot of the sample output: image

To summarize the change, I have implemented the following:

All other implementations are retained, except for the drawLoop and the requestAnimationFrame.

For tweaking these are the change-able values:

I've added this as a another file, genetic.js, so that you can test it without overwriting the previous genetic algorithm implementation.

Hope this helps solve the problem :D :D :D

KonradLinkowski commented 3 years ago

Thanks for the PR. I will look at this in a free time

pupupulp commented 3 years ago

Thank you @KonradLinkowski , hope this fits with the project :D :D :D

pupupulp commented 3 years ago

Hi @KonradLinkowski ,

I've revised some parts of the genetic algorithm, I think it is still covered by this pull request though.

The fastest I have is at 2 minutes span here is the result already: image

However, here is the greatest image match I have achieved after leaving it for a while now: image

Additionally, based on my observations such a match really depends on the rates (the variables used for tweaking) provided because sometimes once a mutation happens the image drops to a lower match percentage or it slows down the increase of the match percentage. This means that the 2 mins span I stated above to achieve a 90% match percentage may differ from time to time depending on how the population reacts.

By the way, this project is so fun! It gives that exciting feeling when the image generated is so close to the original. :D :D :D

KonradLinkowski commented 3 years ago

Does it work? I'm asking because when I swapped main.js width genetic.js app breakes.

pupupulp commented 3 years ago

Hi,

In what way aspect does it break so that I can cheeck :D :D :D Is it unable to generate an image?