Project 5: Workload Cost Optimizer
Scientific Computing
Builds on these lessons
Current Task
Objective
minimize() works with any number of variables at once — x0 just needs one starting value per variable.
Task: minimize a two-variable workload cost function and print the rounded result.
index.py
from scipy.optimize import minimize
def workload_cost(hours):
return (hours[0] - 8) ** 2 + (hours[1] - 8) ** 2
result = minimize(workload_cost, x0=[0, 0])
print(result.x.round(2))
* Hint: Correct characters turn green, incorrect ones turn red.
Live Preview
🖼️
Verify your code to see the preview