subject
Engineering, 04.06.2020 14:07 gorillalover9000

The linear partition problem (LP1) is defined as follows: Given a sequence Sof n positive integers (s1, s2, . . . , sn) and an integer k, partition S into k ranges so as to minimize the maximum sum over all ranges. Note that "minimizing the maximum sum" is one way to quantify fairness. It minimizes the most work that anyone has to do. Another way to quantify fairness given the same input instead maximizes the minimum sum over all ranges. Call this version of the problem LP2. For an input sequence (1 2 4) with k= 2, an optimal solution to LP2 would place a divider between 2 and 4 giving a fairness index of min(1+2,4) = 3. This is superior to placing the divider between 1 and 2 resulting in a fairness index of min(1,2+4) = 1. a. Prove that the two definitions are equivalent when k= 2; i. e., given (s1, s2, . . . , sn), show that an optimal solution to both LP1 and LP2 will partition the sequence in exactly the same location.

b. Using a small example, show that, in general, the two problems are not equivalent; i. e., a partition corresponding to an optimal solution under one definition is not an optimal partition under the other definition.

c. What is the size of the solution space of the linear partition problem? This should be a formula in terms of n and k that counts the number of distinct ways to partition S into k ranges.

d. Provide the recurrence relation (including base cases) for LP2.

e. Implement a recursive algorithm for LP2 in code based on your recurrence relation above. Suggested languages include Python or C++.

f. Implement a dynamic programming algorithm in code (that uses a table to avoid recomputation) to compute the optimal fairness index for LP2.

g. Implement a traceback step in code that identifies the locations of the dividers in an optimal solution to LP2.

h. Demonstrate that your code works correctly by showing its results on the following instance. S= (10 6 7 3 8 5 7 9 11 7 15 10 12 6 19 7 3 12 14 6); k= 4.

ansver
Answers: 2

Another question on Engineering

question
Engineering, 03.07.2019 14:10
Amass of m 1.5 kg of steam is contained in a closed rigid container. initially the pressure and temperature of the steam are: p 1.5 mpa and t 240Ā°c (superheated state), respectively. then the temperature drops to t2= 100Ā°c as the result of heat transfer to the surroundings. determine: a) quality of the steam at the end of the process, b) heat transfer with the surroundings. for: p1.5 mpa and t 240Ā°c: enthalpy of superheated vapour is 2900 kj/kg, specific volume of superheated vapour is 0. 1483 m/kg, while for t 100Ā°c: enthalpy of saturated liquid water is 419kj/kg, specific volume of saturated liquid water is 0.001043m/kg, enthalpy of saturated vapour is 2676 kj/kg, specific volume of saturated vapour is 1.672 m/kg and pressure is 0.1 mpa.
Answers: 3
question
Engineering, 04.07.2019 18:10
The temperature of air decreases as it is compressed by an adiabatic compressor. a)- true b)- false
Answers: 2
question
Engineering, 04.07.2019 18:10
Asingle-geared blanking press has a stroke of 200 mm and a rated capacity of 320 kn. a cam driven ram is assumed to be capable of delivering the full press load at constant force during the last 15 percent of a constant-velocity stroke. the camshaft has an average speed of 90 rev/min and is geared to the flywheel shaft at a 6: 1 ratio. the total work done is to include an allowance of 16 percent for friction a) estimate the maximum energy fluctuation b) find the rim weight for an effective diameter of 1.2 m and a coefficient of speed fluctuation of 0.10
Answers: 1
question
Engineering, 04.07.2019 18:10
The flow rate of air through a through a pipe is 0.02 m5/s. a pitot static tube is placed in the flow. the radius of the pitot static tube is 1 mm. assuming the flow to be steady and the air to be at 300k, calculate the difference in total and static pressure if the diameter of the pipe is: (a) d 0.1 m d 0.05 m (c) d 0.01 m
Answers: 2
You know the right answer?
The linear partition problem (LP1) is defined as follows: Given a sequence Sof n positive integers (...
Questions
question
Chemistry, 02.02.2021 21:00
question
Mathematics, 02.02.2021 21:00
question
History, 02.02.2021 21:00
Questions on the website: 13722367