The algorithm for ativity selection problem:
The solution to above problem:
step 1: sort the activities according to their finish time
i | 2 | 3 | 1 | 5 | 4 | 6 |
si | 1 | 3 | 0 | 5 | 5 | 8 |
fi | 2 | 4 | 6 | 7 | 9 | 9 |
Step 2: select the first activity and print it
output : 2
Step 3: si(activity(3)) > fi(activity(2)
output: 2,3 and repeat the steps,
si(activity(1)) < fi(activity(3))
output: 2,3
si(activity(5))>fi(activity(3))
output : 2,3,5
finally si(activity(6))>fi(activity(5))
so output: 2,3,5,6
so ,the activities that are selected are 2,3,5,6
Consider the following activities. Solve the problem of activity-selection problem.
Consider the following variation on the Activity Selection Problem.You have a resource that may be used for activities 24 hours a day,ever day.Activities repeat that may be used for activities repeat on a daily basis. As in the original problem, each activity has a start time and as end time.If an activity is selected, it will exclusively use the resource during the duration between the start and end time(i.e., no other activity may be scheduled during this time). Note that...
Full question from above:"Consider a modification to the activity-selection problem in which each activity ai has, in addition to a start and a finish time, a value vi. The objective is nolonger to maximize the number of activities scheduled, but instead to maximize the total value of the activities scheduled. That is, we wish to choose a set A ofcompatible activities such that [summation, sub k in A, of v sub k] is maximized. Give a polynomial-time algorithm for this...
In activity selection problem, of all the allowed activities we always picked the activity that ends first. Is picking the allowed activity that starts last a good greedy choice? When is it appropriate to use the dynamic programming approach - describe and explain the prerequisites. What is the difference compared to greedy approach? What is optimal substructure? Explain with an example. For problems that exhibit greedy-choice property, why is greedy approach preferable to dynamic programming approach?
A) Write the pseudocode for an algorithm using dynamic programming to solve the activity-selection problem based on this recurrence: c[i, j] = 0 if Si; = Ø max {c[i, k] + c[k,j] + 1} if Sij +0 ak eSij B) Analyze the running time (the time complexity) of your algorithm and compare it to the iterative greedy algorithm.
show all your work. justify your answer Exercise 3 (20 points) This exercise is about the greedy approach to the activity-selection problem. James claims that in some cases the elimination of the first activity to finish from the set of activities can lead to a larger set of mutually compatible activities. Is James right or wrong? Prove your answer Exercise 3 (20 points) This exercise is about the greedy approach to the activity-selection problem. James claims that in some cases...
Q4. CPM Consider the following list of activities and predecessors. Activity ProcessorsDuration (days) Build foundation Build walls&ceilin Build roof Complete electrical wirin Put in windows Put on sidin Paint house C,F a)Draw the network diagram. Write down the LP to determine the completion time. b)Suppose that by hiring additional workers, the duration of each activity can be reduced. The costs per day of reducing the duration of the activities are given in the following table. Write down the LP to...
Consider the following project activities: Calculate the expected time (te) for each activity. Draw an Activity on Node (AON) diagram to reflect the flow of these activities. Calculate the Early Start (ES), Early Finish (EF), Late Start (LS), and Late Finish (LF) for each activity. Calculate the slack for each activity. Identify all activities on the Critical Path. Use the data to calculate the probability the project will finish in 20 weeks (Hint: z-score). Activity A 8 с D E...
Consider the following precedence chart: ACTIVITY PRECEDING ACTIVITIES OPTIMISTIC TIME (days) PESSIMISTIC TIME days) MOST LIKELY TIME (days) 10 10 10 B.C DE The total slack for activity D is O 2 O O O
Problem 5-7 The following activities are part of a project to be scheduled using CPM: ACTIVITY IMMEDIATE PREDECESSOR TIME (WEEKS) А 7 B 6 2 3 B.D D b. What is the critical path? Оооо A-C-D-E-G A-B-D-F-G A-B-E-G O A-C-D-F-G c. How many weeks will it take to complete the project? Number of weeks d. How much slack does activity B have? Slack of activity B week(s)
I need help with the following problem. Schedule the following activities using CPM. ACTIVITY Immediate Predecessors Time in Weeks A ---- 2 B A 5 C A 4 D B 3 E C, D 6 F D 3 G F 3 H E, G 4 Draw the network diagram below using the square activity I have provided. Just select the object, then copy it and paste how many you need and then arrange them in the order you need and...