def test_dna_assembly_example(tmpdir):
spreadsheet_path = os.path.join('examples', 'examples_data',
"dna_assembly.xls")
colors = (cm.Paired(0.21 * i % 1.0) for i in range(30))
resources = resources_from_spreadsheet(
spreadsheet_path=spreadsheet_path, sheetname="resources")
processes = [
tasks_from_spreadsheet(spreadsheet_path=spreadsheet_path,
sheetname="process",
resources_dict=resources,
tasks_color=next(colors),
task_name_prefix="WU%d_" % (i + 1))
for i in range(5)
]
print("NOW OPTIMIZING THE SCHEDULE, BE PATIENT...")
new_processes = schedule_processes_series(
processes, est_process_duration=5000, time_limit=6)
# PLOT THE TASKS DEPENDENCY TREE
ax = plot_tasks_dependency_graph(processes[0])
ax.set_title("PLAN OF A WORK UNIT")
ax.figure.savefig("basic_example_work_unit.pdf", bbox_inches="tight")
# PLOT THE OPTIMIZED SCHEDULE
ax = plot_schedule([t for process in new_processes for t in process])
ax.figure.set_size_inches((8, 5))
ax.set_xlabel("time (min)")
ax.figure.savefig(os.path.join(str(tmpdir),
"basic_example_schedule.png"),
bbox_inches="tight")
test_basics.py 文件源码
python
阅读 28
收藏 0
点赞 0
评论 0
评论列表
文章目录