Merge branch 'master' of github.com:datawhalechina/easy-rl
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 55 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 42 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 47 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 41 KiB |
@@ -5,7 +5,7 @@ Author: John
|
|||||||
Email: johnjim0816@gmail.com
|
Email: johnjim0816@gmail.com
|
||||||
Date: 2021-03-11 17:59:16
|
Date: 2021-03-11 17:59:16
|
||||||
LastEditor: John
|
LastEditor: John
|
||||||
LastEditTime: 2021-07-14 17:27:40
|
LastEditTime: 2021-07-15 08:52:59
|
||||||
Discription:
|
Discription:
|
||||||
Environment:
|
Environment:
|
||||||
'''
|
'''
|
||||||
@@ -52,14 +52,15 @@ def train(cfg,env,agent):
|
|||||||
# An episode is an array of (state, action, reward) tuples
|
# An episode is an array of (state, action, reward) tuples
|
||||||
state = env.reset()
|
state = env.reset()
|
||||||
ep_reward = 0
|
ep_reward = 0
|
||||||
|
action = agent.choose_action(state)
|
||||||
while True:
|
while True:
|
||||||
# for t in range(cfg.n_steps):
|
# for t in range(cfg.n_steps):
|
||||||
action = agent.choose_action(state)
|
|
||||||
next_state, reward, done = env.step(action)
|
next_state, reward, done = env.step(action)
|
||||||
ep_reward+=reward
|
ep_reward+=reward
|
||||||
next_action = agent.choose_action(next_state)
|
next_action = agent.choose_action(next_state)
|
||||||
agent.update(state, action, reward, next_state, next_action,done)
|
agent.update(state, action, reward, next_state, next_action,done)
|
||||||
state = next_state
|
state = next_state
|
||||||
|
action = next_action
|
||||||
if done:
|
if done:
|
||||||
break
|
break
|
||||||
if ma_rewards:
|
if ma_rewards:
|
||||||
|
|||||||
Reference in New Issue
Block a user