Add Realtime Optimization Algorithms (for now just MPC) - #87
Conversation
|
nurkanovic
left a comment
There was a problem hiding this comment.
Great work overall, MPC runs on my machine.
Some small typos to be fixed, some clarifications for warm start, cvx, and MPEC Lagrangians needed.
| self.__warmstart_ocp() | ||
| self._prediction(**kwargs) | ||
| self.ocp_solver.solve() | ||
| elif self.rt_opts.prepare_step == PreparationStep.SQPCC: |
There was a problem hiding this comment.
is there a shift warm start possible/happening here since self.__warmstart_ocp() is not called ?
There was a problem hiding this comment.
In the SQPCC step we aren't warmstarting because I haven't implemented yet a QPCC warmstart. We may want this but from the testing I did before (for the HyRTI paper) the benefit of this is dubious (since the zero warmstart is already pretty good assuming the measurement doesn't differ much)
There was a problem hiding this comment.
the SQPCC local convergence theory suggests that this warm start ensures a locally unique sequence of iterates that does not jump to other seqeunces. so there might be some benefits when there are nearby multiple minimizers (dont ask me how much this gets wrapped by the homotopy and its restarts)
There was a problem hiding this comment.
Since we are calculating
| self.solver_opts = None | ||
| self.solver = None | ||
|
|
||
| def convexify(self, cvx_opts): |
There was a problem hiding this comment.
this function is independent of the Hessian, but in our current implementation, we pass and convexify the Scholtes NLP Lagrangian Hessian and not the MPEC Langragian Hessian?
I never thought about it, but, the value of their gradients of these two Lagrangians match because of stationary (at least at S-stationary points - both are zero and we use this fact to backcompute mpec multipliers from NLP multipliers), but I am not sure do their Hesians match?
There was a problem hiding this comment.
Do we? I am not sure what you mean by this. We pass here the MPCC objective and generic constraints and form the Lagrangian ourselves or also include the contribution form the MPCC multiplier. I suspect the Hessians do not match because the MPCC Lagrangian Hessian has no cross term contribution (though maybe in the limit they do?).
There was a problem hiding this comment.
For SQPCC, and hence RTI we must use the Hessian of the MPEC Langragian (https://arxiv.org/pdf/2604.18432v1, Definition 4) -- or an approximation lof it, like GN, which is multiplier free.
Our solvers return MPCC solvers return NLP multipliers, hence the Lagrnagian and its derivative might be wrong.
The values of gradients of NLP Lagrangians of MPCC relaxations and MPEC Lagrangians may match at stationary points, but otherwise they dont.
In conclusion, when we already convexify a Hessian, it should be the MPEC Lagrangain Hessian but which requires MPEC multipliers which must be backcomputed from the homotopy solution.
There was a problem hiding this comment.
When the functions G and H are affine the Lagrangian Hessians match everywhere though right (as the hessian of an affine function is the null matrix).
There was a problem hiding this comment.
But generally yes. We should use the MPCC Lagrangian.
There was a problem hiding this comment.
Yeah. but all the other multipliers still do not match. Even if he contribution of G and H are zero, the two set of remaining multipliers do not match? The difference may be infused through the lifting constraints for nonlinear G or H, or something else.
There was a problem hiding this comment.
Hmmm... I must think about it. It is not clear to me that these are not also correct.
… dict to MPCC object
This PR adds
FullMPCandRTIMPCwhich includes itsAS-RTIvariants.I also moved the old examples in this pr to address #70 for my own sanity.
It is not yet feature complete.