本文整理汇总了Python中task.Task.processing_time方法的典型用法代码示例。如果您正苦于以下问题:Python Task.processing_time方法的具体用法?Python Task.processing_time怎么用?Python Task.processing_time使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类task.Task
的用法示例。
在下文中一共展示了Task.processing_time方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: aggregate
# 需要导入模块: from task import Task [as 别名]
# 或者: from task.Task import processing_time [as 别名]
def aggregate(self, ns_density=None):
"""
to aggregate cluster-level tasks into bay-level tasks
:param ns_density: prefix:`noon-simultaneity density``, type:``float``, range:``[0, 1]``
:return: None
"""
if ns_density is None:
ns_density = self.parameter.ns_density
v = self.clone()
v.parameter.p_density = 0.0
v.parameter.ns_density = ns_density
v.precedence = []
v.non_simultaneity = []
# create aggregated bay-level tasks
# remove all the cluster-level tasks
# insert bay-level tasks into bays
v.tasks = []
for b in v.bays:
t = Task()
t.processing_time = b.aggregate_task_processing_time
t.index = b.index
b.empty()
b.append(t)
v.tasks.append(t)
# generate non-simultaneity set
v.generate_non_simultaneity(ns_density)
return v
示例2: _create_tasks
# 需要导入模块: from task import Task [as 别名]
# 或者: from task.Task import processing_time [as 别名]
def _create_tasks(self, n):
# w = fbc
handling_volume = int(self.parameter.handling_rate * self.bay_size * self.parameter.capacity)
cut_points = [(i+1)*self.parameter.capacity for i in range(handling_volume/self.parameter.capacity)]
cut_points.append(handling_volume)
while len(cut_points) < n:
cut = random.randint(1, handling_volume - 1)
if cut not in cut_points:
cut_points.append(cut)
cut_points.insert(0, 0)
cut_points.sort()
# generate tasks
for i in range(n):
t = Task()
t.processing_time = cut_points[i+1] - cut_points[i]
self.tasks.append(t)