Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Variables Declaration
- cu = C[:,0:1]
- cd = C[:,1:2]
- cl = C[:,2:3]
- cr = C[:,3:4]
- gamma = 0.99
- # Matrix creation
- J = np.zeros((6,1))
- # Initialize variables
- err = 1
- i = 0
- while err > 1e-8:
- Qu = cu + gamma * U.dot(J)
- Qd = cd + gamma * D.dot(J)
- Ql = cl + gamma * L.dot(J)
- Qr = cr + gamma * R.dot(J)
- Jnew = np.min((Qu, Qd, Ql, Qr), axis=0)
- err = np.linalg.norm(Jnew - J)
- i+=1
- J = Jnew
- print(J)
- print(i)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement