# Purpose: Script containing Settings for the Model
#
#   Info: Change the Parameters at the top of the scrip to change how the Agent interacts
#
#   Developed as part of the Software Agents Course at City University
#
#   Dev: Dan Dixey and Enrico Lopedoto
#
#   Updated: 10/3/2016
#
import json
import os

import numpy as np

model_version = 3

# Case 1 - Default Evaluation
# Complete: 1, 2
case_one = dict(trials=500,
                completed=100,
                crashed=-100,
                open=1,
                alpha=0.75,
                epsilon=0.15,
                gamma=0.99,
                nb_actions=5,
                model=model_version,
                epsilon_decay=0.9,
                epsilon_action=6000,
                change_values=[],
                train=True)

# Case 2 - Change Gamma values
# Complete: 1, 2, 3
case_two = dict(trials=500,
                completed=100,
                crashed=-100,
                open=1,
                alpha=0.75,
                epsilon=0.15,
                gamma=np.arange(0.1, 1.1, 0.1),
                nb_actions=5,
                model=model_version,
                epsilon_decay=0.9,
                epsilon_action=6000,
                change_values=['gamma'],
                train=True)

# Case 3 - Change Learning Rates
# Complete: 1, 2
# Important to Note: DQN implementation does not use Alpha
case_three = dict(trials=200,
                  completed=500,
                  crashed=-100,
                  open=5,
                  alpha=np.arange(0.1, 1.1, 0.1),
                  epsilon=0.75,
                  gamma=0.7,
                  nb_actions=5,
                  model=model_version,
                  epsilon_decay=0.9,
                  epsilon_action=6000,
                  change_values=['alpha'],
                  train=True)

# Case 4 - Different policies (epsilon)
# Complete: 1, 2, 3
case_four = dict(trials=550,
                 completed=100,
                 crashed=-100,
                 open=1,
                 alpha=0.65,
                 epsilon=np.arange(0.1, 1.1, 0.1),
                 gamma=0.7,
                 nb_actions=5,
                 model=model_version,
                 epsilon_decay=0.9,
                 epsilon_action=6000,
                 change_values=['epsilon'],
                 train=True)

# Case 5 - different Reward functions
# Complete: 1, 2
case_five = dict(trials=550,
                 completed=np.arange(50, 235, 20),
                 crashed=np.arange(-50, -235, -20),
                 open=np.arange(-5, 5),
                 alpha=0.75,
                 epsilon=0.15,
                 gamma=0.7,
                 nb_actions=5,
                 model=model_version,
                 epsilon_decay=0.9,
                 epsilon_action=6000,
                 change_values=['completed',
                                'crashed',
                                'open'],
                 train=True)

# Case Dictionary
case_lookup = dict(case_one=case_one,
                   case_two=case_two,
                   case_three=case_three,
                   case_four=case_four,
                   case_five=case_five)


def save_results(case, settings, results):