小改ddpg main

This commit is contained in:
weixin_46229132 2025-03-18 14:45:50 +08:00
parent b3812a3193
commit 55e45fe14e

View File

@ -1,3 +1,4 @@
from env import PartitionMazeEnv
from utils import str2bool, evaluate_policy from utils import str2bool, evaluate_policy
from datetime import datetime from datetime import datetime
from DDPG import DDPG_agent from DDPG import DDPG_agent
@ -6,9 +7,9 @@ import os
import shutil import shutil
import argparse import argparse
import torch import torch
import sys import sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from env import PartitionMazeEnv
'''Hyperparameter Setting''' '''Hyperparameter Setting'''
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
@ -52,9 +53,10 @@ print(opt)
def main(): def main():
EnvName = ['Pendulum-v1', 'LunarLanderContinuous-v2', 'Humanoid-v4', EnvName = ['PartitionMaze_DDPG', 'Pendulum-v1', 'LunarLanderContinuous-v2', 'Humanoid-v4',
'HalfCheetah-v4', 'BipedalWalker-v3', 'BipedalWalkerHardcore-v3'] 'HalfCheetah-v4', 'BipedalWalker-v3', 'BipedalWalkerHardcore-v3']
BrifEnvName = ['PV1', 'LLdV2', 'Humanv4', 'HCv4', 'BWv3', 'BWHv3'] BrifEnvName = ['PM_DDPG', 'PV1', 'LLdV2',
'Humanv4', 'HCv4', 'BWv3', 'BWHv3']
# Build Env # Build Env
# env = gym.make(EnvName[opt.EnvIdex], render_mode = "human" if opt.render else None) # env = gym.make(EnvName[opt.EnvIdex], render_mode = "human" if opt.render else None)