heatz123 / Reinforcement-Learning-Gomoku

5 stars 0 forks source link

MCTS 구현 #4

Open heatz123 opened 2 years ago

heatz123 commented 2 years ago

https://colab.research.google.com/drive/1ToDfYzIjs_5EpMRKWfvHUhohTsaE7Iw-?usp=sharing

Self-Play로 학습 가능하도록 뉴럴넷/tree search 구현중 어느 정도 완료되면 코드에 병합할 예정

heatz123 commented 2 years ago

Todos

  1. 기존 Rule과 모델이 요구하는 Rule을 통합할 Class 생성
  2. Dirichlet noise, temperature, c_puct 부여
  3. 코드 내의 canonical board state와 string representation of board state 구분
heatz123 commented 2 years ago

지금까지 구현한 점

MCTS: Neural net이 주어지고, Game Rule을 모두 알고 있다면, search를 num_MCTS번 할 시 policy(pi)를 구할 수 있다.

MCTS에는 내부적으로 N, P, W, Q, V, E가 있다. N: 방문수 P: 방문 확률 (Neural net output) W: sum of values of child Q: value (W / N) E: isGameEnded. 1이면 플레이어 win, -1이면 플레이어 lose, 1e-4이면 draw, 0이면 게임 진행중 모든 type은 np.array (E 제외)

pi = N(s,a) / sum over a of N(s,a) (10수 전까지) 또는 pi = N(s,a)의 최대값 index만 1이고 나머진 0인 one-hot vector

구현할 점

heatz123 commented 2 years ago