Skip to content

EvolutionaryConfigsGenAlg

Samuel Gomes edited this page Jul 2, 2024 · 12 revisions

EvolutionaryConfigsGenAlg

This class is a child of ConfigsGenAlg. It uses the genetic algorithm (GA) implementation present in the DEAP library to optimize the generation of group configurations and preferences. A summarized description of GAs is given in the following website. Using this algorithm instead of the previous ones is that instead of just exploring new solutions, it also exploits the current ones while maintaining scalability.

Genetic Structures and Operators

Chromosome Representation

In the context of group organization, a chromosome (or individual) is a group configuration. As such, an individual in our GA implementation is represented using two attributes, the distribution of learners in groups, and a set of InteractionProfiles, one for each group.

For example:

<Individual> ind = [ 
   [
    [1,2,3,4], 
    [5,6,7,8], 
    [9,10,11,12], 
    [13,14,15,16]], 
   [
    <InteractionProfile: {0.86, 0.25}>, 
    <InteractionProfile: {0.12, 0.54}>,
    <InteractionProfile: {0.50, 0.21}>,
    <InteractionProfile: {0.14, 0.97}>
   ]
]

Selection

The currently used selection algorithm is the tools.selBest implemented by DEAP.

Crossover

The crossover operator works on two phases. Firstly, two group configurations are merged in a similar fashion to the method used in the following research paper. Next, the profiles of each group are uniformly crossed over.

Mutation

Similar to the crossover operator, the mutation uses two distinct phases. For the group configuration, the mutation is performed as a crossover with a random configuration, with probability probOfMutationConfig. For the profiles, there is a 50% chance of each dimension decreasing or increasing by a random amount (these changes are currently limited to 0.2). The mutation of each dimension of each profile is computed with probability probOfMutationGIPs.

Fitness Calculation

The fitness is computed resorting to a given QualityEvalAlg.

Constructor and Attributes

Constructor

+ EvolutionaryConfigsGenAlg(playerModelBridge,
        interactionsProfileTemplate,
        qualityEvalAlg: QualityEvalAlg,
        persEstAlg: PreferencesEstAlg,
        preferredNumberOfPlayersPerGroup: int = None,
        minNumberOfPlayersPerGroup: int = 2,
        maxNumberOfPlayersPerGroup: int = 5,
        initialPopulationSize: int = 100,
        numberOfEvolutionsPerIteration: int = 500, 
        
        probOfCross: decimal = 0.7,         
        
        probOfMutation: decimal = 0.2,        
        probOfMutationConfig: decimal = 0.2,         
        probOfMutationGIPs: decimal = 0.2,

        numChildrenPerIteration: int = 5,
        numSurvivors: int = 5,

        cxOp: string {"order", "simple"} = "order",
       
        jointPlayerConstraints: string = "",
        separatedPlayerConstraints: string = ""): void

Attributes

Name: expected type Default value Description
qualityEvalAlg: QualityEvalAlg - The algorithm used to evaluate the quality of a group configuration.
prefEstAlg: PreferencesEstAlg - The algorithm used to estimate the preference of a learner from their past states.
initialPopulationSize: int 100 The number of individuals to generate before the first genetic iteration.
numberOfEvolutionsPerIteration: int 500 The number of genetic iterations to perform each time the GA is executed (organize is called).
probOfCross: decimal 0.7 The probability of selecting the cross operator.
probOfMutation: decimal 0.2 The probability of selecting the mutation operator.
probOfMutationConfig: decimal 0.2 The probability of mutating the group configurations within the mutation operator.
probOfMutationGIPs: decimal 0.2 The probability of mutating the group profiles within the mutation operator.
numSurvivors: int 5 The number of allowed survivors between genetic iterations.
cxOp: string {"order", "simple"} "order" Allows to use a simple crossover operator (see below), for debug purposes.

Methods

- resetGenAlg(): void

Description

Resets the population and current best solutions of the GA. Currently called before the GA execution in every organize.

- randomIndividualGenerator(playerIds: int[], maxNumGroups: int, minNumGroups: int): <Individual>

Description

Internal method used to generate a random chromosome (group configuration with profiles).

- randomProfileGenerator(): InteractionsProfile

Description

Internal method used to generate a random profile.

- cxGIMME_Order(ind1: <Individual>, ind2: <Individual>): (<Individual>, <Individual>)

Description

Internal method implementing the crossover operator (see above).

- cxGIMME_Simple(ind1: <Individual>, ind2: <Individual>): (<Individual>, <Individual>)

Description

(legacy) Internal method implementing a crossover operator used for debug purposes.

- mutGIMME(individual: <Individual>, pGIPs: decimal, pConfig: decimal): (<Individual>)

Description

Internal method implementing the mutation operator.

- calcFitness(individual: <Individual>): decimal

Description

Internal method to obtain an individual's fitness resorting to the QualityEvalAlg passed in the constructor.

- calcFitness_convergenceTest(individual: <Individual>): decimal

Description

(legacy) Internal method that calculates fitness in a way that makes the GA approximate a given fixed chromosome. This was used for debug purposes.

- selGIMME(individuals: <Individual>[], k: int, fit_attr: string = "fitness"): <Individual>[]

Description

Prepares and calls the method selBest from DEAP.

Clone this wiki locally