def calculate_fitness(self):
if self.fitness is not None:<EOL><INDENT>raise Exception(<EOL>"<STR_LIT>".format(self.id)<EOL>+ "<STR_LIT>"<EOL>)<EOL><DEDENT>said_blue = self.infos(type=Meme)[<NUM_LIT:0>].contents == "<STR_LIT>"<EOL>proportion = float(<EOL>max(<EOL>self.network.nodes(type=RogersEnvironment)[<NUM_LIT:0>].infos(),<EOL>key=attrgetter("<STR_LIT:id>"),<EOL>).contents<EOL>)<EOL>self.proportion = proportion<EOL>is_blue = proportion > <NUM_LIT:0.5><EOL>if said_blue is is_blue:<EOL><INDENT>self.score = <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>self.score = <NUM_LIT:0><EOL><DEDENT>is_asocial = self.infos(type=LearningGene)[<NUM_LIT:0>].contents == "<STR_LIT>"<EOL>e = <NUM_LIT:2><EOL>b = <NUM_LIT:1><EOL>c = <NUM_LIT> * b<EOL>baseline = c + <NUM_LIT><EOL>self.fitness = (baseline + self.score * b - is_asocial * c) ** e<EOL>
Calculcate your fitness.