pDESy.model package

Submodules

pDESy.model.base_component module

base_component.

class pDESy.model.base_component.BaseComponent(name=None, ID=None, child_component_id_set=None, targeted_task_id_set=None, space_size=None, parent_product_id=None, state=BaseComponentState.NONE, state_record_list=None, placed_workplace_id=None, placed_workplace_id_record_list=None, error_tolerance=None, error=None)[source]

Bases: SingleNodeMermaidDiagramMixin, ComponentTaskCommonMixin, SingleNodeLogJsonMixin, SingleNodeCommonMixin, object

BaseComponent.

BaseComponent class for expressing target product. This class can be used as template.

add_child_component(child_component: BaseComponent) None[source]

Add child component to child_component_id_set.

Parameters:

child_component (BaseComponent) – BaseComponent which is child of this component.

add_targeted_task(targeted_task: BaseTask) None[source]

Add targeted task to targeted_task_list.

Parameters:

targeted_task (BaseTask) – Targeted task of this component.

append_child_component(child_component: BaseComponent) None[source]

Append child component to child_component_id_set.

Deprecated since version Use: add_child_component instead.

Parameters:

child_component (BaseComponent) – BaseComponent which is child of this component.

append_targeted_task(targeted_task: BaseTask) None[source]

Append targeted task to targeted_task_list.

Deprecated since version Use: add_targeted_task instead.

Parameters:

targeted_task (BaseTask) – Targeted task of this component.

create_task(name=None, ID=None, default_work_amount=None, work_amount_progress_of_unit_step_time=None, input_task_id_dependency_set=None, allocated_team_id_set=None, allocated_workplace_id_set=None, parent_workflow_id=None, workplace_priority_rule=WorkplacePriorityRuleMode.FSS, worker_priority_rule=ResourcePriorityRuleMode.MW, facility_priority_rule=ResourcePriorityRuleMode.SSP, need_facility=False, default_progress=None, due_time=None, auto_task=False, fixing_allocating_worker_id_set=None, fixing_allocating_facility_id_set=None, est=0.0, eft=0.0, lst=-1.0, lft=-1.0, remaining_work_amount=None, remaining_work_amount_record_list=None, state=BaseTaskState.NONE, state_record_list=None, allocated_worker_facility_id_tuple_set=None, allocated_worker_facility_id_tuple_set_record_list=None, additional_work_amount=None, additional_task_flag=False, actual_work_amount=None)[source]

Create a new BaseTask instance and add it to the targeted tasks.

Parameters:
  • name (str, optional) – Name of this task. Defaults to None -> “New Task”.

  • ID (str, optional) – ID will be defined automatically. Defaults to None -> str(uuid.uuid4()).

  • default_work_amount (float, optional) – Default workamount of this BaseTask. Defaults to None -> 10.0.

  • work_amount_progress_of_unit_step_time (float, optional) – Baseline of work amount progress of unit step time. Default to None -> 1.0.

  • input_task_id_dependency_set (set(tuple(str, BaseTaskDependency)), optional) – Set of input BaseTask id and type of dependency(FS, SS, SF, F/F) tuple. Defaults to None -> set().

  • allocated_team_id_set (set[str], optional) – Set of allocated BaseTeam id. Defaults to None -> set().

  • allocated_workplace_id_set (set[str], optional) – Set of allocated BaseWorkplace id. Defaults to None -> set().

  • parent_workflow_id (str, optional) – Parent workflow id. Defaults to None.

  • workplace_priority_rule (WorkplacePriorityRuleMode, optional) – Workplace priority rule for simulation. Defaults to WorkplacePriorityRuleMode.FSS.

  • worker_priority_rule (ResourcePriorityRule, optional) – Worker priority rule for simulation. Defaults to ResourcePriorityRule.SSP.

  • facility_priority_rule (ResourcePriorityRule, optional) – Task priority rule for simulation. Defaults to TaskPriorityRule.TSLACK.

  • need_facility (bool, optional) – Whether one facility is needed for performing this task or not. Defaults to False.

  • default_progress (float, optional) – Progress before starting simulation (0.0 ~ 1.0). Defaults to None -> 0.0.

  • due_time (int, optional) – Defaults to None -> int(-1).

  • auto_task (bool, optional) – If True, this task is performed automatically even if there are no allocated workers. Defaults to False.

  • fixing_allocating_worker_id_set (set[str], optional) – Allocating worker ID set for fixing allocation in simulation. Defaults to None.

  • fixing_allocating_facility_id_set (set[str], optional) – Allocating facility ID set for fixing allocation in simulation. Defaults to None.

  • est (float, optional) – Earliest start time of CPM. This will be updated step by step. Defaults to 0.0.

  • eft (float, optional) – Earliest finish time of CPM. This will be updated step by step. Defaults to 0.0.

  • lst (float, optional) – Latest start time of CPM. This will be updated step by step. Defaults to -1.0.

  • lft (float, optional) – Latest finish time of CPM. This will be updated step by step. Defaults to -1.0.

  • remaining_work_amount (float, optional) – Remaining workamount in simulation. Defaults to None -> default_work_amount * (1.0 - default_progress).

  • remaining_work_amount_record_list (List[float], optional) – Record of remaining workamount in simulation. Defaults to None -> [].

  • state (BaseTaskState, optional) – State of this task in simulation. Defaults to BaseTaskState.NONE.

  • state_record_list (List[BaseTaskState], optional) – Record list of state. Defaults to None -> [].

  • allocated_worker_facility_id_tuple_set (set(tuple(str, str)), optional) – State of allocating worker and facility id tuple set in simulation. Defaults to None -> set().

  • allocated_worker_facility_id_tuple_set_record_list (List[set[tuple(str, str)]], optional) – State of allocating worker and facility id tuple set in simulation. Defaults to None -> [].

  • additional_work_amount (float, optional) – Advanced parameter. Defaults to None.

  • additional_task_flag (bool, optional) – Advanced variable. Defaults to False.

  • actual_work_amount (float, optional) – Advanced variable. Default to None -> default_work_amount*(1.0-default_progress)

Returns:

Created BaseTask instance.

Return type:

BaseTask

extend_child_component_list(child_component_list: list[BaseComponent]) None[source]

Extend the list of child components.

Deprecated since version Use: update_child_component_set instead.

Parameters:

child_component_list (List[BaseComponent]) – List of BaseComponents which are children of this component.

extend_targeted_task_list(targeted_task_list: list[BaseTask]) None[source]

Extend the list of targeted tasks to targeted_task_list.

Deprecated since version Use: update_targeted_task_set instead.

Parameters:

targeted_task_list (List[BaseTask]) – List of targeted tasks.

get_gantt_mermaid_steps_data(range_time: tuple[int, int] = (0, 9223372036854775807), view_ready: bool = False, detailed_info: bool = False, id_name_dict: dict[str, str] = None) list[str][source]

Get gantt mermaid steps data of this component.

Parameters:
  • range_time (tuple[int, int], optional) – Range time of gantt chart. Defaults to (0, sys.maxsize).

  • view_ready (bool, optional) – If True, ready tasks are included in gantt chart. Defaults to False.

  • detailed_info (bool, optional) – If True, detailed information is included in gantt chart. Defaults to False.

  • id_name_dict (dict[str, str], optional) – Dictionary of ID and name for detailed information. Defaults to None.

Returns:

List of lines for gantt mermaid steps diagram.

Return type:

list[str]

get_mermaid_diagram(shape: str = 'odd', subgraph: bool = False, subgraph_name: str = 'Component', subgraph_direction: str = 'LR', print_extra_info: bool = False) list[str][source]

Get mermaid diagram of this component.

Parameters:
  • shape (str, optional) – Shape of mermaid diagram. Defaults to “odd”.

  • subgraph (bool, optional) – Subgraph or not. Defaults to False.

  • subgraph_name (str, optional) – Subgraph name. Defaults to “Component”.

  • subgraph_direction (str, optional) – Direction of subgraph. Defaults to “LR”.

Returns:

List of lines for mermaid diagram.

Return type:

list[str]

get_time_list_for_gantt_chart(finish_margin: float = 1.0) tuple[list[tuple[int, int]], list[tuple[int, int]]][source]

Get ready/working time_list for drawing Gantt chart.

Parameters:

finish_margin (float, optional) – Margin of finish time in Gantt chart. Defaults to 1.0.

Returns:

(ready_time_list, working_time_list)
  • ready_time_list (List[tuple(int, int)]): ready_time_list including start_time, length

  • working_time_list (List[tuple(int, int)]): working_time_list including start_time, length

Return type:

tuple

initialize(state_info: bool = True, log_info: bool = True) None[source]

Initialize the following changeable basic variables of BaseComponent.

If state_info is True, the following attributes are initialized:
  • state

  • placed_workplace

  • error

If log_info is True, the following attributes are initialized:
  • state_record_list

  • placed_workplace_id_record_list

Parameters:
  • state_info (bool, optional) – State information are initialized or not. Defaults to True.

  • log_info (bool, optional) – Log information are initialized or not. Defaults to True.

print_mermaid_diagram(orientations: str = 'LR', shape: str = 'odd', subgraph: bool = False, subgraph_name: str = 'Component', subgraph_direction: str = 'LR', print_extra_info: bool = False) None[source]

Print mermaid diagram of this component.

Parameters:
  • orientations (str, optional) – Orientation of mermaid diagram. See: https://mermaid.js.org/syntax/flowchart.html#direction. Defaults to “LR”.

  • shape (str, optional) – Shape of mermaid diagram. Defaults to “odd”.

  • subgraph (bool, optional) – Subgraph or not. Defaults to False.

  • subgraph_name (str, optional) – Subgraph name. Defaults to “Component”.

  • subgraph_direction (str, optional) – Direction of subgraph. Defaults to “LR”.

  • print_extra_info (bool, optional) – Print extra information or not. Defaults to False.

record_placed_workplace_id() None[source]

Record workplace id in this time to placed_workplace_id_record_list.

record_state(working: bool = True) None[source]

Record current state in state_record_list.

Parameters:

working (bool, optional) – If False and state is WORKING, record READY instead. Defaults to True.

update_child_component_set(child_component_set: set[BaseComponent]) None[source]

Update the set of child components.

Parameters:

child_component_set (set[BaseComponent]) – Set of BaseComponents which are children of this component.

update_error_value(no_error_prob: float, error_increment: float, seed=None) None[source]

Update error value randomly.

If no_error_prob >=1.0, error = error + error_increment.

Parameters:
  • no_error_prob (float) – Probability of no error (0.0~1.0).

  • error_increment (float) – Increment of error variables if error has occurred.

  • seed (int, optional) – Seed of creating random.rand(). Defaults to None.

Note

This method is developed for customized simulation.

update_targeted_task_set(targeted_task_set: set[BaseTask]) None[source]

Extend the list of targeted tasks to targeted_task_id_set.

Parameters:

targeted_task_set (set(BaseTask)) – Targeted tasks set.

class pDESy.model.base_component.BaseComponentState(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

BaseComponentState.

NONE

No state.

Type:

int

READY

Ready state.

Type:

int

WORKING

Working state.

Type:

int

FINISHED

Finished state.

Type:

int

REMOVED

Removed state.

Type:

int

FINISHED = -1
NONE = 0
READY = 1
REMOVED = -2
WORKING = 2

pDESy.model.base_facility module

base_facility.

This module defines the BaseFacility class and related enums for expressing a workplace.

class pDESy.model.base_facility.BaseFacility(name: str = None, ID: str = None, workplace_id: str = None, cost_per_time: float = 0.0, solo_working: bool = False, workamount_skill_mean_map: dict = None, workamount_skill_sd_map: dict = None, absence_time_list: list[int] = None, state: BaseFacilityState = BaseFacilityState.FREE, state_record_list: list[BaseFacilityState] = None, cost_record_list: list[float] = None, assigned_task_worker_id_tuple_set: set[tuple[str, str]] = None, assigned_task_worker_id_tuple_set_record_list: list[set[tuple[str, str]]] = None)[source]

Bases: SingleNodeMermaidDiagramMixin, AssignedPairsMixin, SingleNodeLogJsonMixin, WorkerFacilityCommonMixin, object

get_gantt_mermaid_steps_data(range_time: tuple[int, int] = (0, inf), view_ready: bool = False, detailed_info: bool = False, id_name_dict: dict[str, str] = None)[source]

Get gantt mermaid steps data of this facility.

Parameters:
  • range_time (tuple[int, int], optional) – Range time of gantt chart. Defaults to (0, sys.maxsize).

  • view_ready (bool, optional) – If True, ready tasks are included in gantt chart. Defaults to False.

  • detailed_info (bool, optional) – If True, detailed information is included in gantt chart. Defaults to False.

  • id_name_dict (dict[str, str], optional) – Dictionary of ID and name for detailed information. Defaults to None.

Returns:

List of lines for gantt mermaid steps diagram.

Return type:

list[str]

get_mermaid_diagram(shape: str = 'stadium', subgraph: bool = False, subgraph_name: str = 'Facility', subgraph_direction: str = 'LR', print_extra_info: bool = False)[source]

Get mermaid diagram of this facility.

Parameters:
  • shape (str, optional) – Shape of this facility. Defaults to “stadium”.

  • subgraph (bool, optional) – Whether to use subgraph or not. Defaults to False.

  • subgraph_name (str, optional) – Name of subgraph. Defaults to “Facility”.

  • subgraph_direction (str, optional) – Direction of subgraph. Defaults to “LR”.

  • print_extra_info (bool, optional) – Print extra information or not. Defaults to False.

Returns:

List of lines for mermaid diagram.

Return type:

list[str]

print_mermaid_diagram(orientations: str = 'LR', shape: str = 'stadium', subgraph: bool = False, subgraph_name: str = 'Facility', subgraph_direction: str = 'LR', print_extra_info: bool = False)[source]

Print mermaid diagram of this facility.

Parameters:
  • orientations (str, optional) – Orientation of mermaid diagram. Defaults to “LR”.

  • shape (str, optional) – Shape of mermaid diagram. Defaults to “stadium”.

  • subgraph (bool, optional) – Subgraph or not. Defaults to False.

  • subgraph_name (str, optional) – Subgraph name. Defaults to “Facility”.

  • subgraph_direction (str, optional) – Direction of subgraph. Defaults to “LR”.

  • print_extra_info (bool, optional) – Print extra information or not. Defaults to False.

class pDESy.model.base_facility.BaseFacilityState(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

BaseFacilityState.

Enum for representing the state of a facility.

FREE

Facility is free.

Type:

int

WORKING

Facility is working.

Type:

int

ABSENCE

Facility is absent.

Type:

int

ABSENCE = -1
FREE = 0
WORKING = 1

pDESy.model.base_priority_rule module

base_priority_rule.

This module defines enums and functions for sorting workplaces, workers, facilities, and tasks according to various priority rules.

class pDESy.model.base_priority_rule.ResourcePriorityRuleMode(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Enum for resource (worker/facility) priority rule modes.

MW

A worker whose main workplace is equal to target has high priority.

Type:

int

SSP

A worker/facility with lower skill point sum has high priority.

Type:

int

VC

A worker/facility with lower cost has high priority.

Type:

int

HSV

A worker/facility with higher target skill point has high priority.

Type:

int

HSV = 2
MW = -1
SSP = 0
VC = 1
class pDESy.model.base_priority_rule.TaskPriorityRuleMode(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Enum for task priority rule modes.

TSLACK

Task with lower slack time has high priority.

Type:

int

EST

Earliest Start Time.

Type:

int

SPT

Shortest Processing Time.

Type:

int

LPT

Longest Processing Time.

Type:

int

FIFO

First in First Out.

Type:

int

LRPT

Longest Remaining Process Time.

Type:

int

SRPT

Shortest Remaining Process Time.

Type:

int

EST = 1
FIFO = 4
LPT = 3
LRPT = 5
SPT = 2
SRPT = 6
TSLACK = 0
class pDESy.model.base_priority_rule.WorkplacePriorityRuleMode(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Enum for workplace priority rule modes.

FSS

Free Space Size.

Type:

int

SSP

Sum Skill Points of targeted task.

Type:

int

FSS = 0
SSP = 1
pDESy.model.base_priority_rule.sort_facility_list(facility_list: list, priority_rule_mode=ResourcePriorityRuleMode.SSP, **kwargs)[source]

Sort facility_list as priority_rule_mode.

Parameters:
  • facility_list (List[BaseFacility]) – Target facility list of sorting.

  • priority_rule_mode (ResourcePriorityRuleMode, optional) – Mode of priority rule for sorting. Defaults to ResourcePriorityRuleMode.SSP.

  • **kwargs – Other information of each rule.

Returns:

facility_list after sorted.

Return type:

List[BaseFacility]

pDESy.model.base_priority_rule.sort_task_list(task_list: list, priority_rule_mode=TaskPriorityRuleMode.TSLACK)[source]

Sort task_list as priority_rule_mode.

Parameters:
  • task_list (List[BaseTask]) – Target task list of sorting.

  • priority_rule_mode (TaskPriorityRuleMode, optional) – Mode of priority rule for sorting. Defaults to TaskPriorityRuleMode.TSLACK.

Returns:

task_list after sorted.

Return type:

List[BaseTask]

pDESy.model.base_priority_rule.sort_worker_list(worker_list: list, priority_rule_mode=ResourcePriorityRuleMode.SSP, **kwargs)[source]

Sort worker_list as priority_rule_mode.

Parameters:
  • worker_list (List[BaseWorker]) – Target worker list of sorting.

  • priority_rule_mode (ResourcePriorityRuleMode, optional) – Mode of priority rule for sorting. Defaults to ResourcePriorityRuleMode.SSP.

  • **kwargs – Other information of each rule.

Returns:

worker_list after sorted.

Return type:

List[BaseWorker]

pDESy.model.base_priority_rule.sort_workplace_list(workplace_list: list, priority_rule_mode=WorkplacePriorityRuleMode.FSS, **kwargs)[source]

Sort workplace_list as priority_rule_mode.

Parameters:
  • workplace_list (List[BaseWorkplace]) – Target workplace list of sorting.

  • priority_rule_mode (WorkplacePriorityRuleMode, optional) – Mode of priority rule for sorting. Defaults to WorkplacePriorityRuleMode.FSS.

  • **kwargs – Other information of each rule.

Returns:

workplace_list after sorted.

Return type:

List[BaseWorkplace]

pDESy.model.base_product module

base_product.

class pDESy.model.base_product.BaseProduct(name: str = None, ID: str = None, component_set: set[BaseComponent] = None)[source]

Bases: CollectionMermaidDiagramMixin, CollectionCommonMixin, CollectionLogJsonMixin, object

BaseProduct.

BaseProduct class for expressing target product in a project. BaseProduct consists of multiple BaseComponents. This class will be used as a template.

Parameters:
  • name (str, optional) – Name of this product. Defaults to None -> “Product”.

  • ID (str, optional) – ID will be defined automatically. Defaults to None -> str(uuid.uuid4()).

  • component_set (set[BaseComponent], optional) – Set of BaseComponents.

add_component(component: BaseComponent)[source]

Add target component to this workflow.

Parameters:

component (BaseComponent) – Target component.

append_component(component: BaseComponent)[source]

Append target component to this workflow.

Deprecated since version Use: add_component instead.

Parameters:

component (BaseComponent) – Target component.

create_component(name: str = None, ID: str = None, child_component_id_set: set[str] = None, targeted_task_id_set: set[str] = None, space_size: float = None, state: BaseComponentState = BaseComponentState.NONE, state_record_list: list[BaseComponentState] = None, placed_workplace_id: str = None, placed_workplace_id_record_list: list[str] = None, error_tolerance: float = None, error: float = None)[source]

Create BaseComponent instance and add it to this product.

Parameters:
  • name (str, optional) – Name of this component. Defaults to None -> “New Component”.

  • ID (str, optional) – ID will be defined automatically.

  • child_component_id_set (set[str], optional) – Child BaseComponents id set. Defaults to None -> set().

  • targeted_task_id_set (set[str], optional) – Targeted tasks id set. Defaults to None -> set().

  • space_size (float, optional) – Space size related to base_workplace’s max_space_size. Default to None -> 1.0.

  • state (BaseComponentState, optional) – State of this task in simulation. Defaults to BaseComponentState.NONE.

  • state_record_list (List[BaseComponentState], optional) – Record list of state. Defaults to None -> [].

  • placed_workplace_id (str, optional) – A workplace which this component is placed in simulation. Defaults to None.

  • placed_workplace_id_record_list (List[str], optional) – Record of placed workplace ID in simulation. Defaults to None -> [].

  • error_tolerance (float, optional) – Advanced parameter.

  • error (float, optional) – Advanced variables.

Returns:

The created component.

Return type:

BaseComponent

create_data_for_gantt_plotly(init_datetime: datetime, unit_timedelta: timedelta, target_id_order_list: list[str] = None, finish_margin: float = 1.0, print_product_name: bool = True, view_ready: bool = False)[source]

Create data for gantt plotly from component_set.

Parameters:
  • init_datetime (datetime.datetime) – Start datetime of project.

  • unit_timedelta (datetime.timedelta) – Unit time of simulation.

  • target_id_order_list (list[str], optional) – Target ID order list. Defaults to None.

  • finish_margin (float, optional) – Margin of finish time in Gantt chart. Defaults to 1.0.

  • print_product_name (bool, optional) – Print product name or not. Defaults to True.

  • view_ready (bool, optional) – View READY time or not. Defaults to False.

Returns:

Gantt plotly information of this BaseProduct.

Return type:

List[dict]

create_gantt_plotly(init_datetime: datetime, unit_timedelta: timedelta, target_id_order_list: list[str] = None, title: str = 'Gantt Chart', colors: dict[str, str] = None, index_col: str = None, showgrid_x: bool = True, showgrid_y: bool = True, group_tasks: bool = True, show_colorbar: bool = True, finish_margin: float = 1.0, print_product_name: bool = True, view_ready: bool = False, save_fig_path: str = None)[source]

Create Gantt chart by plotly.

This method will be used after simulation.

Parameters:
  • init_datetime (datetime.datetime) – Start datetime of project.

  • unit_timedelta (datetime.timedelta) – Unit time of simulation.

  • target_id_order_list (list[str], optional) – Target ID order list. Defaults to None.

  • title (str, optional) – Title of Gantt chart. Defaults to “Gantt Chart”.

  • colors (Dict[str, str], optional) – Color setting of plotly Gantt chart. Defaults to None -> dict(Component=”rgb(246, 37, 105)”, READY=”rgb(107, 127, 135)”).

  • index_col (str, optional) – index_col of plotly Gantt chart. Defaults to None -> “State”.

  • showgrid_x (bool, optional) – showgrid_x of plotly Gantt chart. Defaults to True.

  • showgrid_y (bool, optional) – showgrid_y of plotly Gantt chart. Defaults to True.

  • group_tasks (bool, optional) – group_tasks of plotly Gantt chart. Defaults to True.

  • show_colorbar (bool, optional) – show_colorbar of plotly Gantt chart. Defaults to True.

  • finish_margin (float, optional) – Margin of finish time in Gantt chart. Defaults to 1.0.

  • print_product_name (bool, optional) – Print product name or not. Defaults to True.

  • view_ready (bool, optional) – View READY time or not. Defaults to False.

  • save_fig_path (str, optional) – Path of saving figure. Defaults to None.

Returns:

Figure for a gantt chart.

Return type:

figure

Raises:

ImportError – If plotly is not installed.

create_simple_gantt(target_id_order_list: list[str] = None, finish_margin: float = 1.0, print_product_name: bool = True, view_ready: bool = True, component_color: str = '#FF6600', ready_color: str = '#C0C0C0', figsize: tuple[float, float] = None, dpi: float = 100.0, save_fig_path: str = None)[source]

Create Gantt chart by matplotlib.

In this Gantt chart, datetime information is not included. This method will be used after simulation.

Parameters:
  • target_id_order_list (list[str], optional) – Target ID order list. Defaults to None.

  • finish_margin (float, optional) – Margin of finish time in Gantt chart. Defaults to 1.0.

  • view_ready (bool, optional) – View READY time or not. Defaults to True.

  • print_product_name (bool, optional) – Print product name or not. Defaults to True.

  • component_color (str, optional) – Component color setting information. Defaults to “#FF6600”.

  • ready_color (str, optional) – Ready color setting information. Defaults to “#C0C0C0”.

  • figsize ((float, float), optional) – Width, height in inches. Default to None -> [6.4, 4.8].

  • dpi (float, optional) – The resolution of the figure in dots-per-inch. Default to 100.0.

  • save_fig_path (str, optional) – Path of saving figure. Defaults to None.

Returns:

Figure in plt.subplots(). gnt: Axes in plt.subplots().

Return type:

fig

Raises:

ImportError – If matplotlib is not installed.

draw_networkx(g=None, pos: dict = None, arrows: bool = True, component_node_color: str = '#FF6600', figsize: tuple[float, float] = None, dpi: float = 100.0, save_fig_path: str = None, **kwargs)[source]

Draw networkx.

Parameters:
  • g (networkx.Digraph, optional) – The information of networkx graph. Defaults to None -> self.get_networkx_graph().

  • pos (networkx.layout, optional) – Layout of networkx. Defaults to None -> networkx.spring_layout(g).

  • arrows (bool, optional) – Digraph or Graph(no arrows). Defaults to True.

  • component_node_color (str, optional) – Node color setting information. Defaults to “#FF6600”.

  • figsize ((float, float), optional) – Width, height in inches. Default to None -> [6.4, 4.8].

  • dpi (float, optional) – The resolution of the figure in dots-per-inch. Default to 100.0.

  • save_fig_path (str, optional) – Path of saving figure. Defaults to None.

  • **kwargs – Other networkx settings.

Returns:

Figure for a network.

Return type:

figure

Raises:

ImportError – If matplotlib is not installed.

draw_plotly_network(g=None, pos: dict = None, title: str = 'Product', node_size: int = 20, component_node_color: str = '#FF6600', save_fig_path: str = None)[source]

Draw plotly network.

Parameters:
  • g (networkx.Digraph, optional) – The information of networkx graph. Defaults to None -> self.get_networkx_graph().

  • pos (networkx.layout, optional) – Layout of networkx. Defaults to None -> networkx.spring_layout(g).

  • title (str, optional) – Figure title of this network. Defaults to “Product”.

  • node_size (int, optional) – Node size setting information. Defaults to 20.

  • component_node_color (str, optional) – Node color setting information. Defaults to “#FF6600”.

  • save_fig_path (str, optional) – Path of saving figure. Defaults to None.

Returns:

Figure for a network.

Return type:

figure

Raises:

ImportError – If plotly is not installed.

extend_component_list(component_set: set[BaseComponent])[source]

Extend target component_set to this product.

Deprecated since version Use: update_component_set instead.

Parameters:

component_set (set[BaseComponent]) – Target component set.

get_component_set_by_state(target_time_list: list[int], target_state: BaseComponentState)[source]

Extract state component set from simulation result.

Parameters:
  • target_time_list (List[int]) – Target time list. If you want to extract target_state component from time 2 to time 4, you must set [2, 3, 4] to this argument.

  • target_state (BaseComponentState) – Target state.

Returns:

List of BaseComponent.

Return type:

List[BaseComponent]

get_gantt_mermaid_steps(target_id_order_list: list[str] = None, section: bool = True, range_time: tuple[int, int] = (0, 9223372036854775807), view_ready: bool = False, detailed_info: bool = False, id_name_dict: dict[str, str] = None)[source]

Get mermaid diagram of Gantt chart (step-based).

Parameters:
  • target_id_order_list (list[str], optional) – Target ID order list. Defaults to None.

  • section (bool, optional) – Section or not. Defaults to True.

  • range_time (tuple[int, int], optional) – Range of Gantt chart. Defaults to (0, sys.maxsize).

  • view_ready (bool, optional) – If True, ready tasks are included in gantt chart. Defaults to False.

  • detailed_info (bool, optional) – If True, detailed information is included in gantt chart. Defaults to False.

  • id_name_dict (dict[str, str], optional) – Dictionary of ID and name for detailed information. Defaults to None.

Returns:

List of lines for mermaid diagram.

Return type:

list[str]

get_gantt_mermaid_text(project_init_datetime: datetime, project_unit_timedelta: timedelta, target_id_order_list: list[str] = None, section: bool = True, range_time: tuple[int, int] = (0, 9223372036854775807), view_ready: bool = False, detailed_info: bool = False, id_name_dict: dict[str, str] = None)[source]

Get mermaid diagram text of Gantt chart.

Parameters:
  • project_init_datetime (datetime.datetime, optional) – Start datetime of project.

  • project_unit_timedelta (datetime.timedelta, optional) – Unit time of simulation.

  • target_id_order_list (list[str], optional) – Target ID order list. Defaults to None.

  • section (bool, optional) – Section or not. Defaults to True.

  • range_time (tuple[int, int], optional) – Range of Gantt chart. Defaults to (0, sys.maxsize).

  • view_ready (bool, optional) – If True, ready tasks are included in gantt chart. Defaults to False.

  • detailed_info (bool, optional) – If True, detailed information is included in gantt chart. Defaults to False.

  • id_name_dict (dict[str, str], optional) – Dictionary of ID and name for detailed information. Defaults to None.

Returns:

Mermaid gantt diagram text.

Return type:

str

get_mermaid_diagram(shape_component: str = 'odd', link_type_str: str = '-->', subgraph: bool = True, subgraph_direction: str = 'LR')[source]

Get mermaid diagram of this product.

Parameters:
  • shape_component (str, optional) – Shape of mermaid diagram. Defaults to “odd”.

  • link_type_str (str, optional) – Link type of mermaid diagram. Defaults to “–>”.

  • subgraph (bool, optional) – Subgraph or not. Defaults to True.

  • subgraph_direction (str, optional) – Direction of subgraph. Defaults to “LR”.

Returns:

List of lines for mermaid diagram.

Return type:

list[str]

get_networkx_graph()[source]

Get the information of networkx graph.

Returns:

Directed graph of the product.

Return type:

networkx.DiGraph

get_node_and_edge_trace_for_plotly_network(g=None, pos: dict = None, node_size: int = 20, component_node_color: str = '#FF6600')[source]

Get nodes and edges information of plotly network.

Parameters:
  • g (networkx.Digraph, optional) – The information of networkx graph. Defaults to None -> self.get_networkx_graph().

  • pos (networkx.layout, optional) – Layout of networkx. Defaults to None -> networkx.spring_layout(g).

  • node_size (int, optional) – Node size setting information. Defaults to 20.

  • component_node_color (str, optional) – Node color setting information. Defaults to “#FF6600”.

Returns:

Node information of plotly network. edge_trace: Edge information of plotly network.

Return type:

node_trace

Raises:

ImportError – If plotly is not installed.

get_target_component_mermaid_diagram(target_component_set: set[BaseComponent], shape_component: str = 'odd', link_type_str: str = '-->', subgraph: bool = True, subgraph_direction: str = 'LR')[source]

Get mermaid diagram of target component.

Parameters:
  • target_component_set (set[BaseComponent]) – Target component set.

  • shape_component (str, optional) – Shape of mermaid diagram. Defaults to “odd”.

  • link_type_str (str, optional) – Link type of mermaid diagram. Defaults to “–>”.

  • subgraph (bool, optional) – Subgraph or not. Defaults to True.

  • subgraph_direction (str, optional) – Direction of subgraph. Defaults to “LR”.

Returns:

List of lines for mermaid diagram.

Return type:

list[str]

initialize(state_info: bool = True, log_info: bool = True)[source]

Initialize the changeable variables of BaseProduct.

BaseComponent in component_set are also initialized by this function.

Parameters:
  • state_info (bool, optional) – Whether to initialize state information. Defaults to True.

  • log_info (bool, optional) – Whether to initialize log information. Defaults to True.

plot_simple_gantt(target_id_order_list: list[str] = None, finish_margin: float = 1.0, print_product_name: bool = True, view_ready: bool = True, component_color: str = '#FF6600', ready_color: str = '#C0C0C0', figsize: tuple[float, float] = None, dpi: float = 100.0, save_fig_path: str = None)[source]

Plot Gantt chart by matplotlib.

In this Gantt chart, datetime information is not included. This method will be used after simulation.

Parameters:
  • target_id_order_list (list[str], optional) – Target ID order list. Defaults to None.

  • finish_margin (float, optional) – Margin of finish time in Gantt chart. Defaults to 1.0.

  • print_product_name (bool, optional) – Print product name or not. Defaults to True.

  • view_ready (bool, optional) – View READY time or not. Defaults to True.

  • component_color (str, optional) – Component color setting information. Defaults to “#FF6600”.

  • ready_color (str, optional) – Ready color setting information. Defaults to “#C0C0C0”.

  • figsize ((float, float), optional) – Width, height in inches. Default to None -> [6.4, 4.8].

  • dpi (float, optional) – The resolution of the figure in dots-per-inch. Default to 100.0.

  • save_fig_path (str, optional) – Path of saving figure. Defaults to None.

Returns:

Figure in plt.subplots().

Return type:

fig

Raises:

ImportError – If matplotlib is not installed.

print_gantt_mermaid(project_init_datetime: datetime = None, project_unit_timedelta: timedelta = None, target_id_order_list: list[str] = None, section: bool = True, range_time: tuple[int, int] = (0, 9223372036854775807), view_ready: bool = False, detailed_info: bool = False, id_name_dict: dict[str, str] = None)[source]

Print mermaid diagram of Gantt chart.

Parameters:
  • project_init_datetime (datetime.datetime, optional) – Start datetime of project. If None, outputs step-based Gantt chart. Defaults to None.

  • project_unit_timedelta (datetime.timedelta, optional) – Unit time of simulation. Required if project_init_datetime is provided. Defaults to None.

  • target_id_order_list (list[str], optional) – Target ID order list. Defaults to None.

  • section (bool, optional) – Section or not. Defaults to True.

  • range_time (tuple[int, int], optional) – Range of Gantt chart. Defaults to (0, sys.maxsize).

  • view_ready (bool, optional) – If True, ready tasks are included in gantt chart. Defaults to False.

  • detailed_info (bool, optional) – If True, detailed information is included in gantt chart. Defaults to False.

  • id_name_dict (dict[str, str], optional) – Dictionary of ID and name for detailed information. Defaults to None.

print_mermaid_diagram(orientations: str = 'LR', shape_component: str = 'odd', link_type_str: str = '-->', subgraph: bool = True, subgraph_direction: str = 'LR')[source]

Print mermaid diagram of this product.

Parameters:
  • orientations (str, optional) – Orientation of mermaid diagram. See: https://mermaid.js.org/syntax/flowchart.html#direction. Defaults to “LR”.

  • shape_component (str, optional) – Shape of mermaid diagram. Defaults to “odd”.

  • link_type_str (str, optional) – Link type of mermaid diagram. Defaults to “–>”.

  • subgraph (bool, optional) – Subgraph or not. Defaults to True.

  • subgraph_direction (str, optional) – Direction of subgraph. Defaults to “LR”.

print_target_component_mermaid_diagram(target_component_set: set[BaseComponent], orientations: str = 'LR', shape_component: str = 'odd', link_type_str: str = '-->', subgraph: bool = True, subgraph_direction: str = 'LR')[source]

Print mermaid diagram of target component.

Parameters:
  • target_component_set (set[BaseComponent]) – Target component set.

  • orientations (str, optional) – Orientation of mermaid diagram. See: https://mermaid.js.org/syntax/flowchart.html#direction. Defaults to “LR”.

  • shape_component (str, optional) – Shape of mermaid diagram. Defaults to “odd”.

  • link_type_str (str, optional) – Link type of mermaid diagram. Defaults to “–>”.

  • subgraph (bool, optional) – Subgraph or not. Defaults to True.

  • subgraph_direction (str, optional) – Direction of subgraph. Defaults to “LR”.

record(working=True)[source]

Record placed workplace id in this time.

Parameters:

working (bool, optional) – Whether to record as working. Defaults to True.

update_component_set(component_set: set[BaseComponent])[source]

Update target component_set to this product.

Parameters:

component_set (set[BaseComponent]) – Target component set.

pDESy.model.base_project module

base_project.

class pDESy.model.base_project.BaseProject(name: str = None, ID: str = None, init_datetime: datetime = None, unit_timedelta: timedelta = None, absence_time_list: list[int] = None, perform_auto_task_while_absence_time: bool = None, product_set: set[BaseProduct] = None, workflow_set: set[BaseWorkflow] = None, team_set: set[BaseTeam] = None, workplace_set: set[BaseWorkplace] = None, time: int = 0, cost_record_list: list[float] = None, simulation_mode: SimulationMode = None, status: BaseProjectStatus = None)[source]

Bases: CollectionMermaidDiagramMixin, object

BaseProject.

BaseProject class for expressing target project including product, workflow, team_set and workplace_set. This class will be used as template.

add_product(product: BaseProduct)[source]

Add product to this project.

Parameters:

product (BaseProduct) – Product to add.

Raises:

TypeError – If product is not an instance of BaseProduct.

add_team(team: BaseTeam)[source]

Add team to this project.

Parameters:

team (BaseTeam) – Team to add.

Raises:

TypeError – If team is not an instance of BaseTeam.

add_workflow(workflow: BaseWorkflow)[source]

Add workflow to this project.

Parameters:

workflow (BaseWorkflow) – Workflow to add.

Raises:

TypeError – If workflow is not an instance of BaseWorkflow.

add_workplace(workplace: BaseWorkplace)[source]

Add workplace to this project.

Parameters:

workplace (BaseWorkplace) – Workplace to add.

Raises:

TypeError – If workplace is not an instance of BaseWorkplace.

append_product(product: BaseProduct)[source]

Append product to this project.

Parameters:

product (BaseProduct) – Product to append.

Raises:
  • TypeError – If product is not an instance of BaseProduct.

  • DeprecationWarning – This method is deprecated. Use add_product instead.

append_project_log_from_simple_json(file_path: str, encoding: str = 'utf-8')[source]

Append project log information from a JSON file created by BaseProject.write_simple_json().

Note

This function is not yet verified sufficiently.

Parameters:
  • file_path (str) – File path for reading the extended project data.

  • encoding (str, optional) – Encoding for the JSON file. Defaults to “utf-8”.

Returns:

None

append_team(team: BaseTeam)[source]

Append team to this project.

Parameters:

team (BaseTeam) – Team to append.

Raises:
  • TypeError – If team is not an instance of BaseTeam.

  • DeprecationWarning – This method is deprecated. Use add_team instead.

append_workflow(workflow: BaseWorkflow)[source]

Append workflow to this project.

Parameters:

workflow (BaseWorkflow) – Workflow to append.

Raises:
  • TypeError – If workflow is not an instance of BaseWorkflow.

  • DeprecationWarning – This method is deprecated. Use add_workflow instead.

append_workplace(workplace: BaseWorkplace)[source]

Append workplace to this project.

Parameters:

workplace (BaseWorkplace) – Workplace to append.

Raises:
  • TypeError – If workplace is not an instance of BaseWorkplace.

  • DeprecationWarning – This method is deprecated. Use add_workplace instead.

backward_simulate(task_priority_rule: TaskPriorityRuleMode = TaskPriorityRuleMode.TSLACK, error_tol: float = 1e-10, work_amount_limit_per_unit_time: float = 10000000000.0, count_auto_task_in_work_amount_limit: bool = False, absence_time_list: list[int] | None = None, perform_auto_task_while_absence_time: bool = False, initialize_state_info: bool = True, initialize_log_info: bool = True, max_time: int = 10000, unit_time: int = 1, progress_bar: bool = False, considering_due_time_of_tail_tasks: bool = False, reverse_log_information: bool = True)[source]

Simulate this BaseProject using backward simulation.

Parameters:
  • task_priority_rule (TaskPriorityRuleMode, optional) – Task priority rule for simulation. Defaults to TaskPriorityRuleMode.TSLACK.

  • error_tol (float, optional) – Measures against numerical error. Defaults to 1e-10.

  • work_amount_limit_per_unit_time (float, optional) – Upper limit on the total remaining work amount that can be in the WORKING state at any given time. When this limit is reached, additional tasks that would otherwise transition from READY to WORKING remain in the READY state until enough work is completed (i.e., the total remaining work of WORKING tasks falls below the limit). Defaults to 1e10.

  • count_auto_task_in_work_amount_limit (bool, optional) – Whether auto tasks should be counted toward the work amount limit. Defaults to False.

  • absence_time_list (list[int], optional) – List of absence times in simulation. Defaults to None (workers work every time).

  • perform_auto_task_while_absence_time (bool, optional) – Whether to perform auto tasks during absence time. Defaults to False.

  • initialize_state_info (bool, optional) – Whether to initialize state info of this project. Defaults to True.

  • initialize_log_info (bool, optional) – Whether to initialize log info of this project. Defaults to True.

  • max_time (int, optional) – Maximum simulation time. Defaults to 10000.

  • unit_time (int, optional) – Unit time of simulation. Defaults to 1.

  • progress_bar (bool, optional) – Whether to show progress bar during simulation. Defaults to False.

  • considering_due_time_of_tail_tasks (bool, optional) – Whether to consider due time of tail tasks. Defaults to False.

  • reverse_log_information (bool, optional) – Whether to reverse simulation log information after simulation. Defaults to True.

Note

This function is experimental and mainly for research use. It may not be suitable for simulations considering rework.

can_add_resources_to_task(task: BaseTask, worker: BaseWorker | None = None, facility: BaseFacility | None = None)[source]

Judge whether the target task can be assigned additional resources.

Parameters:
  • task (BaseTask) – Target task for checking.

  • worker (BaseWorker, optional) – Target worker for allocating. Defaults to None.

  • facility (BaseFacility, optional) – Target facility for allocating. Defaults to None.

Returns:

True if the target task can be assigned the specified resources, False otherwise.

Return type:

bool

can_put_component_to_workplace(workplace: BaseWorkplace, component: BaseComponent, error_tol: float = 1e-08)[source]

Check whether the target component can be put to this workplace in this time.

Parameters:
  • workplace (BaseWorkplace) – Target workplace for checking.

  • component (BaseComponent) – Component to check for placement.

  • error_tol (float, optional) – Numerical error tolerance. Defaults to 1e-8.

Returns:

Whether the target component can be put to this workplace in this time.

Return type:

bool

check_state_component(component: BaseComponent)[source]

Check and update the state of a component based on its targeted tasks.

Parameters:

component (BaseComponent) – The component whose state will be checked and updated.

check_state_workflow(workflow: BaseWorkflow, state: BaseTaskState, work_amount_limit_per_unit_time: float = 10000000000.0, total_work_amount_in_working_tasks: float = None, count_auto_task_in_work_amount_limit: bool = False)[source]

Check and update the state of all tasks in the given workflow for the specified state.

Parameters:
  • workflow (BaseWorkflow) – The workflow whose tasks’ states will be checked and updated.

  • state (BaseTaskState) – The target state to check (READY, WORKING, or FINISHED). Only tasks that can transition to this state will be updated.

  • work_amount_limit_per_unit_time (float, optional) – Maximum total work amount that can be newly started per simulation time unit across all workflows. This limit is applied only when transitioning tasks into the WORKING state via this method. If the sum of work amounts of eligible tasks that would start working exceeds this limit, only a subset up to the limit is allowed to transition to WORKING; the remaining eligible tasks stay in their current state and are reconsidered in subsequent calls. Defaults to 1e10 (effectively no limit).

  • total_work_amount_in_working_tasks (float, optional) – Current total work amount in WORKING tasks. Used when state is WORKING to enforce the limit across multiple workflows. If None, it will be calculated. Defaults to None.

  • count_auto_task_in_work_amount_limit (bool, optional) – Whether auto tasks should be counted toward the work amount limit. Defaults to False.

Returns:

Updated total work amount in WORKING tasks when state is WORKING, otherwise None.

Return type:

float

create_gantt_plotly(title: str = 'Gantt Chart', target_product_id_order_list: list[str] = None, target_component_id_order_list: list[str] = None, target_workflow_id_order_list: list[str] = None, target_task_id_order_list: list[str] = None, target_team_id_order_list: list[str] = None, target_worker_id_order_list: list[str] = None, target_workplace_id_order_list: list[str] = None, target_facility_id_order_list: list[str] = None, colors: dict[str, str] = None, index_col: str = None, showgrid_x: bool = True, showgrid_y: bool = True, group_tasks: bool = False, show_colorbar: bool = True, finish_margin: float = 1.0, save_fig_path: str = None)[source]

Create a Gantt chart using Plotly.

This method should be used after simulation to visualize the schedule of components, tasks, workers, and facilities.

Parameters:
  • target_product_id_order_list (list[str], optional) – List of target product IDs in the desired order. Defaults to None.

  • target_component_id_order_list (list[str], optional) – List of target component IDs in the desired order. Defaults to None.

  • target_workflow_id_order_list (list[str], optional) – List of target workflow IDs in the desired order. Defaults to None.

  • target_task_id_order_list (list[str], optional) – List of target task IDs in the desired order. Defaults to None.

  • target_team_id_order_list (list[str], optional) – List of target team IDs in the desired order. Defaults to None.

  • target_worker_id_order_list (list[str], optional) – List of target worker IDs in the desired order. Defaults to None.

  • target_workplace_id_order_list (list[str], optional) – List of target workplace IDs in the desired order. Defaults to None.

  • target_facility_id_order_list (list[str], optional) – List of target facility IDs in the desired order. Defaults to None.

  • title (str, optional) – Title of the Gantt chart. Defaults to “Gantt Chart”.

  • colors (dict[str, str], optional) – Color settings for Plotly Gantt chart. Defaults to None.

  • index_col (str, optional) – Column name to group bars by color. Defaults to None (“Type”).

  • showgrid_x (bool, optional) – Whether to show grid lines on the x-axis. Defaults to True.

  • showgrid_y (bool, optional) – Whether to show grid lines on the y-axis. Defaults to True.

  • group_tasks (bool, optional) – Whether to group tasks with the same name. Defaults to False.

  • show_colorbar (bool, optional) – Whether to show the color bar. Defaults to True.

  • finish_margin (float, optional) – Margin to add to the finish time in the Gantt chart. Defaults to 1.0.

  • save_fig_path (str, optional) – Path to save the figure. Supports “html”, “json”, or image formats. Defaults to None.

Returns:

Plotly figure object for the Gantt chart.

Return type:

plotly.graph_objs.Figure

Raises:

ImportError – If plotly is not installed.

create_product(name: str = None, ID: str = None, component_set: set[BaseComponent] = None)[source]

Create a new product and add it to the project.

Parameters:
  • name (str, optional) – Name of the product.

  • ID (str, optional) – ID of the product.

  • component_set (set[BaseComponent], optional) – Set of components to include in the product.

Returns:

The created product.

Return type:

BaseProduct

create_team(name: str = None, ID: str = None, worker_set: set[BaseWorker] = None, targeted_task_id_set: set[str] = None, parent_team_id: str = None, cost_record_list: list[float] = None)[source]

Create a new team and add it to the project.

Parameters:
  • name (str, optional) – Name of this team. Defaults to None -> “New Team”.

  • ID (str, optional) – ID will be defined automatically. Defaults to None -> str(uuid.uuid4()).

  • worker_set (set[BaseWorker], optional) – Set of BaseWorkers who belong to this team. Defaults to None -> set().

  • targeted_task_id_set (set[str], optional) – Targeted BaseTasks id set. Defaults to None -> set().

  • parent_team_id (str, optional) – Parent team id of this team. Defaults to None.

  • cost_record_list (List[float], optional) – History or record of this team’s cost in simulation. Defaults to None -> [].

Returns:

The created team.

Return type:

BaseTeam

create_workflow(name: str = None, ID: str = None, task_set: set[BaseTask] = None, critical_path_length: float = 0.0)[source]

Create a new workflow and add it to the project.

Parameters:
  • name (str, optional) – Name of this workflow. Defaults to None -> “Workflow”.

  • ID (str, optional) – ID will be defined automatically. Defaults to None -> str(uuid.uuid4()).

  • task_set (set[BaseTask], optional) – List of BaseTask in this BaseWorkflow. Default to None -> set().

  • critical_path_length (float, optional) – Critical path length of PERT/CPM. Defaults to 0.0.

Returns:

The created workflow.

Return type:

BaseWorkflow

create_workplace(name: str = None, ID: str = None, facility_set: set[BaseFacility] = None, targeted_task_id_set: set[str] = None, parent_workplace_id: str = None, max_space_size: float = None, input_workplace_id_set: set[str] = None, available_space_size: float = None, cost_record_list: list[float] = None, placed_component_id_set: set[str] = None, placed_component_id_set_record_list: list[list[str]] = None)[source]

Create a new workplace and add it to the project.

Parameters:
  • name (str, optional) – Name of this workplace. Defaults to None -> “New Workplace”.

  • ID (str, optional) – ID will be defined automatically. Defaults to None -> str(uuid.uuid4()).

  • facility_set (set[BaseFacility], optional) – List of BaseFacility who belong to this workplace. Defaults to None -> set().

  • targeted_task_id_set (set[str], optional) – Targeted BaseTasks id set. Defaults to None -> set().

  • parent_workplace_id (str, optional) – Parent workplace id of this workplace. Defaults to None.

  • max_space_size (float, optional) – Max size of space for placing components. Default to None -> 1.0.

  • input_workplace_id_set (set[str], optional) – Input BaseWorkplace id set. Defaults to None -> set().

  • available_space_size (float, optional) – Available space size in this workplace. Defaults to None -> max_space_size.

  • placed_component_id_set (set[str], optional) – Components id which places to this workplace in simulation. Defaults to None -> set().

  • placed_component_id_set_record_list (List[List[str]], optional) – Record of placed components ID in simulation. Defaults to None -> [].

  • cost_record_list (List[float], optional) – History or record of this workplace’s cost in simulation. Defaults to None -> [].

Returns:

The created workplace.

Return type:

BaseWorkplace

draw_networkx(g=None, pos: dict = None, arrows: bool = True, component_node_color: str = '#FF6600', task_node_color: str = '#00EE00', auto_task_node_color: str = '#005500', team_node_color: str = '#0099FF', worker_node_color: str = '#D9E5FF', view_workers: bool = False, view_facilities: bool = False, workplace_node_color: str = '#0099FF', facility_node_color: str = '#D9E5FF', figsize: tuple[float, float] = None, dpi: float = 100.0, save_fig_path: str = None, **kwargs)[source]

Draw the project structure as a NetworkX graph using matplotlib.

Parameters:
  • g (networkx.DiGraph, optional) – NetworkX graph to draw. Defaults to None (uses self.get_networkx_graph()).

  • pos (dict, optional) – Node positions for layout. Defaults to None (uses networkx.spring_layout).

  • arrows (bool, optional) – Whether to draw arrows for directed edges. Defaults to True.

  • component_node_color (str, optional) – Color for component nodes. Defaults to “#FF6600”.

  • task_node_color (str, optional) – Color for task nodes. Defaults to “#00EE00”.

  • auto_task_node_color (str, optional) – Color for auto task nodes. Defaults to “#005500”.

  • team_node_color (str, optional) – Color for team nodes. Defaults to “#0099FF”.

  • worker_node_color (str, optional) – Color for worker nodes. Defaults to “#D9E5FF”.

  • view_workers (bool, optional) – Whether to include workers in the graph. Defaults to False.

  • view_facilities (bool, optional) – Whether to include facilities in the graph. Defaults to False.

  • workplace_node_color (str, optional) – Color for workplace nodes. Defaults to “#0099FF”.

  • facility_node_color (str, optional) – Color for facility nodes. Defaults to “#D9E5FF”.

  • figsize (tuple[float, float], optional) – Figure size in inches. Defaults to None ([6.4, 4.8]).

  • dpi (float, optional) – Figure resolution in dots-per-inch. Defaults to 100.0.

  • save_fig_path (str, optional) – Path to save the figure. Defaults to None.

  • **kwargs – Additional keyword arguments for networkx drawing functions.

Returns:

Matplotlib figure object for the network graph.

Return type:

matplotlib.figure.Figure

Raises:

ImportError – If matplotlib is not installed.

draw_plotly_network(g=None, pos: dict = None, title: str = 'Project', node_size: int = 20, component_node_color: str = '#FF6600', task_node_color: str = '#00EE00', auto_task_node_color: str = '#005500', team_node_color: str = '#0099FF', worker_node_color: str = '#D9E5FF', view_workers: bool = False, workplace_node_color: str = '#0099FF', facility_node_color: str = '#D9E5FF', view_facilities: bool = False, save_fig_path: str = None)[source]

Draw the project structure as a Plotly network graph.

Parameters:
  • g (networkx.DiGraph, optional) – NetworkX graph to visualize. Defaults to None (uses self.get_networkx_graph()).

  • pos (dict, optional) – Node positions for layout. Defaults to None (uses networkx.spring_layout).

  • title (str, optional) – Title of the Plotly figure. Defaults to “Project”.

  • node_size (int, optional) – Size of nodes in the plot. Defaults to 20.

  • component_node_color (str, optional) – Color for component nodes. Defaults to “#FF6600”.

  • task_node_color (str, optional) – Color for task nodes. Defaults to “#00EE00”.

  • auto_task_node_color (str, optional) – Color for auto task nodes. Defaults to “#005500”.

  • team_node_color (str, optional) – Color for team nodes. Defaults to “#0099FF”.

  • worker_node_color (str, optional) – Color for worker nodes. Defaults to “#D9E5FF”.

  • view_workers (bool, optional) – Whether to include workers in the graph. Defaults to False.

  • workplace_node_color (str, optional) – Color for workplace nodes. Defaults to “#0099FF”.

  • facility_node_color (str, optional) – Color for facility nodes. Defaults to “#D9E5FF”.

  • view_facilities (bool, optional) – Whether to include facilities in the graph. Defaults to False.

  • save_fig_path (str, optional) – Path to save the figure. Supports “html”, “json”, or image formats. Defaults to None.

Returns:

Plotly figure object for the network graph.

Return type:

plotly.graph_objs.Figure

Raises:

ImportError – If plotly is not installed.

extend_product_list(product_set: list[BaseProduct])[source]

Extend product list to this project.

Parameters:

product_set (set[BaseProduct]) – List of products to extend.

Raises:
  • TypeError – If any item in product_set is not a BaseProduct.

  • DeprecationWarning – This method is deprecated. Use update_product_set instead.

extend_team_list(team_set: list[BaseTeam])[source]

Extend team list to this project.

Parameters:

team_set (list[BaseTeam]) – List of teams to extend.

Raises:
  • TypeError – If any item in team_set is not a BaseTeam.

  • DeprecationWarning – This method is deprecated. Use update_team_set instead.

extend_workflow_list(workflow_set: list[BaseWorkflow])[source]

Extend workflow list to this project.

Parameters:

workflow_set (list[BaseWorkflow]) – List of workflows to extend.

Raises:
  • TypeError – If any item in workflow_set is not a BaseWorkflow.

  • DeprecationWarning – This method is deprecated. Use update_workflow_set instead.

extend_workplace_list(workplace_set: list[BaseWorkplace])[source]

Extend workplace list to this project.

Parameters:

workplace_set (list[BaseWorkplace]) – List of workplaces to extend.

Raises:
  • TypeError – If any item in workplace_set is not a BaseWorkplace.

  • DeprecationWarning – This method is deprecated. Use update_workplace_set instead.

get_all_component_set()[source]

Get all component set in this project.

Returns:

All component set in this project.

Return type:

set[BaseComponent]

get_all_facility_set()[source]

Get all facility set of this project.

Returns:

All facility set of this project.

Return type:

set[BaseFacility]

get_all_id_name_dict()[source]

Get a flat dictionary of all id-name mappings in this project.

Returns:

Flat dictionary containing all {id: name} mappings.

Return type:

dict

get_all_product_gantt_mermaid_steps(target_product_id_order_list: list[str] = None, target_component_id_order_list: list[str] = None, section: bool = True, range_time: tuple[int, int] = (0, 9223372036854775807), view_ready: bool = False, detailed_info: bool = False)[source]

Get mermaid Gantt diagram lines for all products.

Parameters:
  • target_product_id_order_list (list[str], optional) – List of target product IDs in the desired order. Defaults to None.

  • target_component_id_order_list (list[str], optional) – List of target component IDs in the desired order. Defaults to None.

  • section (bool, optional) – Whether to use sections in the diagram. Defaults to True.

  • range_time (tuple[int, int], optional) – Time range for the diagram. Defaults to (0, sys.maxsize).

  • view_ready (bool, optional) – Whether to include ready tasks. Defaults to False.

  • detailed_info (bool, optional) – Whether to include detailed information. Defaults to False.

Returns:

List of lines for mermaid Gantt diagram.

Return type:

list[str]

get_all_product_gantt_mermaid_text(project_init_datetime: datetime, project_unit_timedelta: timedelta, target_product_id_order_list: list[str] = None, target_component_id_order_list: list[str] = None, section: bool = True, range_time: tuple[int, int] = (0, 9223372036854775807), view_ready: bool = False, detailed_info: bool = False)[source]

Get mermaid Gantt diagram text for all products.

Parameters:
  • project_init_datetime (datetime.datetime, optional) – Start datetime of project.

  • project_unit_timedelta (datetime.timedelta, optional) – Unit time of simulation.

  • target_product_id_order_list (list[str], optional) – List of target product IDs in the desired order. Defaults to None.

  • target_component_id_order_list (list[str], optional) – List of target component IDs in the desired order. Defaults to None.

  • section (bool, optional) – Whether to use sections in the diagram. Defaults to True.

  • range_time (tuple[int, int], optional) – Time range for the diagram. Defaults to (0, sys.maxsize).

  • view_ready (bool, optional) – Whether to include ready tasks. Defaults to False.

  • detailed_info (bool, optional) – Whether to include detailed information. Defaults to False.

Returns:

Mermaid gantt diagram text.

Return type:

str

get_all_product_mermaid_diagram(shape_component: str = 'odd', link_type_str_component: str = '-->', subgraph: bool = True, subgraph_direction: str = 'LR')[source]

Get mermaid diagram of all products.

Parameters:
  • shape_component (str, optional) – Shape of mermaid diagram for components. Defaults to “odd”.

  • link_type_str_component (str, optional) – Link type string of each component. Defaults to “–>”.

  • subgraph (bool, optional) – Whether to use subgraph for products. Defaults to True.

  • subgraph_direction (str, optional) – Direction of product subgraph. Defaults to “LR”.

Returns:

List of lines for mermaid diagram.

Return type:

list[str]

get_all_task_set()[source]

Get all task set in this project.

Returns:

All task set in this project.

Return type:

Set[BaseTask]

get_all_team_gantt_mermaid_steps(target_team_id_order_list: list[str] = None, target_worker_id_order_list: list[str] = None, section: bool = True, range_time: tuple[int, int] = (0, 9223372036854775807), detailed_info: bool = False, view_ready: bool = False)[source]

Get mermaid Gantt diagram lines for all teams.

Parameters:
  • target_team_id_order_list (list[str], optional) – List of target team IDs in the desired order. Defaults to None.

  • target_worker_id_order_list (list[str], optional) – List of target worker IDs in the desired order. Defaults to None.

  • section (bool, optional) – Whether to use sections in the diagram. Defaults to True.

  • range_time (tuple[int, int], optional) – Time range for the diagram. Defaults to (0, sys.maxsize).

  • detailed_info (bool, optional) – Whether to include detailed information. Defaults to False.

  • view_ready (bool, optional) – Whether to include ready tasks. Defaults to False.

Returns:

List of lines for mermaid Gantt diagram.

Return type:

list[str]

get_all_team_gantt_mermaid_text(project_init_datetime: datetime, project_unit_timedelta: timedelta, target_team_id_order_list: list[str] = None, target_worker_id_order_list: list[str] = None, section: bool = True, range_time: tuple[int, int] = (0, 9223372036854775807), detailed_info: bool = False, view_ready: bool = False)[source]

Get mermaid Gantt diagram text for all teams.

Parameters:
  • project_init_datetime (datetime.datetime, optional) – Start datetime of project.

  • project_unit_timedelta (datetime.timedelta, optional) – Unit time of simulation.

  • target_team_id_order_list (list[str], optional) – List of target team IDs in the desired order. Defaults to None.

  • target_worker_id_order_list (list[str], optional) – List of target worker IDs in the desired order. Defaults to None.

  • section (bool, optional) – Whether to use sections in the diagram. Defaults to True.

  • range_time (tuple[int, int], optional) – Time range for the diagram. Defaults to (0, sys.maxsize).

  • detailed_info (bool, optional) – Whether to include detailed information. Defaults to False.

  • view_ready (bool, optional) – Whether to include ready tasks. Defaults to False.

Returns:

Mermaid gantt diagram text.

Return type:

str

get_all_team_mermaid_diagram(print_worker: bool = True, shape_worker: str = 'stadium', link_type_str_worker: str = '-->', subgraph: bool = True, subgraph_direction: str = 'LR')[source]

Get mermaid diagram of all teams.

Parameters:
  • print_worker (bool, optional) – Whether to print workers. Defaults to True.

  • shape_worker (str, optional) – Shape of mermaid diagram for workers. Defaults to “stadium”.

  • link_type_str_worker (str, optional) – Link type string of each worker. Defaults to “–>”.

  • subgraph (bool, optional) – Whether to use subgraph for teams. Defaults to True.

  • subgraph_direction (str, optional) – Direction of team subgraph. Defaults to “LR”.

Returns:

List of lines for mermaid diagram.

Return type:

list[str]

get_all_worker_set()[source]

Get all worker set of this project.

Returns:

All worker set of this project.

Return type:

set[BaseWorker]

get_all_workflow_gantt_mermaid_steps(target_workflow_id_order_list: list[str] = None, target_task_id_order_list: list[str] = None, section: bool = True, range_time: tuple[int, int] = (0, 9223372036854775807), detailed_info: bool = False, view_ready: bool = False)[source]

Get mermaid Gantt diagram lines for all workflows.

Parameters:
  • target_workflow_id_order_list (list[str], optional) – List of target workflow IDs in the desired order. Defaults to None.

  • target_task_id_order_list (list[str], optional) – List of target task IDs in the desired order. Defaults to None.

  • section (bool, optional) – Whether to use sections in the diagram. Defaults to True.

  • range_time (tuple[int, int], optional) – Time range for the diagram. Defaults to (0, sys.maxsize).

  • detailed_info (bool, optional) – Whether to include detailed information. Defaults to False.

  • view_ready (bool, optional) – Whether to include ready tasks. Defaults to False.

Returns:

List of lines for mermaid Gantt diagram.

Return type:

list[str]

get_all_workflow_gantt_mermaid_text(project_init_datetime: datetime, project_unit_timedelta: timedelta, target_workflow_id_order_list: list[str] = None, target_task_id_order_list: list[str] = None, section: bool = True, range_time: tuple[int, int] = (0, 9223372036854775807), detailed_info: bool = False, view_ready: bool = False)[source]

Get mermaid Gantt diagram text for all workflows.

Parameters:
  • project_init_datetime (datetime.datetime, optional) – Start datetime of project.

  • project_unit_timedelta (datetime.timedelta, optional) – Unit time of simulation.

  • target_workflow_id_order_list (list[str], optional) – List of target workflow IDs in the desired order. Defaults to None.

  • target_task_id_order_list (list[str], optional) – List of target task IDs in the desired order. Defaults to None.

  • section (bool, optional) – Whether to use sections in the diagram. Defaults to True.

  • range_time (tuple[int, int], optional) – Time range for the diagram. Defaults to (0, sys.maxsize).

  • detailed_info (bool, optional) – Whether to include detailed information. Defaults to False.

  • view_ready (bool, optional) – Whether to include ready tasks. Defaults to False.

Returns:

Mermaid gantt diagram text.

Return type:

str

get_all_workflow_mermaid_diagram(shape_task: str = 'rect', print_extra_info: bool = True, print_dependency_type: bool = False, link_type_str_task: str = '-->', subgraph: bool = True, subgraph_direction: str = 'LR')[source]

Get mermaid diagram of all workflows.

Parameters:
  • shape_task (str, optional) – Shape of mermaid diagram for tasks. Defaults to “rect”.

  • print_extra_info (bool, optional) – Whether to print work amount info. Defaults to True.

  • print_dependency_type (bool, optional) – Whether to print dependency type info. Defaults to False.

  • link_type_str_task (str, optional) – Link type string of each task. Defaults to “–>”.

  • subgraph (bool, optional) – Whether to use subgraph for workflows. Defaults to True.

  • subgraph_direction (str, optional) – Direction of workflow subgraph. Defaults to “LR”.

Returns:

List of lines for mermaid diagram.

Return type:

list[str]

get_all_workplace_gantt_mermaid_steps(target_workplace_id_order_list: list[str] = None, target_facility_id_order_list: list[str] = None, section: bool = True, range_time: tuple[int, int] = (0, 9223372036854775807), detailed_info: bool = False, view_ready: bool = False)[source]

Get mermaid Gantt diagram lines for all workplaces.

Parameters:
  • target_workplace_id_order_list (list[str], optional) – List of target workplace IDs in the desired order. Defaults to None.

  • target_facility_id_order_list (list[str], optional) – List of target facility IDs in the desired order. Defaults to None.

  • section (bool, optional) – Whether to use sections in the diagram. Defaults to True.

  • range_time (tuple[int, int], optional) – Time range for the diagram. Defaults to (0, sys.maxsize).

  • detailed_info (bool, optional) – Whether to include detailed information. Defaults to False.

  • view_ready (bool, optional) – Whether to include ready tasks. Defaults to False.

Returns:

List of lines for mermaid Gantt diagram.

Return type:

list[str]

get_all_workplace_gantt_mermaid_text(project_init_datetime: datetime, project_unit_timedelta: timedelta, target_workplace_id_order_list: list[str] = None, target_facility_id_order_list: list[str] = None, section: bool = True, range_time: tuple[int, int] = (0, 9223372036854775807), detailed_info: bool = False, view_ready: bool = False)[source]

Get mermaid Gantt diagram text for all workplaces.

Parameters:
  • project_init_datetime (datetime.datetime, optional) – Start datetime of project.

  • project_unit_timedelta (datetime.timedelta, optional) – Unit time of simulation.

  • target_workplace_id_order_list (list[str], optional) – List of target workplace IDs in the desired order. Defaults to None.

  • target_facility_id_order_list (list[str], optional) – List of target facility IDs in the desired order. Defaults to None.

  • section (bool, optional) – Whether to use sections in the diagram. Defaults to True.

  • range_time (tuple[int, int], optional) – Time range for the diagram. Defaults to (0, sys.maxsize).

  • detailed_info (bool, optional) – Whether to include detailed information. Defaults to False.

  • view_ready (bool, optional) – Whether to include ready tasks. Defaults to False.

Returns:

Mermaid gantt diagram text.

Return type:

str

get_all_workplace_mermaid_diagram(print_facility: bool = True, shape_facility: str = 'stadium', link_type_str_facility: str = '-->', subgraph: bool = True, subgraph_direction: str = 'LR', link_type_str_workplace_workplace: str = '-->')[source]

Get mermaid diagram of all workplaces.

Parameters:
  • print_facility (bool, optional) – Whether to print facilities. Defaults to True.

  • shape_facility (str, optional) – Shape of mermaid diagram for facilities. Defaults to “stadium”.

  • link_type_str_facility (str, optional) – Link type string of each facility. Defaults to “–>”.

  • subgraph (bool, optional) – Whether to use subgraph for workplaces. Defaults to True.

  • subgraph_direction (str, optional) – Direction of workplace subgraph. Defaults to “LR”.

  • link_type_str_workplace_workplace (str, optional) – Link type string of each workplace. Defaults to “–>”.

Returns:

List of lines for mermaid diagram.

Return type:

list[str]

get_mermaid_diagram(shape_component: str = 'odd', link_type_str_component: str = '-->', subgraph_product: bool = True, subgraph_direction_product: str = 'LR', shape_task: str = 'rect', print_extra_info: bool = True, print_dependency_type: bool = False, link_type_str_task: str = '-->', subgraph_workflow: bool = True, subgraph_direction_workflow: str = 'LR', print_worker: bool = True, shape_worker: str = 'stadium', link_type_str_worker: str = '-->', subgraph_team: bool = True, subgraph_direction_team: str = 'LR', print_facility: bool = True, shape_facility: str = 'stadium', link_type_str_facility: str = '-->', subgraph_workplace: bool = True, subgraph_direction_workplace: str = 'LR', link_type_str_component_task: str = '-.-', link_type_str_worker_task: str = '-.-', link_type_str_facility_task: str = '-.-', link_type_str_worker_facility: str = '-.-', subgraph: bool = False, subgraph_direction: str = 'LR')[source]

Get mermaid diagram of this project.

Parameters:
  • shape_component (str, optional) – Shape of mermaid diagram for components. Defaults to “odd”.

  • link_type_str_component (str, optional) – Link type string of each component. Defaults to “–>”.

  • subgraph_product (bool, optional) – Whether to use subgraph for products. Defaults to True.

  • subgraph_direction_product (str, optional) – Direction of product subgraph. Defaults to “LR”.

  • shape_task (str, optional) – Shape of mermaid diagram for tasks. Defaults to “rect”.

  • print_extra_info (bool, optional) – Whether to print work amount info. Defaults to True.

  • print_dependency_type (bool, optional) – Whether to print dependency type info. Defaults to False.

  • link_type_str_task (str, optional) – Link type string of each task. Defaults to “–>”.

  • subgraph_workflow (bool, optional) – Whether to use subgraph for workflows. Defaults to True.

  • subgraph_direction_workflow (str, optional) – Direction of workflow subgraph. Defaults to “LR”.

  • print_worker (bool, optional) – Whether to print workers. Defaults to True.

  • shape_worker (str, optional) – Shape of mermaid diagram for workers. Defaults to “stadium”.

  • link_type_str_worker (str, optional) – Link type string of each worker. Defaults to “–>”.

  • subgraph_team (bool, optional) – Whether to use subgraph for teams. Defaults to True.

  • subgraph_direction_team (str, optional) – Direction of team subgraph. Defaults to “LR”.

  • print_facility (bool, optional) – Whether to print facilities. Defaults to True.

  • shape_facility (str, optional) – Shape of mermaid diagram for facilities. Defaults to “stadium”.

  • link_type_str_facility (str, optional) – Link type string of each facility. Defaults to “–>”.

  • subgraph_workplace (bool, optional) – Whether to use subgraph for workplaces. Defaults to True.

  • subgraph_direction_workplace (str, optional) – Direction of workplace subgraph. Defaults to “LR”.

  • link_type_str_component_task (str, optional) – Link type string of each component and task. Defaults to “-.-“.

  • link_type_str_worker_task (str, optional) – Link type string of each worker and task. Defaults to “-.-“.

  • link_type_str_facility_task (str, optional) – Link type string of each facility and task. Defaults to “-.-“.

  • link_type_str_worker_facility (str, optional) – Link type string of each worker and facility. Defaults to “-.-“.

  • subgraph (bool, optional) – Whether to use subgraph for the whole diagram. Defaults to False.

  • subgraph_direction (str, optional) – Direction of the main subgraph. Defaults to “LR”.

Returns:

List of lines for mermaid diagram.

Return type:

list[str]

get_networkx_graph(view_workers: bool = False, view_facilities: bool = False)[source]

Get the information of the project as a NetworkX directed graph.

Parameters:
  • view_workers (bool, optional) – If True, include workers in the graph. Defaults to False.

  • view_facilities (bool, optional) – If True, include facilities in the graph. Defaults to False.

Returns:

Directed graph representing the project structure.

Return type:

networkx.DiGraph

get_node_and_edge_trace_for_plotly_network(g=None, pos: dict = None, node_size: int = 20, component_node_color: str = '#FF6600', task_node_color: str = '#00EE00', auto_task_node_color: str = '#005500', team_node_color: str = '#0099FF', worker_node_color: str = '#D9E5FF', view_workers: bool = False, workplace_node_color: str = '#0099FF', facility_node_color: str = '#D9E5FF', view_facilities: bool = False)[source]

Get nodes and edges information for a Plotly network visualization.

Parameters:
  • g (networkx.DiGraph, optional) – NetworkX graph to visualize. Defaults to None (uses self.get_networkx_graph()).

  • pos (dict, optional) – Node positions for layout. Defaults to None (uses networkx.spring_layout).

  • node_size (int, optional) – Size of nodes in the plot. Defaults to 20.

  • component_node_color (str, optional) – Color for component nodes. Defaults to “#FF6600”.

  • task_node_color (str, optional) – Color for task nodes. Defaults to “#00EE00”.

  • auto_task_node_color (str, optional) – Color for auto task nodes. Defaults to “#005500”.

  • team_node_color (str, optional) – Color for team nodes. Defaults to “#0099FF”.

  • worker_node_color (str, optional) – Color for worker nodes. Defaults to “#D9E5FF”.

  • view_workers (bool, optional) – Whether to include workers in the graph. Defaults to False.

  • workplace_node_color (str, optional) – Color for workplace nodes. Defaults to “#0099FF”.

  • facility_node_color (str, optional) – Color for facility nodes. Defaults to “#D9E5FF”.

  • view_facilities (bool, optional) – Whether to include facilities in the graph. Defaults to False.

Returns:

Plotly Scatter trace for component nodes. task_node_trace: Plotly Scatter trace for task nodes. auto_task_node_trace: Plotly Scatter trace for auto task nodes. team_node_trace: Plotly Scatter trace for team nodes. worker_node_trace: Plotly Scatter trace for worker nodes. workplace_node_trace: Plotly Scatter trace for workplace nodes. facility_node_trace: Plotly Scatter trace for facility nodes. edge_trace: Plotly Scatter trace for edges.

Return type:

component_node_trace

Raises:

ImportError – If plotly is not installed.

get_target_mermaid_diagram(target_product_set: set[BaseProduct] = None, target_workflow_set: set[BaseWorkflow] = None, target_team_set: set[BaseTeam] = None, target_workplace_set: set[BaseWorkplace] = None, shape_component: str = 'odd', link_type_str_component: str = '-->', subgraph_product: bool = True, subgraph_direction_product: str = 'LR', shape_task: str = 'rect', print_extra_info: bool = True, print_dependency_type: bool = False, link_type_str_task: str = '-->', subgraph_workflow: bool = True, subgraph_direction_workflow: str = 'LR', print_worker: bool = True, shape_worker: str = 'stadium', link_type_str_worker: str = '-->', subgraph_team: bool = True, subgraph_direction_team: str = 'LR', print_facility: bool = True, shape_facility: str = 'stadium', link_type_str_facility: str = '-->', subgraph_workplace: bool = True, subgraph_direction_workplace: str = 'LR', link_type_str_component_task: str = '-.-', link_type_str_worker_task: str = '-.-', link_type_str_facility_task: str = '-.-', link_type_str_worker_facility: str = '-.-', link_type_str_workplace_workplace: str = '-->', subgraph: bool = False, subgraph_direction: str = 'LR')[source]

Get mermaid diagram of target information.

Parameters:
  • target_product_set (set[BaseProduct], optional) – Target product set. Defaults to None.

  • target_workflow_set (set[BaseWorkflow], optional) – Target workflow set. Defaults to None.

  • target_team_set (set[BaseTeam], optional) – Target team set. Defaults to None.

  • target_workplace_set (set[BaseWorkplace], optional) – Target workplace set. Defaults to None.

  • shape_component (str, optional) – Shape of mermaid diagram for components. Defaults to “odd”.

  • link_type_str_component (str, optional) – Link type string of each component. Defaults to “–>”.

  • subgraph_product (bool, optional) – Whether to use subgraph for products. Defaults to True.

  • subgraph_direction_product (str, optional) – Direction of product subgraph. Defaults to “LR”.

  • shape_task (str, optional) – Shape of mermaid diagram for tasks. Defaults to “rect”.

  • print_extra_info (bool, optional) – Whether to print work amount info. Defaults to True.

  • print_dependency_type (bool, optional) – Whether to print dependency type info. Defaults to False.

  • link_type_str_task (str, optional) – Link type string of each task. Defaults to “–>”.

  • subgraph_workflow (bool, optional) – Whether to use subgraph for workflows. Defaults to True.

  • subgraph_direction_workflow (str, optional) – Direction of workflow subgraph. Defaults to “LR”.

  • print_worker (bool, optional) – Whether to print workers. Defaults to True.

  • shape_worker (str, optional) – Shape of mermaid diagram for workers. Defaults to “stadium”.

  • link_type_str_worker (str, optional) – Link type string of each worker. Defaults to “–>”.

  • subgraph_team (bool, optional) – Whether to use subgraph for teams. Defaults to True.

  • subgraph_direction_team (str, optional) – Direction of team subgraph. Defaults to “LR”.

  • print_facility (bool, optional) – Whether to print facilities. Defaults to True.

  • shape_facility (str, optional) – Shape of mermaid diagram for facilities. Defaults to “stadium”.

  • link_type_str_facility (str, optional) – Link type string of each facility. Defaults to “–>”.

  • subgraph_workplace (bool, optional) – Whether to use subgraph for workplaces. Defaults to True.

  • subgraph_direction_workplace (str, optional) – Direction of workplace subgraph. Defaults to “LR”.

  • link_type_str_component_task (str, optional) – Link type string of each component and task. Defaults to “-.-“.

  • link_type_str_worker_task (str, optional) – Link type string of each worker and task. Defaults to “-.-“.

  • link_type_str_facility_task (str, optional) – Link type string of each facility and task. Defaults to “-.-“.

  • link_type_str_worker_facility (str, optional) – Link type string of each worker and facility. Defaults to “-.-“.

  • link_type_str_workplace_workplace (str, optional) – Link type string of each workplace and workplace. Defaults to “–>”.

  • subgraph (bool, optional) – Whether to use subgraph for the whole diagram. Defaults to False.

  • subgraph_direction (str, optional) – Direction of the main subgraph. Defaults to “LR”.

Returns:

List of lines for mermaid diagram.

Return type:

list[str]

Get mermaid diagram of product-related information for the specified products.

Parameters:
  • target_product_set (set[BaseProduct]) – Target product set.

  • shape_component (str, optional) – Shape of mermaid diagram for components. Defaults to “odd”.

  • link_type_str_component (str, optional) – Link type string of each component. Defaults to “–>”.

  • subgraph_product (bool, optional) – Whether to use subgraph for products. Defaults to True.

  • subgraph_direction_product (str, optional) – Direction of product subgraph. Defaults to “LR”.

  • shape_task (str, optional) – Shape of mermaid diagram for tasks. Defaults to “rect”.

  • print_extra_info (bool, optional) – Whether to print work amount info. Defaults to True.

  • print_dependency_type (bool, optional) – Whether to print dependency type info. Defaults to False.

  • link_type_str_task (str, optional) – Link type string of each task. Defaults to “–>”.

  • subgraph_workflow (bool, optional) – Whether to use subgraph for workflows. Defaults to True.

  • subgraph_direction_workflow (str, optional) – Direction of workflow subgraph. Defaults to “LR”.

  • print_worker (bool, optional) – Whether to print workers. Defaults to True.

  • shape_worker (str, optional) – Shape of mermaid diagram for workers. Defaults to “stadium”.

  • link_type_str_worker (str, optional) – Link type string of each worker. Defaults to “–>”.

  • subgraph_team (bool, optional) – Whether to use subgraph for teams. Defaults to True.

  • subgraph_direction_team (str, optional) – Direction of team subgraph. Defaults to “LR”.

  • print_facility (bool, optional) – Whether to print facilities. Defaults to True.

  • shape_facility (str, optional) – Shape of mermaid diagram for facilities. Defaults to “stadium”.

  • link_type_str_facility (str, optional) – Link type string of each facility. Defaults to “–>”.

  • subgraph_workplace (bool, optional) – Whether to use subgraph for workplaces. Defaults to True.

  • subgraph_direction_workplace (str, optional) – Direction of workplace subgraph. Defaults to “LR”.

  • link_type_str_component_task (str, optional) – Link type string of each component and task. Defaults to “-.-“.

  • link_type_str_worker_task (str, optional) – Link type string of each worker and task. Defaults to “-.-“.

  • link_type_str_facility_task (str, optional) – Link type string of each facility and task. Defaults to “-.-“.

  • link_type_str_worker_facility (str, optional) – Link type string of each worker and facility. Defaults to “-.-“.

  • subgraph (bool, optional) – Whether to use subgraph for the whole diagram. Defaults to False.

  • subgraph_direction (str, optional) – Direction of the main subgraph. Defaults to “LR”.

Returns:

List of lines for mermaid diagram.

Return type:

list[str]

get_target_task_set(target_task_id_set: set[str])[source]

Get tasks by their IDs.

Parameters:

target_task_id_set (set[str]) – set of task IDs to filter.

Returns:

Set of tasks matching the provided IDs.

Return type:

set[BaseTask]

Get mermaid diagram of team-related information for the specified teams.

Parameters:
  • target_team_set (set[BaseTeam]) – Target team set.

  • shape_component (str, optional) – Shape of mermaid diagram for components. Defaults to “odd”.

  • link_type_str_component (str, optional) – Link type string of each component. Defaults to “–>”.

  • subgraph_product (bool, optional) – Whether to use subgraph for products. Defaults to True.

  • subgraph_direction_product (str, optional) – Direction of product subgraph. Defaults to “LR”.

  • shape_task (str, optional) – Shape of mermaid diagram for tasks. Defaults to “rect”.

  • print_extra_info (bool, optional) – Whether to print work amount info. Defaults to True.

  • print_dependency_type (bool, optional) – Whether to print dependency type info. Defaults to False.

  • link_type_str_task (str, optional) – Link type string of each task. Defaults to “–>”.

  • subgraph_workflow (bool, optional) – Whether to use subgraph for workflows. Defaults to True.

  • subgraph_direction_workflow (str, optional) – Direction of workflow subgraph. Defaults to “LR”.

  • print_worker (bool, optional) – Whether to print workers. Defaults to True.

  • shape_worker (str, optional) – Shape of mermaid diagram for workers. Defaults to “stadium”.

  • link_type_str_worker (str, optional) – Link type string of each worker. Defaults to “–>”.

  • subgraph_team (bool, optional) – Whether to use subgraph for teams. Defaults to True.

  • subgraph_direction_team (str, optional) – Direction of team subgraph. Defaults to “LR”.

  • print_facility (bool, optional) – Whether to print facilities. Defaults to True.

  • shape_facility (str, optional) – Shape of mermaid diagram for facilities. Defaults to “stadium”.

  • link_type_str_facility (str, optional) – Link type string of each facility. Defaults to “–>”.

  • subgraph_workplace (bool, optional) – Whether to use subgraph for workplaces. Defaults to True.

  • subgraph_direction_workplace (str, optional) – Direction of workplace subgraph. Defaults to “LR”.

  • link_type_str_component_task (str, optional) – Link type string of each component and task. Defaults to “-.-“.

  • link_type_str_worker_task (str, optional) – Link type string of each worker and task. Defaults to “-.-“.

  • link_type_str_facility_task (str, optional) – Link type string of each facility and task. Defaults to “-.-“.

  • link_type_str_worker_facility (str, optional) – Link type string of each worker and facility. Defaults to “-.-“.

  • subgraph (bool, optional) – Whether to use subgraph for the whole diagram. Defaults to False.

  • subgraph_direction (str, optional) – Direction of the main subgraph. Defaults to “LR”.

Returns:

List of lines for mermaid diagram.

Return type:

list[str]

Get mermaid diagram of workflow-related information for the specified workflows.

Parameters:
  • target_workflow_set (set[BaseWorkflow]) – Target workflow set.

  • shape_component (str, optional) – Shape of mermaid diagram for components. Defaults to “odd”.

  • link_type_str_component (str, optional) – Link type string of each component. Defaults to “–>”.

  • subgraph_product (bool, optional) – Whether to use subgraph for products. Defaults to True.

  • subgraph_direction_product (str, optional) – Direction of product subgraph. Defaults to “LR”.

  • shape_task (str, optional) – Shape of mermaid diagram for tasks. Defaults to “rect”.

  • print_extra_info (bool, optional) – Whether to print work amount info. Defaults to True.

  • print_dependency_type (bool, optional) – Whether to print dependency type info. Defaults to False.

  • link_type_str_task (str, optional) – Link type string of each task. Defaults to “–>”.

  • subgraph_workflow (bool, optional) – Whether to use subgraph for workflows. Defaults to True.

  • subgraph_direction_workflow (str, optional) – Direction of workflow subgraph. Defaults to “LR”.

  • print_worker (bool, optional) – Whether to print workers. Defaults to True.

  • shape_worker (str, optional) – Shape of mermaid diagram for workers. Defaults to “stadium”.

  • link_type_str_worker (str, optional) – Link type string of each worker. Defaults to “–>”.

  • subgraph_team (bool, optional) – Whether to use subgraph for teams. Defaults to True.

  • subgraph_direction_team (str, optional) – Direction of team subgraph. Defaults to “LR”.

  • print_facility (bool, optional) – Whether to print facilities. Defaults to True.

  • shape_facility (str, optional) – Shape of mermaid diagram for facilities. Defaults to “stadium”.

  • link_type_str_facility (str, optional) – Link type string of each facility. Defaults to “–>”.

  • subgraph_workplace (bool, optional) – Whether to use subgraph for workplaces. Defaults to True.

  • subgraph_direction_workplace (str, optional) – Direction of workplace subgraph. Defaults to “LR”.

  • link_type_str_component_task (str, optional) – Link type string of each component and task. Defaults to “-.-“.

  • link_type_str_worker_task (str, optional) – Link type string of each worker and task. Defaults to “-.-“.

  • link_type_str_facility_task (str, optional) – Link type string of each facility and task. Defaults to “-.-“.

  • link_type_str_worker_facility (str, optional) – Link type string of each worker and facility. Defaults to “-.-“.

  • subgraph (bool, optional) – Whether to use subgraph for the whole diagram. Defaults to False.

  • subgraph_direction (str, optional) – Direction of the main subgraph. Defaults to “LR”.

Returns:

List of lines for mermaid diagram.

Return type:

list[str]

Get mermaid diagram of workplace-related information for the specified workplaces.

Parameters:
  • target_workplace_set (set[BaseWorkplace]) – Target workplace set.

  • shape_component (str, optional) – Shape of mermaid diagram for components. Defaults to “odd”.

  • link_type_str_component (str, optional) – Link type string of each component. Defaults to “–>”.

  • subgraph_product (bool, optional) – Whether to use subgraph for products. Defaults to True.

  • subgraph_direction_product (str, optional) – Direction of product subgraph. Defaults to “LR”.

  • shape_task (str, optional) – Shape of mermaid diagram for tasks. Defaults to “rect”.

  • print_extra_info (bool, optional) – Whether to print work amount info. Defaults to True.

  • print_dependency_type (bool, optional) – Whether to print dependency type info. Defaults to False.

  • link_type_str_task (str, optional) – Link type string of each task. Defaults to “–>”.

  • subgraph_workflow (bool, optional) – Whether to use subgraph for workflows. Defaults to True.

  • subgraph_direction_workflow (str, optional) – Direction of workflow subgraph. Defaults to “LR”.

  • print_worker (bool, optional) – Whether to print workers. Defaults to True.

  • shape_worker (str, optional) – Shape of mermaid diagram for workers. Defaults to “stadium”.

  • link_type_str_worker (str, optional) – Link type string of each worker. Defaults to “–>”.

  • subgraph_team (bool, optional) – Whether to use subgraph for teams. Defaults to True.

  • subgraph_direction_team (str, optional) – Direction of team subgraph. Defaults to “LR”.

  • print_facility (bool, optional) – Whether to print facilities. Defaults to True.

  • shape_facility (str, optional) – Shape of mermaid diagram for facilities. Defaults to “stadium”.

  • link_type_str_facility (str, optional) – Link type string of each facility. Defaults to “–>”.

  • subgraph_workplace (bool, optional) – Whether to use subgraph for workplaces. Defaults to True.

  • subgraph_direction_workplace (str, optional) – Direction of workplace subgraph. Defaults to “LR”.

  • link_type_str_component_task (str, optional) – Link type string of each component and task. Defaults to “-.-“.

  • link_type_str_worker_task (str, optional) – Link type string of each worker and task. Defaults to “-.-“.

  • link_type_str_facility_task (str, optional) – Link type string of each facility and task. Defaults to “-.-“.

  • link_type_str_worker_facility (str, optional) – Link type string of each worker and facility. Defaults to “-.-“.

  • subgraph (bool, optional) – Whether to use subgraph for the whole diagram. Defaults to False.

  • subgraph_direction (str, optional) – Direction of the main subgraph. Defaults to “LR”.

Returns:

List of lines for mermaid diagram.

Return type:

list[str]

get_work_amount_skill_progress(resource, task_name: str, seed=None)[source]

Get the progress of work amount contributed by a resource for a task in this time step.

If the resource (worker or facility) is assigned to multiple tasks at the same time, the progress p_r(t) is calculated as:

p_r(t) = ps_r(t) / N_r(t)

where:
  • ps_r(t): Progress if the resource has only this task at this time.

  • N_r(t): Number of tasks assigned to the resource at this time.

Parameters:
  • resource (BaseWorker or BaseFacility) – The resource whose skill progress is calculated.

  • task_name (str) – Name of the task.

  • seed (int, optional) – Random seed for reproducibility. Defaults to None.

Returns:

Progress of work amount contributed by the resource in this time step.

Return type:

float

initialize(state_info: bool = True, log_info: bool = True)[source]

Initialize the changeable variables of BaseProject.

This method resets the simulation state and/or log information for the project and all its elements (products, workflows, teams, workplaces). If log_info is True, time, cost records, simulation mode, and status are reset. If state_info is True, state information of all elements is initialized.

Parameters:
  • state_info (bool, optional) – Whether to initialize state information of the project and its elements. Defaults to True.

  • log_info (bool, optional) – Whether to initialize log information (time, cost, mode, status). Defaults to True.

insert_absence_time_list(absence_time_list: list[int])[source]

Insert record information on absence_time_list.

Parameters:

absence_time_list (List[int]) – List of absence step times in simulation.

Returns:

None

is_ready_component(component: BaseComponent)[source]

Check whether the given component is in the READY state.

READY component is defined by satisfying the following conditions: - All tasks are not NONE. - There is no WORKING task in this component. - The states of targeted tasks include READY.

Parameters:

component (BaseComponent) – The component to check.

Returns:

True if this component is READY, False otherwise.

Return type:

bool

print_all_log_in_chronological_order(backward: bool = False)[source]

Print all logs in chronological order.

Parameters:

backward (bool, optional) – If True, print logs in reverse (backward) order. Defaults to False.

print_all_product_gantt_mermaid(project_init_datetime: datetime, project_unit_timedelta: timedelta, target_product_id_order_list: list[str] = None, target_component_id_order_list: list[str] = None, section: bool = True, range_time: tuple[int, int] = (0, 9223372036854775807), detailed_info: bool = False, view_ready: bool = False)[source]

Print mermaid Gantt diagram for all products.

Parameters:
  • target_product_id_order_list (list[str], optional) – List of target product IDs in the desired order. Defaults to None.

  • target_component_id_order_list (list[str], optional) – List of target component IDs in the desired order. Defaults to None.

  • project_init_datetime (datetime.datetime, optional) – Start datetime of project.

  • project_unit_timedelta (datetime.timedelta, optional) – Unit time of simulation.

  • section (bool, optional) – Whether to use sections in the diagram. Defaults to True.

  • range_time (tuple[int, int], optional) – Time range for the diagram. Defaults to (0, sys.maxsize).

  • detailed_info (bool, optional) – Whether to include detailed information. Defaults to False.

  • view_ready (bool, optional) – Whether to include ready tasks. Defaults to False.

Returns:

None

print_all_product_mermaid_diagram(orientations: str = 'LR', shape_component: str = 'odd', link_type_str_component: str = '-->', subgraph: bool = True, subgraph_direction: str = 'LR')[source]

Print mermaid diagram of all products.

Parameters:
  • orientations (str) – Orientation of the flowchart. Defaults to “LR”.

  • shape_component (str, optional) – Shape of mermaid diagram for components. Defaults to “odd”.

  • link_type_str_component (str, optional) – Link type string of each component. Defaults to “–>”.

  • subgraph (bool, optional) – Whether to use subgraph for products. Defaults to True.

  • subgraph_direction (str, optional) – Direction of product subgraph. Defaults to “LR”.

Returns:

None

print_all_team_gantt_mermaid(project_init_datetime: datetime, project_unit_timedelta: timedelta, target_team_id_order_list: list[str] = None, target_worker_id_order_list: list[str] = None, section: bool = True, range_time: tuple[int, int] = (0, 9223372036854775807), detailed_info: bool = False, view_ready: bool = False)[source]

Print mermaid Gantt diagram for all teams.

Parameters:
  • target_team_id_order_list (list[str], optional) – List of target team IDs in the desired order. Defaults to None.

  • target_worker_id_order_list (list[str], optional) – List of target worker IDs in the desired order. Defaults to None.

  • project_init_datetime (datetime.datetime, optional) – Start datetime of project.

  • project_unit_timedelta (datetime.timedelta, optional) – Unit time of simulation.

  • section (bool, optional) – Whether to use sections in the diagram. Defaults to True.

  • range_time (tuple[int, int], optional) – Time range for the diagram. Defaults to (0, sys.maxsize).

  • detailed_info (bool, optional) – Whether to include detailed information. Defaults to False.

  • view_ready (bool, optional) – Whether to include ready tasks. Defaults to False.

Returns:

None

print_all_team_mermaid_diagram(orientations: str = 'LR', print_worker: bool = True, shape_worker: str = 'stadium', link_type_str_worker: str = '-->', subgraph: bool = True, subgraph_direction: str = 'LR')[source]

Print mermaid diagram of all teams.

Parameters:
  • orientations (str) – Orientation of the flowchart. Defaults to “LR”.

  • print_worker (bool, optional) – Whether to print workers. Defaults to True.

  • shape_worker (str, optional) – Shape of mermaid diagram for workers. Defaults to “stadium”.

  • link_type_str_worker (str, optional) – Link type string of each worker. Defaults to “–>”.

  • subgraph (bool, optional) – Whether to use subgraph for teams. Defaults to True.

  • subgraph_direction (str, optional) – Direction of team subgraph. Defaults to “LR”.

Returns:

None

print_all_workflow_gantt_mermaid(project_init_datetime: datetime, project_unit_timedelta: timedelta, target_workflow_id_order_list: list[str] = None, target_task_id_order_list: list[str] = None, section: bool = True, range_time: tuple[int, int] = (0, 9223372036854775807), detailed_info: bool = False, view_ready: bool = False)[source]

Print mermaid Gantt diagram for all workflows.

Parameters:
  • target_workflow_id_order_list (list[str], optional) – List of target workflow IDs in the desired order. Defaults to None.

  • target_task_id_order_list (list[str], optional) – List of target task IDs in the desired order. Defaults to None.

  • project_init_datetime (datetime.datetime, optional) – Start datetime of project.

  • project_unit_timedelta (datetime.timedelta, optional) – Unit time of simulation.

  • section (bool, optional) – Whether to use sections in the diagram. Defaults to True.

  • range_time (tuple[int, int], optional) – Time range for the diagram. Defaults to (0, sys.maxsize).

  • detailed_info (bool, optional) – Whether to include detailed information. Defaults to False.

  • view_ready (bool, optional) – Whether to include ready tasks. Defaults to False.

Returns:

None

print_all_workflow_mermaid_diagram(orientations: str = 'LR', shape_task: str = 'rect', print_extra_info: bool = True, print_dependency_type: bool = False, link_type_str_task: str = '-->', subgraph: bool = True, subgraph_direction: str = 'LR')[source]

Print mermaid diagram of all workflows.

Parameters:
  • orientations (str) – Orientation of the flowchart. Defaults to “LR”.

  • shape_task (str, optional) – Shape of mermaid diagram for tasks. Defaults to “rect”.

  • print_extra_info (bool, optional) – Whether to print work amount info. Defaults to True.

  • print_dependency_type (bool, optional) – Whether to print dependency type info. Defaults to False.

  • link_type_str_task (str, optional) – Link type string of each task. Defaults to “–>”.

  • subgraph (bool, optional) – Whether to use subgraph for workflows. Defaults to True.

  • subgraph_direction (str, optional) – Direction of workflow subgraph. Defaults to “LR”.

Returns:

None

print_all_workplace_gantt_mermaid(project_init_datetime: datetime, project_unit_timedelta: timedelta, target_workplace_id_order_list: list[str] = None, target_facility_id_order_list: list[str] = None, section: bool = True, range_time: tuple[int, int] = (0, 9223372036854775807), detailed_info: bool = False, view_ready: bool = False)[source]

Print mermaid Gantt diagram for all workplaces.

Parameters:
  • target_workplace_id_order_list (list[str], optional) – List of target workplace IDs in the desired order. Defaults to None.

  • target_facility_id_order_list (list[str], optional) – List of target facility IDs in the desired order. Defaults to None.

  • project_init_datetime (datetime.datetime, optional) – Start datetime of project.

  • project_unit_timedelta (datetime.timedelta, optional) – Unit time of simulation.

  • section (bool, optional) – Whether to use sections in the diagram. Defaults to True.

  • range_time (tuple[int, int], optional) – Time range for the diagram. Defaults to (0, sys.maxsize).

  • detailed_info (bool, optional) – Whether to include detailed information. Defaults to False.

  • view_ready (bool, optional) – Whether to include ready tasks. Defaults to False.

Returns:

None

print_all_workplace_mermaid_diagram(orientations: str = 'LR', print_facility: bool = True, shape_facility: str = 'stadium', link_type_str_facility: str = '-->', subgraph: bool = True, subgraph_direction: str = 'LR')[source]

Print mermaid diagram of all workplaces.

Parameters:
  • orientations (str) – Orientation of the flowchart. Defaults to “LR”.

  • print_facility (bool, optional) – Whether to print facilities. Defaults to True.

  • shape_facility (str, optional) – Shape of mermaid diagram for facilities. Defaults to “stadium”.

  • link_type_str_facility (str, optional) – Link type string of each facility. Defaults to “–>”.

  • subgraph (bool, optional) – Whether to use subgraph for workplaces. Defaults to True.

  • subgraph_direction (str, optional) – Direction of workplace subgraph. Defaults to “LR”.

Returns:

None

print_log(target_step_time: int)[source]

Print log in the specified step time.

Parameters:

target_step_time (int) – Target step time for printing the log.

print_mermaid_diagram(orientations: str = 'LR', shape_component: str = 'odd', link_type_str_component: str = '-->', subgraph_product: bool = True, subgraph_direction_product: str = 'LR', shape_task: str = 'rect', print_extra_info: bool = True, print_dependency_type: bool = False, link_type_str_task: str = '-->', subgraph_workflow: bool = True, subgraph_direction_workflow: str = 'LR', print_worker: bool = True, shape_worker: str = 'stadium', link_type_str_worker: str = '-->', subgraph_team: bool = True, subgraph_direction_team: str = 'LR', print_facility: bool = True, shape_facility: str = 'stadium', link_type_str_facility: str = '-->', subgraph_workplace: bool = True, subgraph_direction_workplace: str = 'LR', link_type_str_component_task: str = '-.-', link_type_str_worker_task: str = '-.-', link_type_str_facility_task: str = '-.-', link_type_str_worker_facility: str = '-.-', subgraph: bool = False, subgraph_direction: str = 'LR')[source]

Print mermaid diagram of this project.

Parameters:
  • orientations (str, optional) – Orientation of the flowchart. Defaults to “LR”.

  • shape_component (str, optional) – Shape of mermaid diagram for components. Defaults to “odd”.

  • link_type_str_component (str, optional) – Link type string of each component. Defaults to “–>”.

  • subgraph_product (bool, optional) – Whether to use subgraph for products. Defaults to True.

  • subgraph_direction_product (str, optional) – Direction of product subgraph. Defaults to “LR”.

  • shape_task (str, optional) – Shape of mermaid diagram for tasks. Defaults to “rect”.

  • print_extra_info (bool, optional) – Whether to print work amount info. Defaults to True.

  • print_dependency_type (bool, optional) – Whether to print dependency type info. Defaults to False.

  • link_type_str_task (str, optional) – Link type string of each task. Defaults to “–>”.

  • subgraph_workflow (bool, optional) – Whether to use subgraph for workflows. Defaults to True.

  • subgraph_direction_workflow (str, optional) – Direction of workflow subgraph. Defaults to “LR”.

  • print_worker (bool, optional) – Whether to print workers. Defaults to True.

  • shape_worker (str, optional) – Shape of mermaid diagram for workers. Defaults to “stadium”.

  • link_type_str_worker (str, optional) – Link type string of each worker. Defaults to “–>”.

  • subgraph_team (bool, optional) – Whether to use subgraph for teams. Defaults to True.

  • subgraph_direction_team (str, optional) – Direction of team subgraph. Defaults to “LR”.

  • print_facility (bool, optional) – Whether to print facilities. Defaults to True.

  • shape_facility (str, optional) – Shape of mermaid diagram for facilities. Defaults to “stadium”.

  • link_type_str_facility (str, optional) – Link type string of each facility. Defaults to “–>”.

  • subgraph_workplace (bool, optional) – Whether to use subgraph for workplaces. Defaults to True.

  • subgraph_direction_workplace (str, optional) – Direction of workplace subgraph. Defaults to “LR”.

  • link_type_str_component_task (str, optional) – Link type string of each component and task. Defaults to “-.-“.

  • link_type_str_worker_task (str, optional) – Link type string of each worker and task. Defaults to “-.-“.

  • link_type_str_facility_task (str, optional) – Link type string of each facility and task. Defaults to “-.-“.

  • link_type_str_worker_facility (str, optional) – Link type string of each worker and facility. Defaults to “-.-“.

  • subgraph (bool, optional) – Whether to use subgraph for the whole diagram. Defaults to False.

  • subgraph_direction (str, optional) – Direction of the main subgraph. Defaults to “LR”.

Returns:

None

print_target_mermaid_diagram(target_product_set: set[BaseProduct] = None, target_workflow_set: set[BaseWorkflow] = None, target_team_set: set[BaseTeam] = None, target_workplace_set: set[BaseWorkplace] = None, orientations: str = 'LR', shape_component: str = 'odd', link_type_str_component: str = '-->', subgraph_product: bool = True, subgraph_direction_product: str = 'LR', shape_task: str = 'rect', print_extra_info: bool = True, print_dependency_type: bool = False, link_type_str_task: str = '-->', subgraph_workflow: bool = True, subgraph_direction_workflow: str = 'LR', print_worker: bool = True, shape_worker: str = 'stadium', link_type_str_worker: str = '-->', subgraph_team: bool = True, subgraph_direction_team: str = 'LR', print_facility: bool = True, shape_facility: str = 'stadium', link_type_str_facility: str = '-->', subgraph_workplace: bool = True, subgraph_direction_workplace: str = 'LR', link_type_str_component_task: str = '-.-', link_type_str_worker_task: str = '-.-', link_type_str_facility_task: str = '-.-', link_type_str_worker_facility: str = '-.-', subgraph: bool = False, subgraph_direction: str = 'LR')[source]

Print mermaid diagram of target information.

Parameters:
  • target_product_set (set[BaseProduct], optional) – Target product set. Defaults to None.

  • target_workflow_set (set[BaseWorkflow], optional) – Target workflow set. Defaults to None.

  • target_team_set (set[BaseTeam], optional) – Target team set. Defaults to None.

  • target_workplace_set (set[BaseWorkplace], optional) – Target workplace set. Defaults to None.

  • orientations (str, optional) – Orientation of the flowchart. Defaults to “LR”.

  • shape_component (str, optional) – Shape of mermaid diagram for components. Defaults to “odd”.

  • link_type_str_component (str, optional) – Link type string of each component. Defaults to “–>”.

  • subgraph_product (bool, optional) – Whether to use subgraph for products. Defaults to True.

  • subgraph_direction_product (str, optional) – Direction of product subgraph. Defaults to “LR”.

  • shape_task (str, optional) – Shape of mermaid diagram for tasks. Defaults to “rect”.

  • print_extra_info (bool, optional) – Whether to print work amount info. Defaults to True.

  • print_dependency_type (bool, optional) – Whether to print dependency type info. Defaults to False.

  • link_type_str_task (str, optional) – Link type string of each task. Defaults to “–>”.

  • subgraph_workflow (bool, optional) – Whether to use subgraph for workflows. Defaults to True.

  • subgraph_direction_workflow (str, optional) – Direction of workflow subgraph. Defaults to “LR”.

  • print_worker (bool, optional) – Whether to print workers. Defaults to True.

  • shape_worker (str, optional) – Shape of mermaid diagram for workers. Defaults to “stadium”.

  • link_type_str_worker (str, optional) – Link type string of each worker. Defaults to “–>”.

  • subgraph_team (bool, optional) – Whether to use subgraph for teams. Defaults to True.

  • subgraph_direction_team (str, optional) – Direction of team subgraph. Defaults to “LR”.

  • print_facility (bool, optional) – Whether to print facilities. Defaults to True.

  • shape_facility (str, optional) – Shape of mermaid diagram for facilities. Defaults to “stadium”.

  • link_type_str_facility (str, optional) – Link type string of each facility. Defaults to “–>”.

  • subgraph_workplace (bool, optional) – Whether to use subgraph for workplaces. Defaults to True.

  • subgraph_direction_workplace (str, optional) – Direction of workplace subgraph. Defaults to “LR”.

  • link_type_str_component_task (str, optional) – Link type string of each component and task. Defaults to “-.-“.

  • link_type_str_worker_task (str, optional) – Link type string of each worker and task. Defaults to “-.-“.

  • link_type_str_facility_task (str, optional) – Link type string of each facility and task. Defaults to “-.-“.

  • link_type_str_worker_facility (str, optional) – Link type string of each worker and facility. Defaults to “-.-“.

  • subgraph (bool, optional) – Whether to use subgraph for the whole diagram. Defaults to False.

  • subgraph_direction (str, optional) – Direction of the main subgraph. Defaults to “LR”.

Returns:

None

Print mermaid diagram of product-related information for the specified products.

Parameters:
  • target_product_set (set[BaseProduct]) – Target product set.

  • orientations (str, optional) – Orientation of the flowchart. Defaults to “LR”.

  • shape_component (str, optional) – Shape of mermaid diagram for components. Defaults to “odd”.

  • link_type_str_component (str, optional) – Link type string of each component. Defaults to “–>”.

  • subgraph_product (bool, optional) – Whether to use subgraph for products. Defaults to True.

  • subgraph_direction_product (str, optional) – Direction of product subgraph. Defaults to “LR”.

  • shape_task (str, optional) – Shape of mermaid diagram for tasks. Defaults to “rect”.

  • print_extra_info (bool, optional) – Whether to print work amount info. Defaults to True.

  • print_dependency_type (bool, optional) – Whether to print dependency type info. Defaults to False.

  • link_type_str_task (str, optional) – Link type string of each task. Defaults to “–>”.

  • subgraph_workflow (bool, optional) – Whether to use subgraph for workflows. Defaults to True.

  • subgraph_direction_workflow (str, optional) – Direction of workflow subgraph. Defaults to “LR”.

  • print_worker (bool, optional) – Whether to print workers. Defaults to True.

  • shape_worker (str, optional) – Shape of mermaid diagram for workers. Defaults to “stadium”.

  • link_type_str_worker (str, optional) – Link type string of each worker. Defaults to “–>”.

  • subgraph_team (bool, optional) – Whether to use subgraph for teams. Defaults to True.

  • subgraph_direction_team (str, optional) – Direction of team subgraph. Defaults to “LR”.

  • print_facility (bool, optional) – Whether to print facilities. Defaults to True.

  • shape_facility (str, optional) – Shape of mermaid diagram for facilities. Defaults to “stadium”.

  • link_type_str_facility (str, optional) – Link type string of each facility. Defaults to “–>”.

  • subgraph_workplace (bool, optional) – Whether to use subgraph for workplaces. Defaults to True.

  • subgraph_direction_workplace (str, optional) – Direction of workplace subgraph. Defaults to “LR”.

  • link_type_str_component_task (str, optional) – Link type string of each component and task. Defaults to “-.-“.

  • link_type_str_worker_task (str, optional) – Link type string of each worker and task. Defaults to “-.-“.

  • link_type_str_facility_task (str, optional) – Link type string of each facility and task. Defaults to “-.-“.

  • link_type_str_worker_facility (str, optional) – Link type string of each worker and facility. Defaults to “-.-“.

  • subgraph (bool, optional) – Whether to use subgraph for the whole diagram. Defaults to False.

  • subgraph_direction (str, optional) – Direction of the main subgraph. Defaults to “LR”.

Returns:

None

Print mermaid diagram of team-related information for the specified teams.

Parameters:
  • target_team_set (set[BaseTeam]) – Target team set.

  • orientations (str, optional) – Orientation of the flowchart. Defaults to “LR”.

  • shape_component (str, optional) – Shape of mermaid diagram for components. Defaults to “odd”.

  • link_type_str_component (str, optional) – Link type string of each component. Defaults to “–>”.

  • subgraph_product (bool, optional) – Whether to use subgraph for products. Defaults to True.

  • subgraph_direction_product (str, optional) – Direction of product subgraph. Defaults to “LR”.

  • shape_task (str, optional) – Shape of mermaid diagram for tasks. Defaults to “rect”.

  • print_extra_info (bool, optional) – Whether to print work amount info. Defaults to True.

  • print_dependency_type (bool, optional) – Whether to print dependency type info. Defaults to False.

  • link_type_str_task (str, optional) – Link type string of each task. Defaults to “–>”.

  • subgraph_workflow (bool, optional) – Whether to use subgraph for workflows. Defaults to True.

  • subgraph_direction_workflow (str, optional) – Direction of workflow subgraph. Defaults to “LR”.

  • print_worker (bool, optional) – Whether to print workers. Defaults to True.

  • shape_worker (str, optional) – Shape of mermaid diagram for workers. Defaults to “stadium”.

  • link_type_str_worker (str, optional) – Link type string of each worker. Defaults to “–>”.

  • subgraph_team (bool, optional) – Whether to use subgraph for teams. Defaults to True.

  • subgraph_direction_team (str, optional) – Direction of team subgraph. Defaults to “LR”.

  • print_facility (bool, optional) – Whether to print facilities. Defaults to True.

  • shape_facility (str, optional) – Shape of mermaid diagram for facilities. Defaults to “stadium”.

  • link_type_str_facility (str, optional) – Link type string of each facility. Defaults to “–>”.

  • subgraph_workplace (bool, optional) – Whether to use subgraph for workplaces. Defaults to True.

  • subgraph_direction_workplace (str, optional) – Direction of workplace subgraph. Defaults to “LR”.

  • link_type_str_component_task (str, optional) – Link type string of each component and task. Defaults to “-.-“.

  • link_type_str_worker_task (str, optional) – Link type string of each worker and task. Defaults to “-.-“.

  • link_type_str_facility_task (str, optional) – Link type string of each facility and task. Defaults to “-.-“.

  • link_type_str_worker_facility (str, optional) – Link type string of each worker and facility. Defaults to “-.-“.

  • subgraph (bool, optional) – Whether to use subgraph for the whole diagram. Defaults to False.

  • subgraph_direction (str, optional) – Direction of the main subgraph. Defaults to “LR”.

Returns:

None

Print mermaid diagram of workflow-related information for the specified workflows.

Parameters:
  • target_workflow_set (set[BaseWorkflow]) – Target workflow set.

  • orientations (str, optional) – Orientation of the flowchart. Defaults to “LR”.

  • shape_component (str, optional) – Shape of mermaid diagram for components. Defaults to “odd”.

  • link_type_str_component (str, optional) – Link type string of each component. Defaults to “–>”.

  • subgraph_product (bool, optional) – Whether to use subgraph for products. Defaults to True.

  • subgraph_direction_product (str, optional) – Direction of product subgraph. Defaults to “LR”.

  • shape_task (str, optional) – Shape of mermaid diagram for tasks. Defaults to “rect”.

  • print_extra_info (bool, optional) – Whether to print work amount info. Defaults to True.

  • print_dependency_type (bool, optional) – Whether to print dependency type info. Defaults to False.

  • link_type_str_task (str, optional) – Link type string of each task. Defaults to “–>”.

  • subgraph_workflow (bool, optional) – Whether to use subgraph for workflows. Defaults to True.

  • subgraph_direction_workflow (str, optional) – Direction of workflow subgraph. Defaults to “LR”.

  • print_worker (bool, optional) – Whether to print workers. Defaults to True.

  • shape_worker (str, optional) – Shape of mermaid diagram for workers. Defaults to “stadium”.

  • link_type_str_worker (str, optional) – Link type string of each worker. Defaults to “–>”.

  • subgraph_team (bool, optional) – Whether to use subgraph for teams. Defaults to True.

  • subgraph_direction_team (str, optional) – Direction of team subgraph. Defaults to “LR”.

  • print_facility (bool, optional) – Whether to print facilities. Defaults to True.

  • shape_facility (str, optional) – Shape of mermaid diagram for facilities. Defaults to “stadium”.

  • link_type_str_facility (str, optional) – Link type string of each facility. Defaults to “–>”.

  • subgraph_workplace (bool, optional) – Whether to use subgraph for workplaces. Defaults to True.

  • subgraph_direction_workplace (str, optional) – Direction of workplace subgraph. Defaults to “LR”.

  • link_type_str_component_task (str, optional) – Link type string of each component and task. Defaults to “-.-“.

  • link_type_str_worker_task (str, optional) – Link type string of each worker and task. Defaults to “-.-“.

  • link_type_str_facility_task (str, optional) – Link type string of each facility and task. Defaults to “-.-“.

  • link_type_str_worker_facility (str, optional) – Link type string of each worker and facility. Defaults to “-.-“.

  • subgraph (bool, optional) – Whether to use subgraph for the whole diagram. Defaults to False.

  • subgraph_direction (str, optional) – Direction of the main subgraph. Defaults to “LR”.

Returns:

None

Print mermaid diagram of workplace-related information for the specified workplaces.

Parameters:
  • target_workplace_set (set[BaseWorkplace]) – Target workplace set.

  • orientations (str, optional) – Orientation of the flowchart. Defaults to “LR”.

  • shape_component (str, optional) – Shape of mermaid diagram for components. Defaults to “odd”.

  • link_type_str_component (str, optional) – Link type string of each component. Defaults to “–>”.

  • subgraph_product (bool, optional) – Whether to use subgraph for products. Defaults to True.

  • subgraph_direction_product (str, optional) – Direction of product subgraph. Defaults to “LR”.

  • shape_task (str, optional) – Shape of mermaid diagram for tasks. Defaults to “rect”.

  • print_extra_info (bool, optional) – Whether to print work amount info. Defaults to True.

  • print_dependency_type (bool, optional) – Whether to print dependency type info. Defaults to False.

  • link_type_str_task (str, optional) – Link type string of each task. Defaults to “–>”.

  • subgraph_workflow (bool, optional) – Whether to use subgraph for workflows. Defaults to True.

  • subgraph_direction_workflow (str, optional) – Direction of workflow subgraph. Defaults to “LR”.

  • print_worker (bool, optional) – Whether to print workers. Defaults to True.

  • shape_worker (str, optional) – Shape of mermaid diagram for workers. Defaults to “stadium”.

  • link_type_str_worker (str, optional) – Link type string of each worker. Defaults to “–>”.

  • subgraph_team (bool, optional) – Whether to use subgraph for teams. Defaults to True.

  • subgraph_direction_team (str, optional) – Direction of team subgraph. Defaults to “LR”.

  • print_facility (bool, optional) – Whether to print facilities. Defaults to True.

  • shape_facility (str, optional) – Shape of mermaid diagram for facilities. Defaults to “stadium”.

  • link_type_str_facility (str, optional) – Link type string of each facility. Defaults to “–>”.

  • subgraph_workplace (bool, optional) – Whether to use subgraph for workplaces. Defaults to True.

  • subgraph_direction_workplace (str, optional) – Direction of workplace subgraph. Defaults to “LR”.

  • link_type_str_component_task (str, optional) – Link type string of each component and task. Defaults to “-.-“.

  • link_type_str_worker_task (str, optional) – Link type string of each worker and task. Defaults to “-.-“.

  • link_type_str_facility_task (str, optional) – Link type string of each facility and task. Defaults to “-.-“.

  • link_type_str_worker_facility (str, optional) – Link type string of each worker and facility. Defaults to “-.-“.

  • subgraph (bool, optional) – Whether to use subgraph for the whole diagram. Defaults to False.

  • subgraph_direction (str, optional) – Direction of the main subgraph. Defaults to “LR”.

Returns:

None

read_simple_json(file_path: str, encoding: str = 'utf-8')[source]

Read a JSON file created by BaseProject.write_simple_json() and load project data.

Parameters:
  • file_path (str) – File path for reading this project data.

  • encoding (str, optional) – Encoding for the JSON file. Defaults to “utf-8”.

Returns:

None

remove_absence_time_list()[source]

Remove record information on absence_time_list.

This method removes all records related to absence times from products, workflows, teams, workplaces, and the project’s cost record list. It also updates the simulation time and clears the absence_time_list.

Returns:

None

remove_component_on_workplace(target_component: BaseComponent, placed_workplace: BaseWorkplace, set_to_all_children: bool = True)[source]

Remove the placed workplace from a component.

Parameters:
  • target_component (BaseComponent) – Component to remove from the workplace.

  • placed_workplace (BaseWorkplace) – Workplace from which the component will be removed.

  • set_to_all_children (bool, optional) – If True, remove placed_workplace from all child components recursively. Defaults to True.

Returns:

None

reverse_log_information()[source]

Reverse the log information for the project and all its elements.

This method reverses the order of cost records, absence time list, and calls reverse_log_information for all products, workflows, teams, and workplaces. It is mainly used after backward simulation to align log information with forward time order.

set_component_on_workplace(target_component: BaseComponent, placed_workplace: BaseWorkplace, set_to_all_children: bool = True)[source]

Set the placed workplace for a component.

Parameters:
  • target_component (BaseComponent) – Target component to set placed_workplace.

  • placed_workplace (BaseWorkplace) – Workplace to place this component in. If None, removes placement.

  • set_to_all_children (bool, optional) – If True, set placed_workplace to all child components recursively. Defaults to True.

Returns:

None

set_last_datetime(last_datetime: datetime, unit_timedelta: timedelta | None = None, set_init_datetime: bool = True)[source]

Set the last datetime to project simulation result.

This method calculates and optionally sets the initial datetime (init_datetime) of the project so that the simulation ends at the specified last_datetime.

Parameters:
  • last_datetime (datetime.datetime) – Last datetime of the project.

  • unit_timedelta (datetime.timedelta, optional) – Unit time of simulation. If None, uses self.unit_timedelta.

  • set_init_datetime (bool, optional) – If True, sets the calculated init_datetime to this project. Defaults to True.

Returns:

Calculated init datetime of the project considering the last_datetime.

Return type:

datetime.datetime

simulate(task_priority_rule: TaskPriorityRuleMode = TaskPriorityRuleMode.TSLACK, error_tol: float = 1e-10, work_amount_limit_per_unit_time: float = 10000000000.0, count_auto_task_in_work_amount_limit: bool = False, absence_time_list: list[int] | None = None, perform_auto_task_while_absence_time: bool = False, initialize_state_info: bool = True, initialize_log_info: bool = True, max_time: int = 10000, unit_time: int = 1, progress_bar: bool = False)[source]

Simulate this BaseProject.

Parameters:
  • task_priority_rule (TaskPriorityRule, optional) – Task priority rule for simulation. Defaults to TaskPriorityRule.TSLACK.

  • error_tol (float, optional) – Measures against numerical error. Defaults to 1e-10.

  • work_amount_limit_per_unit_time (float, optional) – Upper limit on the total remaining work amount that can be in the WORKING state at any given time. When this limit is reached, additional tasks that would otherwise transition from READY to WORKING remain in the READY state until enough work is completed (i.e., the total remaining work of WORKING tasks falls below the limit). Defaults to 1e10.

  • count_auto_task_in_work_amount_limit (bool, optional) – Whether auto tasks should be counted toward the work amount limit. Defaults to False.

  • absence_time_list (List[int], optional) – List of absence times in simulation. Defaults to None (workers work every time).

  • perform_auto_task_while_absence_time (bool, optional) – Whether to perform auto tasks during absence time. Defaults to False.

  • initialize_state_info (bool, optional) – Whether to initialize state info of this project. Defaults to True.

  • initialize_log_info (bool, optional) – Whether to initialize log info of this project. Defaults to True.

  • max_time (int, optional) – Maximum simulation time. Defaults to 10000.

  • unit_time (int, optional) – Unit time of simulation. Defaults to 1.

  • progress_bar (bool, optional) – Whether to show progress bar during simulation. Defaults to False.

update_product_set(product_set: set[BaseProduct])[source]

Update product set to this project.

Parameters:

product_set (set[BaseProduct]) – Set of products to update.

Raises:

TypeError – If any item in product_set is not a BaseProduct.

update_team_set(team_set: set[BaseTeam])[source]

Update team set to this project.

Parameters:

team_set (set[BaseTeam]) – Set of teams to update.

Raises:

TypeError – If any item in team_set is not a BaseTeam.

update_workflow_set(workflow_set: set[BaseWorkflow])[source]

Update workflow set to this project.

Parameters:

workflow_set (set[BaseWorkflow]) – Set of workflows to update.

Raises:

TypeError – If any item in workflow_set is not a BaseWorkflow.

update_workplace_set(workplace_set: set[BaseWorkplace])[source]

Update workplace set to this project.

Parameters:

workplace_set (set[BaseWorkplace]) – Set of workplaces to update.

Raises:

TypeError – If any item in workplace_set is not a BaseWorkplace.

write_simple_json(file_path: str, encoding: str = 'utf-8', indent: int = 4)[source]

Create a JSON file of this project.

Parameters:
  • file_path (str) – File path for saving this project data.

  • encoding (str, optional) – Encoding for the JSON file. Defaults to “utf-8”.

  • indent (int, optional) – Indentation level for JSON formatting. Defaults to 4.

Returns:

None

class pDESy.model.base_project.BaseProjectStatus(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

BaseProjectStatus.

FINISHED_FAILURE = -1
FINISHED_SUCCESS = 1
NONE = 0
class pDESy.model.base_project.SimulationMode(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

SimulationMode.

BACKWARD = -1
FORWARD = 1
NONE = 0

pDESy.model.base_subproject_task module

BaseSubProjectTask module.

This module provides the BaseSubProjectTask class for expressing target sub projects.

Classes:

BaseSubProjectTask: A class representing a sub project task, inheriting from BaseTask.

class pDESy.model.base_subproject_task.BaseSubProjectTask(file_path: str = None, unit_timedelta: timedelta = None, read_json_file: bool = False, remove_absence_time_list: bool = False, name: str = None, ID: str = None, default_work_amount: float = None, work_amount_progress_of_unit_step_time: float = None, input_task_id_dependency_set: set = None, allocated_team_id_set: set = None, allocated_workplace_id_set: set = None, parent_workflow_id: str = None, workplace_priority_rule: WorkplacePriorityRuleMode = WorkplacePriorityRuleMode.FSS, worker_priority_rule: ResourcePriorityRuleMode = ResourcePriorityRuleMode.SSP, facility_priority_rule: ResourcePriorityRuleMode = ResourcePriorityRuleMode.SSP, need_facility: bool = False, target_component_id: str = None, default_progress: float = None, due_time: float = None, auto_task: bool = True, fixing_allocating_worker_id_set: set = None, fixing_allocating_facility_id_set: set = None, est: float = 0.0, eft: float = 0.0, lst: float = -1.0, lft: float = -1.0, remaining_work_amount: float = None, remaining_work_amount_record_list: list = None, state: BaseTaskState = BaseTaskState.NONE, state_record_list: list = None, allocated_worker_facility_id_tuple_set: set = None, allocated_worker_facility_id_tuple_set_record_list: list = None, additional_work_amount: float = None, additional_task_flag: bool = False, actual_work_amount: float = None)[source]

Bases: BaseTask

A class representing a sub project task.

This class is used for expressing a target sub project within the simulation.

export_dict_json_data()[source]

Exports the information of this task to a JSON-serializable dictionary.

Returns:

JSON format data.

Return type:

dict

set_all_attributes_from_json(file_path: str = None, remove_absence_time_list: bool = True)[source]

Reads attributes from a JSON file created by BaseProject.write_simple_json().

Parameters:
  • file_path (str, optional) – JSON file path for reading sub project data. Defaults to None, which uses self.file_path.

  • remove_absence_time_list (bool, optional) – Whether to remove absence_time_list information from the JSON file. Defaults to True.

Returns:

Duration step time of the target project. datetime.timedelta: Unit time of the target project.

Return type:

int

set_work_amount_progress_of_unit_step_time(project_unit_timedelta: timedelta)[source]

Sets the work amount progress of unit step time.

Parameters:

project_unit_timedelta (datetime.timedelta) – The unit time of the project.

pDESy.model.base_task module

base_task.

class pDESy.model.base_task.BaseTask(name: str = None, ID: str = None, default_work_amount: float = 10.0, work_amount_progress_of_unit_step_time: float = 1.0, input_task_id_dependency_set: set[tuple[str, BaseTaskDependency]] = None, allocated_team_id_set: set[str] = None, allocated_workplace_id_set: set[str] = None, parent_workflow_id: str = None, workplace_priority_rule: WorkplacePriorityRuleMode = WorkplacePriorityRuleMode.FSS, worker_priority_rule: ResourcePriorityRuleMode = ResourcePriorityRuleMode.MW, facility_priority_rule: ResourcePriorityRuleMode = ResourcePriorityRuleMode.SSP, need_facility: bool = False, target_component_id: str = None, default_progress: float = 0.0, due_time: int = -1, auto_task: bool = False, fixing_allocating_worker_id_set: set[str] = None, fixing_allocating_facility_id_set: set[str] = None, est: float = 0.0, eft: float = 0.0, lst: float = -1.0, lft: float = -1.0, remaining_work_amount: float = None, remaining_work_amount_record_list: list[float] = None, state: BaseTaskState = BaseTaskState.NONE, state_record_list: list[BaseTaskState] = None, allocated_worker_facility_id_tuple_set: set[tuple[str, str]] = None, allocated_worker_facility_id_tuple_set_record_list: list[set[tuple[str, str]]] = None, additional_work_amount: float = None, additional_task_flag: bool = False, actual_work_amount: float = None)[source]

Bases: SingleNodeMermaidDiagramMixin, ComponentTaskCommonMixin, AssignedPairsMixin, SingleNodeLogJsonMixin, SingleNodeCommonMixin, object

add_input_task(input_task: BaseTask, task_dependency_mode: BaseTaskDependency = BaseTaskDependency.FS)[source]

Add input task to input_task_id_dependency_set.

Parameters:
  • input_task (BaseTask) – Input BaseTask.

  • task_dependency_mode (BaseTaskDependency, optional) – Task Dependency mode between input_task to this task. Default to BaseTaskDependency.FS.

add_target_component(target_component: BaseComponent)[source]

Add target component to this task.

Parameters:

target_component (BaseComponent) – Target BaseComponent.

append_input_task_dependency(input_task: BaseTask, task_dependency_mode: BaseTaskDependency = BaseTaskDependency.FS)[source]

Append input task to input_task_id_dependency_set.

Deprecated since version Use: add_input_task instead.

Parameters:
  • input_task (BaseTask) – Input BaseTask.

  • task_dependency_mode (BaseTaskDependency, optional) – Task Dependency mode between input_task to this task. Default to BaseTaskDependency.FS.

extend_input_task_list(input_task_list: list[BaseTask], input_task_dependency_mode: BaseTaskDependency = BaseTaskDependency.FS)[source]

Extend the set of input tasks and FS dependency to input_task_id_dependency_set.

Deprecated since version Use: update_input_task_set instead.

Parameters:

input_task_id_dependency_set (set(tuple(str, BaseTask))) – Set of input BaseTask and type of dependency(FS, SS, SF, F/F).

get_gantt_mermaid_steps_data(range_time: tuple[int, int] = (0, 9223372036854775807), detailed_info: bool = False, id_name_dict: dict[str, str] = None, view_ready: bool = False)[source]

Get gantt mermaid steps data of this task.

Parameters:
  • range_time (tuple[int, int], optional) – Range of gantt chart. Defaults to (0, sys.maxsize).

  • detailed_info (bool, optional) – If True, print detailed information. Defaults to False.

  • id_name_dict (dict[str, str], optional) – Dictionary to map ID to name. Defaults to None.

  • view_ready (bool, optional) – If True, include ready time in Gantt chart. Defaults to False.

Returns:

List of lines for gantt mermaid steps diagram.

Return type:

list[str]

get_mermaid_diagram(shape: str = 'rect', subgraph: bool = False, subgraph_name: str = 'Task', subgraph_direction: str = 'LR', print_extra_info: bool = True)[source]

Get mermaid diagram of this task.

Parameters:
  • shape (str, optional) – Shape of mermaid diagram. Defaults to “rect”.

  • subgraph (bool, optional) – Subgraph or not. Defaults to False.

  • subgraph_name (str, optional) – Subgraph name. Defaults to “Task”.

  • subgraph_direction (str, optional) – Direction of subgraph. Defaults to “LR”.

  • print_extra_info (bool, optional) – Print extra information or not. Defaults to True.

Returns:

List of lines for mermaid diagram.

Return type:

list[str]

get_state_from_record(time: int)[source]

Get the state information in time.

Parameters:

time (int) – Target simulation time.

Returns:

Task State information.

Return type:

BaseTaskState

get_time_list_for_gantt_chart(finish_margin: float = 1.0)[source]

Get ready/working time_list for drawing Gantt chart.

Parameters:

finish_margin (float, optional) – Margin of finish time in Gantt chart. Defaults to 1.0.

Returns:

  • ready_time_list including start_time, length

  • working_time_list including start_time, length

Return type:

Tuple[List[tuple(int, int)], List[tuple(int, int)]]

initialize(error_tol: float = 1e-10, state_info: bool = True, log_info: bool = True)[source]

Initialize the changeable variables of BaseTask.

If state_info is True, the following attributes are initialized:
  • est

  • eft

  • lst

  • lft

  • remaining_work_amount

  • state

  • allocated_worker_facility_id_tuple_set

  • additional_task_flag

  • actual_work_amount

If log_info is True, the following attributes are initialized:
  • remaining_work_amount_record_list

  • state_record_list

  • allocated_worker_facility_id_tuple_set_record_list

Parameters:
  • error_tol (float, optional) – Error toleration of work amount for checking the state of this task. Defaults to 1e-10.

  • state_info (bool, optional) – Whether to initialize state information. Defaults to True.

  • log_info (bool, optional) – Whether to initialize log information. Defaults to True.

print_mermaid_diagram(orientations: str = 'LR', shape: str = 'rect', subgraph: bool = False, subgraph_name: str = 'Task', subgraph_direction: str = 'LR', print_extra_info: bool = True)[source]

Print mermaid diagram of this task.

Parameters:
  • orientations (str, optional) – Orientation of mermaid diagram. Defaults to “LR”.

  • shape (str, optional) – Shape of mermaid diagram. Defaults to “rect”.

  • subgraph (bool, optional) – Subgraph or not. Defaults to False.

  • subgraph_name (str, optional) – Subgraph name. Defaults to “Task”.

  • subgraph_direction (str, optional) – Direction of subgraph. Defaults to “LR”.

  • print_extra_info (bool, optional) – Print extra information or not. Defaults to True.

update_input_task_set(input_task_set: set[BaseTask], input_task_dependency_mode: BaseTaskDependency = BaseTaskDependency.FS)[source]

Update the set of input tasks and FS dependency to input_task_id_dependency_set.

Parameters:

input_task_id_dependency_set (set(tuple(str, BaseTask))) – Set of input BaseTask and type of dependency(FS, SS, SF, F/F).

class pDESy.model.base_task.BaseTaskDependency(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

BaseTaskDependency.

Enum for representing task dependency types.

FS

Finish to Start.

Type:

int

SS

Start to Start.

Type:

int

FF

Finish to Finish.

Type:

int

SF

Start to Finish.

Type:

int

FF = 2
FS = 0
SF = 3
SS = 1
class pDESy.model.base_task.BaseTaskState(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

BaseTaskState.

Enum for representing the state of a task.

NONE

No state.

Type:

int

READY

Ready to start.

Type:

int

WORKING

Currently working.

Type:

int

WORKING_ADDITIONALLY

Working additionally.

Type:

int

FINISHED

Finished.

Type:

int

FINISHED = -1
NONE = 0
READY = 1
WORKING = 2
WORKING_ADDITIONALLY = 3

pDESy.model.base_team module

base_team.

class pDESy.model.base_team.BaseTeam(name: str = None, ID: str = None, worker_set: set[BaseWorker] = None, targeted_task_id_set: set[str] = None, parent_team_id: str = None, cost_record_list: list[float] = None)[source]

Bases: CollectionMermaidDiagramMixin, CollectionCommonMixin, CollectionLogJsonMixin, object

add_labor_cost(only_working: bool = True, add_zero_to_all_workers: bool = False)[source]

Add labor cost to workers in this team.

add_targeted_task(targeted_task: BaseTask)[source]

Add targeted task.

Parameters:

targeted_task (BaseTask) – Targeted task.

add_worker(worker: BaseWorker)[source]

Add worker to worker_set.

Parameters:

worker (BaseWorker) – Worker which is added to this workplace.

append_targeted_task(targeted_task: BaseTask)[source]

Append targeted task.

Deprecated since version Use: add_targeted_task instead.

Parameters:

targeted_task (BaseTask) – Targeted task.

check_update_state_from_absence_time_list(step_time: int)[source]

Check and update state of all resources to ABSENCE or FREE or WORKING.

Parameters:

step_time (int) – Target step time of checking and updating state of workers.

create_cost_history_plotly(init_datetime: datetime, unit_timedelta: timedelta, title: str = 'Cost Chart', save_fig_path: str = None)[source]

Create cost chart by plotly.

This method will be used after simulation.

Parameters:
  • init_datetime (datetime.datetime) – Start datetime of project.

  • unit_timedelta (datetime.timedelta) – Unit time of simulation.

  • title (str, optional) – Title of cost chart. Defaults to “Cost Chart”.

  • save_fig_path (str, optional) – Path of saving figure. Defaults to None.

Returns:

Figure for a gantt chart.

Return type:

figure

Raises:

ImportError – If plotly is not installed.

create_data_for_cost_history_plotly(init_datetime: datetime, unit_timedelta: timedelta)[source]

Create data for cost history plotly from cost_record_list of BaseWorker in worker_set.

Parameters:
  • init_datetime (datetime.datetime) – Start datetime of project.

  • unit_timedelta (datetime.timedelta) – Unit time of simulation.

Returns:

Information of cost history chart.

Return type:

List[go.Bar]

Raises:

ImportError – If plotly is not installed.

create_data_for_gantt_plotly(init_datetime: datetime, unit_timedelta: timedelta, target_id_order_list: list[str] = None, finish_margin: float = 1.0, print_team_name: bool = True, view_ready: bool = False, view_absence: bool = False)[source]

Create data for gantt plotly of BaseWorker in worker_set.

Parameters:
  • init_datetime (datetime.datetime) – Start datetime of project.

  • unit_timedelta (datetime.timedelta) – Unit time of simulation.

  • target_id_order_list (list[str], optional) – Target ID order list. Defaults to None.

  • finish_margin (float, optional) – Margin of finish time in Gantt chart. Defaults to 1.0.

  • print_team_name (bool, optional) – Print team name or not. Defaults to True.

  • view_ready (bool, optional) – View READY time or not. Defaults to False.

  • view_absence (bool, optional) – View Absence time or not. Defaults to False.

Returns:

Gantt plotly information of this BaseTeam.

Return type:

List[dict]

create_gantt_plotly(init_datetime: datetime, unit_timedelta: timedelta, target_id_order_list: list[str] = None, title: str = 'Gantt Chart', colors: dict[str, str] = None, index_col: str = None, showgrid_x: bool = True, showgrid_y: bool = True, group_tasks: bool = True, show_colorbar: bool = True, print_team_name: bool = True, save_fig_path: str = None)[source]

Create Gantt chart by plotly.

This method will be used after simulation.

Parameters:
  • init_datetime (datetime.datetime) – Start datetime of project.

  • unit_timedelta (datetime.timedelta) – Unit time of simulation.

  • target_id_order_list (list[str], optional) – Target ID order list. Defaults to None.

  • title (str, optional) – Title of Gantt chart. Defaults to “Gantt Chart”.

  • colors (Dict[str, str], optional) – Color setting of plotly Gantt chart. Defaults to None. If None, default color setting will be used.

  • index_col (str, optional) – index_col of plotly Gantt chart. Defaults to None -> “State”.

  • showgrid_x (bool, optional) – showgrid_x of plotly Gantt chart. Defaults to True.

  • showgrid_y (bool, optional) – showgrid_y of plotly Gantt chart. Defaults to True.

  • group_tasks (bool, optional) – group_tasks of plotly Gantt chart. Defaults to True.

  • show_colorbar (bool, optional) – show_colorbar of plotly Gantt chart. Defaults to True.

  • view_ready (bool, optional) – View READY time or not. Defaults to False.

  • print_team_name (bool, optional) – Print team name or not. Defaults to True.

  • save_fig_path (str, optional) – Path of saving figure. Defaults to None.

Returns:

Figure for a gantt chart.

Return type:

figure

Raises:

ImportError – If plotly is not installed.

create_simple_gantt(target_id_order_list: list[str] = None, finish_margin: float = 1.0, print_team_name: bool = True, view_ready: bool = False, view_absence: bool = False, worker_color: str = '#D9E5FF', ready_color: str = '#DCDCDC', absence_color: str = '#696969', figsize: tuple[float, float] = None, dpi: float = 100.0, save_fig_path: str = None)[source]

Create Gantt chart by matplotlib.

In this Gantt chart, datetime information is not included. This method will be used after simulation.

Parameters:
  • target_id_order_list (list[str], optional) – Target ID order list for Gantt chart. Defaults to None.

  • finish_margin (float, optional) – Margin of finish time in Gantt chart. Defaults to 1.0.

  • print_team_name (bool, optional) – Print team name or not. Defaults to True.

  • view_ready (bool, optional) – View READY time or not. Defaults to False.

  • view_absence (bool, optional) – View ABSENCE time or not. Defaults to False.

  • worker_color (str, optional) – Node color setting information. Defaults to “#D9E5FF”.

  • ready_color (str, optional) – Ready color setting information. Defaults to “#DCDCDC”.

  • absence_color (str, optional) – Absence color setting information. Defaults to “#696969”.

  • figsize ((float, float), optional) – Width, height in inches. Default to None -> [6.4, 4.8].

  • dpi (float, optional) – The resolution of the figure in dots-per-inch. Default to 100.0.

  • save_fig_path (str, optional) – Path of saving figure. Defaults to None.

Returns:

Figure in plt.subplots(). gnt: Axes in plt.subplots().

Return type:

fig

Raises:

ImportError – If matplotlib is not installed.

create_worker(name: str = None, ID: str = None, main_workplace_id: str = None, cost_per_time: float = 0.0, solo_working: bool = False, workamount_skill_mean_map: dict[str, float] = None, workamount_skill_sd_map: dict[str, float] = None, facility_skill_map: dict[str, float] = None, absence_time_list: list[int] = None, state: BaseWorkerState = BaseWorkerState.FREE, state_record_list: list[BaseWorkerState] = None, cost_record_list: list[float] = None, assigned_task_facility_id_tuple_set: set[tuple[str, str]] = None, assigned_task_facility_id_tuple_set_record_list: list[set[tuple[str, str]]] = None, quality_skill_mean_map: dict[str, float] = None, quality_skill_sd_map: dict[str, float] = None)[source]

Create a BaseWorker instance and add it to this team.

Parameters:
  • name (str, optional) – Name of this worker. Defaults to None -> “New Worker”.

  • ID (str, optional) – ID will be defined automatically. Defaults to None -> str(uuid.uuid4()).

  • main_workplace_id (str, optional) – Main workplace ID. Defaults to None.

  • cost_per_time (float, optional) – Cost of this worker per unit time. Defaults to 0.0.

  • solo_working (bool, optional) – Flag whether this worker can work with other workers or not. Defaults to False.

  • workamount_skill_mean_map (Dict[str, float], optional) – Skill for expressing progress in unit time. Defaults to None -> {}.

  • workamount_skill_sd_map (Dict[str, float], optional) – Standard deviation of skill for expressing progress in unit time. Defaults to None -> {}.

  • facility_skill_map (Dict[str, float], optional) – Skill for operating facility in unit time. Defaults to None -> {}.

  • absence_time_list (List[int], optional) – List of absence time of simulation. Defaults to None -> [].

  • state (BaseWorkerState, optional) – State of this worker in simulation. Defaults to BaseWorkerState.FREE.

  • state_record_list (List[BaseWorkerState], optional) – Record list of state. Defaults to None -> [].

  • cost_record_list (List[float], optional) – History or record of his or her cost in simulation. Defaults to None -> [].

  • assigned_task_facility_id_tuple_set (set(tuple(str, str)), optional) – State of his or her assigned task and facility id tuple in simulation. Defaults to None -> set().

  • assigned_task_facility_id_tuple_set_record_list (List[set(tuple(str, str))], optional) – Record of his or her assigned tasks’ id in simulation. Defaults to None -> [].

  • quality_skill_mean_map (Dict[str, float], optional) – Skill for expressing quality in unit time. Defaults to None -> {}.

  • quality_skill_sd_map (Dict[str, float], optional) – Standard deviation of skill for expressing quality in unit time. Defaults to None -> {}.

Returns:

The created worker.

Return type:

BaseWorker

extend_targeted_task_list(targeted_task_list: list[BaseTask])[source]

Extend the list of targeted tasks.

Deprecated since version Use: update_targeted_task_set instead.

Parameters:

targeted_task_list (list[BaseTask]) – List of targeted tasks.

get_gantt_mermaid_steps(target_id_order_list: list[str] = None, section: bool = True, range_time: tuple[int, int] = (0, 9223372036854775807), view_ready: bool = False, detailed_info: bool = False, id_name_dict: dict[str, str] = None)[source]

Get mermaid steps diagram of Gantt chart.

Parameters:
  • target_id_order_list (list[str], optional) – Target ID order list. Defaults to None.

  • section (bool, optional) – Section or not. Defaults to True.

  • range_time (tuple[int, int], optional) – Range of Gantt chart. Defaults to (0, sys.maxsize).

  • view_ready (bool, optional) – Whether to include ready workers in the Gantt chart. Defaults to False.

  • detailed_info (bool, optional) – Whether to include detailed information in the Gantt chart. Defaults to False.

  • id_name_dict (dict[str, str], optional) – Dictionary mapping worker IDs to names. Defaults to None.

Returns:

List of lines for mermaid steps diagram.

Return type:

list[str]

get_gantt_mermaid_text(project_init_datetime: datetime, project_unit_timedelta: timedelta, target_id_order_list: list[str] = None, section: bool = True, range_time: tuple[int, int] = (0, 9223372036854775807), view_ready: bool = False, detailed_info: bool = False, id_name_dict: dict[str, str] = None)[source]

Get mermaid diagram text of Gantt chart.

Parameters:
  • project_init_datetime (datetime.datetime, optional) – Start datetime of project.

  • project_unit_timedelta (datetime.timedelta, optional) – Unit time of simulation.

  • target_id_order_list (list[str], optional) – Target ID order list. Defaults to None.

  • section (bool, optional) – Section or not. Defaults to True.

  • range_time (tuple[int, int], optional) – Range of Gantt chart. Defaults to (0, sys.maxsize).

  • view_ready (bool, optional) – Whether to include ready workers in the Gantt chart. Defaults to False.

  • detailed_info (bool, optional) – Whether to include detailed information in the Gantt chart. Defaults to False.

  • id_name_dict (dict[str, str], optional) – Dictionary mapping worker IDs to names. Defaults to None.

Returns:

Mermaid gantt diagram text.

Return type:

str

get_mermaid_diagram(print_worker: bool = True, shape_worker: str = 'stadium', link_type_str: str = '-->', subgraph: bool = True, subgraph_direction: str = 'LR')[source]

Get mermaid diagram of this team.

Parameters:
  • print_worker (bool, optional) – Print workers or not. Defaults to True.

  • shape_worker (str, optional) – Shape of workers in this team. Defaults to “stadium”.

  • link_type_str (str, optional) – Link type string. Defaults to “–>”.

  • subgraph (bool, optional) – Whether to use subgraph or not. Defaults to True.

  • subgraph_direction (str, optional) – Direction of subgraph. Defaults to “LR”.

Returns:

List of lines for mermaid diagram.

Return type:

list[str]

get_target_worker_mermaid_diagram(target_worker_set: set[BaseWorker], print_worker: bool = True, shape_worker: str = 'stadium', link_type_str: str = '-->', subgraph: bool = True, subgraph_direction: str = 'LR')[source]

Get mermaid diagram of target worker.

Parameters:
  • target_worker_set (set[BaseWorker]) – List of target workers.

  • print_worker (bool, optional) – Print workers or not. Defaults to True.

  • shape_worker (str, optional) – Shape of workers in this team. Defaults to “stadium”.

  • link_type_str (str, optional) – Link type string. Defaults to “–>”.

  • subgraph (bool, optional) – Whether to use subgraph or not. Defaults to True.

  • subgraph_direction (str, optional) – Direction of subgraph. Defaults to “LR”.

Returns:

List of lines for mermaid diagram.

Return type:

list[str]

get_worker_set_by_state(target_time_list: list[int], target_state: BaseWorkerState)[source]

Extract state worker list from simulation result.

Parameters:
  • target_time_list (List[int]) – Target time list. If you want to extract target_state worker from time 2 to time 4, you must set [2, 3, 4] to this argument.

  • target_state (BaseWorkerState) – Target state.

Returns:

Set of BaseWorker.

Return type:

set[BaseWorker]

initialize(state_info: bool = True, log_info: bool = True)[source]

Initialize the changeable variables of BaseTeam.

If log_info is True, the following attributes are initialized:
  • cost_record_list

BaseWorker in worker_set are also initialized by this function.

Parameters:
  • state_info (bool, optional) – Whether to initialize state information. Defaults to True.

  • log_info (bool, optional) – Whether to initialize log information. Defaults to True.

plot_simple_gantt(target_id_order_list: list[str] = None, finish_margin: float = 1.0, print_team_name: bool = True, view_ready: bool = False, worker_color: str = '#D9E5FF', ready_color: str = '#C0C0C0', figsize: tuple[float, float] = None, dpi: float = 100.0, save_fig_path: str = None)[source]

Plot Gantt chart by matplotlib.

In this Gantt chart, datetime information is not included. This method will be used after simulation.

Parameters:
  • target_id_order_list (list[str], optional) – Target ID order list for Gantt chart. Defaults to None.

  • finish_margin (float, optional) – Margin of finish time in Gantt chart. Defaults to 1.0.

  • print_team_name (bool, optional) – Print team name or not. Defaults to True.

  • view_ready (bool, optional) – View READY time or not. Defaults to True.

  • worker_color (str, optional) – Node color setting information. Defaults to “#D9E5FF”.

  • ready_color (str, optional) – Ready color setting information. Defaults to “#C0C0C0”.

  • figsize ((float, float), optional) – Width, height in inches. Default to None -> [6.4, 4.8].

  • dpi (float, optional) – The resolution of the figure in dots-per-inch. Default to 100.0.

  • save_fig_path (str, optional) – Path of saving figure. Defaults to None.

Returns:

Figure in plt.subplots().

Return type:

fig

print_gantt_mermaid(project_init_datetime: datetime = None, project_unit_timedelta: timedelta = None, target_id_order_list: list[str] = None, section: bool = True, range_time: tuple[int, int] = (0, 9223372036854775807), view_ready: bool = False, detailed_info: bool = False, id_name_dict: dict[str, str] = None)[source]

Print mermaid diagram of Gantt chart.

Parameters:
  • project_init_datetime (datetime.datetime, optional) – Start datetime of project. If None, outputs step-based Gantt chart. Defaults to None.

  • project_unit_timedelta (datetime.timedelta, optional) – Unit time of simulation. Required if project_init_datetime is provided. Defaults to None.

  • target_id_order_list (list[str], optional) – Target ID order list. Defaults to None.

  • section (bool, optional) – Section or not. Defaults to True.

  • range_time (tuple[int, int], optional) – Range of Gantt chart. Defaults to (0, sys.maxsize).

  • view_ready (bool, optional) – If True, ready tasks are included in gantt chart. Defaults to False.

  • detailed_info (bool, optional) – Whether to include detailed information in the Gantt chart. Defaults to False.

  • id_name_dict (dict[str, str], optional) – Dictionary mapping worker IDs to names. Defaults to None.

print_mermaid_diagram(orientations: str = 'LR', print_worker: bool = True, shape_worker: str = 'stadium', link_type_str: str = '-->', subgraph: bool = True, subgraph_direction: str = 'LR')[source]

Print mermaid diagram of this team.

Parameters:
  • orientations (str) – Orientation of the flowchart. Defaults to “LR”.

  • print_worker (bool, optional) – Print workers or not. Defaults to True.

  • shape_worker (str, optional) – Shape of workers in this team. Defaults to “stadium”.

  • link_type_str (str, optional) – Link type string. Defaults to “–>”.

  • subgraph (bool, optional) – Whether to use subgraph or not. Defaults to True.

  • subgraph_direction (str, optional) – Direction of subgraph. Defaults to “LR”.

print_target_worker_mermaid_diagram(target_worker_set: set[BaseWorker], orientations: str = 'LR', print_worker: bool = True, shape_worker: str = 'stadium', link_type_str: str = '-->', subgraph: bool = True, subgraph_direction: str = 'LR')[source]

Print mermaid diagram of target worker.

Parameters:
  • target_worker_set (set[BaseWorker]) – List of target workers.

  • orientations (str) – Orientation of the flowchart. Defaults to “LR”.

  • print_worker (bool, optional) – Print workers or not. Defaults to True.

  • shape_worker (str, optional) – Shape of workers in this team. Defaults to “stadium”.

  • link_type_str (str, optional) – Link type string. Defaults to “–>”.

  • subgraph (bool, optional) – Whether to use subgraph or not. Defaults to True.

  • subgraph_direction (str, optional) – Direction of subgraph. Defaults to “LR”.

record_all_worker_state(working: bool = True)[source]

Record the state of all workers by using BaseWorker.record_state().

record_assigned_task_id()[source]

Record assigned task id in this time.

reverse_log_information()[source]

Reverse log information of all.

set_absence_state_to_all_workers()[source]

Set absence state to all workers and facilities.

set_parent_team(parent_team: BaseTeam)[source]

Set parent team.

Parameters:

parent_team (BaseTeam) – Parent team.

update_targeted_task_set(targeted_task_set: set[BaseTask])[source]

Extend the set of targeted tasks.

Parameters:

targeted_task_set (set[BaseTask]) – Set of targeted tasks.

pDESy.model.base_worker module

base_worker.

class pDESy.model.base_worker.BaseWorker(name: str = None, ID: str = None, team_id: str = None, main_workplace_id: str = None, cost_per_time: float = 0.0, solo_working: bool = False, workamount_skill_mean_map: dict[str, float] = None, workamount_skill_sd_map: dict[str, float] = None, facility_skill_map: dict[str, float] = None, absence_time_list: list[int] = None, state: BaseWorkerState = BaseWorkerState.FREE, state_record_list: list[BaseWorkerState] = None, cost_record_list: list[float] = None, assigned_task_facility_id_tuple_set: set[tuple[str, str]] = None, assigned_task_facility_id_tuple_set_record_list: list[set[tuple[str, str]]] = None, quality_skill_mean_map: dict[str, float] = None, quality_skill_sd_map: dict[str, float] = None)[source]

Bases: SingleNodeMermaidDiagramMixin, AssignedPairsMixin, SingleNodeLogJsonMixin, WorkerFacilityCommonMixin, object

get_gantt_mermaid_steps_data(range_time: tuple[int, int] = (0, 9223372036854775807), view_ready: bool = False, detailed_info: bool = False, id_name_dict: dict[str, str] = None)[source]

Get gantt mermaid steps data of this worker.

Parameters:
  • range_time (tuple[int, int], optional) – Range time of gantt chart. Defaults to (0, sys.maxsize).

  • view_ready (bool, optional) – If True, ready tasks are included in gantt chart. Defaults to False.

  • detailed_info (bool, optional) – Detailed information or not. Defaults to False.

  • id_name_dict (dict[str, str], optional) – ID to name dictionary. Defaults to None.

Returns:

List of lines for gantt mermaid steps diagram.

Return type:

list[str]

get_mermaid_diagram(shape: str = 'stadium', subgraph: bool = False, subgraph_name: str = 'Worker', subgraph_direction: str = 'LR', print_extra_info: bool = False)[source]

Get mermaid diagram of this worker.

Parameters:
  • shape (str, optional) – Shape of this worker. Defaults to “stadium”.

  • subgraph (bool, optional) – Whether to use subgraph or not. Defaults to False.

  • subgraph_name (str, optional) – Name of subgraph. Defaults to “Worker”.

  • subgraph_direction (str, optional) – Direction of subgraph. Defaults to “LR”.

  • print_extra_info (bool, optional) – Print extra information or not. Defaults to False.

Returns:

List of lines for mermaid diagram.

Return type:

list[str]

get_quality_skill_point(task_name: str, seed: int = None)[source]

Get point of quality by this worker’s contribution in this time.

Parameters:
  • task_name (str) – Task name.

  • seed (int, optional) – Random seed for reproducibility. Defaults to None.

Returns:

Point of quality by this worker’s contribution in this time.

Return type:

float

has_facility_skill(facility_name: str, error_tol: float = 1e-10)[source]

Check whether this worker has facility skill or not.

By checking facility_skill_map.

Parameters:
  • facility_name (str) – Facility name.

  • error_tol (float, optional) – Measures against numerical error. Defaults to 1e-10.

Returns:

Whether this worker has facility skill of facility_name or not.

Return type:

bool

has_quality_skill(task_name: str, error_tol: float = 1e-10)[source]

Check whether this worker has quality skill or not.

By checking quality_skill_mean_map.

Parameters:
  • task_name (str) – Task name.

  • error_tol (float, optional) – Measures against numerical error. Defaults to 1e-10.

Returns:

Whether this worker has quality skill of task_name or not.

Return type:

bool

print_mermaid_diagram(orientations: str = 'LR', shape: str = 'stadium', subgraph: bool = False, subgraph_name: str = 'Worker', subgraph_direction: str = 'LR', print_extra_info: bool = False)[source]

Print mermaid diagram of this worker.

Parameters:
  • orientations (str, optional) – Orientation of mermaid diagram. Defaults to “LR”.

  • shape (str, optional) – Shape of mermaid diagram. Defaults to “stadium”.

  • subgraph (bool, optional) – Subgraph or not. Defaults to False.

  • subgraph_name (str, optional) – Subgraph name. Defaults to “Worker”.

  • subgraph_direction (str, optional) – Direction of subgraph. Defaults to “LR”.

  • print_extra_info (bool, optional) – Print extra information or not. Defaults to False.

class pDESy.model.base_worker.BaseWorkerState(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

BaseWorkerState.

Enum for representing the state of a worker.

FREE

Worker is free.

Type:

int

WORKING

Worker is working.

Type:

int

ABSENCE

Worker is absent.

Type:

int

ABSENCE = -1
FREE = 0
WORKING = 1

pDESy.model.base_workflow module

base_workflow.

class pDESy.model.base_workflow.BaseWorkflow(name: str = None, ID: str = None, task_set: set[BaseTask] = None, critical_path_length: float = 0.0)[source]

Bases: CollectionMermaidDiagramMixin, CollectionCommonMixin, CollectionLogJsonMixin, object

BaseWorkflow.

BaseWorkflow class for expressing workflow in a project. BaseWorkflow consists of multiple BaseTasks. This class will be used as a template.

Parameters:
  • name (str, optional) – Name of this workflow. Defaults to None -> “Workflow”.

  • ID (str, optional) – ID will be defined automatically. Defaults to None -> str(uuid.uuid4()).

  • task_set (set[BaseTask], optional) – List of BaseTask in this BaseWorkflow. Default to None -> set().

  • critical_path_length (float, optional) – Critical path length of PERT/CPM. Defaults to 0.0.

add_task(task: BaseTask)[source]

Add target task to this workflow.

Parameters:

task (BaseTask) – Target task.

append_child_task(task: BaseTask)[source]

Append target task to this workflow.

Deprecated since version Use: add_task instead.

Parameters:

task (BaseTask) – Target task.

create_data_for_gantt_plotly(init_datetime: datetime, unit_timedelta: timedelta, target_id_order_list: list[str] = None, finish_margin: float = 1.0, print_workflow_name: bool = True, view_ready: bool = False)[source]

Create data for gantt plotly from task_set.

Parameters:
  • init_datetime (datetime.datetime) – Start datetime of project.

  • unit_timedelta (datetime.timedelta) – Unit time of simulation.

  • target_id_order_list (list[str], optional) – Target ID order list. Defaults to None.

  • finish_margin (float, optional) – Margin of finish time in Gantt chart. Defaults to 1.0.

  • print_workflow_name (bool, optional) – Print workflow name or not. Defaults to True.

  • view_ready (bool, optional) – View READY time or not. Defaults to False.

Returns:

Gantt plotly information of this BaseWorkflow.

Return type:

list[dict]

create_gantt_plotly(init_datetime: datetime, unit_timedelta: timedelta, target_id_order_list: list[str] = None, title: str = 'Gantt Chart', colors: dict[str, str] = None, index_col: str = None, showgrid_x: bool = True, showgrid_y: bool = True, group_tasks: bool = True, show_colorbar: bool = True, finish_margin: float = 1.0, print_workflow_name: bool = True, view_ready: bool = False, save_fig_path: str = None)[source]

Create Gantt chart by plotly.

This method will be used after simulation.

Parameters:
  • init_datetime (datetime.datetime) – Start datetime of project.

  • unit_timedelta (datetime.timedelta) – Unit time of simulation.

  • target_id_order_list (list[str], optional) – Target ID order list. Defaults to None.

  • title (str, optional) – Title of Gantt chart. Defaults to “Gantt Chart”.

  • colors (Dict[str, str], optional) – Color setting of plotly Gantt chart. Defaults to None -> dict(WORKING=”rgb(146, 237, 5)”, READY=”rgb(107, 127, 135)”).

  • index_col (str, optional) – index_col of plotly Gantt chart. Defaults to None -> “State”.

  • showgrid_x (bool, optional) – showgrid_x of plotly Gantt chart. Defaults to True.

  • showgrid_y (bool, optional) – showgrid_y of plotly Gantt chart. Defaults to True.

  • group_tasks (bool, optional) – group_tasks of plotly Gantt chart. Defaults to True.

  • show_colorbar (bool, optional) – show_colorbar of plotly Gantt chart. Defaults to True.

  • finish_margin (float, optional) – Margin of finish time in Gantt chart. Defaults to 1.0.

  • print_workflow_name (bool, optional) – Print workflow name or not. Defaults to True.

  • save_fig_path (str, optional) – Path of saving figure. Defaults to None.

Returns:

Figure for a gantt chart.

Return type:

figure

Raises:

ImportError – If plotly is not installed.

create_simple_gantt(target_id_order_list: list[str] = None, finish_margin: float = 1.0, print_workflow_name: bool = True, view_auto_task: bool = False, view_ready: bool = False, task_color: str = '#00EE00', auto_task_color: str = '#005500', ready_color: str = '#C0C0C0', figsize: tuple[float, float] = None, dpi: float = 100.0, save_fig_path: str = None)[source]

Create Gantt chart by matplotlib.

In this Gantt chart, datetime information is not included. This method will be used after simulation.

Parameters:
  • target_id_order_list (list[str], optional) – Target ID order list. Defaults to None.

  • finish_margin (float, optional) – Margin of finish time in Gantt chart. Defaults to 1.0.

  • print_workflow_name (bool, optional) – Print workflow name or not. Defaults to True.

  • view_auto_task (bool, optional) – View auto_task or not. Defaults to False.

  • view_ready (bool, optional) – View READY time or not. Defaults to False.

  • task_color (str, optional) – Task color setting information. Defaults to “#00EE00”.

  • auto_task_color (str, optional) – Auto Task color setting information. Defaults to “#005500”.

  • ready_color (str, optional) – Ready Task color setting information. Defaults to “#C0C0C0”.

  • figsize ((float, float), optional) – Width, height in inches. Default to None -> [6.4, 4.8].

  • dpi (float, optional) – The resolution of the figure in dots-per-inch. Default to 100.0.

  • save_fig_path (str, optional) – Path of saving figure. Defaults to None.

Returns:

Figure in plt.subplots(). gnt: Axes in plt.subplots().

Return type:

fig

Raises:

ImportError – If matplotlib is not installed.

create_task(name: str = None, ID: str = None, default_work_amount: float = None, work_amount_progress_of_unit_step_time: float = None, input_task_id_dependency_set: set[tuple[str, BaseTaskDependency]] = None, allocated_team_id_set: set[str] = None, allocated_workplace_id_set: set[str] = None, workplace_priority_rule: WorkplacePriorityRuleMode = WorkplacePriorityRuleMode.FSS, worker_priority_rule: ResourcePriorityRuleMode = ResourcePriorityRuleMode.MW, facility_priority_rule: ResourcePriorityRuleMode = ResourcePriorityRuleMode.SSP, need_facility: bool = False, target_component_id: str = None, default_progress: float = None, due_time: float = None, auto_task: bool = False, fixing_allocating_worker_id_set: set[str] = None, fixing_allocating_facility_id_set: set[str] = None, est: float = 0.0, eft: float = 0.0, lst: float = -1.0, lft: float = -1.0, remaining_work_amount: float = None, remaining_work_amount_record_list: list[float] = None, state: BaseTaskState = BaseTaskState.NONE, state_record_list: list[BaseTaskState] = None, allocated_worker_facility_id_tuple_set: set[tuple[str, str]] = None, allocated_worker_facility_id_tuple_set_record_list: list[set[tuple[str, str]]] = None, additional_work_amount: float = None, additional_task_flag: bool = False, actual_work_amount: float = None)[source]

Create a BaseTask instance and add it to this workflow.

Parameters:
  • name (str, optional) – Name of this task. Defaults to None -> “New Task”.

  • ID (str, optional) – ID will be defined automatically. Defaults to None -> str(uuid.uuid4()).

  • default_work_amount (float, optional) – Default workamount of this BaseTask. Defaults to None -> 10.0.

  • work_amount_progress_of_unit_step_time (float, optional) – Baseline of work amount progress of unit step time. Default to None -> 1.0.

  • input_task_id_dependency_set (set(tuple(str, BaseTaskDependency)), optional) – Set of input BaseTask id and type of dependency(FS, SS, SF, F/F) tuple. Defaults to None -> set().

  • allocated_team_id_set (set[str], optional) – Set of allocated BaseTeam id. Defaults to None -> set().

  • allocated_workplace_id_set (set[str], optional) – Set of allocated BaseWorkplace id. Defaults to None -> set().

  • workplace_priority_rule (WorkplacePriorityRuleMode, optional) – Workplace priority rule for simulation. Defaults to WorkplacePriorityRuleMode.FSS.

  • worker_priority_rule (ResourcePriorityRule, optional) – Worker priority rule for simulation. Defaults to ResourcePriorityRule.SSP.

  • facility_priority_rule (ResourcePriorityRule, optional) – Task priority rule for simulation. Defaults to TaskPriorityRule.TSLACK.

  • need_facility (bool, optional) – Whether one facility is needed for performing this task or not. Defaults to False.

  • target_component_id (str, optional) – Target BaseComponent id. Defaults to None.

  • default_progress (float, optional) – Progress before starting simulation (0.0 ~ 1.0). Defaults to None -> 0.0.

  • due_time (int, optional) – Due time. Defaults to None -> int(-1).

  • auto_task (bool, optional) – If True, this task is performed automatically even if there are no allocated workers. Defaults to False.

  • fixing_allocating_worker_id_set (set[str], optional) – Allocating worker ID set for fixing allocation in simulation. Defaults to None.

  • fixing_allocating_facility_id_set (set[str], optional) – Allocating facility ID set for fixing allocation in simulation. Defaults to None.

  • est (float, optional) – Earliest start time of CPM. This will be updated step by step. Defaults to 0.0.

  • eft (float, optional) – Earliest finish time of CPM. This will be updated step by step. Defaults to 0.0.

  • lst (float, optional) – Latest start time of CPM. This will be updated step by step. Defaults to -1.0.

  • lft (float, optional) – Latest finish time of CPM. This will be updated step by step. Defaults to -1.0.

  • remaining_work_amount (float, optional) – Remaining workamount in simulation. Defaults to None -> default_work_amount * (1.0 - default_progress).

  • remaining_work_amount_record_list (List[float], optional) – Record of remaining workamount in simulation. Defaults to None -> [].

  • state (BaseTaskState, optional) – State of this task in simulation. Defaults to BaseTaskState.NONE.

  • state_record_list (List[BaseTaskState], optional) – Record list of state. Defaults to None -> [].

  • allocated_worker_facility_id_tuple_set (set(tuple(str, str)), optional) – State of allocating worker and facility id tuple set in simulation. Defaults to None -> set().

  • allocated_worker_facility_id_tuple_set_record_list (List[set[tuple(str, str)]], optional) – State of allocating worker and facility id tuple set in simulation. Defaults to None -> [].

  • additional_work_amount (float, optional) – Advanced parameter. Defaults to None.

  • additional_task_flag (bool, optional) – Advanced variable. Defaults to False.

  • actual_work_amount (float, optional) – Advanced variable. Default to None -> default_work_amount*(1.0-default_progress)

Returns:

The created task.

Return type:

BaseTask

draw_networkx(g=None, pos: dict = None, arrows: bool = True, task_node_color: str = '#00EE00', auto_task_node_color: str = '#005500', figsize: tuple[float, float] = None, dpi: float = 100.0, save_fig_path: str = None, **kwargs)[source]

Draw networkx.

Parameters:
  • g (networkx.Digraph, optional) – The information of networkx graph. Defaults to None -> self.get_networkx_graph().

  • pos (networkx.layout, optional) – Layout of networkx. Defaults to None -> networkx.spring_layout(g).

  • arrows (bool, optional) – Digraph or Graph(no arrows). Defaults to True.

  • task_node_color (str, optional) – Node color setting information. Defaults to “#00EE00”.

  • auto_task_node_color (str, optional) – Node color setting information. Defaults to “#005500”.

  • figsize ((float, float), optional) – Width, height in inches. Default to None -> [6.4, 4.8].

  • dpi (float, optional) – The resolution of the figure in dots-per-inch. Default to 100.0.

  • save_fig_path (str, optional) – Path of saving figure. Defaults to None.

  • **kwargs – Other networkx settings.

Returns:

Figure for a network.

Return type:

figure

Raises:

ImportError – If matplotlib is not installed.

draw_plotly_network(g=None, pos: dict = None, title: str = 'Workflow', node_size: int = 20, task_node_color: str = '#00EE00', auto_task_node_color: str = '#005500', save_fig_path=None)[source]

Draw plotly network.

Parameters:
  • g (networkx.Digraph, optional) – The information of networkx graph. Defaults to None -> self.get_networkx_graph().

  • pos (networkx.layout, optional) – Layout of networkx. Defaults to None -> networkx.spring_layout(g).

  • title (str, optional) – Figure title of this network. Defaults to “Workflow”.

  • node_size (int, optional) – Node size setting information. Defaults to 20.

  • task_node_color (str, optional) – Node color setting information. Defaults to “#00EE00”.

  • auto_task_node_color (str, optional) – Node color setting information. Defaults to “#005500”.

  • save_fig_path (str, optional) – Path of saving figure. Defaults to None.

Returns:

Figure for a network.

Return type:

figure

Raises:

ImportError – If plotly is not installed.

extend_child_task_list(task_set: set[BaseTask])[source]

Extend target task_set to this workflow.

Deprecated since version Use: updated_task_set instead.

Parameters:

task_set (set[BaseTask]) – Target task set.

get_gantt_mermaid_steps(target_id_order_list: list[str] = None, section: bool = True, range_time: tuple[int, int] = (0, 9223372036854775807), view_ready: bool = False, detailed_info: bool = False, id_name_dict: dict[str, str] = None)[source]

Get mermaid diagram of Gantt chart.

Parameters:
  • target_id_order_list (list[str], optional) – Target ID order list. Defaults to None.

  • section (bool, optional) – Section or not. Defaults to True.

  • range_time (tuple[int, int], optional) – Range of Gantt chart. Defaults to (0, sys.maxsize).

  • view_ready (bool, optional) – If True, ready tasks are included in gantt chart. Defaults to False.

  • detailed_info (bool, optional) – Detailed information or not. Defaults to False.

  • id_name_dict (dict[str, str], optional) – Dictionary of ID and name for tasks. Defaults to None.

Returns:

List of lines for mermaid diagram.

Return type:

list[str]

get_gantt_mermaid_text(project_init_datetime: datetime, project_unit_timedelta: timedelta, target_id_order_list: list[str] = None, section: bool = True, range_time: tuple[int, int] = (0, 9223372036854775807), view_ready: bool = False, detailed_info: bool = False, id_name_dict: dict[str, str] = None)[source]

Get mermaid diagram text of Gantt chart.

Parameters:
  • project_init_datetime (datetime.datetime, optional) – Start datetime of project.

  • project_unit_timedelta (datetime.timedelta, optional) – Unit time of simulation.

  • target_id_order_list (list[str], optional) – Target ID order list. Defaults to None.

  • section (bool, optional) – Section or not. Defaults to True.

  • range_time (tuple[int, int], optional) – Range of Gantt chart. Defaults to (0, sys.maxsize).

  • view_ready (bool, optional) – If True, ready tasks are included in gantt chart. Defaults to False.

  • detailed_info (bool, optional) – Detailed information or not. Defaults to False.

  • id_name_dict (dict[str, str], optional) – Dictionary of ID and name for tasks. Defaults to None.

Returns:

Mermaid gantt diagram text.

Return type:

str

get_mermaid_diagram(shape_task: str = 'rect', print_extra_info: bool = True, link_type_str: str = '-->', print_dependency_type: bool = False, subgraph: bool = True, subgraph_direction: str = 'LR')[source]

Get mermaid diagram of this workflow.

Parameters:
  • shape_task (str, optional) – Shape of mermaid diagram. Defaults to “rect”.

  • print_extra_info (bool, optional) – Print extra information or not. Defaults to True.

  • link_type_str (str, optional) – Link type string. Defaults to “–>”.

  • print_dependency_type (bool, optional) – Print dependency type information or not. Defaults to False.

  • subgraph (bool, optional) – Subgraph or not. Defaults to True.

  • subgraph_direction (str, optional) – Direction of subgraph. Defaults to “LR”.

Returns:

List of lines for mermaid diagram.

Return type:

list[str]

get_networkx_graph()[source]

Get the information of networkx graph.

Returns:

Directed graph of the workflow.

Return type:

networkx.DiGraph

get_node_and_edge_trace_for_plotly_network(g=None, pos: dict = None, node_size: int = 20, task_node_color: str = '#00EE00', auto_task_node_color: str = '#005500')[source]

Get nodes and edges information of plotly network.

Parameters:
  • g (networkx.Digraph, optional) – The information of networkx graph. Defaults to None -> self.get_networkx_graph().

  • pos (networkx.layout, optional) – Layout of networkx. Defaults to None -> networkx.spring_layout(g).

  • node_size (int, optional) – Node size setting information. Defaults to 20.

  • task_node_color (str, optional) – Node color setting information. Defaults to “#00EE00”.

  • auto_task_node_color (str, optional) – Node color setting information. Defaults to “#005500”.

Returns:

Normal Task Node information of plotly network. auto_task_node_trace: Auto Task Node information of plotly network. edge_trace: Edge information of plotly network.

Return type:

task_node_trace

Raises:

ImportError – If plotly is not installed.

get_target_task_mermaid_diagram(target_task_set: set[BaseTask], shape_task: str = 'rect', print_extra_info: bool = True, link_type_str: str = '-->', print_dependency_type: bool = False, subgraph: bool = True, subgraph_direction: str = 'LR')[source]

Get mermaid diagram of target task.

Parameters:
  • target_task_set (set[BaseTask]) – Set of target tasks.

  • shape_task (str, optional) – Shape of mermaid diagram. Defaults to “rect”.

  • print_extra_info (bool, optional) – Print extra information or not. Defaults to True.

  • link_type_str (str, optional) – Link type string. Defaults to “–>”.

  • print_dependency_type (bool, optional) – Print dependency type information or not. Defaults to False.

  • subgraph (bool, optional) – Subgraph or not. Defaults to True.

  • subgraph_direction (str, optional) – Direction of subgraph. Defaults to “LR”.

Returns:

List of lines for mermaid diagram.

Return type:

list[str]

get_task_set_by_state(target_time_list: list[int], target_state: BaseTaskState)[source]

Extract state task list from simulation result.

Parameters:
  • target_time_list (List[int]) – Target time list. If you want to extract target_state task from time 2 to time 4, you must set [2, 3, 4] to this argument.

  • target_state (BaseTaskState) – Target state.

Returns:

List of BaseTask.

Return type:

List[BaseTask]

initialize(state_info: bool = True, log_info: bool = True)[source]

Initialize the changeable variables of BaseWorkflow including PERT calculation.

If state_info is True, the following attributes are initialized:
  • critical_path_length

  • PERT data

  • The state of each task after all tasks are initialized.

BaseTask in task_set are also initialized by this function.

Parameters:
  • state_info (bool, optional) – Whether to initialize state information. Defaults to True.

  • log_info (bool, optional) – Whether to initialize log information. Defaults to True.

plot_simple_gantt(target_id_order_list: list[str] = None, finish_margin: float = 1.0, print_workflow_name: bool = True, view_auto_task: bool = False, view_ready: bool = False, task_color: str = '#00EE00', auto_task_color: str = '#005500', ready_color: str = '#C0C0C0', figsize: tuple[float, float] = None, dpi: float = 100.0, save_fig_path: str = None)[source]

Plot Gantt chart by matplotlib.

In this Gantt chart, datetime information is not included. This method will be used after simulation.

Parameters:
  • target_id_order_list (list[str], optional) – Target ID order list. Defaults to None.

  • finish_margin (float, optional) – Margin of finish time in Gantt chart. Defaults to 1.0.

  • print_workflow_name (bool, optional) – Print workflow name or not. Defaults to True.

  • view_auto_task (bool, optional) – View auto_task or not. Defaults to False.

  • view_ready (bool, optional) – View READY time or not. Defaults to False.

  • task_color (str, optional) – Task color setting information. Defaults to “#00EE00”.

  • auto_task_color (str, optional) – Auto Task color setting information. Defaults to “#005500”.

  • ready_color (str, optional) – Ready Task color setting information. Defaults to “#C0C0C0”.

  • figsize ((float, float), optional) – Width, height in inches. Default to None -> [6.4, 4.8].

  • dpi (float, optional) – The resolution of the figure in dots-per-inch. Default to 100.0.

  • save_fig_path (str, optional) – Path of saving figure. Defaults to None.

Returns:

Figure in plt.subplots().

Return type:

fig

Raises:

ImportError – If matplotlib is not installed.

print_gantt_mermaid(project_init_datetime: datetime = None, project_unit_timedelta: timedelta = None, target_id_order_list: list[str] = None, section: bool = True, range_time: tuple[int, int] = (0, 9223372036854775807), view_ready: bool = False, detailed_info: bool = False, id_name_dict: dict[str, str] = None)[source]

Print mermaid diagram of Gantt chart.

Parameters:
  • project_init_datetime (datetime.datetime, optional) – Start datetime of project. If None, outputs step-based Gantt chart. Defaults to None.

  • project_unit_timedelta (datetime.timedelta, optional) – Unit time of simulation. Required if project_init_datetime is provided. Defaults to None.

  • target_id_order_list (list[str], optional) – Target ID order list. Defaults to None.

  • section (bool, optional) – Section or not. Defaults to True.

  • range_time (tuple[int, int], optional) – Range of Gantt chart. Defaults to (0, sys.maxsize).

  • view_ready (bool, optional) – If True, ready tasks are included in gantt chart. Defaults to False.

  • detailed_info (bool, optional) – Detailed information or not. Defaults to False.

  • id_name_dict (dict[str, str], optional) – Dictionary of ID and name for tasks. Defaults to None.

print_mermaid_diagram(orientations: str = 'LR', shape_task: str = 'rect', print_extra_info: bool = True, link_type_str: str = '-->', print_dependency_type: bool = False, subgraph: bool = True, subgraph_direction: str = 'LR')[source]

Print mermaid diagram of this workflow.

Parameters:
  • orientations (str, optional) – Orientation of mermaid diagram. See: https://mermaid.js.org/syntax/flowchart.html#direction. Defaults to “LR”.

  • shape_task (str, optional) – Shape of mermaid diagram. Defaults to “rect”.

  • print_extra_info (bool, optional) – Print extra information or not. Defaults to True.

  • link_type_str (str, optional) – Link type string. Defaults to “–>”.

  • print_dependency_type (bool, optional) – Print dependency type information or not. Defaults to False.

  • subgraph (bool, optional) – Subgraph or not. Defaults to True.

  • subgraph_direction (str, optional) – Direction of subgraph. Defaults to “LR”.

print_target_task_mermaid_diagram(target_task_set: set[BaseTask], orientations: str = 'LR', shape_task: str = 'rect', print_extra_info: bool = True, link_type_str: str = '-->', print_dependency_type: bool = False, subgraph: bool = True, subgraph_direction: str = 'LR')[source]

Print mermaid diagram of target task.

Parameters:
  • target_task_set (set[BaseTask]) – Set of target tasks.

  • orientations (str, optional) – Orientation of mermaid diagram. See: https://mermaid.js.org/syntax/flowchart.html#direction. Defaults to “LR”.

  • shape_task (str, optional) – Shape of mermaid diagram. Defaults to “rect”.

  • print_extra_info (bool, optional) – Print extra information or not. Defaults to True.

  • link_type_str (str, optional) – Link type string. Defaults to “–>”.

  • print_dependency_type (bool, optional) – Print dependency type information or not. Defaults to False.

  • subgraph (bool, optional) – Subgraph or not. Defaults to True.

  • subgraph_direction (str, optional) – Direction of subgraph. Defaults to “LR”.

record(working: bool = True)[source]

Record the state of all tasks in task_set.

Parameters:

working (bool, optional) – Whether to record as working. Defaults to True.

reverse_dependencies()[source]

Reverse all task dependencies in task_set.

Note

This method is developed only for backward simulation.

reverse_log_information()[source]

Reverse log information of all.

update_pert_data(time: int)[source]

Update PERT data (est, eft, lst, lft) of each BaseTask in task_set.

Parameters:

time (int) – Simulation time.

update_task_set(task_set: set[BaseTask])[source]

Update target task_set to this workflow.

Parameters:

task_set (set[BaseTask]) – Target task set.

pDESy.model.base_workplace module

base_workplace.

class pDESy.model.base_workplace.BaseWorkplace(name: str = None, ID: str = None, facility_set: set[BaseFacility] = None, targeted_task_id_set: set[str] = None, parent_workplace_id: str = None, max_space_size: float = None, input_workplace_id_set: set[str] = None, available_space_size: float = None, cost_record_list: list[float] = None, placed_component_id_set: set[str] = None, placed_component_id_set_record_list: list[list[str]] = None)[source]

Bases: CollectionMermaidDiagramMixin, CollectionCommonMixin, CollectionLogJsonMixin, object

add_facility(facility: BaseFacility)[source]

Add facility to facility_set.

Parameters:

facility (BaseFacility) – Facility which is added to this workplace.

add_input_workplace(input_workplace: BaseWorkplace)[source]

Add input workplace to input_workplace_id_set.

Parameters:

input_workplace (BaseWorkplace) – Input workplace.

add_labor_cost(only_working: bool = True, add_zero_to_all_facilities: bool = False)[source]

Add labor cost to facilities in this workplace.

add_targeted_task(targeted_task: BaseTask)[source]

Add targeted task to targeted_task_id_set.

Parameters:

targeted_task (BaseTask) – Targeted task.

append_input_workplace(input_workplace: BaseWorkplace)[source]

Append input workplace to input_workplace_id_set.

Deprecated since version Use: add_input_workplace instead.

Parameters:

input_workplace (BaseWorkplace) – Input workplace.

append_targeted_task(targeted_task: BaseTask)[source]

Append targeted task to targeted_task_list.

Deprecated since version Use: add_targeted_task instead.

Parameters:

targeted_task (BaseTask) – Targeted task.

check_update_state_from_absence_time_list(step_time: int)[source]

Check and update state of all resources to ABSENCE or FREE or WORKING.

Parameters:

step_time (int) – Target step time of checking and updating state of facilities.

create_cost_history_plotly(init_datetime: datetime, unit_timedelta: timedelta, title: str = 'Cost Chart', save_fig_path: str = None)[source]

Create cost chart by plotly.

This method will be used after simulation.

Parameters:
  • init_datetime (datetime.datetime) – Start datetime of project.

  • unit_timedelta (datetime.timedelta) – Unit time of simulation.

  • title (str, optional) – Title of cost chart. Defaults to “Cost Chart”.

  • save_fig_path (str, optional) – Path of saving figure. Defaults to None.

Returns:

Figure for a gantt chart.

Return type:

figure

Raises:

ImportError – If plotly is not installed.

create_data_for_cost_history_plotly(init_datetime: datetime, unit_timedelta: timedelta)[source]

Create data for cost history plotly from cost_record_list in facility_set.

Parameters:
  • init_datetime (datetime.datetime) – Start datetime of project.

  • unit_timedelta (datetime.timedelta) – Unit time of simulation.

Returns:

Information of cost history chart.

Return type:

List[go.Bar]

Raises:

ImportError – If plotly is not installed.

create_data_for_gantt_plotly(init_datetime: datetime, unit_timedelta: timedelta, target_id_order_list: list[str] = None, finish_margin: float = 1.0, print_workplace_name: bool = True, view_ready: bool = False, view_absence: bool = False)[source]

Create data for gantt plotly of BaseFacility in facility_set.

Parameters:
  • init_datetime (datetime.datetime) – Start datetime of project.

  • unit_timedelta (datetime.timedelta) – Unit time of simulation.

  • target_id_order_list (list[str], optional) – Target ID order list. Defaults to None.

  • finish_margin (float, optional) – Margin of finish time in Gantt chart. Defaults to 1.0.

  • print_workplace_name (bool, optional) – Print workplace name or not. Defaults to True.

  • view_ready (bool, optional) – View READY time or not. Defaults to False.

  • view_absence (bool, optional) – View ABSENCE time or not. Defaults to False.

Returns:

Gantt plotly information of this BaseWorkplace.

Return type:

List[dict]

create_facility(name: str = None, ID: str = None, cost_per_time: float = 0.0, solo_working: bool = False, workamount_skill_mean_map: dict[str, float] = None, workamount_skill_sd_map: dict[str, float] = None, absence_time_list: list[int] = None, state: BaseFacilityState = BaseFacilityState.FREE, state_record_list: list[BaseFacilityState] = None, cost_record_list: list[float] = None, assigned_task_worker_id_tuple_set: set[tuple[str, str]] = None, assigned_task_worker_id_tuple_set_record_list: list[set[tuple[str, str]]] = None)[source]

Create a new BaseFacility and add it to this workplace.

Parameters:
  • name (str, optional) – Name of this facility. Defaults to None -> “New Facility”.

  • ID (str, optional) – ID will be defined automatically. Defaults to None -> str(uuid.uuid4()).

  • cost_per_time (float, optional) – Cost of this facility per unit time. Defaults to 0.0.

  • solo_working (bool, optional) – Flag whether this facility can work any task with other facilities or not. Defaults to False.

  • workamount_skill_mean_map (Dict[str, float], optional) – Mean skill for expressing progress in unit time. Defaults to {}.

  • workamount_skill_sd_map (Dict[str, float], optional) – Standard deviation of skill for expressing progress in unit time. Defaults to {}.

  • absence_time_list (List[int], optional) – List of absence time of simulation. Defaults to None -> [].

  • state (BaseFacilityState, optional) – State of this facility in simulation. Defaults to BaseFacilityState.FREE.

  • state_record_list (List[BaseFacilityState], optional) – Record list of state. Defaults to None -> [].

  • cost_record_list (List[float], optional) – History or record of his or her cost in simulation. Defaults to None -> [].

  • assigned_task_worker_id_tuple_set (set(tuple(str, str)), optional) – State of his or her assigned tasks id in simulation. Defaults to None -> set().

  • assigned_task_worker_id_tuple_set_record_list (List[set(tuple(str, str))], optional) – Record of his or her assigned tasks’ id in simulation. Defaults to None -> [].

Returns:

The created facility.

Return type:

BaseFacility

create_gantt_plotly(init_datetime: datetime, unit_timedelta: timedelta, target_id_order_list: list[str] = None, title: str = 'Gantt Chart', colors: dict[str, str] = None, index_col: str = None, showgrid_x: bool = True, showgrid_y: bool = True, group_tasks: bool = True, show_colorbar: bool = True, print_workplace_name: bool = True, save_fig_path: str = None)[source]

Create Gantt chart by plotly.

This method will be used after simulation.

Parameters:
  • init_datetime (datetime.datetime) – Start datetime of project.

  • unit_timedelta (datetime.timedelta) – Unit time of simulation.

  • target_id_order_list (list[str], optional) – Target ID order list. Defaults to None.

  • title (str, optional) – Title of Gantt chart. Defaults to “Gantt Chart”.

  • colors (Dict[str, str], optional) – Color setting of plotly Gantt chart. Defaults to None. If None, default color setting will be used.

  • index_col (str, optional) – index_col of plotly Gantt chart. Defaults to None -> “Type”.

  • showgrid_x (bool, optional) – showgrid_x of plotly Gantt chart. Defaults to True.

  • showgrid_y (bool, optional) – showgrid_y of plotly Gantt chart. Defaults to True.

  • group_tasks (bool, optional) – group_tasks of plotly Gantt chart. Defaults to True.

  • show_colorbar (bool, optional) – show_colorbar of plotly Gantt chart. Defaults to True.

  • print_workplace_name (bool, optional) – Print workplace name or not. Defaults to True.

  • save_fig_path (str, optional) – Path of saving figure. Defaults to None.

Returns:

Figure for a gantt chart.

Return type:

figure

Raises:

ImportError – If plotly is not installed.

create_simple_gantt(target_id_order_list: list[str] = None, finish_margin: float = 1.0, print_workplace_name: bool = True, view_ready: bool = False, view_absence: bool = False, facility_color: str = '#D9E5FF', ready_color: str = '#DCDCDC', absence_color: str = '#696969', figsize: tuple[float, float] = None, dpi: float = 100.0, save_fig_path: str = None)[source]

Create Gantt chart by matplotlib.

In this Gantt chart, datetime information is not included. This method will be used after simulation.

Parameters:
  • target_id_order_list (list[str], optional) – Target ID order list. Defaults to None.

  • finish_margin (float, optional) – Margin of finish time in Gantt chart. Defaults to 1.0.

  • print_workplace_name (bool, optional) – Print workplace name or not. Defaults to True.

  • view_ready (bool, optional) – View READY time or not. Defaults to False.

  • view_absence (bool, optional) – View Absence time or not. Defaults to False.

  • facility_color (str, optional) – Node color setting information. Defaults to “#D9E5FF”.

  • ready_color (str, optional) – Ready color setting information. Defaults to “#DCDCDC”.

  • absence_color (str, optional) – Absence color setting information. Defaults to “#696969”.

  • figsize ((float, float), optional) – Width, height in inches. Default to None -> [6.4, 4.8].

  • dpi (float, optional) – The resolution of the figure in dots-per-inch. Default to 100.0.

  • save_fig_path (str, optional) – Path of saving figure. Defaults to None.

Returns:

Figure in plt.subplots(). gnt: Axes in plt.subplots().

Return type:

fig

Raises:

ImportError – If matplotlib is not installed.

extend_input_workplace_list(input_workplace_list: list[BaseWorkplace])[source]

Extend the list of input workplaces to input_workplace_id_set.

Deprecated since version Use: update_input_workplace_set instead.

Parameters:

input_workplace_list (list[BaseWorkplace]) – List of input workplaces.

extend_targeted_task_list(targeted_task_list: list[BaseTask])[source]

Extend the list of targeted tasks to targeted_task_list.

Deprecated since version Use: update_targeted_task_set instead.

Parameters:

targeted_task_list (list[BaseTask]) – List of targeted tasks.

get_facility_set_by_state(target_time_list: list[int], target_state: BaseFacilityState)[source]

Extract state facility list from simulation result.

Parameters:
  • target_time_list (List[int]) – Target time list. If you want to extract target_state facility from time 2 to time 4, you must set [2, 3, 4] to this argument.

  • target_state (BaseFacilityState) – Target state.

Returns:

Set of BaseFacility.

Return type:

set[BaseFacility]

get_gantt_mermaid_steps(target_id_order_list: list[str] = None, section: bool = True, range_time: tuple[int, int] = (0, 9223372036854775807), view_ready: bool = False, detailed_info: bool = False, id_name_dict: dict[str, str] = None)[source]

Get mermaid diagram of Gantt chart.

Parameters:
  • target_id_order_list (list[str], optional) – Target ID order list. Defaults to None.

  • section (bool, optional) – Section or not. Defaults to True.

  • range_time (tuple[int, int], optional) – Range of Gantt chart. Defaults to (0, sys.maxsize).

  • view_ready (bool, optional) – If True, the Gantt chart is displayed in a “ready” state. Defaults to False.

  • detailed_info (bool, optional) – If True, detailed information is included in gantt chart. Defaults to False.

  • id_name_dict (dict[str, str], optional) – Dictionary of ID and name for detailed information. Defaults to None.

Returns:

List of lines for mermaid diagram.

Return type:

list[str]

get_gantt_mermaid_text(project_init_datetime: datetime, project_unit_timedelta: timedelta, target_id_order_list: list[str] = None, section: bool = True, range_time: tuple[int, int] = (0, 9223372036854775807), view_ready: bool = False, detailed_info: bool = False, id_name_dict: dict[str, str] = None)[source]

Get mermaid diagram text of Gantt chart.

Parameters:
  • project_init_datetime (datetime.datetime, optional) – Start datetime of project.

  • project_unit_timedelta (datetime.timedelta, optional) – Unit time of simulation.

  • target_id_order_list (list[str], optional) – Target ID order list. Defaults to None.

  • section (bool, optional) – Section or not. Defaults to True.

  • range_time (tuple[int, int], optional) – Range of Gantt chart. Defaults to (0, sys.maxsize).

  • view_ready (bool, optional) – If True, the Gantt chart is displayed in a “ready” state. Defaults to False.

  • detailed_info (bool, optional) – If True, detailed information is included in gantt chart. Defaults to False.

  • id_name_dict (dict[str, str], optional) – Dictionary of ID and name for detailed information. Defaults to None.

Returns:

Mermaid gantt diagram text.

Return type:

str

get_mermaid_diagram(print_facility: bool = True, shape_facility: str = 'stadium', link_type_str: str = '-->', subgraph: bool = True, subgraph_direction: str = 'LR')[source]

Get mermaid diagram of this workplace.

Parameters:
  • print_facility (bool, optional) – Print facilities or not. Defaults to True.

  • shape_facility (str, optional) – Shape of facilities in this workplace. Defaults to “stadium”.

  • link_type_str (str, optional) – Link type string. Defaults to “–>”.

  • subgraph (bool, optional) – Whether to use subgraph or not. Defaults to True.

  • subgraph_direction (str, optional) – Direction of subgraph. Defaults to “LR”.

Returns:

List of lines for mermaid diagram.

Return type:

list[str]

get_target_facility_mermaid_diagram(target_facility_set: set[BaseFacility], print_facility: bool = True, shape_facility: str = 'stadium', link_type_str: str = '-->', subgraph: bool = True, subgraph_direction: str = 'LR')[source]

Get mermaid diagram of target facility.

Parameters:
  • target_facility_set (set[BaseFacility]) – Set of target facilities.

  • print_facility (bool, optional) – Print facilities or not. Defaults to True.

  • shape_facility (str, optional) – Shape of facilities in this workplace. Defaults to “stadium”.

  • link_type_str (str, optional) – Link type string. Defaults to “–>”.

  • subgraph (bool, optional) – Whether to use subgraph or not. Defaults to True.

  • subgraph_direction (str, optional) – Direction of subgraph. Defaults to “LR”.

Returns:

List of lines for mermaid diagram.

Return type:

list[str]

get_total_workamount_skill(task_name: str, error_tol: float = 1e-10)[source]

Get total number of workamount skill of all facilities.

By checking workamount_skill_mean_map.

Parameters:
  • task_name (str) – Task name.

  • error_tol (float, optional) – Measures against numerical error. Defaults to 1e-10.

Returns:

Total workamount skill of target task name.

Return type:

float

initialize(state_info: bool = True, log_info: bool = True)[source]

Initialize the changeable variables of BaseWorkplace.

If state_info is True, the following attributes are initialized:
  • placed_component_id_set

  • available_space_size

If log_info is True, the following attributes are initialized:
  • cost_record_list

  • placed_component_id_set_record_list

BaseFacility in facility_set are also initialized by this function.

Parameters:
  • state_info (bool, optional) – Whether to initialize state information. Defaults to True.

  • log_info (bool, optional) – Whether to initialize log information. Defaults to True.

plot_simple_gantt(target_id_order_list: list[str] = None, finish_margin: float = 1.0, print_workplace_name: bool = True, view_ready: bool = False, facility_color: str = '#D9E5FF', ready_color: str = '#C0C0C0', figsize: tuple[float, float] = None, dpi: float = 100.0, save_fig_path: str = None)[source]

Plot Gantt chart by matplotlib.

In this Gantt chart, datetime information is not included. This method will be used after simulation.

Parameters:
  • target_id_order_list (list[str], optional) – Target ID order list. Defaults to None.

  • finish_margin (float, optional) – Margin of finish time in Gantt chart. Defaults to 1.0.

  • print_workplace_name (bool, optional) – Print workplace name or not. Defaults to True.

  • view_ready (bool, optional) – View READY time or not. Defaults to True.

  • facility_color (str, optional) – Node color setting information. Defaults to “#D9E5FF”.

  • ready_color (str, optional) – Ready color setting information. Defaults to “#C0C0C0”.

  • figsize ((float, float), optional) – Width, height in inches. Default to None -> [6.4, 4.8].

  • dpi (float, optional) – The resolution of the figure in dots-per-inch. Default to 100.0.

  • save_fig_path (str, optional) – Path of saving figure. Defaults to None.

Returns:

Figure in plt.subplots().

Return type:

fig

Raises:

ImportError – If matplotlib is not installed.

print_gantt_mermaid(project_init_datetime: datetime = None, project_unit_timedelta: timedelta = None, target_id_order_list: list[str] = None, section: bool = True, range_time: tuple[int, int] = (0, 9223372036854775807), view_ready: bool = False, detailed_info: bool = False, id_name_dict: dict[str, str] = None)[source]

Print mermaid diagram of Gantt chart.

Parameters:
  • project_init_datetime (datetime.datetime, optional) – Start datetime of project. If None, outputs step-based Gantt chart. Defaults to None.

  • project_unit_timedelta (datetime.timedelta, optional) – Unit time of simulation. Required if project_init_datetime is provided. Defaults to None.

  • target_id_order_list (list[str], optional) – Target ID order list. Defaults to None.

  • section (bool, optional) – Section or not. Defaults to True.

  • range_time (tuple[int, int], optional) – Range of Gantt chart. Defaults to (0, sys.maxsize).

  • view_ready (bool, optional) – If True, the Gantt chart is displayed in a “ready” state. Defaults to False.

  • detailed_info (bool, optional) – If True, detailed information is included in gantt chart. Defaults to False.

  • id_name_dict (dict[str, str], optional) – Dictionary of ID and name for detailed information. Defaults to None.

print_mermaid_diagram(orientations: str = 'LR', print_facility: bool = True, shape_facility: str = 'stadium', link_type_str: str = '-->', subgraph: bool = True, subgraph_direction: str = 'LR')[source]

Print mermaid diagram of this workplace.

Parameters:
  • orientations (str) – Orientation of the flowchart. Defaults to “LR”.

  • print_facility (bool, optional) – Print facilities or not. Defaults to True.

  • shape_facility (str, optional) – Shape of facilities in this workplace. Defaults to “stadium”.

  • link_type_str (str, optional) – Link type string. Defaults to “–>”.

  • subgraph (bool, optional) – Whether to use subgraph or not. Defaults to True.

  • subgraph_direction (str, optional) – Direction of subgraph. Defaults to “LR”.

print_target_facility_mermaid_diagram(target_facility_set: set[BaseFacility], orientations: str = 'LR', print_facility: bool = True, shape_facility: str = 'stadium', link_type_str: str = '-->', subgraph: bool = True, subgraph_direction: str = 'LR')[source]

Print mermaid diagram of this workplace.

Parameters:
  • target_facility_set (set[BaseFacility]) – Set of target facilities.

  • orientations (str) – Orientation of the flowchart. Defaults to “LR”.

  • print_facility (bool, optional) – Print facilities or not. Defaults to True.

  • shape_facility (str, optional) – Shape of facilities in this workplace. Defaults to “stadium”.

  • link_type_str (str, optional) – Link type string. Defaults to “–>”.

  • subgraph (bool, optional) – Whether to use subgraph or not. Defaults to True.

  • subgraph_direction (str, optional) – Direction of subgraph. Defaults to “LR”.

record_all_facility_state(working: bool = True)[source]

Record state of all facilities.

Parameters:

working (bool, optional) – Whether to record as working. Defaults to True.

record_assigned_task_id()[source]

Record assigned task id.

record_placed_component_id()[source]

Record component id list to placed_component_id_set_record_list.

reverse_log_information()[source]

Reverse log information of all.

set_absence_state_to_all_facilities()[source]

Set absence state to all facilities.

set_parent_workplace(parent_workplace: BaseWorkplace)[source]

Set parent_workplace.

Parameters:

parent_workplace (BaseWorkplace) – Parent workplace.

update_input_workplace_set(input_workplace_set: set[BaseWorkplace])[source]

Update the set of input workplaces to input_workplace_id_set.

Parameters:

input_workplace_set (set[BaseWorkplace]) – Set of input workplaces.

update_targeted_task_set(targeted_task_set: set[BaseTask])[source]

Extend the set of targeted tasks to targeted_task_id_set.

Parameters:

targeted_task_set (Set[BaseTask]) – Set of targeted tasks.

Module contents

__init__.