- Exercise 18.2-3, page 363.

- Problem 18-2, page 376.

- In this question, we consider a problem in car ownership. As a car
gets older, the maintenance costs (fuel costs, repair costs, insurance
costs, etc) for the car may increase to the extent that it would be
advantageous to sell the current car and buy a new car. The difficulty in
this problem is that the prices of new cars change from year to year, the
maintenance costs of cars purchased in different years may be different and
the resale value of a car can change from year to year as well.
For this question, you are given the following information:

- p(i) = the price of a new car in year i, for 1 <= i <= n
- v(i,k) = the resale value of a car purchased in year i and sold in year k, for 1 <= i < k <= n+1.
- m(i,k) = the maintenance cost during year k of a car purchased in year i, for 1 <= i <= k <= n.

The problem is to determine the years y

_{1}, y_{2}, ..., y_{r}when you would purchase new cars such that the total cost of car ownership from years 1 through n is minimized. The total cost is the sum of the maintenance costs for years 1 through n plus the price of each car purchased minus the resale value of each car sold.For example, if n = 10, y

_{1}= 1, y_{2}= 5 and y_{3}= 7, then this solution states that you should purchase a new car in year 1, buy the second car in year 5 and buy the third car in year 7. (You would also sell the first car in year 5, the second car in year 7 and the third car at the beginning of year 11.) In addition, you should make the following assumptions.- You don't have a car before year 1. (Since you have to buy a new car
in year 1, y
_{1}= 1.) - There is only 1 type of car for sale each year.
- You are always able to sell your old car for v(i,k) dollars.
- At the end of n years, you sell your last car for v(y
_{r},n+1) dollars.

Describe in some detail a dynamic programming algorithm which finds the optimal solution to this problem. Be sure to include a description of the content and size of the memoization table. Analyze and justify the running time of your algorithm.

Last Modified: 29 Jan 2001 13:00:53 EST by

Richard Chang

Back up to Spring 2001 CMSC 641 Homepage