import numpy as np

""" Choose camera """
CAMERA = "Scene"  # "Scene" or "Truck"

""" Print summaries of models """
PRINT_SUMMARIES = True

""" Random Start and Spot"""
WHOLE_FIELD_X = [-25, 69]
WHOLE_FIELD_Y = [1, 70]
START_ANGLE_RANGE = [0, 359]
TRUCK_DIMENSIONS = [4.75, 1.5, -14.5, -1.5]

""" POSITION SIZE OF WINDOW """
WINDOW_X_POS = 0
WINDOW_Y_POS = 32
WINDOW_X_SIZE = 1500
WINDOW_Y_SIZE = 750

""" ACTION AND STATES SPACE """
LOWER_BOUND = -1.0
UPPER_BOUND = 1.0
NUM_OF_ACTIONS = 2
NUM_OF_STATES = 21

""" General Hyperparameters"""
TOTAL_EPISODES = 1_500
TOTAL_STEPS_PER_EPISODE = 800
AGGREGATE_STATS_PER = 3
AVE_SCORE_AFTER_EP = 30
AVE_SCORE_LAST_EP = 30
SAVE_MODEL_PER = 50
SAVE_RECORDING_PER = 20
MAX_DIFFICULTY_EPISODE = 1_500

""" TD3 Hyperparameters """
ALPHA = 0.001
BETA = 0.001
TAU = 0.005
GAMMA = 0.99
UPDATE_ACTOR_INTERVAL = 2
WARMUP = 1000
MAX_MEM_SIZE = 50_000
BATCH_SIZE = 100
NOISE = 0.3

ACTOR_HIDDEN_LAYERS = [128, 256, 128]
CRITIC_1_HIDDEN_LAYERS = [128, 256, 128]
CRITIC_2_HIDDEN_LAYERS = [128, 256, 128]
TD3_ACTOR_HIDDEN_ACTIVATION = 'relu'
TD3_ACTOR_OUTPUT_ACTIVATION = 'tanh'
TD3_CRITIC_HIDDEN_ACTIVATION = 'relu'

KERNEL_INITIALIZATION_MINVAL = -0.0004
KERNEL_INITIALIZATION_MAXVAL = 0.0004

MAX_EPSILON = 1
MIN_EPSILON = 0.05
total_steps = TOTAL_EPISODES * TOTAL_STEPS_PER_EPISODE
STEPS_FOR_MIN_EPSILON = -total_steps/np.log(MIN_EPSILON/MAX_EPSILON)

""" REWARDS VARIABLES """
JACKKNIFE_ANGLE = np.deg2rad(90)
ANGLE_PHI_RANGE = np.deg2rad(5)
COLLISION_PUNISH = -1
JACK_KNIFE_PUNISHMENT = -1
LOW_ANGLE_REWARD = 0.8
SPEED_REWARD = 0.005
CLOSE_DISTANCE_REWARD = 0.05

""" DDPG HYPERPARAMETERS"""
# # Training Parameters
# SHOW_EVERY = 20
# AGGREGATE_STATS_EVERY = 1
# SAVE_MODEL_PER = 30
# NUM_EPISODE_MEAN = 40
# # MIN_REWARD = 0
# MODEL_NAME = 'truck'
# # Buffer
# BUFFER_CAPACITY = 100000
# BATCH_SIZE = 64
#
# # Discount factor for future rewards
# GAMMA = 0.99
#
# # Used to update target networks
# TAU = 0.001
#
# # Learning rate for actor-critic models
# CRITIC_LR = 0.001 #was .002
# ACTOR_LR = 0.0001 #was .001
#
# HIDDEN_LAYERS_ACTOR = [256, 128, 128]
# ACTOR_ACTIVATION = "relu"
# HIDDEN_LAYERS_CRITIC = [[], [], [256, 128, 64]]  # [150, 250, 150, 50]]
# CRITIC_ACTIVATION = "relu"
# OUTPUT_ACTIVATION = "tanh"
#
# KERNEL_INITIALIZATION_MINVAL = -0.0001
# KERNEL_INITIALIZATION_MAXVAL = 0.0001
#
# NOISE_STD = 0.2 # 0.3
# BIG_NOISE_STD = 0.5
# NOISE_THETA = 0.15
# NOISE_DT = 1e-2


