-
Notifications
You must be signed in to change notification settings - Fork 438
Add passivity module, ispassive function, and passivity_test. Introduces optional dependency cvxopt. #739
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
Conversation
I need to cut the formation of the LMI via symbolic variables for performance. Did a timing test on a size 20 state, input, output system, 99% of the time is spent constructing the LMI and converting to cvxopt form. |
The initial disussion is here: #732 Thanks for the initiative! As far as I understand, you introduce 3 new depenendies because you work with symbolic matrices:
Would it be possible to implement the matrix handling and solving with NumPy and SciPy functions only? |
I'm about 60% sure cvxopt is necessary to solve the linear matrix inequality. Sympy and lmi_sdp can definitely be dropped. Cvxopt only requires BLAS/LAPACK, which it seems that slycot also requires. So this passivity package could be setup to be optional? |
CVXOPT is available on conda-forge and as wheels with bundled libraries on PyPI. They link and bundle OpenBLAS. I am not sure how well that plays with "Generic" Netlib linked NumPy and Slycot packages. But we can worry about that when it comes up. It must be installed in the test suite, so we need to add it to the requirements. It can be set as optional similar to how we do it with Slycot. |
@bnavigator I've removed sympy and lmi-sdp from the function, and I attempted to setup cvxopt in the test suite. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Some initial review comments.
Co-authored-by: Ben Greiner <code@bnavigator.de>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comments below. Also, it would be nice to add a unit test to make sure that if cvxopt is not installed that the proper exception is raised.
@bnavigator I believe I've resolved all the outstanding review comments? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more review comment
Co-authored-by: Ben Greiner <code@bnavigator.de>
Instead of writing things in the standard SDP notation, you might want to use CVXPY notation (which acts like YALMIP) so you don't have to use the tiresome basis matrices. Also note that strictly proper systems cannot be checked via positive real lemma via strict inequalities due zero D + D.T block forcing the optimization problem to infeasibilty. You either have to use extended version or nudge D block with |
I would definitely be up for using cvxpy, but it looks like it has more dependencies than just using cvxopt (https://www.cvxpy.org/install/#install-from-source vs https://cvxopt.org/install/#building-and-installing-from-source)? That seems like an issue for a project maintainer. You're right about the D = 0 case, I will nudge it as you suggested. Thanks for catching that. |
CVXPY: I don't think it is necessary to employ a full domain specific language with all its dependencies for one hardcoded optimization problem. |
… rename is_passive to ispassive for naming convention consistency. Autoformat to pep8.
…led in an object oriented style as a LTI class member. Added unit tests for transfer function and oo style calls. Ran autopep8 on lti.py.
I took the liberty of fixing the missing skips. I hope you don't mind. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is ready for a merge. Any improvements welcome with subsequent PRs.
I made a discussion topic a couple of weeks ago about making a passivity module, @murrayrm suggested making a draft PR. Here it is!