René's URL Explorer Experiment


Title: About the "horizon" parameter in the solve_ocp() method · Issue #782 · python-control/python-control · GitHub

Open Graph Title: About the "horizon" parameter in the solve_ocp() method · Issue #782 · python-control/python-control

X Title: About the "horizon" parameter in the solve_ocp() method · Issue #782 · python-control/python-control

Description: Discussed in #781 Originally posted by zhengzl18 October 17, 2022 Hi, I'm running the example code of the optimal module: https://python-control.readthedocs.io/en/0.9.2/optimal.html#example When calling the solve_ocp method, a parameter ...

Open Graph Description: Discussed in #781 Originally posted by zhengzl18 October 17, 2022 Hi, I'm running the example code of the optimal module: https://python-control.readthedocs.io/en/0.9.2/optimal.html#example When ca...

X Description: Discussed in #781 Originally posted by zhengzl18 October 17, 2022 Hi, I'm running the example code of the optimal module: https://python-control.readthedocs.io/en/0.9.2/optimal.html#example Whe...

Opengraph URL: https://github.com/python-control/python-control/issues/782

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"About the \"horizon\" parameter in the solve_ocp() method","articleBody":"### Discussed in https://github.com/python-control/python-control/discussions/781\r\n\r\n\u003cdiv type='discussions-op-text'\u003e\r\n\r\n\u003csup\u003eOriginally posted by **zhengzl18** October 17, 2022\u003c/sup\u003e\r\nHi,\r\nI'm running the example code of the `optimal` module: https://python-control.readthedocs.io/en/0.9.2/optimal.html#example\r\nWhen calling the `solve_ocp` method, a parameter called \"horizon\" is required:\r\n```\r\nhorizon = np.linspace(0, Tf, 3, endpoint=True)\r\nresult = opt.solve_ocp(\r\n    vehicle, horizon, x0, traj_cost, constraints,\r\n    terminal_cost=term_cost, initial_guess=u0)\r\n```\r\nIn this setting, it works just fine.\r\n\r\nBut when I tried to change the horizon into something like (changing nothing but the number of points in the linspace):\r\n```\r\nhorizon = np.linspace(0, Tf, 4, endpoint=True)\r\n```\r\nthe result seemed to be extremely strange, with the inputs u always remaining the same:\r\n```\r\nSummary statistics:\r\n* Cost function calls: 9\r\n* Constraint calls: 20\r\n* System simulations: 27\r\n* Final cost: 16000.0\r\n    cost: 16000.0\r\n     fun: 16000.0\r\n  inputs: array([[10., 10., 10., 10.],\r\n       [ 0.,  0.,  0.,  0.]])\r\n     jac: array([ 0.00000000e+00,  2.44140625e-04,  1.22070312e-04,  0.00000000e+00,\r\n       -3.62099047e+06, -6.84054738e+06, -2.12256850e+06, -7.49211857e+05])\r\n message: 'Optimization terminated successfully'\r\n    nfev: 9\r\n     nit: 5\r\n    njev: 1\r\n problem: \u003ccontrol.optimal.OptimalControlProblem object at 0x7ff0cb281df0\u003e\r\n  states: array([[  0.        ,  33.33333333,  66.66666667, 100.        ],\r\n       [ -2.        ,  -2.        ,  -2.        ,  -2.        ],\r\n       [  0.        ,   0.        ,   0.        ,   0.        ]])\r\n  status: 0\r\n success: True\r\n    time: array([ 0.        ,  3.33333333,  6.66666667, 10.        ])\r\n       x: array([10., 10., 10., 10.,  0.,  0.,  0.,  0.])\r\n\r\n```\r\n\r\nIt's the case for all `num` except 3 in the np.linspace(0, Tf, num).\r\n\r\nI'm confused by this results and wonder what's the actual use of 'horizon'? (I do notice from the comments that it's a \"List of times at which the optimal input should be computed\", but I still can't understand)\r\n\r\nHope for any help.\r\n\r\nThanks!\u003c/div\u003e","author":{"url":"https://github.com/zhengzl18","@type":"Person","name":"zhengzl18"},"datePublished":"2022-10-18T13:14:56.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/782/python-control/issues/782"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:60f76591-5161-4238-16ed-234f419689ee
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idD7D2:2846F6:E51DC9:13AD5D3:697A7D07
html-safe-nonce540fa2f43d5da6bfa3a2b3216ada782a5dc07b14504991a4b85c4bb76274ed6d
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEN0QyOjI4NDZGNjpFNTFEQzk6MTNBRDVEMzo2OTdBN0QwNyIsInZpc2l0b3JfaWQiOiIzMTYyOTA3NTg3NDg1NzkzNTQzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac22e58d09ef98354b9af250d7d60130148fe4bcf179d26e38ac570b4596402931
hovercard-subject-tagissue:1413210079
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python-control/python-control/782/issue_layout
twitter:imagehttps://opengraph.githubassets.com/d67bf3ec4ea76f711bf5e846b49bddfe04fbcf992cd5a2a56f5d6fdf4abcbb19/python-control/python-control/issues/782
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/d67bf3ec4ea76f711bf5e846b49bddfe04fbcf992cd5a2a56f5d6fdf4abcbb19/python-control/python-control/issues/782
og:image:altDiscussed in #781 Originally posted by zhengzl18 October 17, 2022 Hi, I'm running the example code of the optimal module: https://python-control.readthedocs.io/en/0.9.2/optimal.html#example When ca...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamezhengzl18
hostnamegithub.com
expected-hostnamegithub.com
Nonea9d1eabfb8cf0cb510bcf598032681675ad29b7ee4cb3bfb9a0a088a12803628
turbo-cache-controlno-preview
go-importgithub.com/python-control/python-control git https://github.com/python-control/python-control.git
octolytics-dimension-user_id2285872
octolytics-dimension-user_loginpython-control
octolytics-dimension-repository_id22791752
octolytics-dimension-repository_nwopython-control/python-control
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id22791752
octolytics-dimension-repository_network_root_nwopython-control/python-control
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release31bacebc3305d80609c1b175449c3d314bd1a855
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python-control/python-control/issues/782#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython-control%2Fpython-control%2Fissues%2F782
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython-control%2Fpython-control%2Fissues%2F782
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=python-control%2Fpython-control
Reloadhttps://github.com/python-control/python-control/issues/782
Reloadhttps://github.com/python-control/python-control/issues/782
Reloadhttps://github.com/python-control/python-control/issues/782
python-control https://github.com/python-control
python-controlhttps://github.com/python-control/python-control
Notifications https://github.com/login?return_to=%2Fpython-control%2Fpython-control
Fork 447 https://github.com/login?return_to=%2Fpython-control%2Fpython-control
Star 2k https://github.com/login?return_to=%2Fpython-control%2Fpython-control
Code https://github.com/python-control/python-control
Issues 87 https://github.com/python-control/python-control/issues
Pull requests 8 https://github.com/python-control/python-control/pulls
Discussions https://github.com/python-control/python-control/discussions
Actions https://github.com/python-control/python-control/actions
Projects 0 https://github.com/python-control/python-control/projects
Wiki https://github.com/python-control/python-control/wiki
Security 0 https://github.com/python-control/python-control/security
Insights https://github.com/python-control/python-control/pulse
Code https://github.com/python-control/python-control
Issues https://github.com/python-control/python-control/issues
Pull requests https://github.com/python-control/python-control/pulls
Discussions https://github.com/python-control/python-control/discussions
Actions https://github.com/python-control/python-control/actions
Projects https://github.com/python-control/python-control/projects
Wiki https://github.com/python-control/python-control/wiki
Security https://github.com/python-control/python-control/security
Insights https://github.com/python-control/python-control/pulse
New issuehttps://github.com/login?return_to=https://github.com/python-control/python-control/issues/782
New issuehttps://github.com/login?return_to=https://github.com/python-control/python-control/issues/782
#799https://github.com/python-control/python-control/pull/799
About the "horizon" parameter in the solve_ocp() methodhttps://github.com/python-control/python-control/issues/782#top
#799https://github.com/python-control/python-control/pull/799
https://github.com/murrayrm
bughttps://github.com/python-control/python-control/issues?q=state%3Aopen%20label%3A%22bug%22
0.9.3https://github.com/python-control/python-control/milestone/11
https://github.com/zhengzl18
https://github.com/zhengzl18
zhengzl18https://github.com/zhengzl18
on Oct 18, 2022https://github.com/python-control/python-control/issues/782#issue-1413210079
#781https://github.com/python-control/python-control/discussions/781
https://python-control.readthedocs.io/en/0.9.2/optimal.html#examplehttps://python-control.readthedocs.io/en/0.9.2/optimal.html#example
murrayrmhttps://github.com/murrayrm
bughttps://github.com/python-control/python-control/issues?q=state%3Aopen%20label%3A%22bug%22
0.9.3https://github.com/python-control/python-control/milestone/11
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.