Notice that Fred can always invest in 1-year deposits and get this money at the beginning of the next year for further investments. This means that all available money will always be invested and we do not bother about the rest.
Year 1: invest $ x_1 $ in 1-year deposit $ 4\% $, $ x_2 $ in 2-year $ 9\% $
- $ x_1 + x_2 \leq 5000 $ (= available money)
Year 2: invest $ x_3 $ in 1-year $ 4\% $, $ x_4 $ in 2-year $ 9\% $, $ x_5 $ in 3-year $ 15\% $
- $ x_3 + x_4 + x_5 \leq 1.04 \times x_1 $ (= available money)
Year 3: invest $ x_6 $ in 1-year $ 4\% $, $ x_7 $ in 2-year $ 9\% $, $ x_8 $ in 3-year $ 15\% $
- $ x_6 + x_7 + x_8 \leq 1.04 \times x_3 + 1.09 \times x_2 $ (= available money)
Year 4: invest $ x_9 $ in 1-year $ 4\% $, $ x_{10} $ in 2-year $ 9\% $
- $ x_9 + x_{10} \leq 1.04 \times x_6 + 1.09 \times x_4 $ (= available money)
Year 5: invest $ x_{11} $ in 1-year $ 4\% $
- $ x_{11} \leq 1.04 \times x_9 + 1.09 \times x_7 + 1.15 \times x_5 $ (= available money)
Year 6:
- available money = $ 1.04 \times x_{11} + 1.09 \times x_{10} + 1.15 \times x_8 $ = final cash = maximize !
So, if I did not make a mistake, there are 11 unknowns x1, ..., x11
for the individual investments, 5 linear inequalities (1) - (5), and one linear goal function (6) to be maximized. This linear programming problem can be solved by the simplex algorithm.
ADDED (based on Mike's comment): for completeness the 11 inequalities xi >= 0
for the unknowns should be added.
When solving problems of this sort it helps to systematically follow something like the following procedure.
1) Write down the variables that you want to solve for.
In this case, you want to find the amount of each loan that you want to take out. Let us let $L$ be the number of long term loans that you want, and $S_1$ to $S_5$ be the amount of each short term loan, $S_1$ the loan amount for July, to $S_5$ the loan amount for November. Each of these loan amounts must be greater than or equal to 0.
2) Write down the constraints (adding internal variables if necessary).
Here there is only one type of constraint -- at the beginning of each month, after cash on hand along with last months income and loans have been applied to last months bills and expiring loans.
We see that cash on hand at the beginning of each month is a probably best described as a variable (otherwise we would need to repeat computations in the constraints). So to simplify the constraints, let us add variables $C_1$ to $C_6$ denoting cash on hand at the beginning of August to January. These variables are constrained to be greater than or equal to 0. This makes the 6 constraints:
$$L + S_1 + 3000 - 6000 = C_1$$
$$C_1 + S_2 + 2000 - 6000 - 1.04 S_1 = C_2$$
$$C_2 + S_3 + 1000 - 4000 - 1.04 S_2 = C_3$$
$$C_3 + S_4 + 2000 - 2000 - 1.04 S_3 = C_4$$
$$C_4 + S_5 + 6000 - 1000 - 1.04 S_4 = C_5$$
$$C_5 + 10000 - 1000 - 1.04 S_5 - 1.1 L = C_6$$
3) Write down the objective.
Here this is just the amount of money left over at the beginning of January, and we want as much of it as possible, so the Objective is to maximize $C_6$.
4) Solve.
In answer to your extended question: I am not familiar with the software you are using, so I cannot explain its results. It does seem that the answers that you are getting are absurd. For a problem like this that you can solve without resorting to a linear program (once you have chosen the amount of the long term loan, everything else is determined), solve it. Then compare your solution with the output of the software.
Best Answer
Denote by
$m_i\ $ : Cash at the beginning of month $i$ before investment, but after bills
$n_i\ \ $ : Cash at the beginning of month $i$ after investment
$p_i$ : Revenue minus bills at beginning of month $i$
$a_i\,$ : 1-month investment at the beginning of month $i$
$b_i\ $ : 2-month investment at the beginning of month $i$
$c_i\,$ : 3-month investment at the beginning of month $i$
$d_i\,$ : 4-month investment at the beginning of month $i$
Then the $p_i$s are constants equal to
$p_1=400-600\\p_2=800-500\\p_3=300-500\\p_4=300-250\\p_5=0$
The $m$s and $n$s are not choices, so each of them implies an equality constraint in addition to the non-negativity:
$m_1=400+p_1\\m_2=n_1+p_2+1.001 a_1\\m_3=n_2+p_3+1.001 a_2+1.005 b_1\\m_4=n_3+p_4+1.001 a_3+1.005 b_2+1.01 c_1\\m_5=n_4+p_5+1.001 a_4+1.005 b_3+1.01 c_2+1.02 d_1$
$n_1=m_1-a_1-b_1-c_1-d_1\\n_2=m_2-a_2-b_2-c_2\\n_3=m_3-a_3-b_3\\n_4=m_4-a_4$
$m_1\geq 0,m_2\geq 0,m_3\geq 0,m_4\geq 0,m_5\geq 0,n_1\geq 0,n_2\geq 0,n_3\geq 0,n_4\geq 0$
The $a,b,c,d$s are choices and don't even need non-negativity constraints.
The variables are
$m_1,m_2,m_3,m_4,m_5,n_1,n_2,n_3,n_4,a_1,a_2,a_3,a_4,b_1,b_2,b_3,c_1,c_2,d_1$
And the utility function is
$z = m_5$