fixed ranking algo for unfunded

This commit is contained in:
Khalim Conn-Kowlessar 2025-10-28 13:43:10 +00:00
parent 93723697a1
commit 504a714fc6

View file

@ -959,15 +959,19 @@ async def model_engine(body: PlanTriggerRequest):
) )
# Given the solutions we select the optimal one # Given the solutions we select the optimal one
# 1) If the scheme is ECO4, the full project funding and uplift are deducted from the cost
# 2) If the sheme is GBIS, the partial project funding and uplift are deducted from the cost
# 3) Otherwise, no funding is deducted from the cost
solutions["cost_less_full_project_funding"] = np.where( solutions["cost_less_full_project_funding"] = np.where(
solutions["scheme"] == "eco4", solutions["scheme"] == "none",
solutions["total_cost"] - solutions["full_project_funding"] - solutions["total_uplift"], solutions["total_cost"],
solutions["total_cost"] - solutions["partial_project_funding"] - solutions["total_uplift"] np.where(
solutions["scheme"] == "eco4",
solutions["total_cost"] - solutions["full_project_funding"] - solutions["total_uplift"],
solutions["total_cost"] - solutions["partial_project_funding"] - solutions["total_uplift"]
)
) )
solutions["cost_less_full_project_funding"] = (
solutions["total_cost"] - solutions["full_project_funding"] - solutions["total_uplift"]
)
solutions = solutions.sort_values("cost_less_full_project_funding", ascending=True) solutions = solutions.sort_values("cost_less_full_project_funding", ascending=True)
if solutions["meets_upgrade_target"].any(): if solutions["meets_upgrade_target"].any():