Open Solomon-GC opened 10 months ago
This looks like a solver inaccuracy problem. Try fiddling with the parameters, or using a different solver.
On Mon, Sep 4, 2023 at 1:02 PM Solomon-GC @.***> wrote:
Hi,
I would appreciate getting your help with the LQR example. Following the LQR example, I notice that for a continuous problem, e.g., cart pole, with linearized dynamics at the fixed point, the LQR solution doesn't work. It returns "inf."
For example,
Consider the following dynamics matrices: A = np.array([ [0, 0, 1, 0], [0, -0.71707317, 0, 0], [0, 0, 0, 1], [0, 15.77560976, 0, 0]])
B = np.array([ [0], [0], [0.97560976], [-1.46341463]])
The following code doesn't work: So that you know, I changed the discrete ARE from your notebook to the continuous ARE.
################################################### P = cp.Variable((n, n), PSD=True) R0cvxpy = cp.Parameter((m, m), PSD=True)
objective = @.) constraints = [cp.bmat([ [R0cvxpy, @., @., Q0 + @. + @.*** ]) >> 0, P >> 0] R0cvxpy.value = R0 result = cp.Problem(cp.Maximize(objective), constraints).solve() P_lqr = P.value print(result) ##################################################
Returns: Inf
UserWarning: Solution may be inaccurate. Try another solver, adjusting the solver settings, or solve with verbose=True for more information.
I appreciate any help you can provide.
Best regards, Solomon
— Reply to this email directly, view it on GitHub https://github.com/cvxgrp/cocp/issues/3, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB7LUGLXPWASXXX4USBMXHDXYWYLBANCNFSM6AAAAAA4KHW2XY . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Hi,
Thank you for your feedback. Could you please elaborate on the line of code: "objective = cp.trace(P@W)"
I didn't see this in the paper: https://arxiv.org/pdf/1912.09529.pdf
I wonder if this should be adjusted in my case.
https://web.stanford.edu/~boyd/papers/pdf/stoch_ctrl_bnds.pdf
Equation 9
On Tue, Sep 5, 2023 at 11:34 AM Solomon-GC @.***> wrote:
Hi,
Thank you for your feedback. Could you please elaborate on the line of code: "objective = @.***)"
I didn't see this in the paper: https://arxiv.org/pdf/1912.09529.pdf http://url
I wonder if this should be adjusted in my case.
— Reply to this email directly, view it on GitHub https://github.com/cvxgrp/cocp/issues/3#issuecomment-1706274297, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB7LUGN24LEDX4CGSWGNPWLXY3WZPANCNFSM6AAAAAA4KHW2XY . You are receiving this because you commented.Message ID: @.***>
Hi,
I would appreciate getting your help with the LQR example. Following the LQR example, I notice that for a continuous problem, e.g., cart pole, with linearized dynamics at the fixed point, the LQR solution doesn't work. It returns "inf."
For example,
Consider the following dynamics matrices: A = np.array([ [0, 0, 1, 0], [0, -0.71707317, 0, 0], [0, 0, 0, 1], [0, 15.77560976, 0, 0]])
B = np.array([ [0], [0], [0.97560976], [-1.46341463]])
The following code doesn't work: So that you know, I changed the discrete ARE from your notebook to the continuous ARE.
################################################### P = cp.Variable((n, n), PSD=True) R0cvxpy = cp.Parameter((m, m), PSD=True)
objective = cp.trace(P@W) constraints = [cp.bmat([ [R0cvxpy, B.T@P], [P@B, Q0 + A.T@P + P@A] ]) >> 0, P >> 0] R0cvxpy.value = R0 result = cp.Problem(cp.Maximize(objective), constraints).solve() P_lqr = P.value print(result) ##################################################
Returns: Inf
UserWarning: Solution may be inaccurate. Try another solver, adjusting the solver settings, or solve with verbose=True for more information.
I appreciate any help you can provide.
Best regards, Solomon