Comments (2)
Sure, you can define your fitness
method any way you want. For example you could write something like this:
require 'darwinning'
class Triple
include Darwinning
...
def initialize(target_sum)
@target_sum = target_sum
end
def fitness
# Try to get the sum of the 3 digits to add up to 100
(first_number + second_number + third_number - @target_sum).abs
end
end
from darwinning.
So, I wrote something similar to that also, but when I used the snippet showing how to call evolve!
, I get the following error:
in `initialize': wrong number of arguments (given 0, expected 1) (ArgumentError)
from /usr/local/bundle/gems/darwinning-0.1.1/lib/darwinning/population.rb:101:in `new'
from /usr/local/bundle/gems/darwinning-0.1.1/lib/darwinning/population.rb:101:in `build_member'
from /usr/local/bundle/gems/darwinning-0.1.1/lib/darwinning/population.rb:31:in `block in build_population'
from /usr/local/bundle/gems/darwinning-0.1.1/lib/darwinning/population.rb:30:in `times'
from /usr/local/bundle/gems/darwinning-0.1.1/lib/darwinning/population.rb:30:in `build_population'
from /usr/local/bundle/gems/darwinning-0.1.1/lib/darwinning/population.rb:25:in `initialize'
from /usr/local/bundle/gems/darwinning-0.1.1/lib/darwinning.rb:18:in `new'
from /usr/local/bundle/gems/darwinning-0.1.1/lib/darwinning.rb:18:in `build_population'
from test.rb:25:in `<main>'
⬆️ that is from this.
from darwinning.
Related Issues (12)
- Old fork HOT 4
- 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
- Just a question on design HOT 4
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.