Skip to content

ConfigsGenAlg

Samuel Gomes edited this page Jun 23, 2020 · 23 revisions

ConfigsGenAlg

ConfigsGenAlg is an abstract base class for the group organization algorithms. These algorithms are usually called coalition structure generation algorithms. GIMME currently implements a few of them, such as: a purely random generator; an exploratory algorithm which does not save any information between iterations; a genetic driven approach (still to be fully implemented); etc...

Constructor and Attributes

Constructor

ConfigsGenAlg(numberOfConfigChoices, minNumberOfPlayersPerGroup, maxNumberOfPlayersPerGroup, preferredNumberOfPlayersPerGroup, fitnessWeights, regAlg)

Attributes

Name: expected type Default value Description
playerModelBridge: PlayerModelBridge - The connector for the players data model
interactionsProfileTemplate: InteractionsProfile - A template for creating new profiles. The template acts as a facilitator to not only the number of interaction dimensions to be considered, but also their designations.
preferredNumberOfPlayersPerGroup: int None A preferred group size to consider. When filled (=/= None), the configurations will try following a fixed group size (with the few smaller groups containing the remaining players)
minNumberOfPlayersPerGroup: int 2 The minimum group size to consider
maxNumberOfPlayersPerGroup: int 5 The maximum group size to consider

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.

randomConfigGenerator(playerIds, minNumGroups, maxNumGroups): void

Description

Auxiliary method which generates a random group configuration.

organize(): int[][]

Description

Actually performs the group organization and returns a group configuration (or coalition structure).

updateMetrics( generatedConfig: int[][] ) : void

Description

Updates groupSizeFreqs and configSizeFreqs.

Name: expected type Default value Description
generatedConfig: int[][] - The generated group organization

Example

configsAlg = SimpleConfigsGen(playerBridge, regAlg = KNNRegression(playerBridge, 5), numberOfConfigChoices=100, preferredNumberOfPlayersPerGroup = 4, qualityWeights = PlayerCharacteristics(ability=0.5, engagement=0.5))
print(configsAlg.organize())

# Example return for a 10 player 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