Skip to content

TaskModelBridge

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

TaskModelBridge

The task model bridge connects the execution of the GIMME processes to the task data storage. After creating a child class, the programmer is required to implement several methods so that the algorithms can fetch task data.

Constructor

TaskModelBridge(): void

Functions

get_all_task_ids(): string[]

Description

A method called whenever a list of all task ids are needed. Must return an array.

get_task_interactions_profile(taskId: string): InteractionsProfile

Description

A method called whenever the InteractionsProfile of a certain task is needed. Must return an InteractionsProfile.

get_min_task_required_ability(taskId: string): decimal

Description

A method called whenever an estimation for the difficulty percentage of the task is needed. Must return a decimal.

get_min_task_duration(taskId: string): Date

Description

A method called whenever an estimation for the duration of the task is needed. Must return a Date.

get_task_init_date(taskId: string): Date

Description

A method called whenever the initial date of a task is needed. Must return a Date.

get_task_final_date(taskId: string): Date

Description

A method called whenever the final date of a task is needed. Must return a Date.

get_task_difficulty_weight(taskId: string): decimal {0.0..1.0}

Description

A method called to find the importance given to the difficulty when selecting a task. Must return a decimal number between 0.0 and 1.0.

get_task_profile_weight(taskId: string): decimal {0.0..1.0}

Description

A method called to find the importance given to the interaction profile when selecting a task. Must return a decimal number between 0.0 and 1.0.

get_task_diversity_weight(taskId: string): decimal {0.0..1.0}

Description

A method called to inform how much group diversity is adequate when selecting a task. Must return a decimal number between 0.0 and 1.0.

Example

from GIMMECore import TaskModelBridge

class CustomTaskModelBridge(TaskModelBridge):
    def __init__(self):
        self.tasks = []

    def clear_tasks(self):
        self.tasks = []

    def register_new_task(self, task_id, description, min_required_ability, profile, min_duration, difficulty_weight,
                          profile_weight):
        new_task = TaskModelMock(task_id, description, min_required_ability, profile, min_duration,
                                 difficulty_weight, profile_weight)
        if int(task_id) < len(self.tasks):
            self.tasks[task_id] = new_task
        else:
            self.tasks.append(new_task)

    def get_all_task_ids(self):
        return [str(task.id) for task in self.tasks]

    def get_task_interactions_profile(self, task_id):
        return self.tasks[int(task_id)].profile

    def get_min_task_required_ability(self, task_id):
        return self.tasks[int(task_id)].min_required_ability

    def get_min_task_duration(self, task_id):
        return self.tasks[int(task_id)].min_duration

    def get_task_difficulty_weight(self, task_id):
        return self.tasks[int(task_id)].difficulty_weight

    def get_task_profile_weight(self, task_id):
        return self.tasks[int(task_id)].profile_weight

    def get_task_init_date(self, task_id):
        return self.tasks[int(task_id)].initDate

    def get_task_final_date(self, task_id):
        return self.tasks[int(task_id)].finalDate

    def get_task_diversity_weight(self, task_id):
        return 0.5

Clone this wiki locally