Coder Social home page Coder Social logo

Just a question on design about darwinning HOT 4 CLOSED

dorkrawk avatar dorkrawk commented on August 12, 2024
Just a question on design

from darwinning.

Comments (4)

dorkrawk avatar dorkrawk commented on August 12, 2024

Hey! Thanks for checking out the library. You're totally right that many of these examples are probably wasting time recalculating fitness each time its used. Because I'd like Organism#fitness to be as flexible as possible I think the best solution would be to memoize the #fitness value. Something like:

def fitness
  @fitness ||= attr_a + attr_b + att_c
end

I'll update some of the examples with this pattern.

from darwinning.

dorkrawk avatar dorkrawk commented on August 12, 2024

Here's an updated example: cdd96c0

from darwinning.

illtellyoulater avatar illtellyoulater commented on August 12, 2024

Thanks a lot for clarifying. I've experimented with darwinning to build a system which creates small musical (MIDI) themes, that evolve after being played and rated by the user, so much similar to your cookie example (but I had checked it out only later :) ). So I had temporarily put the rating code inside the #fitness method, and saw how for the same member/object I was asked to listen it and rate it many times (presumably as many times as the number of comparisons with other members it is going through?).
So yeah, I had fixed it by only calculating it first time and then just letting fitness return it for subsequent times, as you did above.. well maybe it could be fun if I could add it to this repo examples.. :) It's using https://github.com/arirusso/unimidi multi platform midi lib.

I'm seeing though, that it gets fastly stuck on the same tune. I've googled around a bit and read that in some conditions genetic algorithms tends to quickly get stuck to local optimum... but again I don't know much about this yet.. (thanks for having given me the opportunity to learn something on this fascinating subject with your gem!).

from darwinning.

dorkrawk avatar dorkrawk commented on August 12, 2024

That's a really cool project! One of my first genetic algorithm projects back in grad school worked with MIDI as well (but it was written in Python). Here's a small paper I published on it: http://socrs.cdm.depaul.edu/2011/program/papers/paper_13.pdf

from darwinning.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.