Suppose you're consulting for a company that manufactures PC equipment and ships it to distributors all over the country. For each of the next n weeks, they have a projected supply si of equipment (measured in pounds), which has to be shipped by an air freight carrier.
Each week's supply can be carried by one of two air freight companies, A or B.
• Company A charges a fixed rate r per pound (so it costs r • si to ship a week's supply si). • Company B makes contracts for a fixed amount c per week, independent of the weight. However, contracts with company B must be made in blocks of four consecutive weeks at a time.
A schedule, for the PC company, is a choice of air freight company (A or B) for each of the n weeks, with the restriction that company B, whenever it is chosen, must be chosen for blocks of four contiguous weeks at a time. The cost of the schedule is the total amount paid to company A and B, according to the description above.
Give a polynomial-time algorithm that takes a sequence of supply values s1, s2, … ,sn and returns a schedule of minimum cost.
Example. Suppose r = 1, c = 10, and the sequence of values is
11 , 9 , 9 , 12 , 12 , 12 , 12 , 9 , 9 , 11.
Then the optimal schedule would be to choose company A for the first three weeks, then company B for a block of four consecutive weeks, and then company A for the final three weeks.
12. Suppose we want to replicate a file over a collection of n servers, labeled s1, s2,…, Sn. To place a copy of the file at server St results in a placement cost of ci, for an integerci > 0.
Now, if a user requests the file from server Si, and no copy of the file is present at Si, then the servers Si+1, Si+2, Si+3 … are searched in order until a copy of the file is finally found, say at server Sj, where j > i. This results in an access cost of j – i. (Note that the lower-indexed servers S–1, Si—2,... are not consulted in this search.) The access cost is 0 if Si holds a copy of the file. We will require that a copy of the file be placed at server Sn, so that all such searches will terminate, at the latest, at Sn.
We'd like to place copies of the files at the servers so as to minimize the sum of placement and access costs. Formally, we say that a configuration is a choice, for each server St with i = 1, 2, n – 1, of whether to place a copy of the file at St or not. (Recall that a copy is always placed at Sn.) The total cost of a configuration is the sum of all placement costs for servers with a copy of the file, plus the sum of all access costs associated with all n servers.
Give a polynomial-time algorithm to find a configuration of minimum total cost.
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.