One of the challenges I face in our program is managing my energy levels throughout the entire program and balancing that with the various side projects I continually explore. At first glance, it might seem as though I have a fixed amount of energy, and whenever I add a new side project, each project receives less energy since the total energy is divided among the projects. If this were the case, the solution would be straightforward: divide my energy among fewer projects.
However, my cognitive style is not typical, and engaging in multiple new projects creates more energy for me. Focusing on just one project at a time causes my energy levels to decrease. This results in a more complex optimization challenge, where I need to find the right balance of projects to be involved in to maximize my energy levels.
Influenced by our program, I will approach this question as an optimization problem and attempt to simulate it using Python.
Mathematical modeling
This article investigates the relationship between an individual’s energy level and the number of projects they undertake, considering the context-switching cost and similarity between projects. We propose a mathematical model to determine the optimal balance between the number of projects and energy conservation.
Let us define the following variables:
T: Total time available
E: Total energy available
M: Total motivation available
P: Number of projects
A: Daily fixed energy
B: Level of excitement due to new projects
C: Cost of context switching
Y: Number of context switches
H: Number of days from the last day off
S: Similarity between projects (0 < S< 1)
(1)
We aim to maximize the individual’s energy level by finding the optimal balance between the number of projects and the cost of context switching. To do this, we introduce a new objective function:
(2)
We now incorporate the similarity factor S to account for the potential reduction in context switching cost when projects are more similar. We modify Equation (1) as follows:
(3)
To find the optimal number of projects and similarity factor that maximizes the individual’s energy level, we can solve the following optimization problem:
(4)
By solving this optimization problem, we can determine the optimal balance between the number of projects and the similarity factor that allows the individual to maintain the highest energy level while minimizing the cost of context switching.1
Conclusion
Maximizing energy levels does not automatically translate to completing the maximum number of projects within a given time.
Our simulations2 have demonstrated that the optimal strategy for maximizing the number of finished projects is to focus on one project at a time. This approach differs from the one used to maximize energy levels over a long period for maximum personal development. Ultimately, the choice depends on your priorities: focusing on a single project for a higher completion rate or maintaining a high energy level through multiple projects for your growth. What is your choice?
import pandas as pd
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
# Define the energy function
def energy(P, Y, S, A, B, C, H):
return A / (C * H) + B * P - C * Y * (1 - S)
# Constants
A = 100 # Daily fixed energy
B = 10 # Level of excitement due to new projects
C = 5 # Cost of context switching
H = 7 # Number of days from the last day off
# Generate data
data = []
for P in range(0, 11): # Number of projects from 0 to 10
for Y in range(0, 11): # Number of context switches from 0 to 10
for S in np.linspace(0, 1, 11): # Similarity factor from 0 to 1 in increments of 0.1
E = energy(P, Y, S, A, B, C, H)
data.append([P, Y, S, E])
# Create a DataFrame and pivot table
df = pd.DataFrame(data, columns=["Projects", "Context Switches", "Similarity", "Energy"])
pivot_table = df.pivot_table(values="Energy", index=["Projects", "Context Switches"], columns="Similarity")
print("Pivot Table:")
print(pivot_table)
# 3D Visualization
fig = plt.figure(figsize=(10, 8))
ax = fig.add_subplot(111, projection="3d")
x = df["Projects"]
y = df["Context Switches"]
z = df["Similarity"]
c = df["Energy"]
img = ax.scatter(x, y, z, c=c, cmap="viridis")
ax.set_xlabel("Projects")
ax.set_ylabel("Context Switches")
ax.set_zlabel("Similarity")
ax.set_title("Energy Optimization")
fig.colorbar(img, ax=ax, label="Energy")
plt.show()
from scipy.optimize import minimize
# Define the objective function (number of finished projects)
def finished_projects(x, A, B, C, H, min_energy_per_project):
P, Y, S = x
E = A / (C * H) + B * P - C * Y * (1 - S)
return -P if E >= P * min_energy_per_project else np.inf
# Constants
A = 100 # Daily fixed energy
B = 10 # Level of excitement due to new projects
C = 5 # Cost of context switching
H = 7 # Number of days from the last day off
min_energy_per_project = 20
# Initial guess
x0 = np.array([1, 1, 0.5])
# Define constraints
cons = (
{"type": "ineq", "fun": lambda x: x[0]}, # P >= 0
{"type": "ineq", "fun": lambda x: x[1]}, # Y >= 0
{"type": "ineq", "fun": lambda x: x[2]}, # S >= 0
{"type": "ineq", "fun": lambda x: 1 - x[2]}, # S <= 1
)
# Optimize
result = minimize(finished_projects, x0, args=(A, B, C, H, min_energy_per_project), constraints=cons)
# Display results
optimal_P, optimal_Y, optimal_S = result.x
print(f"Optimal number of projects (P): {optimal_P}")
print(f"Optimal number of context switches (Y): {optimal_Y}")
print(f"Optimal similarity factor (S): {optimal_S}")
# Find the maximum number of finished projects point
max_finished_projects_point = df.loc[(df["Projects"] == optimal_P) & (df["Context Switches"] == optimal_Y) & (df["Similarity"] == optimal_S)].iloc[0]
# 3D Visualization
fig = plt.figure(figsize=(10, 8))
ax = fig.add_subplot(111, projection="3d")
x = df["Projects"]
y = df["Context Switches"]
z = df["Similarity"]
c = df["Energy"]
img = ax.scatter(x, y, z, c=c, cmap="viridis")
# Add the maximum number of finished projects point
ax.scatter(max_finished_projects_point["Projects"], max_finished_projects_point["Context Switches"], max_finished_projects_point["Similarity"],
c="red", marker="*", s=200, label="Max Finished Projects")
ax.set_xlabel("Projects")
ax.set_ylabel("Context Switches")
ax.set_zlabel("Similarity")
ax.set_title("Finished Projects Optimization")
fig.colorbar(img, ax=ax, label="Energy")
ax.legend()
plt.show()