parameters: (
          prob_orig=problem.ackley(10),
          noise=0.3,
          pop_n=20,
          num_winner=4,
          eval_budget=200)
return_statement: return errors
docstring: Returns a list containing the rank-sum error rates of different methods.
  
      Rank-sum error rates: The same metric used in the C++ tests.
  
      The error is defined as the difference between the true ranks sum and the
      returned ranks sum. For example if race returns [1,3,5], then the error is
      (1+3+5) - (0+1+2) = 6. The allowed error is the size of the returned list,
      corresponding, to allow just losing the winner (i.e. [1,2,3] is still valid, but
      [1,2,4] not)
docstring_summary: Returns a list containing the rank-sum error rates of different methods.
docstring_tokens: Returns a list containing the rank - sum error rates of different methods .
function: def get_rank_sum_errors(
          prob_orig=problem.ackley(10),
          noise=0.3,
          pop_n=20,
          num_winner=4,
          eval_budget=200):
      """
      Returns a list containing the rank-sum error rates of different methods.
  
      Rank-sum error rates: The same metric used in the C++ tests.
  
      The error is defined as the difference between the true ranks sum and the
      returned ranks sum. For example if race returns [1,3,5], then the error is
      (1+3+5) - (0+1+2) = 6. The allowed error is the size of the returned list,
      corresponding, to allow just losing the winner (i.e. [1,2,3] is still valid, but
      [1,2,4] not)
      """
  
      prob_noisy = problem.noisy(prob_orig, 1, 0, noise)
  
      pop_orig = population(prob_orig, pop_n)
  
      # Increase the level of difficulty
      # algo = algorithm.pso(gen=50)
      # pop_orig = algo.evolve(pop_orig)
  
      # True ordering of the individuals
      winners_orig = pop_orig.get_best_idx(pop_n)
  
  # Individuals are already sorted by their true quality in pop_noisy
      pop_noisy = population(prob_noisy)
      for ind_idx in winners_orig:
          pop_noisy.push_back(pop_orig[ind_idx].cur_x)
  
  # In perfect case, rank sum should be sum([0,1,2,....,num_winner-1])
      ground_truth = ((num_winner - 1) + 1) * (num_winner - 1) / 2
  
      # Worse possible error
      # normalize_factor = (((pop_n-1)+1)*(pop_n-1) / 2  - ground_truth) - ground_truth
  
      errors = []
  
      # Results from different methods:
      winners_racing, fevals = pop_noisy.race(
          num_winner, 0, eval_budget, 0.05, [])
      error_race = sum(winners_racing) - ground_truth
      errors.append(error_race)
  
      winners_brute_force_rank = brute_force_average_rank(
          pop_noisy, num_winner, eval_budget)
      error_bf_rank = sum(winners_brute_force_rank) - ground_truth
      errors.append(error_bf_rank)
  
      if(prob_noisy.f_dimension == 1 and prob_noisy.c_dimension == 0):
          winners_brute_force_f = brute_force_average_f(
              pop_noisy, num_winner, eval_budget)
          error_bf_f = sum(winners_brute_force_f) - ground_truth
          errors.append(error_bf_f)
  
      return errors
function_tokens: def get_rank_sum_errors ( prob_orig = problem . ackley ( 10 ) , noise = 0.3 , pop_n = 20 , num_winner = 4 , eval_budget = 200 ) : prob_noisy = problem . noisy ( prob_orig , 1 , 0 , noise ) pop_orig = population ( prob_orig , pop_n ) # Increase the level of difficulty # algo = algorithm.pso(gen=50) # pop_orig = algo.evolve(pop_orig) # True ordering of the individuals winners_orig = pop_orig . get_best_idx ( pop_n ) # Individuals are already sorted by their true quality in pop_noisy pop_noisy = population ( prob_noisy ) for ind_idx in winners_orig : pop_noisy . push_back ( pop_orig [ ind_idx ] . cur_x ) # In perfect case, rank sum should be sum([0,1,2,....,num_winner-1]) ground_truth = ( ( num_winner - 1 ) + 1 ) * ( num_winner - 1 ) / 2 # Worse possible error # normalize_factor = (((pop_n-1)+1)*(pop_n-1) / 2  - ground_truth) - ground_truth errors = [ ] # Results from different methods: winners_racing , fevals = pop_noisy . race ( num_winner , 0 , eval_budget , 0.05 , [ ] ) error_race = sum ( winners_racing ) - ground_truth errors . append ( error_race ) winners_brute_force_rank = brute_force_average_rank ( pop_noisy , num_winner , eval_budget ) error_bf_rank = sum ( winners_brute_force_rank ) - ground_truth errors . append ( error_bf_rank ) if ( prob_noisy . f_dimension == 1 and prob_noisy . c_dimension == 0 ) : winners_brute_force_f = brute_force_average_f ( pop_noisy , num_winner , eval_budget ) error_bf_f = sum ( winners_brute_force_f ) - ground_truth errors . append ( error_bf_f ) return errors