In the third implementation (the numerically robust one), R_L matrix is defined with a size of {(MPC_HP_LEN*SS_Z_LEN + MPC_HU_LEN*SS_U_LEN), MPC_HP_LEN*SS_Z_LEN}.
But R_L is multiplied with dU(k)_optimal during the problem formulation. As dU(k)_optimal has a size of {MPC_HU_LEN*SS_U_LEN,1}, the R_L matrix should have a size of {(MPC_HP_LEN*SS_Z_LEN + MPC_HU_LEN*SS_U_LEN), MPC_HU_LEN*SS_U_LEN}.
This size is confirmed by the fact that GammaLeft is (SQ*CTHETA) over SR :
SQ has a size of {MPC_HP_LEN*SS_Z_LEN, MPC_HP_LEN*SS_Z_LEN}
CTHETA has a size of {MPC_HP_LEN*SS_Z_LEN, MPC_HU_LEN*SS_U_LEN}
- Thus,
SQ*CTHETA has a size of {MPC_HP_LEN*SS_Z_LEN, MPC_HU_LEN*SS_U_LEN}
SR has a size of {MPC_HU_LEN*SS_U_LEN, MPC_HU_LEN*SS_U_LEN}
- Therefore
(SQ*CTHETA) over SR has a size of {(MPC_HP_LEN*SS_Z_LEN + MPC_HU_LEN*SS_U_LEN), MPC_HU_LEN*SS_U_LEN}
Q_L * R_L = GammaLeft, so the number of columns of R_L is the number of columns of GammaLeft, which is MPC_HU_LEN*SS_U_LEN and not MPC_HP_LEN*SS_Z_LEN
In your model, it does not seem to be an issue because MPC_HU_LEN*SS_U_LEN is 8 and MPC_HP_LEN*SS_Z_LEN is 14, i.e. MPC_HU_LEN*SS_U_LEN < MPC_HP_LEN*SS_Z_LEN.
Nonetheless, thank you for this amazing open source code
Best regards
In the third implementation (the numerically robust one),
R_Lmatrix is defined with a size of{(MPC_HP_LEN*SS_Z_LEN + MPC_HU_LEN*SS_U_LEN), MPC_HP_LEN*SS_Z_LEN}.But
R_Lis multiplied withdU(k)_optimalduring the problem formulation. AsdU(k)_optimalhas a size of{MPC_HU_LEN*SS_U_LEN,1}, theR_Lmatrix should have a size of{(MPC_HP_LEN*SS_Z_LEN + MPC_HU_LEN*SS_U_LEN), MPC_HU_LEN*SS_U_LEN}.This size is confirmed by the fact that
GammaLeftis(SQ*CTHETA)overSR:SQhas a size of{MPC_HP_LEN*SS_Z_LEN, MPC_HP_LEN*SS_Z_LEN}CTHETAhas a size of{MPC_HP_LEN*SS_Z_LEN, MPC_HU_LEN*SS_U_LEN}SQ*CTHETAhas a size of{MPC_HP_LEN*SS_Z_LEN, MPC_HU_LEN*SS_U_LEN}SRhas a size of{MPC_HU_LEN*SS_U_LEN, MPC_HU_LEN*SS_U_LEN}(SQ*CTHETA)overSRhas a size of{(MPC_HP_LEN*SS_Z_LEN + MPC_HU_LEN*SS_U_LEN), MPC_HU_LEN*SS_U_LEN}Q_L * R_L = GammaLeft, so the number of columns ofR_Lis the number of columns ofGammaLeft, which isMPC_HU_LEN*SS_U_LENand notMPC_HP_LEN*SS_Z_LENIn your model, it does not seem to be an issue because
MPC_HU_LEN*SS_U_LENis 8 andMPC_HP_LEN*SS_Z_LENis 14, i.e.MPC_HU_LEN*SS_U_LEN < MPC_HP_LEN*SS_Z_LEN.Nonetheless, thank you for this amazing open source code
Best regards