Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

DLQR and DLQE#670

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
murrayrm merged 18 commits intopython-control:masterfromsawyerbfuller:dlqr2
Dec 31, 2021
Merged

DLQR and DLQE#670

murrayrm merged 18 commits intopython-control:masterfromsawyerbfuller:dlqr2
Dec 31, 2021

Conversation

sawyerbfuller
Copy link
Contributor

@sawyerbfullersawyerbfuller commentedNov 9, 2021
edited
Loading

update 2021.1.09
Slycot not currently working with my new M1 mac so I made it so lqr, lqe, dlqr, and dlqe now have a fallback to scipy-only. They use an updated version ofcare anddare that have non-slycot options available.

  • care anddare now use scipysolve_continuous_are andsolve_discrete_are if possible instead of slycot (only case they don't is whenstabilizing=False)

@sawyerbfullersawyerbfuller linked an issueNov 9, 2021 that may beclosed by this pull request
@bnavigator
Copy link
Contributor

Any indication, why you can't have Slycot on your M1? No conda packages?

@sawyerbfuller
Copy link
ContributorAuthor

Any indication, why you can't have Slycot on your M1? No conda packages?

Not sure. conda has been spending a lot of time "solving" the environment and then not succeeding (I don't remember the error message) when I try to install slycot with conda-forge. Will try again

bnavigator reacted with thumbs up emoji

Comment on lines 413 to 415
@slycotonly
def test_care_antistabilizing(self, matarrayin):
"""Test anti-stabilizing feedbacks, continuous"""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

How about instead of duplicating code lines, you parameterizetest_care andtest_dare with something like

@pytest.mark.parametrize("stabilizing",    [True,pytest.param(False,marks=slycotonly),    ]deftest_care(self,matarrayin,stabilizing):    ...X,L,G=care(A,B,Q,R,S,E,stabilizing=stabilizing)sgn= {True:-1,False:1}[stabilizing]assertnp.all((sgn*np.real(L))>0)

?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

thanks for the suggestion & code sketch. done

Comment on lines 500 to 502
if not stabilizing:
return care_slycot(A, B, Q, R, S, E, stabilizing)
else:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This always favors the SciPy version over Slycot forstabilizing=True. I guess the SLICOT routine should be more efficient than calling 3 solvers forX,G,L.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Found7cf9630 and#8. Has this ever been investigated thoroughly?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Might be nicer to implement amethod keyword as suggested in#255.

bnavigator reacted with thumbs up emoji
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I guess the significant number of uncovered lines as reported by coveralls comes from this change.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

One of my grad students actually encountered that bug with slycot’sdare. I’ll see if I can find the bug. Ok if we leave adding amethod keyword to a different PR?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I'm would be okay with deferring the method keyword to a later PR.

But I don't like leaving code in the repo which is essentially untested or disabled.

Comment on lines 233 to 234
raiseControlArgument("Q must be a symmetric matrix.")
raiseControlDimension("Q must be a symmetric matrix.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

That's not a dimension error.ControlDimension would have been raised above.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

True. I was trying to make it so both slycot and scipy versions raised the same kind of error (ValueError) rather than different types (ControlArgument is a TypeError), so that we could run the same test on both. win-win solution: I'll just change that to a ValueError because I think it can be argued that being non-symmetric is more of a value error than a type error.

bnavigator reacted with thumbs up emoji
@coveralls
Copy link

coveralls commentedNov 9, 2021
edited
Loading

Coverage Status

Coverage increased (+0.1%) to 93.655% when pulling0d4ff4c on sawyerbfuller:dlqr2 into8356044 on python-control:master.

@sawyerbfullersawyerbfuller marked this pull request as draftNovember 10, 2021 17:41
@sawyerbfullersawyerbfuller marked this pull request as ready for reviewNovember 23, 2021 22:40
@sawyerbfullersawyerbfuller changed the title[WIP] DLQR and DLQEDLQR and DLQENov 23, 2021
@sawyerbfuller
Copy link
ContributorAuthor

Marked this as ready for a review to merge. Still working on getting slycot working on my mac (reinstall anaconda didn't do it) so I think a PR that adds a method keyword will have to wait until I get that resolved.

@murrayrm
Copy link
Member

Some (minor) overlapping changes in#673, which allows thelqe function to be called with aStateSpace object as the first argument. We might consider adding some of the functionality for#673 into this PR, for consistency. We could also updatelqr andlqe so that if they are passed a discrete timeLTI system as their first argument, they calldlqr anddlqe directly (?).

@sawyerbfuller
Copy link
ContributorAuthor

@murrayrm I like the idea of "overloading"lqe andlqr to work as the corresponding discrete-time versions when passed a discrete-time SS system. Possible rationale: they're both still "linear quadratic regulators/estimators".

Happy to rebase this one on top of#673, or vice versa, but it may be a few days before I have time to do anything on it.

@murrayrm
Copy link
Member

@sawyerbfuller FYI, if you rebase this, you might want to wait until#683 is merged since that has a lot of relevant changes in bothmateqn andstatefbk.

@murrayrmmurrayrm added the needs rebaseThe PR needs a rebase to current master branch labelDec 26, 2021
murrayrmand others added10 commitsDecember 26, 2021 12:01
@murrayrmmurrayrm removed the needs rebaseThe PR needs a rebase to current master branch labelDec 26, 2021
@murrayrm
Copy link
Member

murrayrm commentedDec 26, 2021
edited
Loading

Rebased on latest master. A couple of other things we could do before merging:

  • Add timebase checks tolqr() to call thelqr ordlqr, as appropriate
  • Regularize the use of_method incare anddare
  • Remove redundant argument processing indare and_dare_slycot (since the latter is an internal function)

@sawyerbfuller
Copy link
ContributorAuthor

@murrayrm thanks for moving this one toward the finish line.

One remark in regards to a change on line 280 instatefbk.py that changedB toG. I think it should remainB. In the general case there should be a distinction between theB (input) andG (disturbance input) matrices , and it is nice to have aG in case you have disturbances that only act on a subset of states (eg force but not velocity disturbances).

The question is, what iflqe is passed a system? Then I think it is ok to interpret the system’sB matrix asG, as currently implemented. But I think the place to state that is down at the end of the doc string where the option to pass a system is described.

@murrayrm
Copy link
Member

One remark in regards to a change on line 280 in statefbk.py that changed B to G. I think it should remain B. In the general case there should be a distinction between the B (input) and G (disturbance input) matrices , and it is nice to have a G in case you have disturbances that only act on a subset of states (eg force but not velocity disturbances).

Oops. Reverted.

@murrayrmmurrayrm added this to the0.9.1 milestoneDec 30, 2021
@murrayrmmurrayrm merged commita33bcc5 intopython-control:masterDec 31, 2021
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@bnavigatorbnavigatorbnavigator left review comments

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
0.9.1
Development

Successfully merging this pull request may close these issues.

Discrete Time LQR Option
4 participants
@sawyerbfuller@bnavigator@coveralls@murrayrm

[8]ページ先頭

©2009-2025 Movatter.jp