sampo.scheduler.timeline.momentum_timeline#
Overview#
Timeline that stores the intervals in which resources is occupied. |
Classes#
- class sampo.scheduler.timeline.momentum_timeline.MomentumTimeline(tasks: Iterable[sampo.schemas.graph.GraphNode], contractors: Iterable[sampo.schemas.contractor.Contractor], worker_pool: sampo.schemas.contractor.WorkerContractorPool, landscape: sampo.schemas.landscape.LandscapeConfiguration)#
Bases:
sampo.scheduler.timeline.base.TimelineTimeline that stores the intervals in which resources is occupied.
- find_min_start_time_with_additional(node: sampo.schemas.graph.GraphNode, worker_team: list[sampo.schemas.resources.Worker], node2swork: dict[sampo.schemas.graph.GraphNode, sampo.schemas.scheduled_work.ScheduledWork], spec: sampo.schemas.schedule_spec.WorkSpec, assigned_start_time: sampo.schemas.time.Time | None = None, assigned_parent_time: sampo.schemas.time.Time = Time(0), work_estimator: sampo.schemas.time_estimator.WorkTimeEstimator = DefaultWorkEstimator()) tuple[sampo.schemas.time.Time, sampo.schemas.time.Time, dict[sampo.schemas.graph.GraphNode, tuple[sampo.schemas.time.Time, sampo.schemas.time.Time]]]#
Looking for an available time slot for given ‘GraphNode’
- Parameters:
worker_team – list of passed workers. Should be IN THE SAME ORDER AS THE CORRESPONDING WREQS
node – info about given GraphNode
node2swork – dictionary, that match GraphNode to ScheduleWork respectively
spec – schedule specification
assigned_start_time – start time, that can be received from
another algorithms of calculation the earliest start time :param assigned_parent_time: minimum start time :param work_estimator: function that calculates execution time of the GraphNode :return: start time, end time, time of execution
- _find_min_start_time(resource_timeline: dict[str, sortedcontainers.SortedList[sampo.schemas.types.ScheduleEvent]], inseparable_chain: list[sampo.schemas.graph.GraphNode], spec: sampo.schemas.schedule_spec.WorkSpec, parent_time: sampo.schemas.time.Time, exec_time: sampo.schemas.time.Time, passed_workers: list[sampo.schemas.resources.Worker]) sampo.schemas.time.Time#
Find start time for the whole ‘GraphNode’
- Parameters:
resource_timeline – dictionary that stores resource and its Timeline
inseparable_chain – list of GraphNodes that represent one big task,
that are divided into several dependent tasks :param parent_time: the minimum start time :param exec_time: the time of execution :param passed_workers: list of passed workers. Should be IN THE SAME ORDER AS THE CORRESPONDING WREQS :return:
- static _find_earliest_time_slot(state: sortedcontainers.SortedList[sampo.schemas.types.ScheduleEvent], parent_time: sampo.schemas.time.Time, exec_time: sampo.schemas.time.Time, required_worker_count: int, spec: sampo.schemas.schedule_spec.WorkSpec) sampo.schemas.time.Time#
Searches for the earliest time starting from start_time, when a time slot of exec_time is available, when required_worker_count of resources is available
- Parameters:
state – stores Timeline for the certain resource
parent_time – the minimum start time starting from the end of the parent task
exec_time – execution time of work
required_worker_count – requirements amount of Worker
- Returns:
the earliest start time
- update_timeline(finish_time: sampo.schemas.time.Time, node: sampo.schemas.graph.GraphNode, node2swork: dict[sampo.schemas.graph.GraphNode, sampo.schemas.scheduled_work.ScheduledWork], worker_team: list[sampo.schemas.resources.Worker])#
Inserts chosen_workers into the timeline with it’s inseparable_chain
- schedule(node: sampo.schemas.graph.GraphNode, node2swork: dict[sampo.schemas.graph.GraphNode, sampo.schemas.scheduled_work.ScheduledWork], workers: list[sampo.schemas.resources.Worker], contractor: sampo.schemas.contractor.Contractor, spec: sampo.schemas.schedule_spec.WorkSpec, assigned_start_time: sampo.schemas.time.Time | None = None, assigned_time: sampo.schemas.time.Time | None = None, assigned_parent_time: sampo.schemas.time.Time = Time(0), work_estimator: sampo.schemas.time_estimator.WorkTimeEstimator = DefaultWorkEstimator())#
Schedules the given GraphNode using passed agents, spec and times. If start time not passed, it should be computed as minimum work start time. :return: scheduled finish time of given work
- _schedule_with_inseparables(node: sampo.schemas.graph.GraphNode, node2swork: dict[sampo.schemas.graph.GraphNode, sampo.schemas.scheduled_work.ScheduledWork], inseparable_chain: list[sampo.schemas.graph.GraphNode], worker_team: list[sampo.schemas.resources.Worker], contractor: sampo.schemas.contractor.Contractor, start_time: sampo.schemas.time.Time, exec_times: dict[sampo.schemas.graph.GraphNode, tuple[sampo.schemas.time.Time, sampo.schemas.time.Time]])#
- __getitem__(item: sampo.schemas.types.AgentId)#