Skip to content

Commit

Permalink
[docs] dqn report
Browse files Browse the repository at this point in the history
  • Loading branch information
wbs2788 committed Nov 16, 2021
1 parent e62fb96 commit 34fa757
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 13 deletions.
11 changes: 5 additions & 6 deletions dqn/DQN.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,21 @@

# Tutorial sample #7: The Maze Decorator

import torch

import game
import train

try:
from malmo import MalmoPython
except:
import MalmoPython

import json
import os
import random
import sys
import time

import numpy as np
import torch

import game
import train

# from priority_dict import priorityDictionary as PQ

Expand Down
2 changes: 0 additions & 2 deletions dqn/game.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

import cv2
import numpy as np
import random
import time

class Env():
def __init__(self):
Expand Down
7 changes: 2 additions & 5 deletions dqn/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,17 @@
@author: godfp
"""

from game import Env
import time
import random
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import tqdm

#参数
BATCH_SIZE = 32
LR = 0.01 # 学习率
EPSILON = 0.9 # 最优选择动作百分比(有0.9的几率是最大选择,还有0.1是随机选择,增加网络能学到的Q值)
GAMMA = 0.9 # 奖励递减参数(衰减作用,如果没有奖励值r=0,则衰减Q值)
TARGET_REPLACE_ITER = 4 # Q 现实网络的更新频率100次循环更新一次
TARGET_REPLACE_ITER = 100 # Q 现实网络的更新频率100次循环更新一次
MEMORY_CAPACITY = 2000 # 记忆库大小
N_ACTIONS = 4 # 棋子的动作0,1,2,3
N_STATES = 1
Expand Down
Binary file added dqn/强化学习第三课作业实验报告.pdf
Binary file not shown.

0 comments on commit 34fa757

Please sign in to comment.