Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- import numpy as np
- X = {1,2,3,4,5,6}
- A = {"Up","Down","Right","Left"}
- Pup=np.array([[0.8, 0.1, 0, 0.1, 0, 0],
- [ 0.1, 0.7, 0.1, 0, 0.1, 0],
- [ 0, 0.1, 0.8, 0, 0, 0.1],
- [ 0.6, 0, 0, 0.3, 0.1, 0],
- [ 0, 0.6, 0, 0.1, 0.2, 0.1],
- [ 0, 0, 0.6, 0, 0.1, 0.3],
- ])
- Pdown=np.array([[0.3, 0.1, 0, 0.6, 0, 0], #1
- [ 0.1, 0.2, 0.1, 0, 0.6, 0], #2
- [ 0, 0.1, 0.3, 0, 0, 0.6], #3
- [ 0.1, 0, 0, 0.8, 0.1, 0], #4
- [ 0, 0.1, 0, 0.1, 0.7, 0.1], #5
- [ 0, 0, 0.1, 0, 0.1, 0.8], #6
- ])
- Pright=np.array([[0.3, 0.6, 0, 0.1, 0, 0], #1
- [ 0.1, 0.2, 0.6, 0, 0.1, 0], #2
- [ 0, 0.1, 0.8, 0, 0, 0.1], #3
- [ 0.1, 0, 0, 0.3, 0.6, 0], #4
- [ 0, 0.1, 0, 0.1, 0.2, 0.6], #5
- [ 0, 0, 0.1, 0, 0.1, 0.8], #6
- ])
- Pleft=np.array([[0.8, 0.1, 0, 0.1, 0, 0], #1
- [ 0.6, 0.2, 0.1, 0, 0.1, 0], #2
- [ 0, 0.6, 0.3, 0, 0, 0.1], #3
- [ 0.1, 0, 0, 0.8, 0.1, 0], #4
- [ 0, 0.1, 0, 0.6, 0.2, 0.1], #5
- [ 0, 0, 0.1, 0, 0.6, 0.3], #6
- ])
- # UP DOWN RIGHT LEFT
- C = np.array([[0.15, 0.15, 0.15, 0.15], #1
- [ 0.15, 1, 0.15, 0.15], #2
- [ 0.15, 0, 0.15, 0.15], #3
- [ 0.15, 0.15, 1, 0.15], #4
- [ 0.15, 1, 0.15, 0.15], #5
- [ 0.15, 0, 0, 1], #6
- ])# Insert your code here
- print("State List: \n", X)
- print("Action List: \n", A)
- print("Transition UP: \n", Pup)
- print("Transition DOWN: \n", Pdown)
- print("Transition RIGHT: \n", Pright)
- print("Transition LEFT: \n", Pleft)
- print("Cost Matrix: \n", C)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement