From de22ba80a46183b9f6f0214443e2b98d927d172e Mon Sep 17 00:00:00 2001 From: Hassan Date: Wed, 27 Nov 2024 15:47:33 -0700 Subject: [PATCH] Set PStart on branch switching variables (#163) * Setting PStart on branch switching variables * Use a more pythonic pattern --------- Co-authored-by: Simon Bowly --- src/gurobi_optimods/opf/grbformulator.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gurobi_optimods/opf/grbformulator.py b/src/gurobi_optimods/opf/grbformulator.py index 556881ba..3bed7673 100644 --- a/src/gurobi_optimods/opf/grbformulator.py +++ b/src/gurobi_optimods/opf/grbformulator.py @@ -108,6 +108,9 @@ def lpformulator_optimize(alldata, model, opftype): for j in range(1, 1 + numbuses): bus = buses[j] evar[bus].PStart = 1.0 + if alldata["branchswitching_mip"]: + for zvar in alldata["MIP"]["zvar"].values(): + zvar.PStart = 1.0 model.update() model.optimize()