Weighted Intervals Problem EXAMPLE:Suppose we have the following weighted intervals. start   finish   weight  11       14       4  10       13       5   9       11       5  11       14       3   8        9       2 To solve the problem, we start out by sorting the intervals by finish time. This gives us the following. start   finish   weight   8        9       2   9       11       5  10       13       5  11       14       4  11       14       3 Next we calculate the p-values. P(j) = k where interval k is the last interval prior to interval j in the list below which does not conflict with interval j, or P(j) = 0 if all intervals prior to interval j conflict with it. #   start    finish    weight    P 1     8         9        2       0 2     9        11        5       1 3    10        13        5       1 4    11        14        3       2 5    11        14        4       2 Finally, we use the formula OPT(j) = max{OPT(j-1), weight(j)+ OPT(P(j))} to fill in the OPT value for each j. (The base case where j=1 is that OPT(1)=weight(1)). #   start    finish    weight    P    OPT 1     8         9        2       0     2 2     9        11        5       1     7 3    10        13        5       1     7 4    11        14        3       2    10 5    11        14        4       2    11 BACKTRACKING:Since OPT(5)=11>10=OPT(4), we know that interval 5 is part of an optimal solution. Since the P value for 5 is 2, we know that the rest of the intervals are chosen from among intervals 1 and 2.Since OPT(2)=7>2=Opt(1), we know that interval 2 is part of an optimal solution that uses interval 5. Since the P value for 2 is 1, we know that the rest of the intervals are chosen from "among" interval 1. As a base case of the backtracking, we see that we can either take interval 1, and get its weight 2, or not take it, and get nothing, so we conclude that interval 1 is a part of the solution.Thus, by backtracking, we have found that intervals 5, 2, and 1 form an optimal solution, with total weight 11. The example above shows how to work this kind of problem. Your assignment is to work the following problem, and to produce the corresponding table and backtracking results, according to the technique illustrated in the example.YOUR ASSIGNED PROBLEM: start   finish   weight  13       15       2  11       13       4  13       16       2  14       17       6  10       13       6 Let me know in class if you have questions about how such problems are solved. The algorithm is covered in sections 6.1 and 6.2.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%



Weighted Intervals Problem



EXAMPLE:

Suppose we have the following weighted intervals.

start   finish   weight

 11       14       4

 10       13       5

  9       11       5

 11       14       3

  8        9       2

To solve the problem, we start out by sorting the intervals by finish time. This gives us the following.

start   finish   weight

  8        9       2

  9       11       5

 10       13       5

 11       14       4

 11       14       3

Next we calculate the p-values. P(j) = k where interval k is the last interval prior to interval j in the list below which does not conflict with interval j, or P(j) = 0 if all intervals prior to interval j conflict with it.

#   start    finish    weight    P

1     8         9        2       0

2     9        11        5       1

3    10        13        5       1

4    11        14        3       2

5    11        14        4       2

Finally, we use the formula OPT(j) = max{OPT(j-1), weight(j)+ OPT(P(j))} to fill in the OPT value for each j. (The base case where j=1 is that OPT(1)=weight(1)).

#   start    finish    weight    P    OPT

1     8         9        2       0     2

2     9        11        5       1     7

3    10        13        5       1     7

4    11        14        3       2    10

5    11        14        4       2    11

BACKTRACKING:

Since OPT(5)=11>10=OPT(4), we know that interval 5 is part of an optimal solution. Since the P value for 5 is 2, we know that the rest of the intervals are chosen from among intervals 1 and 2.

Since OPT(2)=7>2=Opt(1), we know that interval 2 is part of an optimal solution that uses interval 5. Since the P value for 2 is 1, we know that the rest of the intervals are chosen from "among" interval 1. 

As a base case of the backtracking, we see that we can either take interval 1, and get its weight 2, or not take it, and get nothing, so we conclude that interval 1 is a part of the solution.

Thus, by backtracking, we have found that intervals 5, 2, and 1 form an optimal solution, with total weight 11. 

The example above shows how to work this kind of problem. Your assignment is to work the following problem, and to produce the corresponding table and backtracking results, according to the technique illustrated in the example.

YOUR ASSIGNED PROBLEM:


start   finish   weight

 13       15       2

 11       13       4

 13       16       2

 14       17       6

 10       13       6

Let me know in class if you have questions about how such problems are solved. The algorithm is covered in sections 6.1 and 6.2. 








 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 3 images

Blurred answer
Knowledge Booster
Topological Sort
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education