Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding reset after pre-lp warmstart loop #236

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions egret/models/unit_commitment.py
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,11 @@ def _lazy_ptdf_termination_cleanup(m, md, time_periods, solver, ptdf_options, pr
if persistent_solver:
lpu._load_pf_slacks(solver, m, t_subset)
_lazy_ptdf_warmstart_copy_violations(m, md, time_periods, solver, ptdf_options, prepend_str)
# After adding so many constraints,
# the warmstart basis is typically
# worse than useless. If the solver
# implements it, reset the solver.
solver.reset()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't this cause an error for anything other than the gurobi persistent interface?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought so for the longest time as well, but this is actually a method on the OptSolver base class:
https://github.com/Pyomo/pyomo/blob/5.7.1/pyomo/opt/base/solvers.py#L752-L756

It would be better if the other persistent solvers implemented this method, but obviously that needs to be updated in Pyomo. In any case, it doesn't seem to do any harm on solvers that aren't gurobi persistent.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually did not know that existed, haha!

results = _lazy_ptdf_solve(m, solver, persistent_solver, symbolic_solver_labels, solver_tee, vars_to_load, solve_method_options)
if persistent_solver and duals and (results is not None) and (vars_to_load is None):
solver.load_duals()
Expand Down