# You're in charge of running a scientific program (job) that simulates a physical system for as ma...

###### Question:

You're in charge of running a scientific program (job) that simulates a physical system for as many discrete steps as you can. The lab you're working in has two large supercomputers, which we'll call A and B, which are capable of processing this job. However, you're not one of the high-priority users of these supercomputers, so at any given point in time, you're only able to use as many spare cycles as these machines have available. Here's the problem you face. Your job can only run on one of the machines at any given minute. Over each of the next n minutes, you have a "profile" of how much processing power is available on each machine In minute i you would be able to run ai> 0 steps of the simulation if your job is on machine A, and b, > 0steps of the simulation if your job is on machine B. You also have the ability to move your job from one machine to the other; but doing this costs you a minute of time in which no processing is done on your job. So, given a sequence of n minutes, a plan is specified by a choice of A, B, or "move" for each minute, with the property that choices A and B cannot appear in consecutive minutes. For example, if your job is on machine A in minute i, and you want to switch to machine B, then your choice for minute i+1 must be move, and then your choice for minute i+2 can be B. The value of a plan is the total number of simulation steps that you manage to execute over the n minutes: so it's the sum of ai over all minutes in which the job is in A, plus the sum of b over all minutes in which the job is onB The Problem: Given values a,a an and b,b. .bn find a plan of maximum value. Note that your plan can start at either of the machines A and B in minute 1. Example: Suppose n 4, and the values of a, and bi are given by the following table. Minute 1 10 Minute 2 Minute 3 Minute 4 10 20 20 Then the plan of maximum value would be to choose A for minute 1 then move to minute 2, and then B for minute 3 and 4. The value of this plan would be 10+0+20+20 50 (a) [10 pts Letthe maximum value of any plan that ends at Machine A at the end of the k-th minute Similarly, letthe maximum value of any plan that ends at Machine A at the end of the k-th minute. Write recursive formulas for and (b) [10 pts] Write an algorithm, in pseudo code, that returns the value of the best plan that ends at the n-th minute. The input to your algorithm should be integer arrays a[ ] and bl1, where for eachi- 1ton, old a and

#### Similar Solved Questions

##### The graphs below show the force applied to a 250 g cart and the resulting motion....
The graphs below show the force applied to a 250 g cart and the resulting motion. a)How much work was done on the car? b)How much thermal energy was produced (i.e. how much energy was dissipated by friction) Forie v 1o is 2o 2s 3035...
Question 9 10 pts U.S. Corporate Tax Rate Schedule Taxable income (in $) Marginal Tax Rate 0 - 50,000 15% 50.000 - 75,000 25% 75,000 100.000 34% 100,000 335.000 39% 335.000 10,000,000 34% 10,000,000 15,000,000 35% 38% 15.000.000 - 18.333,333 35% 18 333,333 Based on the US. Corporate Tax Rate Schedul... 1 answer ##### Two cars are driving in the same direction from the same place. If one travels at 50 mph and the other at 58 mph, how long will it take them to be 40 miles apart? Two cars are driving in the same direction from the same place. If one travels at 50 mph and the other at 58 mph, how long will it take them to be 40 miles apart?... 1 answer ##### An investment earning simple interest rate of 1.10% per annum for a term of 5 years earned 82.50 in interest An investment earning simple interest rate of 1.10% per annum for a term of 5 years earned 82.50 in interest. What was the principal?... 1 answer ##### For the directed weighted graph given below find shortest distances and shortest paths from A to... For the directed weighted graph given below find shortest distances and shortest paths from A to all other vertices. Use the Dijkstra algorithm. Show the status of the array of distances after each iteration of the while loop. 2-1 C ) 泊 H e- 90油 2 2 22 (4-21由121回 G... 1 answer ##### Brief Exercise 17-03 The following T-account is a summary of the Cash account of Cuellar Company.... Brief Exercise 17-03 The following T-account is a summary of the Cash account of Cuellar Company. Cash (Summary Form) Balance, Jan. 1 7,000 Receipts from customers 368,600 Payments for goods Dividends on stock investments 5,400 Payments for operating expenses Proceeds from sale of equipment 36,000 I... 1 answer ##### 2 H2 + O2 → 2 H2O How many grams of H2O are produced from 284... 2 H2 + O2 → 2 H2O How many grams of H2O are produced from 284 grams of H2?... 1 answer ##### EXAM 3B 1. The Carnot heat engine receives 6500 kJ/h of heat from a boiler at... EXAM 3B 1. The Carnot heat engine receives 6500 kJ/h of heat from a boiler at 950 °C and rejects the waste heat to a well at 20°C. The produced power output of heat engine is fully used to operate the heat pump that draws the heat from the outdoor environment and transfers it to warm the hou... 1 answer ##### If an antigen mutates, will the same lymphocytes recognize it? Why or why not? 5. HIV... If an antigen mutates, will the same lymphocytes recognize it? Why or why not? 5. HIV (the virus that causes AIDS) specifically targets the helper T-lymphocytes, causing the destruction of these cells. Given the role of helper T-lymphocytes, why does this disease increase a person’s susceptibi... 1 answer ##### How many molecules of water are made from the reaction of 15 moles of HCl with... How many molecules of water are made from the reaction of 15 moles of HCl with excess oxygen? Given the reaction: 4 HCI + O2-2 H20 + 2Cl2 9.0 x 1025 6.2x 10-24 4.5 x 1024 5.0 x 10-23 3.6 x 1025 2.3x1024 1.8 x 1025... 1 answer ##### YIELD TO MATURITY A firm's bonds have a maturity of 14 years with a$1,000 face...
YIELD TO MATURITY A firm's bonds have a maturity of 14 years with a $1,000 face value, have an 11% semiannual coupon, are callable in 7 years at$1,224, and currently sell at a price of \$1,386. a. What is their nominal yield to maturity? Do not round intermediate calculations. Round your answer ...