finite-horizon-lqr
Solving finite-horizon LQR via dynamic programming for MPC.
Install / Use
npx skills add benchflow-ai/skillsbench --skill finite-horizon-lqrInstalls into whichever agent you are using.
SKILL.md
Installable skill definition
Quality Score
Category
Development & EngineeringSupported Platforms
Our assessment of finite-horizon-lqr
finite-horizon-lqr scores 69/100 on our quality scale, 3367th of 4,258 Development & Engineering skills we index.
Its SKILL.md is 1.1 KB long, split into 6 sections with 4 code examples: fairly brief, so expect to fill in details yourself.
With 1,813 GitHub stars, it is one of the more widely adopted skills in the catalogue.
Maintenance, license and trust
- The repository was last updated about 2 months ago, so finite-horizon-lqr is actively maintained.
- It is released under the Apache-2.0 license, a permissive license that allows use, modification and commercial use with attribution.
- Its trust signals score 100/100, with no cautions. These come from repository metadata, not a code audit — read the skill file before letting an agent act on it.
finite-horizon-lqr compared with similar skills
All 4 of these similar skills score higher than finite-horizon-lqr; compare them before choosing.
| Skill | Score | Stars | Updated | Format |
|---|---|---|---|---|
| finite-horizon-lqr (this skill)by benchflow-ai | 69 | 1.8k | 2mo ago | SKILL.md |
| Agent-Reachby Panniantong | 100 | 86.9k | 15d ago | CLAUDE.md |
| headroomby headroomlabs-ai | 100 | 74.2k | today | CLAUDE.md |
| ai-job-searchby MadsLorentzen | 100 | 44.6k | 1d ago | CLAUDE.md |
| claude-howtoby luongnv89 | 100 | 41.7k | today | CLAUDE.md |
Frequently asked questions
- How do I install finite-horizon-lqr?
- Run
npx skills add benchflow-ai/skillsbench --skill finite-horizon-lqr. The install tabs above show the steps for each supported agent. - Which AI agents does finite-horizon-lqr work with?
- It is written for Universal, as a SKILL.md file. Other agents that read the same format can often use it too.
- Is finite-horizon-lqr safe to use?
- It is Apache-2.0-licensed and scores 100/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
- Is finite-horizon-lqr still maintained?
- The repository was last updated about 2 months ago, so finite-horizon-lqr is actively maintained.
Skill content
View source on GitHubname: finite-horizon-lqr description: Solving finite-horizon LQR via dynamic programming for MPC.
Finite-Horizon LQR for MPC
Problem Formulation
Minimize cost over horizon N:
J = Σ(k=0 to N-1) [x'Qx + u'Ru] + x_N' P x_N
Backward Riccati Recursion
Initialize: P_N = Q (or LQR solution for stability)
For k = N-1 down to 0:
K_k = inv(R + B'P_{k+1}B) @ B'P_{k+1}A
P_k = Q + A'P_{k+1}(A - B @ K_k)
Forward Simulation
Starting from x_0:
u_k = -K_k @ x_k
x_{k+1} = A @ x_k + B @ u_k
Python Implementation
def finite_horizon_lqr(A, B, Q, R, N, x0):
nx, nu = A.shape[0], B.shape[1]
K = np.zeros((nu, nx, N))
P = Q.copy()
# Backward pass
for k in range(N-1, -1, -1):
K[:,:,k] = np.linalg.solve(R + B.T @ P @ B, B.T @ P @ A)
P = Q + A.T @ P @ (A - B @ K[:,:,k])
# Return first control
return -K[:,:,0] @ x0
MPC Application
At each timestep:
- Measure current state x
- Solve finite-horizon LQR from x
- Apply first control u_0
- Repeat next timestep
Related Skills
Agent-Reach
86.9kGive your AI agent eyes to see the entire internet. Read & search Twitter, Reddit, YouTube, GitHub, Bilibili, XiaoHongShu — one CLI, zero API fees.
headroom
74.2kCompress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.
ai-job-search
44.6kThe job search that runs on your machine. AI job application framework built on Claude Code: evaluate postings, tailor CVs, write cover letters, prep interviews. Fork it and own it.
claude-howto
41.7kA visual, example-driven guide to Claude Code — from basic concepts to advanced agents, with copy-paste templates that bring immediate value.
Languages
Trust signals
From repository metadata: license, adoption, age and documentation. Not a code audit — see the Safety scan above for what the skill file itself contains.
