Description:
        Generate a mixture of 2 Plackett-Luce models dataset
        and return the parameters and votes.
    Parameters:
        n:            number of votes to generate
        m:            number of alternatives
        useDirichlet: boolean flag to use the Dirichlet distribution

def generate_mix2pl_dataset(n, m, useDirichlet=True):
    """
    Description:
        Generate a mixture of 2 Plackett-Luce models dataset
        and return the parameters and votes.
    Parameters:
        n:            number of votes to generate
        m:            number of alternatives
        useDirichlet: boolean flag to use the Dirichlet distribution
    """

    alpha = np.random.rand()
    gamma1 = None
    gamma2 = None

    if useDirichlet:
        gamma1 = np.random.dirichlet(np.ones(m))
        gamma2 = np.random.dirichlet(np.ones(m))
    else:
        gamma1 = np.random.rand(m)
        gamma1 /= np.sum(gamma1) # normalize sum to 1.0 (not needed for Dirichlet)
        gamma2 = np.random.rand(m)
        gamma2 /= np.sum(gamma1)

    votes = []

    for i in range(n):
        vote = None
        draw = np.random.rand()
        if draw <= alpha:
            vote = draw_pl_vote(m, gamma1)
        else: # draw > alpha
            vote = draw_pl_vote(m, gamma2)
        votes.append(vote)
    params = np.hstack((alpha, gamma1, gamma2))
    return (params, votes)