function evaluate_fitness(state::Matrix{Float64},evo_config::POOLConfig)
    colors = unique(state)
    filter!(e->e!=0,colors)
    n_color = size(colors,1)
    
    matches = 0
    
    for j in 1:size(state,2)
        for i in 1:size(state,1)
            
            if state[i,j] == evo_config.flag[i,j]
                matches += 1
            end
        end
    end
    
    return exp(-(n_color - 3)^2)*matches

end

function evaluate_fitness(state::Matrix{Float64},evo_config::EMAPConfig)
    
    colors = unique(state)
    filter!(e->e!=0,colors)
    n_color = size(colors,1)
    
    if n_color in evo_config.families
        
        section_step = Int(floor(size(state,2)/n_color))
        
        choices = permutations(colors) |> collect
        
        results = []
        
        for layout in choices
            
            matches = 0
            
            start = 1

            for section in 1:n_color
                
                for j in (1 + (start - 1)*section_step):min(start*section_step,size(state,2))
                    for i in 1:size(state,1)

                        if state[i,j] == layout[section]
                            matches += 1
                        end
                    end
                end
                
                start += 1
            end
            
            push!(results,matches)
        end
        
        fingerprint = 1
        
        for i in colors
            if i == 1
                fingerprint += 2^3
            elseif i == 2
                fingerprint += 2^2
            elseif i == 3
                fingerprint += 2^1
            elseif i == 4
                fingerprint += 2^0
            else
                fingerprint = "error"
            end
        end
        
        return maximum(results),fingerprint
    else
        return 0,1
    end

end