Decision Optimization

Warmstarting in a moving horizon context with Cplex C API

By Michelle W. Ricks posted Fri July 10, 2020 07:35 AM

I have a MILP which I want to solve on a horizon T = {1,...,N}. Since the problem would be too large, I intend to solve it with a moving horizon approach. What I do is solve the MILP (lets call it P1) on the shorter horizon T1 = {1,...,k} of length k, k < N, then shift the horizon by l, l < k, and solve the MILP for T2 = {l,...,l+k} (P2), and so on until I reach the end of the horizon T. My total solution will then be fused together from all the subsolutions: Indices 1 to l would be from the solution P1, indices l+1 to 2l would be from P2 and so on.

Now to my problem: I would like to warmstart the next problem with the solution of the previous problem. Lets say I have the solution of P1. Since the horizons of P1 and P2 overlap on the indices l to k, I would like to take the solution of P1 and warmstart P2 on these indices. For example if the shift is only 1, then the overlap is very large and probably would give a huge improvement in computation time when warmstarting. What I did for now is write out the solution with CPXXsolwrite(). But how can I now use this to warmstart the next problem? Would I need to shift manually all the variables in that file? Or is there an easier way to do what I described above?
1 comment



Mon August 10, 2020 10:44 AM

It might be better to ask this question in the forum, because that is dedicated to discussions.

Anyway, the easiest way to solve this is to keep the variables from the previous iteration(s) but fix them to the solution in the second iteration. Then you can use CPXwritemipstarts() and CPXreadcopymipstarts() to write out the solutions and read them back as starting point.

Moreover, CPLEX automatically retains solutions as MIP starts. That is, if you only modify the problem (and do not recreate it), then CPLEX will automatically try to use every feasible solution from the previous run as MIP start for the next run.