Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using java create the following program and post the answer as well. The Weighted Interval Scheduling problem is this: Given a set of weighted intervals,

Using java create the following program and post the answer as well.

The Weighted Interval Scheduling problem is this: Given a set of weighted intervals, choose a set of non-overlapping intervals such that the total weight is maximal. You may think of the weight as the profit for doing the work in the given interval

A weighted interval x can be represented by a triple

x = (s, f, v),

where

s = start time of x, f = finish time of x, v = weight or profit of this job

For example, consider the test case for Weighted Interval Scheduling problem depicted below:

image text in transcribed

These weighted intervals can be represented by the triples

(0,3,3) (1,4,2) (0,5,4) (3,6,1) (4,7,2) (3,9,5) (5,10,2) (8,10,1)

Write a program to compute a solution to the Weighted Interval Scheduling problem.

Your program must read in a set of weighted intervals. Each interval should be entered as 3 integers. The intervals must be given in a textfile and also be entered in increasing order of finish time. In the above case we would have

0 3 3 1 4 2 0 5 4 3 6 1 ...

The program must print out the value of the total weight or profit of the optimum solution and the indices of the jobs. The output must be in the following format (the output below does NOT have the correct result).

Optimum profit: 7

Usng Jobs: 2 5

The program MUST use recursion. An iterative solution will not receive full credit. Use of memoization will receive 20 points extra credit.

You must submit a run using the example above. You must also submit a run using the following sample data set:

Number of Jobs n = 4

Job Details {Start Time, Finish Time, Profit}

Job 1: {1, 2, 50}

Job 2: {3, 5, 20}

Job 3: {6, 19, 100}

Job 4: {2, 100, 200}

In both cases you must submit a printout of the input file used.

3 2 5 2 3 0 12345678

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

=+ What would it look like? Who should deliver it?

Answered: 1 week ago