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 — Add collocation method for optimal control problems by murrayrm · Pull Request #799 · python-control/python-control

Conversation

@murrayrm

@murrayrm murrayrm commented Nov 26, 2022 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

This PR changes the default way that optimal control problems are solved from using a shooting method to using collocation. This results in more robust (and faster) solutions, especially for trajectory generation for unstable or marginally stable systems (where shooting is very sensitive to small parameter variations).

The following new functionality is included:

  • The solve_ocp() function and OptimalControlProblem class have new parameters trajectory_method that be set to either shooting (default for discrete time systems) or collocation (default for continuous time systems).
  • When collocation is used, the initial_guess parameter can either be an input trajectory (as before) or a tuple consisting of a state trajectory and an input trajectory.
  • Constraints can now be specified in the form LinearConstraint(A, lb, ub) or NonlinearConstraint(fun, lb, ub) instead of the previous forms (LinearConstraint, A, lb, ub) and (NonlinearConstraint, fun, lb, ub). The legacy format is still supported.
  • The documentation (docstrings and manual) have been updated to reflect the new functionality.
  • New unit tests are included that tease out the functionality of the various possibilities.
  • Benchmarks comparing shooting and collocation have been added.

This PR also addresses issue #782 (see also discussion in #781) which were showing some of the weakness of the shooting methodology.

Sorry, something went wrong.

Uh oh!

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

All reactions
@coveralls

coveralls commented Nov 26, 2022 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.03%) to 94.803% when pulling dd5e42d on murrayrm:fix_horizon-19Nov2022 into 4d89991 on python-control:main.

All reactions

Sorry, something went wrong.

Uh oh!

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

@murrayrm murrayrm mentioned this pull request Nov 26, 2022
Update benchmarks to help with optimal control tuning #800
Merged
@murrayrm murrayrm linked an issue Nov 26, 2022 that may be closed by this pull request
About the "horizon" parameter in the solve_ocp() method #782
Closed
murrayrm added 5 commits November 26, 2022 13:02
@murrayrm
add trajectory_method='shooting'
d9ec3ec
@murrayrm
add trajectory_method='collocation'
ce5e67a
@murrayrm
set default trajectory_methood for ctime systems to collocation
8256fa0
@murrayrm
updated examples + code cleanup
d121102
@murrayrm
update documentation + allow constraints in scipy.optimize form
e0f71f4
@murrayrm
murrayrm force-pushed the fix_horizon-19Nov2022 branch from 27a200e to e0f71f4 Compare November 26, 2022 21:03
@murrayrm
add benchmarks for shooting vs collocation
dd5e42d
@murrayrm murrayrm added this to the 0.9.3 milestone Nov 27, 2022
@sawyerbfuller

sawyerbfuller commented Dec 2, 2022

Copy link
Copy Markdown
Contributor

LGTM

All reactions

Sorry, something went wrong.

Uh oh!

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

@murrayrm

murrayrm commented Dec 2, 2022

Copy link
Copy Markdown
Member Author

Updated the initial post to reflect the additional commits, so that we don't lose track of the changes.

All reactions

Sorry, something went wrong.

Uh oh!

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

@murrayrm
murrayrm merged commit 9d65bf8 into python-control:main Dec 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

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.

About the "horizon" parameter in the solve_ocp() method

Uh oh!

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

3 participants

@murrayrm @coveralls @sawyerbfuller
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.