Guest User

Untitled

a guest
May 13th, 2019
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.98 KB | None | 0 0
  1. As per the practice project, things to look out for in solving the questions are:
  2.  
  3. Make sure to name functions and arguments as stipulated in the question, but never be afraid to create extra functions of your own, e.g. to break up the code into conceptual sub-parts, or avoid redundancy in your code
  4. Commenting of code is one thing that you will be marked on; get some practice writing comments in your code, focusing on:
  5. Describing key variables when they are first defined (but not things like index variables in for loops)
  6. Describing what "chunks" of code do (i.e. not every line, but chunks of code that perform a particular operation, such as #find the maximum value in the list or #count the number of vowels
  7. Describing what every function does, including what its arguments are, and what it returns.
  8.  
  9. Background
  10. Consider the problem of moving house
  11.  
  12. Your goal is to move in to your new house.
  13.  
  14. Before you can do this, there are many tasks you must perform, e.g., getting boxes to store your belongings, packing your belongings, cleaning the old house, finding a removalist, moving your packed belongings.
  15.  
  16. There are also dependencies between tasks, e.g., you need to get boxes before you can pack your belongings, you need to move your packed belongings before you can clean the house, and so on.
  17.  
  18. A plan that achieves your goal specifies the order in which tasks should be executed so that all the dependencies are met, noting that some tasks can be executed in parallel.
  19.  
  20. For example:
  21. Goal task: move-in
  22. Other tasks: get-boxes, pack, clean, find-removalist, find-cleaner
  23. Dependencies:
  24. get-boxes → pack, find-removalist → move-in
  25. pack → clean,
  26. clean → move-in,
  27. find-cleaner → clean
  28.  
  29. To generate a plan, we need to assign a time-slot to each task.
  30.  
  31. We assume each task takes 1 time-step.
  32.  
  33. Note that some tasks can be done in parallel.
  34.  
  35. There can be many valid plans for a given goal and set of dependencies.
  36.  
  37. Valid vs Invalid Plans
  38. A plan is valid if all dependencies are satisfied.
  39.  
  40. Optimal vs Suboptimal plans
  41. We will consider a plan to be optimal if it follows the just-in-time scheduling strategy, where a task is scheduled for execution just before it is needed, i.e., as late as possible.
  42.  
  43. Planning metrics
  44. The number of time-steps required by a given plan is called the length of the plan.
  45.  
  46. The maximum number of tasks in parallel in any time-step of a given plan is called the number of workers required by the plan.
  47.  
  48. Task Planning Problems
  49. In this project we will define and implement a very simple programming language for task planning:
  50.  
  51. Is a given plan valid? (Question 1)
  52. How long will it take a plan to execute (Question 2)
  53. How many workers are needed to execute the plan (Question 3)
  54. Assumptions:
  55. Each task is a pre-requisite for at most one other task.
  56.  
  57. Dependencies : each tuple (1, 2) in the dependency list specifies that task 2 depends upon task 1
  58.  
  59. When specifying a plan, the order of tasks in a time-step is irrelevant, i.e., the following to plans are equivalent: [[1,4], [5,6, 3], [2]] and [[4,1], [3,5,6], [2]]
  60.  
  61. There will be no cyclic dependencies given, e.g., you would not be given the following dependencies: [(1,2), (2,3), (3,1)].
  62.  
  63. The order of tasks between time-steps may be relevant, depending on the dependencies. If (1,3) and (2,3) are the only dependencies, then [[1],[2],[3]] and [[2],[1],[3]] and [[1,2],[3]] are the only valid plans. Of those, only the last one is optimal.
  64.  
  65. A given goal task will never have another task as a dependent.
  66.  
  67. There will always be at least one dependency given.
  68.  
  69. Plans do not contain any empty time-steps. We would never give you a plan such as [[1,2],[],[3]]
  70.  
  71. An example
  72. Tasks: 1,2,3,4,5,6
  73.  
  74. Goal: 2
  75.  
  76. Dependencies: [(1,3), (4,3), (5,2), (6,2), (3,2)]
  77.  
  78. (Optimal) Plan: [[1,4], [3,5,6], [2]]
  79.  
  80. Length of plan: 3
  81.  
  82. Number of workers for plan: 3
  83.  
  84. Sub-optimal (but valid) Plan : [[1], [4], [3], [5], [6], [2]]
  85.  
  86. Sub-optimal (but valid) Plan: [[1],[4], [3,5,6], [2]]
  87.  
  88. An Invalid Plan: [[1],[4], [3,5], [2,6]]
Advertisement
Add Comment
Please, Sign In to add comment