This function validates a provided batch assignment or generates random batch assignments for individuals.
Arguments
- batch
Either an integer specifying the number of batches or a vector/list of batch assignments for all individuals.
- n
An integer specifying the number of individuals in the population.
Value
A list containing:
batches
A list where each element contains the indices of individuals assigned to a specific batch.
nb_batch
The total number of batches.