Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

제 3장 코드에서 width,height 혼동 문제. #40

Open
hccho2 opened this issue Dec 15, 2019 · 0 comments
Open

제 3장 코드에서 width,height 혼동 문제. #40

hccho2 opened this issue Dec 15, 2019 · 0 comments

Comments

@hccho2
Copy link

hccho2 commented Dec 15, 2019

1-grid-word ---> 1-policy-iteration 에서

코드 전제적으로 width, height 순서가 맞지 않습니다.
코드에서는 widht=5, height=5로 되어 있어, 작동하지만,
width=5, height=6이면, 작동하지 않습니다.

예들 들어,

self.value_table = [[0.0] * env.width for _ in range(env.height)]  # height x width

--->

self.value_table = [[0.0] * env.height for _ in range(env.width)]  # width x height

코드 전체를 좀 손봐야 할 것 같습니다.

graphic상 에서는 height, width 순으로 되어 있는 것과 반대로, value, reward를 width, height순으로 되어 있는데. 이때문에 혼동이 일어난 것 같습니다.

그리고,

POSSIBLE_ACTIONS = [0, 1, 2, 3]  # 좌, 우, 상, 하

def draw_one_arrow(self, col, row, policy):
    if col == 2 and row == 2:
        return

    if policy[0] > 0:  # up
        origin_x, origin_y = 50 + (UNIT * row), 10 + (UNIT * col)
        self.arrows.append(self.canvas.create_image(origin_x, origin_y,image=self.up))
    if policy[1] > 0:  # down
        origin_x, origin_y = 50 + (UNIT * row), 90 + (UNIT * col)
        self.arrows.append(self.canvas.create_image(origin_x, origin_y,image=self.down))
    if policy[2] > 0:  # left
        origin_x, origin_y = 10 + (UNIT * row), 50 + (UNIT * col)
        self.arrows.append(self.canvas.create_image(origin_x, origin_y,image=self.left))
    if policy[3] > 0:  # right
        origin_x, origin_y = 90 + (UNIT * row), 50 + (UNIT * col)
        self.arrows.append(self.canvas.create_image(origin_x, origin_y,image=self.right))

policy에서의 방향과 draw_one_arrow()에서의 sync가 맞지 않습니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant