env代码小调整

This commit is contained in:
weixin_46229132 2025-03-14 11:17:12 +08:00
parent dfec68e122
commit 4fdb8aa152
2 changed files with 7 additions and 3 deletions

8
env.py
View File

@ -36,9 +36,14 @@ class PartitionMazeEnv(gym.Env):
self.trans_energy_factor = params['trans_energy_factor']
self.battery_energy_capacity = params['battery_energy_capacity']
##############################
# 可能需要手动修改的超参数
##############################
self.CUT_NUM = 4 # 横切一半,竖切一半
self.BASE_LINE = 3500.0 # 基准时间通过greedy或者蒙特卡洛计算出来
self.phase = 0 # 阶段控制0区域划分阶段1迷宫初始化阶段2走迷宫阶段
self.partition_step = 0 # 区域划分阶段步数,范围 0~4
self.CUT_NUM = 6 # 横切一半,竖切一半
self.partition_values = np.zeros(
self.CUT_NUM, dtype=np.float32) # 存储 c₁, c₂, r₁, r₂
@ -61,7 +66,6 @@ class PartitionMazeEnv(gym.Env):
# 路径规划阶段相关变量
self.MAX_STEPS = 50 # 迷宫走法步数上限
self.BASE_LINE = 3500.0 # 基准时间通过greedy或者蒙特卡洛计算出来
self.step_count = 0
self.rectangles = {}
self.car_pos = [(self.H / 2, self.W / 2) for _ in range(self.num_cars)]

View File

@ -5,7 +5,7 @@ env = PartitionMazeEnv()
state = env.reset()
print(state)
action_series = [[0], [0], [0.5], [0], [0.1], [0.3]]
action_series = [[0], [0.3], [0], [0], [0.1], [0.7]]
for i in range(10):
action = action_series[i]