compute total cost and max workload