# builders.domain.scheduling.modes

Domain specification

Domain

# VaryingModeConsumption

Defines the most generic type of mode.

# Constructor VaryingModeConsumption

VaryingModeConsumption(
  mode_dict: dict[str, list[int]]
)

Initialize self. See help(type(self)) for accurate signature.

# get_resource_need_at_time ModeConsumption

get_resource_need_at_time(
  self,
resource_name: str,
time: int
)

Return the resource consumption for the given resource at the given time. Note that the time should be the time from the start of the execution of the task (starting from 0).

# _get_resource_need_at_time ModeConsumption

_get_resource_need_at_time(
  self,
resource_name: str,
time: int
)

Return the resource consumption for the given resource at the given time. Note that the time should be the time from the start of the execution of the task (starting from 0).

# ConstantModeConsumption

Defines a mode where the resource consumption is constant throughout the duration of the task.

# Constructor ConstantModeConsumption

ConstantModeConsumption(
  mode_dict: dict[str, int]
)

Initialize self. See help(type(self)) for accurate signature.

# get_resource_need ConstantModeConsumption

get_resource_need(
  self,
resource_name: str
)

Return the resource consumption for the given resource.

# get_resource_need_at_time ModeConsumption

get_resource_need_at_time(
  self,
resource_name: str,
time: int
)

Return the resource consumption for the given resource at the given time. Note that the time should be the time from the start of the execution of the task (starting from 0).

# _get_resource_need ConstantModeConsumption

_get_resource_need(
  self,
resource_name: str
)

Return the resource consumption for the given resource.

# _get_resource_need_at_time ModeConsumption

_get_resource_need_at_time(
  self,
resource_name: str,
time: int
)

Return the resource consumption for the given resource at the given time. Note that the time should be the time from the start of the execution of the task (starting from 0).

# MultiMode

A domain must inherit this class if tasks can be done in 1 or more modes.

# _get_tasks_ids MultiMode

_get_tasks_ids(
  self
) -> Union[set[int], dict[int, Any], list[int]]

Return a set or dict of int = id of tasks

# _get_tasks_modes MultiMode

_get_tasks_modes(
  self
) -> dict[int, dict[int, ModeConsumption]]

Return a nested dictionary where the first key is a task id and the second key is a mode id. The value is a Mode object defining the resource consumption. If the domain is an instance of VariableResourceConsumption, VaryingModeConsumption objects should be used. If this is not the case (i.e. the domain is an instance of ConstantResourceConsumption), then ConstantModeConsumption should be used.

E.g. with constant resource consumption { 12: { 1: ConstantModeConsumption({'rt_1': 2, 'rt_2': 0, 'ru_1': 1}), 2: ConstantModeConsumption({'rt_1': 0, 'rt_2': 3, 'ru_1': 1}), } }

E.g. with time varying resource consumption { 12: { 1: VaryingModeConsumption({'rt_1': [2,2,2,2,3], 'rt_2': [0,0,0,0,0], 'ru_1': [1,1,1,1,1]}), 2: VaryingModeConsumption({'rt_1': [1,1,1,1,2,2,2], 'rt_2': [0,0,0,0,0,0,0], 'ru_1': [1,1,1,1,1,1,1]}), } }

# SingleMode

A domain must inherit this class if ALL tasks only have 1 possible execution mode.

# _get_tasks_ids MultiMode

_get_tasks_ids(
  self
) -> Union[set[int], dict[int, Any], list[int]]

Return a set or dict of int = id of tasks

# _get_tasks_mode SingleMode

_get_tasks_mode(
  self
) -> dict[int, ModeConsumption]

Return a dictionary where the key is a task id and the value is a ModeConsumption object defining the resource consumption. If the domain is an instance of VariableResourceConsumption, VaryingModeConsumption objects should be used. If this is not the case (i.e. the domain is an instance of ConstantResourceConsumption), then ConstantModeConsumption should be used.

E.g. with constant resource consumption { 12: ConstantModeConsumption({'rt_1': 2, 'rt_2': 0, 'ru_1': 1}) }

E.g. with time varying resource consumption { 12: VaryingModeConsumption({'rt_1': [2,2,2,2,3], 'rt_2': [0,0,0,0,0], 'ru_1': [1,1,1,1,1]}) }

# _get_tasks_modes MultiMode

_get_tasks_modes(
  self
) -> dict[int, dict[int, ModeConsumption]]

Return a nested dictionary where the first key is a task id and the second key is a mode id. The value is a Mode object defining the resource consumption.