Skip to content

ConfigsGenAlg

Samuel Gomes edited this page Jul 12, 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 in newest versions (see version 1.6.5. for the previous names).

Representations

Group Configurations

A complete group configuration returned by a ConfigsGenAlg is 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.

Constraints

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.

Groups as Binary Numbers

For efficiency, this class enables the encoding of a group to an integer, making use of its binary representation. For this representation, the enabled bits of a number represent the player ids in the group.

Constructor and Members

Constructor

ConfigsGenAlg(player_model_bridge: PlayerModelBridge,
        interactions_profile_template: InteractionsProfile,
        preferred_num_players_per_group: int = None,
        min_num_players_per_group: int = 2,
        max_num_players_per_group: int = 5,
        joint_player_constraints: string = "",
        separated_player_constraints: string = ""): void

Members

Name: expected type Default value Description
_player_model_bridge: PlayerModelBridge - The connector for the players data model.
_interactions_profile_template: 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.
_min_num_players_per_group*: int 2 The minimum group size to consider.
_max_num_players_per_group*: int 5 The maximum group size to consider.
_joint_players_constraints: int[][] - Informs the system about the learners that should be assigned to the same group.
_separated_players_constraints: int[][] - Informs the system about the learners that should be assigned to different group.
_all_constraints: [] - All learner constraints registered by the system (see above the representation of a constraint).

*A preferred_num_players_per_group may be passed instead, informing 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.

Functions

organize(): <group configuration>

Description

Used to generate and return a group configuration (see above).

add_joint_players_constraints(players: int[]): void

Description

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

add_separated_players_constraints(players: int[]): void

Description

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

reset_players_constraints(): void

Description

Removes all constraints from the system.

get_player_constraints(): dict<constraint>

Description

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

get_completion_percentage(): decimal

Description

(auxiliary) Returns the current completion percentage of the algorithm.

_random_config_generator(player_ids: int[], min_num_groups: int, max_num_groups: int): int[][]

Description

Generates a random group configuration.

Return

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

_verify_coalition_validity(config: int[], 
                            player_joint_requirements: int[][], 
                            player_separated_requirements: int[][], players_without_group: int[]): int[]

Description

Verifies if a group (coalition) follows constraints, and returns an updated group (used in _random_config_generator).

_from_string_constraint_to_list(constraints: string): <constraint>[]

Description

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

_convert_coalition_from_byte_to_bit_format(coalition_in_byte_format: int[][], coalition_size: int): int

Description

Converts a group as represented by the system to a binary representation (see above).

_get_group_from_bit_format(coalition: int): int[]

Description

Converts a group as represented by a binary number (see above) to the conventional system representation.

_convert_from_byte_to_ids(coalition: int[]): int[]

Description

Receives a group and converts its flexible player ids to numeric ones.

_convert_from_ids_to_bytes(coalition: int[]): int[]

Description

Receives a group and converts its numeric player ids to the system ones (represented by a string).

_convert_set_of_combinations_from_bit_format(set_of_combinations_in_bit_format: int[]): int[][]

Description

Converts a set of groups in binary format to a set of player id lists.

_compute_coalitions_restrictions(): (int[],int[])

Description

Returns a pair informing players to be joined (first member) and separated (second member).

_convert_cs_bytes_to_dict(cs_in_byte_format: int[][], 
                            coalitions_profiles: InteractionsProfile[][], 
                            coalitions_avg_characteristics: PlayerCharacteristics[][]): dict { groups: int[][], profiles: InteractionsProfile[], avgCharacteristics: PlayerCharacteristics[], tasks: int[] }

Description

Joins different lists as a dictionary with the group configuration system format (see above).

Example

#Initialization of configs generation
int_prof_2d = InteractionsProfile({"dim_0": 0, "dim_1": 0})
configs_alg = ConfigsGenAlg(
    player_model_bridge=player_bridge,
    interactions_profile_template=int_prof_2d.generate_copy(),
    preferred_num_players_per_group=4
)
...

Clone this wiki locally