Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug of the cvxpy variables with cp.reshape #2

Open
chengwei-xia opened this issue Apr 22, 2024 · 1 comment
Open

Bug of the cvxpy variables with cp.reshape #2

chengwei-xia opened this issue Apr 22, 2024 · 1 comment

Comments

@chengwei-xia
Copy link

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.

@rssalessio
Copy link
Owner

Hi @chengwei-xia , thanks for the comment. Do you have an example that leads to the bug you mentioned?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants