update
This commit is contained in:
@@ -5,13 +5,16 @@ Author: John
|
|||||||
Email: johnjim0816@gmail.com
|
Email: johnjim0816@gmail.com
|
||||||
Date: 2020-09-11 23:03:00
|
Date: 2020-09-11 23:03:00
|
||||||
LastEditor: John
|
LastEditor: John
|
||||||
LastEditTime: 2021-03-26 17:16:07
|
LastEditTime: 2021-03-31 18:21:00
|
||||||
Discription:
|
Discription:
|
||||||
Environment:
|
Environment:
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import sys,os
|
import sys,os
|
||||||
sys.path.append(os.getcwd()) # 添加当前终端路径
|
curr_path = os.path.dirname(__file__)
|
||||||
|
parent_path=os.path.dirname(curr_path)
|
||||||
|
sys.path.append(parent_path) # add current terminal path to sys.path
|
||||||
|
|
||||||
import gym
|
import gym
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
@@ -20,16 +23,16 @@ from QLearning.agent import QLearning
|
|||||||
from common.plot import plot_rewards
|
from common.plot import plot_rewards
|
||||||
from common.utils import save_results
|
from common.utils import save_results
|
||||||
|
|
||||||
SEQUENCE = datetime.datetime.now().strftime("%Y%m%d-%H%M%S") # 获取当前时间
|
SEQUENCE = datetime.datetime.now().strftime("%Y%m%d-%H%M%S") # obtain current time
|
||||||
SAVED_MODEL_PATH = os.path.split(os.path.abspath(__file__))[0]+"/saved_model/"+SEQUENCE+'/' # 生成保存的模型路径
|
SAVED_MODEL_PATH = curr_path+"/saved_model/"+SEQUENCE+'/' # path to save model
|
||||||
if not os.path.exists(os.path.split(os.path.abspath(__file__))[0]+"/saved_model/"): # 检测是否存在文件夹
|
if not os.path.exists(curr_path+"/saved_model/"):
|
||||||
os.mkdir(os.path.split(os.path.abspath(__file__))[0]+"/saved_model/")
|
os.mkdir(curr_path+"/saved_model/")
|
||||||
if not os.path.exists(SAVED_MODEL_PATH): # 检测是否存在文件夹
|
if not os.path.exists(SAVED_MODEL_PATH):
|
||||||
os.mkdir(SAVED_MODEL_PATH)
|
os.mkdir(SAVED_MODEL_PATH)
|
||||||
RESULT_PATH = os.path.split(os.path.abspath(__file__))[0]+"/results/"+SEQUENCE+'/' # 存储reward的路径
|
RESULT_PATH = curr_path+"/results/"+SEQUENCE+'/' # path to save rewards
|
||||||
if not os.path.exists(os.path.split(os.path.abspath(__file__))[0]+"/results/"): # 检测是否存在文件夹
|
if not os.path.exists(curr_path+"/results/"):
|
||||||
os.mkdir(os.path.split(os.path.abspath(__file__))[0]+"/results/")
|
os.mkdir(curr_path+"/results/")
|
||||||
if not os.path.exists(RESULT_PATH): # 检测是否存在文件夹
|
if not os.path.exists(RESULT_PATH):
|
||||||
os.mkdir(RESULT_PATH)
|
os.mkdir(RESULT_PATH)
|
||||||
|
|
||||||
class QlearningConfig:
|
class QlearningConfig:
|
||||||
|
|||||||
Reference in New Issue
Block a user