<p>Suppose the probability of an error in the <span class="math-container">$n$</span>th cycle since the most recent maintenance is
<span class="math-container">$a+bn$</span>, and let the number of tasks (cycles) between maintenance be <span class="math-container">$x$</span>. I'm assuming here that the tasks can be treated as discrete.</p>
<p>The way I would approach the optimization is to calculate both the total maintenance cost and the expected total error cost over some fairly large number of cycles - say 1,000.  What number is chosen here is arbitrary, but I find it more intuitive to think of total costs in that context than averages per cycle, although each should lead to the same result.</p>
<p>Total maintenance costs are:</p>
<p><span class="math-container">$$\frac{1000}{x}\times 1000=\frac{1000000}{x}$$</span></p>
<p>Expected error costs between two successive maintenance events, using the triangle number formula to sum the <span class="math-container">$b$</span>'s, are:</p>
<p><span class="math-container">$$\sum_{n=1}^x 15(a+bn)=15\Big(ax+b\Big(\frac{x(x+1)}{2}\Big)\Big)$$</span></p>
<p>Hence total expected error costs are:</p>
<p><span class="math-container">$$\frac{1000}{x}\times 15\Big(ax+b\Big(\frac{x(x+1)}{2}\Big)\Big)=15000\Big(a+\Big(b\frac{x+1}{2}\Big)\Big)$$</span></p>
<p>Total costs <span class="math-container">$TC$</span> (including both maintenance and expected error costs) are therefore:</p>
<p><span class="math-container">$$TC = \frac{1000000}{x} + 15000\Big(a+\Big(b\frac{x+1}{2}\Big)\Big)$$</span></p>
<p>Setting the first derivative equal to zero to find the minimum:</p>
<p><span class="math-container">$$\frac{dTC}{dx}=\frac{-1000000}{x^2}+15000\Big(\frac{b}{2}\Big)=0$$</span></p>
<p><span class="math-container">$$-2000000+15000bx^2=0$$</span></p>
<p><span class="math-container">$$-400+3bx^2=0$$</span></p>
<p><span class="math-container">$$x=\sqrt{\frac{400}{3b}}$$</span></p>
<p>To confirm this is a minimum:</p>
<p><span class="math-container">$$\frac{d^2TC}{dx^2}=\frac{2000000}{x^3}&gt;0$$</span></p>
<p>Putting (as approximately suggested by the chart) <span class="math-container">$a=0.18, b=0.001$</span>, this yields:</p>
<p><span class="math-container">$$x=\sqrt{\frac{400}{0.003}}\approx365$$</span></p>
<p>Note that in this case <span class="math-container">$a+bx=0.18+(0.001\times365)=0.545 &lt; 1$</span>.  The formula would need modifying should the values imply a probability of error exceeding 1 before reaching the next maintenance event.</p>
<p><em>Addendum 3/11/2020</em></p>
<p>In response to your comment re integration, if the tasks are taken to be discrete then integration does not give an exactly correct formula for the total expected error costs.  The integral needed is:</p>
<p><span class="math-container">$$\int_0^x 15(a+bn)dn=15\Big(ax+\frac{bx^2}{2}\Big)$$</span></p>
<p>This has <span class="math-container">$x^2$</span> where the calculation above has <span class="math-container">$x(x+1)$</span>.  However, this difference vanishes on differentiating TC since:</p>
<p><span class="math-container">$$\frac{d(bx)}{dx}=\frac{d(b(x+1))}{dx}=b$$</span></p>
<p>Thus this approach leads to the same optimum value for <span class="math-container">$x$</span>.</p>

CC BY-SA 4.0
2020-11-03T07:19:41.053Z
Thank you for the fast response. I have a question regarding the summation. Why dont just integrate the linear function: a + bx --> 0.5 b x² + ax +c
user31069
CC BY-SA 4.0
2020-11-03T13:08:43.007Z
@user31069 I have added to my answer to address this point.
Adam Bailey
CC BY-SA 4.0
2020-11-02T23:26:13.070Z
2020-11-03T13:08:00.553Z
2020-11-03T13:08:00.553Z
Adam Bailey
<p>I have a question regarding a cost calculation problem:</p>
<p>I have the following curve, which shows, that with increasing number of tasks without maintaining a machine, the error probability for the produced parts increases.</p>
<p><a href="https://i.sstatic.net/FsBkJ.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/FsBkJ.png" alt="enter image description here" /></a></p>
<p>The x-Axis represents the counter of tasks without maintaining the machine. This means the point (10;0.2) says: When the machine wasn’t maintained the last 10 cycles, the error rate is 20%.</p>
<p>Maintaining the machine costs, let’s say 1000 € and one error 15 €. Now I need to find out the perfect maintaining counter, when to maintain the machine.</p>
<p>I thought about multiplying the curve with 15€ and then integrating the function, to take into account the already increased probability of the previous cycles at a specific count. However, I am not sure about this integration step.</p>
<p>Maybe anyone else has any idea how to handle this problem.</p>

CC BY-SA 4.0
2020-11-02T13:04:16.077Z
Interesting question, but could you clarify "error".  I can think of two interpretations: a) if an error occurs in a cycle, the machine continues to perform in subsequent cycles, subject to the error rate defined by the chart; b) if an error occurs in a cycle, the machine fails in all subsequent cycles until maintenance is carried out.  I think you probably mean (a), but it would be helpful to be sure.
Adam Bailey
CC BY-SA 4.0
2020-11-02T13:10:49.693Z
Ah i am sorry. With an error i mean that the machine creates a workpiece which is faulty. The machine still continues, the workpiece just has an error.
user31069
CC BY-SA 4.0
2020-11-02T16:31:55.397Z
Is number of tasks a continuous variable or discrete?
Dayne
CC BY-SA 4.0
2020-11-02T16:33:56.857Z
Also please add a self study tag if this is homework.
Dayne
<mathematical-economics><self-study>
How to calculate the ideal maintaining time of a machine?
user31069
# How to calculate the ideal maintaining time of a machine?

(Asked by: username_0 on 2020-11-02)

I have a question regarding a cost calculation problem:

I have the following curve, which shows, that with increasing number of tasks without maintaining a machine, the error probability for the produced parts increases.

[![enter image description here](https://i.sstatic.net/FsBkJ.png)](https://i.sstatic.net/FsBkJ.png)

The x-Axis represents the counter of tasks without maintaining the machine. This means the point (10;0.2) says: When the machine wasn’t maintained the last 10 cycles, the error rate is 20%.

Maintaining the machine costs, let’s say 1000 € and one error 15 €. Now I need to find out the perfect maintaining counter, when to maintain the machine.

I thought about multiplying the curve with 15€ and then integrating the function, to take into account the already increased probability of the previous cycles at a specific count. However, I am not sure about this integration step.

Maybe anyone else has any idea how to handle this problem.

**Tags:** mathematical-economics, self-study
> **Comments:**
> **username_1**: Interesting question, but could you clarify "error".  I can think of two interpretations: a) if an error occurs in a cycle, the machine continues to perform in subsequent cycles, subject to the error rate defined by the chart; b) if an error occurs in a cycle, the machine fails in all subsequent cycles until maintenance is carried out.  I think you probably mean (a), but it would be helpful to be sure.  
> **username_0**: Ah i am sorry. With an error i mean that the machine creates a workpiece which is faulty. The machine still continues, the workpiece just has an error.  
> **username_2**: Is number of tasks a continuous variable or discrete?  
> **username_2**: Also please add a self study tag if this is homework.  

---

## 1 answers

### Answer by username_1 on 2020-11-02. Score: 2 | Accepted answer

Suppose the probability of an error in the $n$th cycle since the most recent maintenance is
$a+bn$, and let the number of tasks (cycles) between maintenance be $x$. I'm assuming here that the tasks can be treated as discrete.

The way I would approach the optimization is to calculate both the total maintenance cost and the expected total error cost over some fairly large number of cycles - say 1,000. What number is chosen here is arbitrary, but I find it more intuitive to think of total costs in that context than averages per cycle, although each should lead to the same result.

Total maintenance costs are:

$$\frac{1000}{x}\times 1000=\frac{1000000}{x}$$

Expected error costs between two successive maintenance events, using the triangle number formula to sum the $b$'s, are:

$$\sum\_{n=1}^x 15(a+bn)=15\Big(ax+b\Big(\frac{x(x+1)}{2}\Big)\Big)$$

Hence total expected error costs are:

$$\frac{1000}{x}\times 15\Big(ax+b\Big(\frac{x(x+1)}{2}\Big)\Big)=15000\Big(a+\Big(b\frac{x+1}{2}\Big)\Big)$$

Total costs $TC$ (including both maintenance and expected error costs) are therefore:

$$TC = \frac{1000000}{x} + 15000\Big(a+\Big(b\frac{x+1}{2}\Big)\Big)$$

Setting the first derivative equal to zero to find the minimum:

$$\frac{dTC}{dx}=\frac{-1000000}{x^2}+15000\Big(\frac{b}{2}\Big)=0$$

$$-2000000+15000bx^2=0$$

$$-400+3bx^2=0$$

$$x=\sqrt{\frac{400}{3b}}$$

To confirm this is a minimum:

$$\frac{d^2TC}{dx^2}=\frac{2000000}{x^3}>0$$

Putting (as approximately suggested by the chart) $a=0.18, b=0.001$, this yields:

$$x=\sqrt{\frac{400}{0.003}}\approx365$$

Note that in this case $a+bx=0.18+(0.001\times365)=0.545 < 1$. The formula would need modifying should the values imply a probability of error exceeding 1 before reaching the next maintenance event.

*Addendum 3/11/2020*

In response to your comment re integration, if the tasks are taken to be discrete then integration does not give an exactly correct formula for the total expected error costs. The integral needed is:

$$\int\_0^x 15(a+bn)dn=15\Big(ax+\frac{bx^2}{2}\Big)$$

This has $x^2$ where the calculation above has $x(x+1)$. However, this difference vanishes on differentiating TC since:

$$\frac{d(bx)}{dx}=\frac{d(b(x+1))}{dx}=b$$

Thus this approach leads to the same optimum value for $x$.

> **Comments:**
> **username_0**: Thank you for the fast response. I have a question regarding the summation. Why dont just integrate the linear function: a + bx --> 0.5 b x² + ax +c  
> **username_1**: @user31069 I have added to my answer to address this point.  

---

