def calc_discrete_entropy_2(agent_stats, skill_headers=None, verbose=False, pop=None, punish_youth=True):
    agent_skills = get_pop_stats(agent_stats['skills'], pop)
    lifespans = get_pop_stats(agent_stats['lifespans'], pop)
    agent_skills_0 = agent_skills = np.vstack(agent_skills)
    lifespans = np.hstack(lifespans)
    n_agents = lifespans.shape[0]
    if (n_agents == 1):
        return (- np.float('inf'))
    n_skills = agent_skills.shape[1]
    if verbose:
        print('skills')
        print(agent_skills_0.transpose())
        print('lifespans')
        print(lifespans)
    agent_skills = np.where((agent_skills == 0), 1e-07, agent_skills)
    if punish_youth:
        a_skills = contract_by_lifespan(agent_skills, lifespans)
    div_agents = skbio.diversity.alpha_diversity('shannon', a_skills).mean()
    div_skills = skbio.diversity.alpha_diversity('shannon', a_skills.transpose()).mean()
    score = (- (div_agents * div_skills))
    score = score
    if verbose:
        print('Score:', score)
    return score
def calc_discrete_entropy_2(agent_stats, skill_headers=None, verbose=False, pop=None, punish_youth=True):
    agent_skills = get_pop_stats(agent_stats['skills'], pop)
    lifespans = get_pop_stats(agent_stats['lifespans'], pop)
    agent_skills_0 = agent_skills = np.vstack(agent_skills)
    lifespans = np.hstack(lifespans)
    n_agents = lifespans.shape[0]
    if (n_agents == 1):
        return (- np.float('inf'))
    n_skills = agent_skills.shape[1]
    if verbose:
        print('skills')
        print(agent_skills_0.transpose())
        print('lifespans')
        print(lifespans)
    agent_skills = np.where((agent_skills == 0), 1e-07, agent_skills)
    if punish_youth:
        a_skills = contract_by_lifespan(agent_skills, lifespans)
    div_agents = skbio.diversity.alpha_diversity('shannon', a_skills).mean()
    div_skills = skbio.diversity.alpha_diversity('shannon', a_skills.transpose()).mean()
    score = (- (div_agents * div_skills))
    score = score
    if verbose:
        print('Score:', score)
    return score