Project 27: Task Scheduling Optimizer
Scientific Computing
Current Task
Objective
Review day: reuse minimize — day 5 — with more variables to schedule several tasks at once.
Task: minimize a 3-variable scheduling cost function and print the rounded result.
index.py
from scipy.optimize import minimize
def schedule_cost(hours):
return sum((h - 2) ** 2 for h in hours)
result = minimize(schedule_cost, x0=[0, 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