Comments (4)
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.
Here's an updated example: cdd96c0
from darwinning.
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.
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)
- Old fork HOT 4
- Organism with arguments in initialize HOT 2
- Bug in best_each_generation HOT 1
- Intermittent population spec failures
- Any ability to seed the first generation? HOT 1
- Please add a license
- Variabile number of genes?
- The mutation is broken
- Run exemples HOT 2
- Basic usage HOT 2
- undefined method `nice_print' HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from darwinning.