def fitness(W, D, sol):
    """
    Fitness will compute the value of our solution.
    We assume that:
        - W is the flow matrix
        - D is the distance matrix
        - sol is a solution
    We assume that W,D are some numpy matrix
    Sol is a list.
    """
    res = 0
    for i in range(len(sol)):
        for j in range(i+1, len(sol)):
            # we take the object i in sol and object j
            # we substract 1 beacause we count from 0
            res += W[i, j] * D[sol[i] - 1, sol[j] - 1]
    return 2 * res