Permalink
Browse files

Fixes for Spea2 class

  • Loading branch information...
1 parent b49f7d3 commit 83fbee084bba142a1abb15b8eed6b13edfd1c2ea @guilleiguaran committed Jun 7, 2012
Showing with 3 additions and 3 deletions.
  1. +3 −3 spea2.rb
View
@@ -2,8 +2,8 @@ class Spea2
BITS_PER_PARAM = 16
attr_accessor :context
- attr_accessor :context, :problem_size, :search_space,
- :max_gens, :pop_size, :archive_size, :p_cross
+ attr_accessor :problem_size, :search_space, :max_gens,
+ :pop_size, :archive_size, :p_cross
def initialize(context, options)
self.context = context
@@ -147,7 +147,7 @@ def binary_tournament(pop)
return (s1[:fitness] < s2[:fitness]) ? s1 : s2
end
- def search(problem_size, search_space, max_gens, pop_size, archive_size, p_crossover)
+ def search
pop = Array.new(pop_size) do |i|
{:bitstring => random_bitstring(problem_size*BITS_PER_PARAM)}
end

0 comments on commit 83fbee0

Please sign in to comment.