Skip to content

ConfigsGenAlg

Samuel Gomes edited this page Jul 1, 2024 · 23 revisions

ConfigsGenAlg

ConfigsGenAlg is an abstract class for the group organization algorithms. These algorithms are usually called coalition structure generation algorithms. This class also manipulates learner constraints. Such constraints inform the system about learners that should be joined or separated.

Note: Some of these approaches were renamed since the current master deployment.

Constraint Representation

A constraint is represented by a dictionary { players: int[], type: string {"JOINT","SEPARATE"} } with the following entries:

Name: expected type Description
players: int[] The list of players that are associated to the constraint.
type: string {"JOINT","SEPARATE"} The type of constraint.

Constructor and Attributes

Constructor

+ ConfigsGenAlg(playerModelBridge: PlayerModelBridge,
        interactionsProfileTemplate: InteractionsProfile,
        taskModelBridge: TaskModelBridge,
        preferredNumberOfPlayersPerGroup: int = None,
        minNumberOfPlayersPerGroup: int = 2,
        maxNumberOfPlayersPerGroup: int = 5,
        jointPlayerConstraints: string = "",
        separatedPlayerConstraints: string = ""): void

Attributes

Name: expected type Default value Description
playerModelBridge: PlayerModelBridge - The connector for the players data model.
interactionsProfileTemplate: InteractionsProfile - A template for creating interaction profiles. When creating interaction profiles, the template informs the system about the number of interaction dimensions to be considered as well as their designations.
taskModelBridge: TaskModelBridge - The connector for the tasks data model.
preferredNumberOfPlayersPerGroup: int None A preferred group size to consider. When filled (not None), the configurations will try following a fixed group size. Whenever such cannot be achieved, the system distributes the remaining learners by the already formed groups.
minNumberOfPlayersPerGroup: int 2 The minimum group size to consider.
maxNumberOfPlayersPerGroup: int 5 The maximum group size to consider.
jointPlayerConstraints: int[][] - Informs the system about the learners that should be assigned to the same group.
separatedPlayerConstraints: int[][] - Informs the system about the learners that should be assigned to different group.
allPlayerConstraints: [] - All learner constraints registered by the system (see above the representation of a constraint).

Methods

+ init(): void

Description

Abstract method to be used for initializing a configuration algorithm if data is stored between iterations.

+ reset(): void

Description

Abstract method to be used for resetting the configuration algorithm if data is stored between iterations.

+ organize(): dict { groups: int[][], profiles: InteractionsProfile[], avgCharacteristics: PlayerCharacteristics[], tasks: int[] }

Description

Purely virtual method used to generate and return a group configuration.

Return

Returns a dictionary with the following entries:

Name: expected type Description
groups: int[][] An array of groups, with each group represented as an array of IDs.
profiles: InteractionsProfile[] The profiles for each group, in the order that the groups appear in groups.
avgCharacteristics: PlayerCharacteristics[] The average learning states of each group, in the order that the groups appear in groups.
tasks: int[] The tasks assigned for each group, in the order that the groups appear in groups.

+ addJointPlayersConstraints(players: int[]): void

Description

Adds a constraint informing the system that the learners in players should be assigned to the same group.

Parameters

Name: expected type Default value Description
players: int[] - The list of learner IDs that are associated to the constraint.

+ addSeparatedPlayersConstraints(players: int[]): void

Description

Adds a constraint informing the system that the learners in players should be assigned to different groups.

Parameters

Name: expected type Default value Description
players: int[] - The list of learner IDs that are associated to the constraint.

+ resetPlayersConstraints(): void

Description

Removes all constraints from the system.

+ getPlayerConstraints(): <constraint>[]

Description

Retrieves all current group formation constraints. See above for the representation of constraints.

# fromStringConstraintToList(constraints: string): <constraint>[]

Description

Converts a string to constraints as represented by the system (see above).

Parameters

Name: expected type Default value Description
constraints: string - The string to be parsed for constraints.

# randomConfigGenerator(playerIds: int[], minNumGroups: int, maxNumGroups: int): int[][]

Description

An auxiliary method that generates a random group configuration.

Parameters

Name: expected type Default value Description
playerIds: int[] - The IDs of the learners considered for group organization.
minNumGroups: int - The minimum number of groups to form.
maxNumGroups: int - The maximum number of groups to form.

Return

Expected type Description
int[][] An array of groups, with each group represented as an array of IDs.

Example

regAlg = KNNRegression(playerModelBridge = playerBridge, numberOfNNs = 5)
intProfTemplate2D = InteractionsProfile(dimensions = {"dim_0": 0, "dim_1": 0})

configsAlg = PureRandomSearchConfigsGen(
	playerModelBridge = playerBridge, 
	interactionsProfileTemplate = intProfTemplate2D.generateCopy(), 
	regAlg = regAlg, 
	persEstAlg = ExplorationPreferencesEstAlg(
		playerModelBridge = playerBridge, 
		interactionsProfileTemplate = intProfTemplate2D.generateCopy(), 
		regAlg = regAlg,
		numTestedPlayerProfiles = numTestedPlayerProfilesInEst, 
		qualityWeights = PlayerCharacteristics(ability=0.5, engagement=0.5)), 
	numberOfConfigChoices = numberOfConfigChoices, 
	preferredNumberOfPlayersPerGroup = preferredNumberOfPlayersPerGroup, 
	qualityWeights = PlayerCharacteristics(ability=0.5, engagement=0.5)
)

print(configsAlg.organize())

# Example return for a 10 learner class: {'groups': [[6, 0, 2, 7], [1, 5, 4, 3], [9, 8]], 'profiles': 
#[<InteractionsProfile.InteractionsProfile object at 0x7f426050bad0>, <InteractionsProfile.InteractionsProfile object 
#at 0x7f426050bb10>, <InteractionsProfile.InteractionsProfile object at 0x7f426050bcd0>], 'avgStates': 
#[<PlayerStructs.PlayerState object at 0x7f426050bb50>, <PlayerStructs.PlayerState object at 0x7f426050bc10>, 
#<PlayerStructs.PlayerState object at 0x7f426050bbd0>]}

Clone this wiki locally