Example 4 On a circular road, there are four middle schools arranged in sequence: $A_{1}, A_{2}, A_{3}, A_{4}$. They have 15, 8, 5, and 12 color TVs, respectively. To make the number of color TVs in each school the same, some schools are allowed to transfer color TVs to adjacent schools. How should the TVs be transferred to minimize the total number of TVs transferred? Find the minimum total number of TVs transferred.
Solution: Let $A_{1}$ high school transfer $x_{1}$ color TVs to $A_{2}$ high school (if $x_{1}$ is negative, it means $A_{2}$ high school transfers $r_{1}$ color TVs to $A_{1}$ high school. The same applies below), $A_{2}$ high school transfers $x_{2}$ color TVs to $A_{3}$ high school, $A_{3}$ high school transfers $x_{3}$ color TVs to $A_{4}$ high school, and $A_{4}$ high school transfers $x_{4}$ color TVs to $A_{1}$ high school. Since there are 40 color TVs in total, with an average of 10 per school, therefore,
$$
\begin{array}{c}
15-x_{1}+x_{4}=10,8-x_{2}+x_{1}=10, \\
5-x_{3}+x_{2}=10,12-x_{4}+x_{3}=10 . \\
\therefore x_{4}=x_{1}-5, x_{1}=x_{2}+2, x_{2}=x_{3}+5, \\
x_{3}=x_{4}-2, x_{3}=\left(x_{1}-5\right)-2=x_{1}-7, x_{2}= \\
\left(x_{1}-7\right)+5=x_{1}-2 .
\end{array}
$$

This problem requires finding the minimum value of $y=\left|x_{1}\right|+\left|x_{2}\right|+\left|x_{3}\right|+$ $\left|x_{4}\right|=\left|x_{1}\right|+|x_{1}-2|+| x_{1}-7 |+$ $\left|x_{1}-5\right|$. Here, $x_{1}$ is an integer satisfying $-8 \leqslant x_{1} \leqslant 15$.
Let $x_{i}=x$.
Consider the function defined on $-8 \quad 15$
$$
y=|x|+|x-2|+|x-7|+|x-5| \text {. }
$$
$|x|+|x-7|$ represents the sum of the distances from $x$ to 0 and 7. When $0 \leq x \leq 7$, $|x|+|x-7|$ takes the minimum value of 7; similarly, when $2 \leqslant x \leqslant 5$, $|x-2|+|x-5|$ takes the minimum value of 3.

Therefore, when $2 \leqslant x \leqslant 5$, $y$ takes the minimum value of 10. In other words, when $x_{1}=2,3,4,5$, $\left|x_{1}\right|+\left|x_{1}-2\right|+$ $\left|x_{1}-7\right|+\left|x_{1}-5\right|$ takes the minimum value of 10.

Thus, the minimum total number of color TVs to be transferred is 10, and the transfer schemes are as follows: