From f05f8400fbe57243f8f0813f4bd98e127028e974 Mon Sep 17 00:00:00 2001 From: along Date: Sat, 29 Mar 2025 12:00:26 +0800 Subject: [PATCH] =?UTF-8?q?ddpg=E6=B1=82=E8=A7=A3env=5Fpart?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DDPG_solver/main.py | 10 +++++----- env_partion.py | 9 +++++---- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/DDPG_solver/main.py b/DDPG_solver/main.py index c1fdd6e..3b137c0 100644 --- a/DDPG_solver/main.py +++ b/DDPG_solver/main.py @@ -9,7 +9,7 @@ import torch import sys import os sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) -from env import PartitionMazeEnv +from env_partion import PartitionEnv # fmt: on '''Hyperparameter Setting''' @@ -54,16 +54,16 @@ print(opt) def main(): - EnvName = ['PartitionMaze_DDPG', 'Pendulum-v1', 'LunarLanderContinuous-v2', 'Humanoid-v4', + EnvName = ['Partition_DDPG', 'Pendulum-v1', 'LunarLanderContinuous-v2', 'Humanoid-v4', 'HalfCheetah-v4', 'BipedalWalker-v3', 'BipedalWalkerHardcore-v3'] - BrifEnvName = ['PM_DDPG', 'PV1', 'LLdV2', + BrifEnvName = ['Part_DDPG', 'PV1', 'LLdV2', 'Humanv4', 'HCv4', 'BWv3', 'BWHv3'] # Build Env # env = gym.make(EnvName[opt.EnvIdex], render_mode = "human" if opt.render else None) - env = PartitionMazeEnv() + env = PartitionEnv() # eval_env = gym.make(EnvName[opt.EnvIdex]) - eval_env = PartitionMazeEnv() + eval_env = PartitionEnv() opt.state_dim = env.observation_space.shape[0] opt.action_dim = env.action_space.shape[0] # remark: action space【-max,max】 diff --git a/env_partion.py b/env_partion.py index a5ac212..65b20d3 100644 --- a/env_partion.py +++ b/env_partion.py @@ -18,11 +18,11 @@ class PartitionEnv(gym.Env): ############################## # 可能需要手动修改的超参数 ############################## - self.params = 'params3' - self.CUT_NUM = 2 - self.ROW_CUT_LIMIT = 1 + self.params = 'params2' + self.CUT_NUM = 4 + self.ROW_CUT_LIMIT = 3 self.COL_CUT_LIMIT = 1 - self.BASE_LINE = 5000 + self.BASE_LINE = 10000 self.mTSP_STEPS = 10000 # 车队参数设置 @@ -176,6 +176,7 @@ class PartitionEnv(gym.Env): # print(best_path) reward += self.BASE_LINE - best_time + print(reward) return state, reward, True, False, best_path