Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist
View gist:3146253
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
class Chromosome
attr_accessor :bitstring
 
def initialize (length, bitstring=nil)
@bitstring ||= rand(2**length+1).to_s(2).rjust(length, '0')
fitness
end
 
def self.random_chromosomes(length, number)
return Array.new(length) { Chromosome.new(length) }
end
 
def to_s
@bitstring
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.