The following model gives the purchasing temporal sequence for truck so that the cash flow is optimal within the planning horizon of 17 years. The model requires $68$ Boolean variables ($68=17 \cdot 4$) and $17$ integers variables (1 integer variable for each year). Every year will be designate by means of a pedice $k=1, 2, \cdots, m=17$.
For each year the possible choices are basically two:
“sell” or “buy” the truck in the k-th year
By the contest, there are four kind of available plans:
1-st plan: keep the truck $2$ years, $t_1=2$;
2-nd plan: keep the truck $3$ years, $t_2=3$;
3-rd plan: keep the truck $4$ years, $t_3=4$;
4-rd plan: keep the truck $5$ years, $t_4=5$.
We designate by means of a pedice $j=1, 2, \cdots , 4$ the kind of adopted plan for each year. As a consequence, we need $17 \cdot 4 = 68 $ variables in order to define all possible decisions. Let introduce the Boolean variable $x_{k,j}$:
- $x_{k,j}=1$ if in k-th year I decide to keep the truck as many years as specified by the j-th plan
- $x_{k,j}=0$ if in k-th year I decide to not keep the truck as many years as specified by the j-th plan.
For example, the sequence $ x_{1,3}= x_{2,3}= \cdots = x_{k-1,3}= x_{k+1,3}= \cdots = 0 $ and $ x_{k,3}=1$ is suitable to describe the choice of buying the truck in year k and keeping it 3 years.
Unitary Time Period
The planning horizon $T$ is divided into a finite set of $m$ instants: $t_{k+1}= t_k + \Delta h_k$ where $ K=0,1, \cdots, m-1$. The discretization step will be chosen constant and with an extent of 1 year: $ \Delta h_k = \Delta h = 1$ year. In this way, $T= \Delta t_1 + \cdots + \Delta t_m = m \cdot \Delta h $ and in our case study we have $m=17$ with $t_0=0$.
Temporal Constraints
We introduce $m=17$ equations and variables $A_k$ that track in each year how long the truck will be kept for the future years.
$ A_1 = \sum_{j=1}^{4} x_{1,j} \cdot t_j $
$ A_2 = A_1 - 1 + \sum_{j=1}^{4} x_{2,j} \cdot t_j $
$ \vdots $
$ A_m = A_{m-1} - 1 + \sum_{j=1}^{4} x_{m,j} \cdot t_j $
For example, in the first year if we decide to buy the truck and to keep it for three years (2nd plan), it results: $ A_1 = \sum_{j=1}^{4} x_{1,j} \cdot t_j = t_2 = 3$ because $ x_{1,2}=1$ and $ x_{1,1}=x_{1,3}= x_{1,4}= 0 $.
In order to impose that in every year there is a truck in service, we add further $m$ constraints:
$ A_k \geq 1 \quad \forall k=1,\ldots,m $.
Finally, the constraint $ \sum_{k=1}^{17} \sum_{j=1}^{4} x_{k,j} \cdot t_j \leq 17 $ makes sure that all investment choices are made within the fixed planning horizon $T$ and generate cash flows with maturity no later than horizon planning $T=17$.
In order to avoid the unacceptable situation of buying a truck when the plan of the previous truck has not yet come to an end, we introduce $m-1$ additional constraints as follows:
$\left\{ \begin{array}{l}
\sum_{j=1}^{4} x_{1,j} \cdot t_j \leq (1 - \sum_{j=1}^{4} x_{2,j} ) \cdot M +1 \\
A_{1} -1 + \sum_{j=1}^{4} x_{2,j} \cdot t_j \leq (1 - \sum_{j=1}^{4} x_{3,j} ) \cdot M +1 \\
\vdots \\
A_{m-2} -1 + \sum_{j=1}^{4} x_{m-1,j} \cdot t_j \leq (1 - \sum_{j=1}^{4} x_{m,j} ) \cdot M +1 \\
\end{array} \right. $
where $M > \max_j t_j $
Whenever $ A_{k-1} = A_{k-2} -1 + \sum_{j=1}^{4} x_{k-1,j} \cdot t_j \geq 2 $ we have
$(1 - \sum_{j=1}^{4} x_{k,j} ) \cdot M +1 = M+1 $, so it implicitly requires that in the following period $ \sum_{j=1}^{4} x_{k,j} = 0 $ for every $j$. On the other hand, suppose at time $k$ we buy a truck with regards to $\tilde j$ plan earlier than expected, that is when being $ A_{k-2} \geq 2$ then $ A_{k-2} -1 + t_{\tilde j} \leq 1 $ holds. This last inequality is not possible if $ A_{k-2} \geq 2$. As a result, it is not possible to buy a truck before sell the previous one. Of course, it is possible buy a truck in $k-1$ period if $ A_{k-2} =1 $.
Objective Function
$ \max (revenue - cost) = \max (revenue) + \max (-cost) = \max (revenue) - \min (cost) $
revenue $=\sum_{k=1}^{17} r_k ( \sum_{j=1}^{4} x_{k,j})$
cost $=\sum_{k=1}^{17} c_k ( \sum_{j=1}^{4} x_{k,j})$
where $ r_k $ and $ c_k $ for $k=1, \cdots, 17$ play the role of coefficients. These coefficients can be easily calculated as:
- $r_k= 45000 \cdot (1-0.10) \cdot (1-0.07)^{k-1}$
- $c_k= 45000 \cdot (1+0.05)^{k-1}$