def run
      start_time = Time.now
      in_progress = true
      @algorithm.setup @start
      @current_params = @start
      max_scores = @target.count_parameter_permutations
      while in_progress
        run_iteration
        # update the best result
        best = @best
        @best = @algorithm.best
        ptext = @best[:parameters].each_pair.map{ |k, v| "#{k}:#{v}" }.join(", ")
        if @best &&
           @best.key?(:score) &&
           best &&
           best.key?(:score) &&
           @best[:score] > best[:score]
           unless @verbosity == :silent
             puts "found a new best score: #{@best[:score]} "+
                  "for parameters #{ptext}"
           end
        end
        # have we finished?
        in_progress = !@algorithm.finished? && @scores.size < max_scores
        if in_progress && !(@timelimit.nil?)
          in_progress = (Time.now - start_time < @timelimit)
        end
      end
      @algorithm.write_data if @algorithm.respond_to? :write_data
      unless @verbosity == :silent
        puts "found optimum score: #{@best[:score]} for parameters "+
             "#{@best[:parameters]} in #{@iteration_count} iterations."
      end
      return @best
    end
def run
      start_time = Time.now
      in_progress = true
      @algorithm.setup @start
      @current_params = @start
      max_scores = @target.count_parameter_permutations
      while in_progress
        run_iteration
        # update the best result
        best = @best
        @best = @algorithm.best
        ptext = @best[:parameters].each_pair.map{ |k, v| "#{k}:#{v}" }.join(", ")
        if @best &&
           @best.key?(:score) &&
           best &&
           best.key?(:score) &&
           @best[:score] > best[:score]
           unless @verbosity == :silent
             puts "found a new best score: #{@best[:score]} "+
                  "for parameters #{ptext}"
           end
        end
        # have we finished?
        in_progress = !@algorithm.finished? && @scores.size < max_scores
        if in_progress && !(@timelimit.nil?)
          in_progress = (Time.now - start_time < @timelimit)
        end
      end
      @algorithm.write_data if @algorithm.respond_to? :write_data
      unless @verbosity == :silent
        puts "found optimum score: #{@best[:score]} for parameters "+
             "#{@best[:parameters]} in #{@iteration_count} iterations."
      end
      return @best
    end
Runs the experiment until the completion criteria
 are met. On completion, returns the best parameter
 set.