cvxgrp / scs

Splitting Conic Solver
MIT License
549 stars 135 forks source link

Save the result of each iteration for shutdown robustness #79

Open IgnacioRubioScola opened 7 years ago

IgnacioRubioScola commented 7 years ago

I'm solving pretty huge problems with CVXPY and SCS using the GPU (1-2M variables and about 2-3 days calculation on a GTX 970), i want to know if there exist any possibility to save the state after each iteration to resume the optimization in case of shutdown. Thank you in advance.

bodono commented 7 years ago

Right now there isn't really a good way to automatically checkpoint the state of the algorithm. Your best bet is to do something along the following lines:

  1. Get CVXPY to give you the canonical cone form of the problem, it has an api to do that: http://www.cvxpy.org/en/latest/tutorial/advanced/#getting-the-standard-form
  2. Call SCS from python directly with the standard form data with relatively small max_iters.
  3. SCS will return the 'best guess' after that many iterations (hopefully it will be feasible, if not you have to increase the number of max_iters), at which point you can save everything to disk.
  4. Feed back in the 'best guess' as a warm start using functionality here https://github.com/cvxgrp/scs/blob/master/python/scs.py#L28 (basically adding x,y,s as probdata), which should continue from where it left off.
  5. Do this a few times until convergence.
  6. At the end, invert the canonicalization via CVXPY.