GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Removed epsilon perturbation value in solve_passivity_LMI. Fix associated unit test. by Mark-Yeatman · Pull Request #814 · python-control/python-control

Conversation

@Mark-Yeatman

@Mark-Yeatman Mark-Yeatman commented Dec 12, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

This should hopefully address #761

There was a unit test that was supposed to "hint at" how much you could scale matrices and expect to still correct results. It was marked as xfail after it was flakey on githubs integration pipeline. Hopefully this change removes the flakeyness.

This change also pushes more responsibility on the user for knowing if their system is "well conditioned". I suspect the root cause of the flakeyness is that CVXOPT does matrix inversions while solving the passivity LMI, and the algorithm would divide by zero if the condition numbers of the system matrices were too high. So, I added a exception handling case to catch the zero division during the cvxopt solve, said we think its because the matrices are ill conditioned, and then reraised the exception.

I then empirically bumped down the relative scaling on the unit test until it started passing on my local system.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Mark-Yeatman
Removed epsilon perturbation value in solve_passivity_LMI. Change uni…
4792163
…t test to reflect scaling values from empirical testing.
@Mark-Yeatman Mark-Yeatman mentioned this pull request Dec 12, 2022
Passivity test is ill-conditioned #761
Closed
@coveralls

coveralls commented Dec 12, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.008%) to 94.81% when pulling e6b837d on Mark-Yeatman:main into 9d65bf8 on python-control:main.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bnavigator

bnavigator commented Dec 13, 2022

Copy link
Copy Markdown
Contributor

I then empirically bumped down the relative scaling on the unit test until it started passing on my local system.

This is dangerous. There is a zoo of lower precision hardware systems out there where python-control might be used and packaged. For example, I frequently encounter errors for such tests on the openSUSE build system with i586, aarch64, 32-bit arm, s390x, PowerPC and so on platforms.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Mark-Yeatman

Mark-Yeatman commented Dec 14, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

I think we'd either have to delete this test then; or do something like detect the precision of the architecture somehow, then back out the values of the matrices such that the condition number is bounded by like 10^(n/2), where n is the number of bits allocated to representing floating points numbers. (Just spit balling).

bnavigator reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Mark-Yeatman

Mark-Yeatman commented Dec 15, 2022

Copy link
Copy Markdown
Contributor Author

I will delete the test.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Mark-Yeatman
Remove test case.
a17e3c8
bnavigator
bnavigator reviewed Dec 15, 2022
View reviewed changes
Comment thread control/passivity.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

roryyorke
roryyorke reviewed Dec 16, 2022
View reviewed changes
Comment thread control/passivity.py
except ImportError:
cvx = None

eps = np.nextafter(0, 1)

@roryyorke roryyorke Dec 16, 2022

Copy link
Copy Markdown
Contributor

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.

(This is a by-the-way comment, feel free to ignore.)

This eps was very small; I think a more typical "eps" would be "the smallest number eps such that 1+eps > 1", or a multiple or maybe square root of that. np.finfo is useful to find these sorts of value.

In [402]: np.nextafter(0, 1)
Out[402]: 5e-324

In [403]: np.finfo(float).eps
Out[403]: 2.220446049250313e-16

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

bnavigator reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

@Mark-Yeatman Mark-Yeatman Dec 16, 2022

Copy link
Copy Markdown
Contributor Author

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.

That is a pro tip, and what I was aiming for.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@murrayrm murrayrm linked an issue Dec 16, 2022 that may be closed by this pull request
Passivity test is ill-conditioned #761
Closed
@Mark-Yeatman @bnavigator
Update control/passivity.py
e6b837d
Co-authored-by: Ben Greiner <[email protected]>
@murrayrm
murrayrm merged commit 2d0d513 into python-control:main Dec 17, 2022
@murrayrm murrayrm added this to the 0.9.3 milestone Dec 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@bnavigator bnavigator bnavigator left review comments
+1 more reviewer
@roryyorke roryyorke roryyorke left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

0.9.3

Development

Successfully merging this pull request may close these issues.

Passivity test is ill-conditioned

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@Mark-Yeatman @coveralls @bnavigator @roryyorke @murrayrm
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.