Advertisement
Guest User

Untitled

a guest
Dec 17th, 2014
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. Problem 1
  2.  
  3. The problem contains in computing the maximum time to finish all input tasks. To do this, we will output the biggest time required for any task.
  4.  
  5. In the function readData, I read the input information from the file schedule2.in. In the array finalResults, I will save all the final times, after the execution of the algorithms, therefore the output will be the max value of this array.
  6.  
  7. In the array tasksTime, I save the time required for the current task (read from the input file).
  8.  
  9. In the array taskDependencies, I save all the dependencies of any task i, if the respective task has any dependency. For exmaple, for task1 in the example read file, I will save task2 and task3 (his dependencies).
  10.  
  11. In unresolved, I will save the indexes for all the tasks that have to be resolved.
  12.  
  13. Initially, the resolved tasks are the ones with 0 dependencies. After that, the algorithm iterates in the unresolved array and I compute all the tasks that have all their dependencies already resolved.
  14.  
  15. The algorithm ends when all the initial unresolved tasks are now resolved (therefore all their dependencies have been resolved).
  16.  
  17. For resolving a particular task, I know all his dependencies are already resolved, so I know the time required to finish it (including the depending time).
  18. The time for the current task is the maximum time between the time read from file and the time required to finish all the dependencies (because all tasks are finished 'in parallel' if possible).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement