nodes: 0, module; 1, function_definition; 2, function_name:rankingEval; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, expression_statement; 11, for_statement; 12, expression_statement; 13, comment:# Compute the selection probabilities of each individual; 14, expression_statement; 15, expression_statement; 16, for_statement; 17, expression_statement; 18, expression_statement; 19, return_statement; 20, string; 21, assignment; 22, assignment; 23, identifier:i; 24, call; 25, block; 26, assignment; 27, identifier:i; 28, call; 29, block; 30, assignment; 31, assignment; 32, assignment; 33, identifier:i; 34, call; 35, block; 36, assignment; 37, assignment; 38, list; 39, string_content:Sorting the pop. base on the fitnessEval result; 40, identifier:fitnessAll; 41, call; 42, identifier:fitnessNorm; 43, call; 44, identifier:range; 45, argument_list; 46, expression_statement; 47, expression_statement; 48, identifier:maxFitness; 49, call; 50, identifier:range; 51, argument_list; 52, expression_statement; 53, identifier:fitnessSorted; 54, call; 55, identifier:probability; 56, call; 57, identifier:S; 58, float:2.0; 59, identifier:range; 60, argument_list; 61, expression_statement; 62, attribute; 63, integer:1; 64, attribute; 65, identifier:fitnessAll; 66, identifier:fitnessAll; 67, subscript; 68, identifier:probability; 69, attribute; 70, argument_list; 71, attribute; 72, argument_list; 73, attribute; 74, call; 75, assignment; 76, attribute; 77, argument_list; 78, attribute; 79, assignment; 80, attribute; 81, argument_list; 82, attribute; 83, argument_list; 84, attribute; 85, assignment; 86, identifier:self; 87, identifier:rankingComputed; 88, identifier:self; 89, identifier:fitness; 90, identifier:fitnessSorted; 91, slice; 92, identifier:numpy; 93, identifier:zeros; 94, attribute; 95, identifier:numpy; 96, identifier:zeros; 97, attribute; 98, identifier:self; 99, identifier:length; 100, attribute; 101, argument_list; 102, subscript; 103, attribute; 104, identifier:fitnessAll; 105, identifier:max; 106, identifier:self; 107, identifier:length; 108, subscript; 109, binary_operator:(maxFitness - fitnessAll[i]) / maxFitness; 110, identifier:fitnessNorm; 111, identifier:argsort; 112, identifier:numpy; 113, identifier:zeros; 114, attribute; 115, identifier:self; 116, identifier:length; 117, subscript; 118, binary_operator:((2-S)/self.length) + (2*i*(S-1))/(self.length*(self.length-1)); 119, unary_operator; 120, identifier:self; 121, identifier:length; 122, identifier:self; 123, identifier:length; 124, subscript; 125, identifier:fitnessEval; 126, identifier:fitnessAll; 127, identifier:i; 128, subscript; 129, identifier:fitness; 130, identifier:fitnessNorm; 131, identifier:i; 132, parenthesized_expression; 133, identifier:maxFitness; 134, identifier:self; 135, identifier:length; 136, identifier:probability; 137, subscript; 138, parenthesized_expression; 139, binary_operator:(2*i*(S-1))/(self.length*(self.length-1)); 140, integer:1; 141, attribute; 142, identifier:i; 143, attribute; 144, identifier:i; 145, binary_operator:maxFitness - fitnessAll[i]; 146, identifier:fitnessSorted; 147, identifier:i; 148, binary_operator:(2-S)/self.length; 149, parenthesized_expression; 150, parenthesized_expression; 151, identifier:self; 152, identifier:Ind; 153, identifier:self; 154, identifier:Ind; 155, identifier:maxFitness; 156, subscript; 157, parenthesized_expression; 158, attribute; 159, binary_operator:2*i*(S-1); 160, binary_operator:self.length*(self.length-1); 161, identifier:fitnessAll; 162, identifier:i; 163, binary_operator:2-S; 164, identifier:self; 165, identifier:length; 166, binary_operator:2*i; 167, parenthesized_expression; 168, attribute; 169, parenthesized_expression; 170, integer:2; 171, identifier:S; 172, integer:2; 173, identifier:i; 174, binary_operator:S-1; 175, identifier:self; 176, identifier:length; 177, binary_operator:self.length-1; 178, identifier:S; 179, integer:1; 180, attribute; 181, integer:1; 182, identifier:self; 183, identifier:length
code: def rankingEval(self):
  		'''
  		Sorting the pop. base on the fitnessEval result
  		'''
  		fitnessAll = numpy.zeros(self.length)
  		fitnessNorm = numpy.zeros(self.length)
  
  		for i in range(self.length):
  			self.Ind[i].fitnessEval()
  			fitnessAll[i] = self.Ind[i].fitness
  
  		maxFitness = fitnessAll.max()
  		for i in range(self.length):
  			fitnessNorm[i] = (maxFitness - fitnessAll[i]) / maxFitness
  		fitnessSorted = fitnessNorm.argsort()
  
  		# Compute the selection probabilities of each individual
  		probability = numpy.zeros(self.length)
  		S = 2.0
  		for i in range(self.length):
  			probability[fitnessSorted[i]] = ((2-S)/self.length) + (2*i*(S-1))/(self.length*(self.length-1))
  		self.rankingComputed = 1
  		self.fitness = 	fitnessAll
  
  		return [fitnessAll, fitnessSorted[::-1], probability]