import numpy as np

# =======================================
# A3C模型相关
# 线程数
WORKERS = 21
# 学习率
LR = 0.00008
# 衰减权重gamma
G = 0.98
# loss中entropy所占比例
ENTROPY_WEIGHT = 0.01
# gae参数T
T = 1.00
M = 10000
# 最大episode长度
NS = 360
# 优化器
SO = True
OPT = 'Adam'
# 随机种子
seed = 42

# =======================================
# 强化学习参数
# 奖励表
reward_table = {
    'abs_0_5': 0.1,
    'abs_5_10': -0.01,
    'abs_10_15': -0.03,
    'abs_15_20': -0.06,
    'abs_20': -0.1,
}

# =======================================
# 水力学模型相关
# 常量
# action类型
DENSE = 'DENSE'

# 分水模式
STABLE = 'STABLE'
UNSTABLE = 'UNSTABLE'

INPUT_SINGLE_UP = '_SINGLE_UP'
INPUT_SINGLE_DOWN = '_SINGLE_DOWN'
INPUT_BOUNDARY_UP = '_BOUNDARY_UP'
INPUT_BOUNDARY_DOWN = '_BOUNDARY_DOWN'
INPUT_NORMAL = ''

# 参量
LOG_TAG = 'U.sw_D.ll.60gates'
NUM_GATE = 5
START_GATE = 48
# 是否加入水位差20cm的限制
END_STATE_2_CONSTRAINT = False

WARM_UP_LOG = False
WARM_UP_STEP = 10
SAVE_WARM_UP_LOG = False  # deprecated

# action列表类型
ACTION_MODE = DENSE

# 分水表的未来几步作为特征
INLET_FORWARD_LENGTH = 1

# 分水模式 非稳态计划还是稳态扰动
INLET_MODE = UNSTABLE

INLET_DISTURBANCE = True  # 是否设置分水扰动
# 分退水扰动因子(百分比)
DISTURBANCE_FACTOR = np.array([
    ['T42-滹沱河退水闸', 0],
    ['F63-永安分水口', 100],
    ['T43-磁河古道退水闸', 0],
    ['F64-西名分水口', 100],
    ['T44-沙河(北)退水闸', 0],
    ['F65-留营分水口', 100],
    ['F66-中管头分水口', 100],
    ['T45-唐河退水闸', 0],
])[:, 1].astype(np.int).tolist()
# 分退水扰动因子(百分比)
# DISTURBANCE_FACTOR = np.array([
#     ['F1-肖楼分水口', 10],
#     ['T1-刁河退水闸', 0],
#     ['F2-望城岗分水口', 50],
#     ['T2-湍河退水闸', 0],
#     ['F3-彭家分水口', 0],
#     ['T3-严陵河退水闸', 0],
#     ['F4-谭寨分水口', 50],
#     ['T4-潦河退水闸', 0],
#     ['F5-姜沟分水口', 0],
#     ['F6-田洼分水口', 0],
#     ['F7-大寨分水口', 51],
#     ['T5-白河退水闸', 0],
#     ['F8-半坡店分水口', 50],
#     ['T6-清河退水闸', 0],
#     ['F9-大营分水口', 0],
#     ['F10-十里庙分水口', 0],
#     ['T7-贾河退水闸', 0],
#     ['F11-辛庄分水口', 50],
#     ['T8-澧河退水闸', 0],
#     ['T9-澎河退水闸', 0],
#     ['F12-澎河分水口', 0],
#     ['T10-沙河退水闸', 0],
#     ['F13-张村分水口', 0],
#     ['F14-马庄分水口', 0],
#     ['F15-高庄分水口', 50],
#     ['T11-北汝河退水闸', 0],
#     ['F16-赵庄分水口', 51],
#     ['T12兰河退水闸', 0],
#     ['F17-宴窑分水口', 50],
#     ['F18-任坡分水口', 50],
#     ['T13-颖河退水闸', 0],
#     ['F19-孟坡分水口', 50],
#     ['F20-洼李分水口', 51],
#     ['T14-沂水河退水闸', 0],
#     ['T15-双洎河退水闸', 0],
#     ['F21-李垌分水口', 50],
#     ['F22-小河刘分水口', 50],
#     ['T16-十八里河退水闸', 0],
#     ['F23-刘湾分水口', 29],
#     ['F24-密垌分水口', 0],
#     ['T17-贾峪河退水闸', 0],
#     ['F25-中原西路分水口', 20],
#     ['F26-前蒋寨分水口', 50],
#     ['T18-索河退水闸', 0],
#     ['F27-上街分水口', 0],
#     ['T19-黄河退水闸', 0],
#     ['F28-北冷分水口', 50],
#     ['F29-北石涧分水口', 51],
#     ['F30-府城分水口', 0],
#     ['T20-闫河退水闸', 0],
#     ['T21-李河退水闸', 0],
#     ['F31-苏蔺分水口', 50],
#     ['T22-溃城寨河退水闸', 0],
#     ['F32-白庄分水口', 0],
#     ['F33-郭屯分水口', 52],
#     ['T23-峪河退水闸', 0],
#     ['T24-黄水河支退水闸', 0],
#     ['F34-路固分水口', 0],
#     ['T25-孟坟河退水闸', 0],
#     ['F35-老道井分水口', 50],
#     ['F36-温寺门分水口', 50],
#     ['T26-香泉河退水闸', 0],
#     ['F37-袁庄分水口', 51],
#     ['F38-三里屯分水口', 19],
#     ['T27-淇河退水闸', 0],
#     ['F39-鹤壁刘庄分水口', 50],
#     ['F40-董庄分水口', 50],
#     ['T28-汤河退水闸', 0],
#     ['F41-小营分水口', 50],
#     ['F42-南流寺分水口', 0],
#     ['T29-安阳河退水闸', 0],
#     ['T30-漳河退水闸', 0],
#     ['FF-民有渠分水口', 0],
#     ['T31-滏阳河退水闸', 0],
#     ['F43-于家店分水口', 0],
#     ['T32-牤牛河南支退水闸', 0],
#     ['F44-白村分水口', 50],
#     ['F45-下庄分水口', 50],
#     ['F46-郭河分水口', 0],
#     ['T33-沁河退水闸', 0],
#     ['F47-三陵分水口', 0],
#     ['F48-吴庄分水口', 50],
#     ['T34-洺河退水闸', 0],
#     ['F49-赞善分水口', 50],
#     ['F50-邓家庄分水口', 0],
#     ['T35-七里河退水闸', 0],
#     ['F51-南大郭分水口', 0],
#     ['T36-白马河退水闸', 0],
#     ['F52-刘家庄分水口', 0],
#     ['T37-李阳河退水闸', 0],
#     ['T38-泜河退水闸', 0],
#     ['F53-北盘石分水口', 0],
#     ['F54-黑沙村分水口', 51],
#     ['T39-午河退水闸', 0],
#     ['F55-泲河分水口', 0],
#     ['F56-北马分水口', 0],
#     ['T40-槐河(一)退水闸', 0],
#     ['F57-赵同分水口', 0],
#     ['F58-万年分水口', 50],
#     ['T41-洨河退水闸', 0],
#     ['F59+F60-上庄分水口+新增', 50],
#     ['F61-南新城分水口', 50],
#     ['F62-田庄分水口', 10],
#     ['T42-滹沱河退水闸', 0],
#     ['F63-永安分水口', 50],
#     ['T43-磁河古道退水闸', 0],
#     ['F64-西名分水口', 50],
#     ['T44-沙河(北)退水闸', 0],
#     ['F65-留营分水口', 50],
#     ['F66-中管头分水口', 50],
#     ['T45-唐河退水闸', 0],
#     ['F67-大寺城涧分水口', 51],
#     ['F68-高昌分水口', 50],
#     ['T46-曲逆中支退水闸', 0],
#     ['F69-塔坡分水口', 60],
#     ['T47-蒲阳河退水闸', 0],
#     ['T48-界河退水闸', 0],
#     ['F70-郑家佐分水口', 51],
#     ['T49-漕河退水闸', 0],
#     ['F71-徐水刘庄分水口', 0],
#     ['F86-F97-西黑山分水口', 3],
#     ['T50-瀑河退水闸', 0],
#     ['F72-荆柯山分水口', 50],
#     ['T51-北易水退水闸', 0],
#     ['F73-下车亭分水口', 50],
#     ['T52-水北沟退水闸', 0],
#     ['F74-三岔沟分水口', 50],
#     ['T53-北拒马退水闸', 0],
# ])[:, 1].astype(np.int).tolist()

WORKING_CONDITION = INPUT_NORMAL  # inputfile 类型

# TODO STABLE_BASE_INLET换成变化量表示; 所有的分水,包括下游边界全部从inlet中读取
# TODO COM-ELEMENT是在预热之前还是之后改?
# TODO 预热过程的分退水值从哪里读取?

# TODO 通过水力学模型的多步计算把预热过程解决掉

80a8e7eb71379a09ab738acd4bd9c59a875f2f13
<mask token>

<mask token>
WORKERS = 21
LR = 8e-05
G = 0.98
ENTROPY_WEIGHT = 0.01
T = 1.0
M = 10000
NS = 360
SO = True
OPT = 'Adam'
seed = 42
reward_table = {'abs_0_5': 0.1, 'abs_5_10': -0.01, 'abs_10_15': -0.03,
    'abs_15_20': -0.06, 'abs_20': -0.1}
DENSE = 'DENSE'
STABLE = 'STABLE'
UNSTABLE = 'UNSTABLE'
INPUT_SINGLE_UP = '_SINGLE_UP'
INPUT_SINGLE_DOWN = '_SINGLE_DOWN'
INPUT_BOUNDARY_UP = '_BOUNDARY_UP'
INPUT_BOUNDARY_DOWN = '_BOUNDARY_DOWN'
INPUT_NORMAL = ''
LOG_TAG = 'U.sw_D.ll.60gates'
NUM_GATE = 5
START_GATE = 48
END_STATE_2_CONSTRAINT = False
WARM_UP_LOG = False
WARM_UP_STEP = 10
SAVE_WARM_UP_LOG = False
ACTION_MODE = DENSE
INLET_FORWARD_LENGTH = 1
INLET_MODE = UNSTABLE
INLET_DISTURBANCE = True
DISTURBANCE_FACTOR = np.array([['T42-滹沱河退水闸', 0], ['F63-永安分水口', 100], [
    'T43-磁河古道退水闸', 0], ['F64-西名分水口', 100], ['T44-沙河(北)退水闸', 0], [
    'F65-留营分水口', 100], ['F66-中管头分水口', 100], ['T45-唐河退水闸', 0]])[:, 1].astype(np
    .int).tolist()
WORKING_CONDITION = INPUT_NORMAL

import numpy as np
WORKERS = 21
LR = 8e-05
G = 0.98
ENTROPY_WEIGHT = 0.01
T = 1.0
M = 10000
NS = 360
SO = True
OPT = 'Adam'
seed = 42
reward_table = {'abs_0_5': 0.1, 'abs_5_10': -0.01, 'abs_10_15': -0.03,
    'abs_15_20': -0.06, 'abs_20': -0.1}
DENSE = 'DENSE'
STABLE = 'STABLE'
UNSTABLE = 'UNSTABLE'
INPUT_SINGLE_UP = '_SINGLE_UP'
INPUT_SINGLE_DOWN = '_SINGLE_DOWN'
INPUT_BOUNDARY_UP = '_BOUNDARY_UP'
INPUT_BOUNDARY_DOWN = '_BOUNDARY_DOWN'
INPUT_NORMAL = ''
LOG_TAG = 'U.sw_D.ll.60gates'
NUM_GATE = 5
START_GATE = 48
END_STATE_2_CONSTRAINT = False
WARM_UP_LOG = False
WARM_UP_STEP = 10
SAVE_WARM_UP_LOG = False
ACTION_MODE = DENSE
INLET_FORWARD_LENGTH = 1
INLET_MODE = UNSTABLE
INLET_DISTURBANCE = True
DISTURBANCE_FACTOR = np.array([['T42-滹沱河退水闸', 0], ['F63-永安分水口', 100], [
    'T43-磁河古道退水闸', 0], ['F64-西名分水口', 100], ['T44-沙河(北)退水闸', 0], [
    'F65-留营分水口', 100], ['F66-中管头分水口', 100], ['T45-唐河退水闸', 0]])[:, 1].astype(np
    .int).tolist()
WORKING_CONDITION = INPUT_NORMAL

import numpy as np

# =======================================
# A3C模型相关
# 线程数
WORKERS = 21
# 学习率
LR = 0.00008
# 衰减权重gamma
G = 0.98
# loss中entropy所占比例
ENTROPY_WEIGHT = 0.01
# gae参数T
T = 1.00
M = 10000
# 最大episode长度
NS = 360
# 优化器
SO = True
OPT = 'Adam'
# 随机种子
seed = 42

# =======================================
# 强化学习参数
# 奖励表
reward_table = {
    'abs_0_5': 0.1,
    'abs_5_10': -0.01,
    'abs_10_15': -0.03,
    'abs_15_20': -0.06,
    'abs_20': -0.1,
}

# =======================================
# 水力学模型相关
# 常量
# action类型
DENSE = 'DENSE'

# 分水模式
STABLE = 'STABLE'
UNSTABLE = 'UNSTABLE'

INPUT_SINGLE_UP = '_SINGLE_UP'
INPUT_SINGLE_DOWN = '_SINGLE_DOWN'
INPUT_BOUNDARY_UP = '_BOUNDARY_UP'
INPUT_BOUNDARY_DOWN = '_BOUNDARY_DOWN'
INPUT_NORMAL = ''

# 参量
LOG_TAG = 'U.sw_D.ll.60gates'
NUM_GATE = 5
START_GATE = 48
# 是否加入水位差20cm的限制
END_STATE_2_CONSTRAINT = False

WARM_UP_LOG = False
WARM_UP_STEP = 10
SAVE_WARM_UP_LOG = False  # deprecated

# action列表类型
ACTION_MODE = DENSE

# 分水表的未来几步作为特征
INLET_FORWARD_LENGTH = 1

# 分水模式 非稳态计划还是稳态扰动
INLET_MODE = UNSTABLE

INLET_DISTURBANCE = True  # 是否设置分水扰动
# 分退水扰动因子(百分比)
DISTURBANCE_FACTOR = np.array([
    ['T42-滹沱河退水闸', 0],
    ['F63-永安分水口', 100],
    ['T43-磁河古道退水闸', 0],
    ['F64-西名分水口', 100],
    ['T44-沙河(北)退水闸', 0],
    ['F65-留营分水口', 100],
    ['F66-中管头分水口', 100],
    ['T45-唐河退水闸', 0],
])[:, 1].astype(np.int).tolist()
# 分退水扰动因子(百分比)
# DISTURBANCE_FACTOR = np.array([
#     ['F1-肖楼分水口', 10],
#     ['T1-刁河退水闸', 0],
#     ['F2-望城岗分水口', 50],
#     ['T2-湍河退水闸', 0],
#     ['F3-彭家分水口', 0],
#     ['T3-严陵河退水闸', 0],
#     ['F4-谭寨分水口', 50],
#     ['T4-潦河退水闸', 0],
#     ['F5-姜沟分水口', 0],
#     ['F6-田洼分水口', 0],
#     ['F7-大寨分水口', 51],
#     ['T5-白河退水闸', 0],
#     ['F8-半坡店分水口', 50],
#     ['T6-清河退水闸', 0],
#     ['F9-大营分水口', 0],
#     ['F10-十里庙分水口', 0],
#     ['T7-贾河退水闸', 0],
#     ['F11-辛庄分水口', 50],
#     ['T8-澧河退水闸', 0],
#     ['T9-澎河退水闸', 0],
#     ['F12-澎河分水口', 0],
#     ['T10-沙河退水闸', 0],
#     ['F13-张村分水口', 0],
#     ['F14-马庄分水口', 0],
#     ['F15-高庄分水口', 50],
#     ['T11-北汝河退水闸', 0],
#     ['F16-赵庄分水口', 51],
#     ['T12兰河退水闸', 0],
#     ['F17-宴窑分水口', 50],
#     ['F18-任坡分水口', 50],
#     ['T13-颖河退水闸', 0],
#     ['F19-孟坡分水口', 50],
#     ['F20-洼李分水口', 51],
#     ['T14-沂水河退水闸', 0],
#     ['T15-双洎河退水闸', 0],
#     ['F21-李垌分水口', 50],
#     ['F22-小河刘分水口', 50],
#     ['T16-十八里河退水闸', 0],
#     ['F23-刘湾分水口', 29],
#     ['F24-密垌分水口', 0],
#     ['T17-贾峪河退水闸', 0],
#     ['F25-中原西路分水口', 20],
#     ['F26-前蒋寨分水口', 50],
#     ['T18-索河退水闸', 0],
#     ['F27-上街分水口', 0],
#     ['T19-黄河退水闸', 0],
#     ['F28-北冷分水口', 50],
#     ['F29-北石涧分水口', 51],
#     ['F30-府城分水口', 0],
#     ['T20-闫河退水闸', 0],
#     ['T21-李河退水闸', 0],
#     ['F31-苏蔺分水口', 50],
#     ['T22-溃城寨河退水闸', 0],
#     ['F32-白庄分水口', 0],
#     ['F33-郭屯分水口', 52],
#     ['T23-峪河退水闸', 0],
#     ['T24-黄水河支退水闸', 0],
#     ['F34-路固分水口', 0],
#     ['T25-孟坟河退水闸', 0],
#     ['F35-老道井分水口', 50],
#     ['F36-温寺门分水口', 50],
#     ['T26-香泉河退水闸', 0],
#     ['F37-袁庄分水口', 51],
#     ['F38-三里屯分水口', 19],
#     ['T27-淇河退水闸', 0],
#     ['F39-鹤壁刘庄分水口', 50],
#     ['F40-董庄分水口', 50],
#     ['T28-汤河退水闸', 0],
#     ['F41-小营分水口', 50],
#     ['F42-南流寺分水口', 0],
#     ['T29-安阳河退水闸', 0],
#     ['T30-漳河退水闸', 0],
#     ['FF-民有渠分水口', 0],
#     ['T31-滏阳河退水闸', 0],
#     ['F43-于家店分水口', 0],
#     ['T32-牤牛河南支退水闸', 0],
#     ['F44-白村分水口', 50],
#     ['F45-下庄分水口', 50],
#     ['F46-郭河分水口', 0],
#     ['T33-沁河退水闸', 0],
#     ['F47-三陵分水口', 0],
#     ['F48-吴庄分水口', 50],
#     ['T34-洺河退水闸', 0],
#     ['F49-赞善分水口', 50],
#     ['F50-邓家庄分水口', 0],
#     ['T35-七里河退水闸', 0],
#     ['F51-南大郭分水口', 0],
#     ['T36-白马河退水闸', 0],
#     ['F52-刘家庄分水口', 0],
#     ['T37-李阳河退水闸', 0],
#     ['T38-泜河退水闸', 0],
#     ['F53-北盘石分水口', 0],
#     ['F54-黑沙村分水口', 51],
#     ['T39-午河退水闸', 0],
#     ['F55-泲河分水口', 0],
#     ['F56-北马分水口', 0],
#     ['T40-槐河(一)退水闸', 0],
#     ['F57-赵同分水口', 0],
#     ['F58-万年分水口', 50],
#     ['T41-洨河退水闸', 0],
#     ['F59+F60-上庄分水口+新增', 50],
#     ['F61-南新城分水口', 50],
#     ['F62-田庄分水口', 10],
#     ['T42-滹沱河退水闸', 0],
#     ['F63-永安分水口', 50],
#     ['T43-磁河古道退水闸', 0],
#     ['F64-西名分水口', 50],
#     ['T44-沙河(北)退水闸', 0],
#     ['F65-留营分水口', 50],
#     ['F66-中管头分水口', 50],
#     ['T45-唐河退水闸', 0],
#     ['F67-大寺城涧分水口', 51],
#     ['F68-高昌分水口', 50],
#     ['T46-曲逆中支退水闸', 0],
#     ['F69-塔坡分水口', 60],
#     ['T47-蒲阳河退水闸', 0],
#     ['T48-界河退水闸', 0],
#     ['F70-郑家佐分水口', 51],
#     ['T49-漕河退水闸', 0],
#     ['F71-徐水刘庄分水口', 0],
#     ['F86-F97-西黑山分水口', 3],
#     ['T50-瀑河退水闸', 0],
#     ['F72-荆柯山分水口', 50],
#     ['T51-北易水退水闸', 0],
#     ['F73-下车亭分水口', 50],
#     ['T52-水北沟退水闸', 0],
#     ['F74-三岔沟分水口', 50],
#     ['T53-北拒马退水闸', 0],
# ])[:, 1].astype(np.int).tolist()

WORKING_CONDITION = INPUT_NORMAL  # inputfile 类型

# TODO STABLE_BASE_INLET换成变化量表示; 所有的分水,包括下游边界全部从inlet中读取
# TODO COM-ELEMENT是在预热之前还是之后改?
# TODO 预热过程的分退水值从哪里读取?

# TODO 通过水力学模型的多步计算把预热过程解决掉
