Genetic Algorithms the Easy Way

Most of my work to date has been reactive, that is there is a 1-1 connection between what the user does and what the application does.

Recently for a class project I decided to use Genetic Algorithms to enhance the user experience and potentially augment some of the creative processes of working with a tool.

I always stayed away from this type of coding because it didn’t match the types of applications I was interested in making.

Additionally GA has always shrouded in mystery for most coders since the concepts are described using genetic metaphors and binary crossover operations.

I took a somewhat different tact for this assignment and I’m posting this for the benefit of anyone who is interested in a simple GA implementation for creative coding.

This assumes the user makes an input that can be mapped directly or indirectly to a property of your system.

Here are the steps:

  1. Make user input your fitness value (user did x, x = fitness)
  2. For all objects in your system measure distance from fitness value to matching object property
  3. Sort results
  4. Collect top 10% – 25% of the objects with closest property values to the fitness value
  5. For all objects, select 2 or more candidate objects randomly and average their property assigning it to the current object
  6. Optionally add in the fitness value itself (weighted by a learning factor)
  7. Optionally add in a random value (weighted)

My application maps user gestures to motion properties such as: linear angle, linear speed, wave amplitude, wave speed, curve speed and so on…

By employing the use of this simple GA, the user’s actions are not mapped 1-1 to a specific resulting motion type. Instead the system appears to “learn” the desired motion by virtue of the selection and mutation processes outlined in the steps above.

Here are some initial results (does not really show the GA part, but until the app is released assume the experience is amazing):

This entry was posted in Works, School. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

One Comment

  1. Posted June 3, 2015 at 1:02 am | Permalink

    An interesting discussion is worth comment. I believe that you need to write
    more on this issue, it may not be a taboo subject but generally people don’t talk about these subjects.
    To the next! Cheers!!

Post a Comment

Your email is never published nor shared. Required fields are marked *

You may use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

*
*