def evalXKCD(individual, target_price):
 price = 0.0
 times = list()
 for (item, number) in individual.items():
  price += (ITEMS[item][0] * number)
  times.append(ITEMS[item][1])
 return (abs((price - target_price)), max(times))

def evalXKCD ( individual , target_price ) : price = 0.0 times = list ( ) for ( item , number ) in individual . items ( ) : price += ( ITEMS [ item ] [ 0 ] * number ) times . append ( ITEMS [ item ] [ 1 ] ) return ( abs ( ( price - target_price ) ) , max ( times ) )
evaluates the fitness and return the error on the price and the time taken by the order if the chef can cook everything in parallel .