# Warm starting a LP problem with PuLP and Gurobi

I have a set of many similar linear programs (LP). All these LPs have the same objective function, and almost all constraints are the same. The only difference is for one linear constraint $$f(x)=a_{i}$$, where $$a_{i}$$ is a constant that changes from one LP to the next. Instead of solving each LP from scratch, I am trying to use the information from the first LP problem to solve the other LPs more quickly.

Thanks to this conversation, I was told that this kind of change preserves dual feasibility, so I should apply the dual simplex method with a warm start from the previous optimal basis.

Based on this suggestion, I was trying to iteratively warm start LP number $$i$$ with the optimal solution from LP number $$(i-1)$$. Concretely, I was using the following steps using PuLP with Gurobi:

• Update the only constraint that changes in the LP: prob.constraints['cst_a'] += a[i-1] - a[i]
• Set the initial value to all LP variables: for t in ts: varProb[t].setInitialValue(optimalVarPreviousProb[t])
• Solve the new LP using warm start and dual simplex: prob.solve(pulp.GUROBI_CMD(logPath="LogFile.log", warmStart=True, options=[("method",1)]))

However, I was surprised to see that the total computation time did not decrease. If anything, it actually increased slightly (certainly due to the extra time to set initial values).

I compared the log files with and without warm starting the problem, and the number of dual simplex iterations for each LP is exactly the same. In other words, it looks like the warm starting did not do anything.

Actually, the log file does not seem to acknowledge any warm starting. But when I use warm start with MILP problems, the log file does acknowledge the use of a "User MIP start". Does that mean LP warm start does not work with PuLP and/or Gurobi?

Any other idea what I could be doing wrong?

• Update: I tried the same process using gurobipy instead of PuLP and the warm start does work! I only have to do cst_a.rhs = a[i] and model.update(). This is simpler because I do not even have to set the initial values, the gurobi model "remembers" the last solution. However, I would still be interested to know how to do it in PuLP Commented Dec 13, 2023 at 17:57
• Are you warm starting using a primal infeasible solution or a basis corresponding to the solution?
– Sune
Commented Dec 15, 2023 at 20:58
• The solution I am using for warm start was feasible (and optimal) in the previous LP but infeasible in the new LP. This is because it satisfied the previous equality constraint f(x) = a_(i-1) but it does not satisfy f(x)=a_i. But it has the same objective function so it is dual feasible in both LP. Commented Dec 16, 2023 at 21:10
• You also don't need your second bullet in pulp if you are calling the same model object. The values will be set to whatever the solved solution was in the prior iteration. This shows warmstart for CPLEX, but is an example of subtour elimination constraints using pulp, github.com/apwheele/PatrolRedistrict/blob/master/DataCreated/…. Commented Dec 17, 2023 at 16:48