 ```What we could do is also implement a different strategy in that function.
Then, iterate HEFT until makespan * money rounded up is below the limit.
If it is not, use the other strategy to select a cheaper combination of
machines.```
parent c73c9883
 #!/usr/bin/env python3 from typing import List from parser import parse_tasks, parse_machine_prices from preprocessing import * from preprocessing import parallel_width_assuming_mapreduce, best_performance_under_limit def main(): def main(limit = 6): # parse tasks = parse_tasks() prices = parse_machine_prices() # preprocess parallel_width_estimate = parallel_width_assuming_mapreduce(tasks) # print(parallel_width_estimate) cost, machine_count = best_performance_under_limit(parallel_width_estimate, prices, limit) print(cost, machine_count) if __name__ == "__main__": main()
 ... ... @@ -5,7 +5,7 @@ from taskgraph import Task from typing import List def parse_machine_prices(fname: str) -> List[float]: def parse_machine_prices(fname: str = "price.csv") -> List[float]: with open(fname, "r") as f: f.readline() # ignore header lines = f.readlines() ... ...
 #!/usr/bin/env python3 from typing import List from typing import List, Tuple from taskgraph import * ... ... @@ -23,6 +23,21 @@ def parallel_width_assuming_mapreduce(taskgraph: List[Task]) -> int: return max_width def best_performance_under_limit(taskgraph: List[Task], prices: List[float], limit: float) -> List[float]: pass def best_performance_under_limit( max_width: int, prices: List[float], limit: float, strategy: str = "Biggest") -> Tuple[float, List[int]]: current_solution = [0 for machine in prices] current_price = 0.0 # TODO: this assumes more expensive is better and simply fills up with the largest possible # TODO: it also completely ignores that we may need the machines for MORE than one hour if strategy == "Biggest": for machine, price in enumerate(reversed(prices)): while current_price + price < limit and sum( current_solution) < max_width: current_price += price current_solution[-machine - 1] += 1 return current_price, current_solution
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!