PyDeePC icon indicating copy to clipboard operation
PyDeePC copied to clipboard

Bug of the cvxpy variables with cp.reshape

Open chengwei-xia opened this issue 1 year ago • 0 comments

Describe the bug There is a small issue in deepc.py lines 139 and 140 with the following lines: u = cp.reshape(u, (self.horizon, self.M)) y = cp.reshape(y, (self.horizon, self.P)) This may lead to a bug in the constraints when using multiple inputs or outputs, because the cp.reshape is Fortran type by default.

To Fix This can be fixed by simply forcing the C type reshape as follows: u = cp.reshape(u, (self.horizon, self.M), 'C') y = cp.reshape(y, (self.horizon, self.P), 'C')

** Other comments** Please do more tests if you can to make sure the reshape doesn't affect other things in the code.

chengwei-xia avatar Apr 22 '24 16:04 chengwei-xia