sampo.generator.pipeline.project#

Overview#

Function#

get_small_graph(cluster_name, rand)

Creates a small graph of works consisting of 30-50 vertices

_get_cluster_graph(root_node, cluster_name, pipe_nodes_count, pipe_net_count, light_masts_count, borehole_counts, add_addition_cluster, addition_cluster_probability, rand)

-

get_graph(mode, cluster_name_prefix, cluster_counts, branching_probability, addition_cluster_probability, bottom_border, top_border, rand)

Invokes a graph of the given type if at least one positive value of cluster_counts, addition_cluster_probability,

_graph_mode_to_callable(mode)

-

_parallel_graph_mode_get_root(stages, branching_probability, rand)

-

_sequence_graph_mode_get_root(stages, branching_probability, rand)

-

_general_graph_mode(stages, branching_probability, rand)

-

get_start_stage(work_id, rand)

Creates a service vertex necessary for constructing the graph of works,

get_finish_stage(parents, work_id, rand)

Creates a service vertex necessary for constructing the graph of works,

Functions#

sampo.generator.pipeline.project.get_small_graph(cluster_name: str | None = 'C1', rand: random.Random | None = None) sampo.schemas.graph.WorkGraph#

Creates a small graph of works consisting of 30-50 vertices

Parameters:
  • cluster_name – str - the first cluster name

  • rand – Optional[Random] - generator of numbers with a given seed or None

Returns:

work_graph: WorkGraph - work graph where count of vertex between 30 and 50

sampo.generator.pipeline.project._get_cluster_graph(root_node: sampo.schemas.graph.GraphNode, cluster_name: str, pipe_nodes_count: int | None = None, pipe_net_count: int | None = None, light_masts_count: int | None = None, borehole_counts: list[int] | None = None, add_addition_cluster: bool | None = False, addition_cluster_probability: float | None = ADDITION_CLUSTER_PROBABILITY, rand: random.Random | None = None)#
sampo.generator.pipeline.project.get_graph(mode: sampo.generator.pipeline.types.SyntheticGraphType | None = SyntheticGraphType.GENERAL, cluster_name_prefix: str | None = 'C', cluster_counts: int | None = 0, branching_probability: float | None = BRANCHING_PROBABILITY, addition_cluster_probability: float | None = ADDITION_CLUSTER_PROBABILITY, bottom_border: int | None = 0, top_border: int | None = 0, rand: random.Random | None = None) sampo.schemas.graph.WorkGraph#

Invokes a graph of the given type if at least one positive value of cluster_counts, addition_cluster_probability, bottom_border is given

Parameters:
  • mode – str - ‘general’ or ‘sequence’ or ‘parallel - the type of the returned graph

  • cluster_name_prefix – str - cluster name prefix, if the prefix is ‘C’, the clusters will be called ‘C1’, ‘C2’ etc.

  • cluster_counts – Optional[int] - Number of clusters for the graph

  • branching_probability – Optional[float] - The probability that the node will not be connected to the last cluster, but to any other cluster for the general mode

  • addition_cluster_probability – Optional[float] - probability of a slave (example C3_1) cluster to the main cluster

  • bottom_border – Optional[int] - bottom border for number of works for the graph

  • top_border – Optional[int] - top border for number of works for the graph

  • rand – Optional[Random] - generator of numbers with a given seed or None

Returns:

work_graph: WorkGraph - the desired work graph

sampo.generator.pipeline.project._graph_mode_to_callable(mode: sampo.generator.pipeline.types.SyntheticGraphType) Callable[[list[tuple[sampo.schemas.graph.GraphNode, dict[str, sampo.schemas.graph.GraphNode]]], float, random.Random], sampo.schemas.graph.GraphNode]#
sampo.generator.pipeline.project._parallel_graph_mode_get_root(stages: list[tuple[sampo.schemas.graph.GraphNode, dict[str, sampo.schemas.graph.GraphNode]]], branching_probability: float, rand: random.Random) sampo.schemas.graph.GraphNode#
sampo.generator.pipeline.project._sequence_graph_mode_get_root(stages: list[tuple[sampo.schemas.graph.GraphNode, dict[str, sampo.schemas.graph.GraphNode]]], branching_probability: float, rand: random.Random) sampo.schemas.graph.GraphNode#
sampo.generator.pipeline.project._general_graph_mode(stages: list[tuple[sampo.schemas.graph.GraphNode, dict[str, sampo.schemas.graph.GraphNode]]], branching_probability: float, rand: random.Random) sampo.schemas.graph.GraphNode#
sampo.generator.pipeline.project.get_start_stage(work_id: str | None = '', rand: random.Random | None = None) sampo.schemas.graph.GraphNode#

Creates a service vertex necessary for constructing the graph of works, which is the only vertex without a parent in the graph :param work_id: id for the start node :param rand: Number generator with a fixed seed, or None for no fixed seed :return: desired node

sampo.generator.pipeline.project.get_finish_stage(parents: list[sampo.schemas.graph.GraphNode | tuple[sampo.schemas.graph.GraphNode, float, sampo.schemas.graph.EdgeType]], work_id: str | None = '', rand: random.Random | None = None) sampo.schemas.graph.GraphNode#

Creates a service vertex necessary for constructing the graph of works, which is the only vertex without children in the graph :param parents: a list of all non-service nodes that do not have children :param work_id: id for the start node :param rand: Number generator with a fixed seed, or None for no fixed seed :return: desired node