Skip to content
Snippets Groups Projects
Commit edcb2b87 authored by tuhe's avatar tuhe
Browse files

More solutions files

parent c13c7d04
Branches
Tags
No related merge requests found
Q, R, q = compute_Q_R_q(model, dt)
\ No newline at end of file
agent = LQRAgent(env, A=A, B=B, d=d, Q=Q, R=R, q=q)
\ No newline at end of file
Q = cost.Q * dt
R = cost.R * dt
q = cost.q * dt
\ No newline at end of file
B_discrete = scipy.linalg.inv(model.A) @ (A_discrete - np.eye(model.A.shape[0])) @ model.B
d_discrete = scipy.linalg.inv(model.A) @ (A_discrete - np.eye(model.A.shape[0])) @ d
\ No newline at end of file
import matplotlib
matplotlib.use('agg')
\ No newline at end of file
V[N], v[N], vc[N] = QN, qN, qcN
\ No newline at end of file
Suu = R[k] + B[k].T @ (V[k+1] + mu * In) @ B[k]
Sux = H[k] + B[k].T @ (V[k+1] + mu * In) @ A[k]
Su = r[k] + B[k].T @ v[k + 1] + B[k].T @ V[k + 1] @ d[k]
L[k] = -np.linalg.solve(Suu, Sux)
\ No newline at end of file
(self.L, self.l), _ = LQR(A=[A]*N, B=[B]*N, d=[d]*N if d is not None else None, Q=[Q]*N, q=[q]*N if q is not None else None, R=[R]*N)
\ No newline at end of file
u = self.L[k] @ x + self.l[k]
\ No newline at end of file
def pi(self,x, k, info=None):
action = self.L[0] @ x + self.l[0]
return action
\ No newline at end of file
Kp, Kd = (-L0).flat
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment