You might have heard the phrase that working 2 hours at 100% utilization is equivalent to working 4 hours at 50% utilization. This is usually a simplification made to illustrate a point, not necessarily a reality. Someone who is working at 100% utilization, may still experience a bottleneck that forces them to work at reduced capacity. Which means that worker utilization and the capacity to do more in a unit of time go together.

We know that productivity is determined as the ratio betwen worker output to worker input. But assume that we know only the hours worked, the worker utilization and the available capacity. How could we describe productivity in this case?

We know that by keeping all other variables constant, more work hours is connected to higher overall productivity. The same is valid for utilization and capacity if we look at them separately. Higher capacity means that a programmer has to wait less on program compilation, while having more time to write code that adds value. Then the produced value would be a combination of these three factors: work hours during which the performance can be sustained, utilization (percentage of resources in use) and available capacity (scalability potential).

But we also know that working longer hours, despite bringing productivity gains also comes with certain costs (of foregone opportunities). By estimating a monthly salary in the best case, the number of workdays in the month and the hours worked each day, it is easy to estimate the cost of working one additional hour. Then the question becomes whether the gain in productivity we realize by increasing utilization (working with higher conventration or speed) and/or capacity (working after infrastructure improvements), when converted to a monetary value can offset at least 3/4 of our hourly cost of work. We have to understand whether these hours, utilization and capacity lead to a positive effect.

Here is sample code, which plots productivity against cost of work.

```
import numpy as np
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(7.4, 5.55))
ax.set_title('Productivity vs. cost of work', fontsize=14)
# hours worked, utilization (%), estimated capacity
productivity = np.array([
[2, 95, 0.25],
#[2, 95, 1],
[5, 40, 1],
[4, 60, 0.4],
[3.8, 65, 0.6],
#[3.8, 65, 1],
[4.5, 85, 0.45],
[6, 45, 0.6],
#[8, 100, 1]
])
p = productivity.copy()
workday_hours = 8
workdays_in_month = 22
monthly_salary = 3000
monthly_salary_best_opportunity = 4000
p[:,0] = p[:,0] / workday_hours
p[:,1] /= 100 # in [0, 1]
factors_product = np.prod(p, axis=1)
value_of_time_per_hour = monthly_salary_best_opportunity / (workdays_in_month * workday_hours)
productivity_costs = productivity[:,0] * value_of_time_per_hour
max_productivity_cost = workday_hours * value_of_time_per_hour
for idx, (cost, produced_value) in enumerate(zip(productivity_costs, factors_product)):
cost_ratio = cost/max_productivity_cost
plt.plot(produced_value, cost_ratio, '.', markersize=12)
plt.annotate(list(productivity[idx]), xy=(produced_value, cost_ratio), xytext=(produced_value+0.01, cost_ratio - 0.01), fontsize=8)
print("Cost of work: %.4f, Produced value: %.4f" % (cost_ratio, produced_value))
plt.plot([0,1],[0,1],'--',lw=0.5, color='grey')
ax.set_xlabel('productivity', fontsize=12)
ax.set_ylabel('cost of work (longer hours → higher cost)', fontsize=12)
ax.set_xlim(0,1)
ax.set_ylim(0,1)
plt.text(0.32 ,0.04, '[work hours, utilization (%), capacity]', fontsize=9, color='grey')
plt.tight_layout()
plt.show()
print('Best productivity result: %s' % (productivity[np.argmax(factors_product)]))
"""
Cost of work: 0.2500, Produced value: 0.0594
Cost of work: 0.6250, Produced value: 0.2500
Cost of work: 0.5000, Produced value: 0.1200
Cost of work: 0.4750, Produced value: 0.1852
Cost of work: 0.5625, Produced value: 0.2152
Cost of work: 0.7500, Produced value: 0.2025
Best productivity result: [ 5. 40. 1.]
"""
```

We see that the best productivity is estimated to be when the worker invested 5 hours of time at 40% utilization and 1 available capacity. This corresponds to the second case with the highest produced value. If we plot the produced values against the costs of work, we see:

We have drawn the diagonal line to indicate that an optimal case would be located at the upper right—8 hours of uninterrupted work at 100% utilization and unit/maximal capacity. In all the cases we have, we see opportunity for plenty of improvement. We have identified that the orange point refers to the operation with the best productivity, but we also see that the cost of work is significantly higher compared to the case where the worker was busy for only two hours (blue point on the lower left). Perhaps this worker is highly capable, but unwilling to put effort into projects with high likelihood of failure. Additionally, the worker seems to be unlucky, having to operate under very low capacity.

The obvious question: What could be done to improve the worker productivity in each case? Lets say the most productive worker ([5, 40, 1]) decides to put in the maximal number of hours, which adds some fatigue and further decreases its utilization to 35% ([8, 35, 1]). Capacity cannot be touched, since this worker was quick to upgrade it to its maximum to gain early advantage. At the same time, the least productive worker, who was busy for only 2 hours, receives the opportunity to upgrade the available capacity to 0.8. Still not perfect, but this step motivates him/her to work 2 more hours to get more done ([4, 95, 0.8]). Now, observe what happens:

While the first worker increased its productivity, this was to a much lesser extent than the second worker. In fact, the second worker now has even higher productivity (0.38 vs. 0.35) and has to work only half as many hours (leading to half the cost of work). This suggests that sometimes greater productivity gains may be possible to be realized through the support of people lacking capacity rather than by encouraging indifferent workers to try harder/put in more hours.