from functools import reduce
from operator import add


def fitness(individual, target):
    """
    Calculutes the fitness of an individual, lower is better
    :param individual: individual to calculate fitness
    :param target: the target value to achieve
    """
    result = reduce(add, individual, 0)
    return abs(target-result)