Unverified Commit 1582cde1 authored by Bennett Piater's avatar Bennett Piater
Browse files

add parallel width estimate

parent 41069a10
#!/usr/bin/env python3
from typing import List
from parser import parse_tasks, parse_machine_prices
from preprocessing import *
def main():
tasks = parse_tasks()
parallel_width_estimate = parallel_width_assuming_mapreduce(tasks)
# print(parallel_width_estimate)
if __name__ == "__main__":
#!/usr/bin/env python3
from typing import List
from taskgraph import *
def parallel_width_assuming_mapreduce(taskgraph: List[Task]) -> int:
max_width = 1
current_width = 0
current_predecessors = None
for task in taskgraph:
# check for one row in the graph
if task.inDegree == 1 and (current_predecessors == None or
current_predecessors == task.predecessors):
current_width += 1
current_predecessors = task.predecessors
current_predecessors = None
current_width = 0
max_width = max(current_width, max_width)
return max_width
def best_performance_under_limit(taskgraph: List[Task], prices: List[float],
limit: float) -> List[float]:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment