dqn跑通一个场景

This commit is contained in:
weixin_46229132 2025-04-03 14:20:27 +08:00
parent 0be9fa596a
commit adaf8cc50e
4 changed files with 9 additions and 9 deletions

View File

@ -13,12 +13,12 @@ print('state:', state)
# action_series = [1] * 30
# action_series = [[0.2], [0.4], [0.7], [0.5]]
# action_series = [[-0.08], [-0.08], [0], [0]]
action_series = [3, 5, 3, 5, 3, 5, 3, 5, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4,
3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4]
action_series = [3, 5, 3, 5, 1, 1, 3, 5, 1, 5, 3, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1,
2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1]
for i in range(100):
action = action_series[i]
state, reward, done, info, _ = env.step(action)
state, reward, done, _, info = env.step(action)
print('state:', state)
print('reward:', reward)
if done:

View File

@ -12,7 +12,7 @@ random.seed(42)
# ---------------------------
# 需要修改的超参数
# ---------------------------
num_iterations = 300000000
num_iterations = 10000000000
# 随机生成分区的行分段数与列分段数
R = random.randint(0, 3) # 行分段数
C = random.randint(0, 3) # 列分段数

View File

@ -1,10 +1,10 @@
{
"best_time": 8848.626166217664,
"best_time": 8820.015746422654,
"row_cuts": [
0,
0.2700000000000001,
0.2900000000000001,
0.4700000000000001,
0.76,
0.77,
1
],
"col_cuts": [
@ -26,5 +26,5 @@
6,
0
],
"timestamp": "2025-04-01 20:05:51"
"timestamp": "2025-04-03 10:58:44"
}

View File

@ -200,7 +200,7 @@ if __name__ == "__main__":
# 需要修改的超参数
# ---------------------------
params_file = 'params_50_50_3'
solution_file = r'solutions\finetune_params_50_50_3.json'
solution_file = r'solutions\dqn_params_50_50_3_2.json'
with open(params_file + '.yml', 'r', encoding='utf-8') as file:
params = yaml.safe_load(file)