<s> import json <EOL> import os <EOL> import numpy as np <EOL> model_version = <NUM_LIT:2> <EOL> case_one = dict ( trials = <NUM_LIT> , <EOL> completed = <NUM_LIT:100> , <EOL> crashed = - <NUM_LIT:100> , <EOL> open = <NUM_LIT:1> , <EOL> alpha = <NUM_LIT> , <EOL> epsilon = <NUM_LIT> , <EOL> gamma = <NUM_LIT> , <EOL> nb_actions = <NUM_LIT:5> , <EOL> model = model_version , <EOL> epsilon_decay = <NUM_LIT> , <EOL> epsilon_action = <NUM_LIT> , <EOL> change_values = [ ] , <EOL> train = True ) <EOL> case_two = dict ( trials = <NUM_LIT> , <EOL> completed = <NUM_LIT:100> , <EOL> crashed = - <NUM_LIT:100> , <EOL> open = <NUM_LIT:1> , <EOL> alpha = <NUM_LIT> , <EOL> epsilon = <NUM_LIT> , <EOL> gamma = np . arange ( <NUM_LIT:0.1> , <NUM_LIT> , <NUM_LIT:0.1> ) , <EOL> nb_actions = <NUM_LIT:5> , <EOL> model = model_version , <EOL> epsilon_decay = <NUM_LIT> , <EOL> epsilon_action = <NUM_LIT> , <EOL> change_values = [ '<STR_LIT>' ] , <EOL> train = True ) <EOL> case_three = dict ( trials = <NUM_LIT:200> , <EOL> completed = <NUM_LIT> , <EOL> crashed = - <NUM_LIT:100> , <EOL> open = <NUM_LIT:5> , <EOL> alpha = np . arange ( <NUM_LIT:0.1> , <NUM_LIT> , <NUM_LIT:0.1> ) , <EOL> epsilon = <NUM_LIT> , <EOL> gamma = <NUM_LIT> , <EOL> nb_actions = <NUM_LIT:5> , <EOL> model = model_version , <EOL> epsilon_decay = <NUM_LIT> , <EOL> epsilon_action = <NUM_LIT> , <EOL> change_values = [ '<STR_LIT>' ] , <EOL> train = True ) <EOL> case_four = dict ( trials = <NUM_LIT> , <EOL> completed = <NUM_LIT:100> , <EOL> crashed = - <NUM_LIT:100> , <EOL> open = <NUM_LIT:1> , <EOL> alpha = <NUM_LIT> , <EOL> epsilon = np . arange ( <NUM_LIT:0.1> , <NUM_LIT> , <NUM_LIT:0.1> ) , <EOL> gamma = <NUM_LIT> , <EOL> nb_actions = <NUM_LIT:5> , <EOL> model = model_version , <EOL> epsilon_decay = <NUM_LIT> , <EOL> epsilon_action = <NUM_LIT> , <EOL> change_values = [ '<STR_LIT>' ] , <EOL> train = True ) <EOL> case_five = dict ( trials = <NUM_LIT> , <EOL> completed = np . arange ( <NUM_LIT:50> , <NUM_LIT> , <NUM_LIT:20> ) , <EOL> crashed = np . arange ( - <NUM_LIT:50> , - <NUM_LIT> , - <NUM_LIT:20> ) , <EOL> open = np . arange ( - <NUM_LIT:5> , <NUM_LIT:5> ) , <EOL> alpha = <NUM_LIT> , <EOL> epsilon = <NUM_LIT> , <EOL> gamma = <NUM_LIT> , <EOL> nb_actions = <NUM_LIT:5> , <EOL> model = model_version , <EOL> epsilon_decay = <NUM_LIT> , <EOL> epsilon_action = <NUM_LIT> , <EOL> change_values = [ '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ] , <EOL> train = True ) <EOL> case_lookup = dict ( case_one = case_one , <EOL> case_two = case_two , <EOL> case_three = case_three , <EOL> case_four = case_four , <EOL> case_five = case_five ) <EOL> def save_results ( case , settings , results ) : <EOL> """<STR_LIT>""" <EOL> f = open ( <EOL> os . path . join ( <EOL> os . getcwd ( ) , <EOL> '<STR_LIT>' , <EOL> case , <EOL> '<STR_LIT>' . format ( <EOL> settings [ '<STR_LIT>' ] ) + <EOL> '<STR_LIT>' ) , <EOL> '<STR_LIT:w>' ) . write ( <EOL> json . dumps ( results ) ) <EOL> def load_results ( directory , model ) : <EOL> """<STR_LIT>""" <EOL> return json . loads ( <EOL> open ( directory + '<STR_LIT>' . format ( model ) , '<STR_LIT:r>' ) . read ( ) ) <EOL> def check_files ( settings , case , value_iter ) : <EOL> """<STR_LIT>""" <EOL> name = '<STR_LIT>' . format ( <EOL> settings [ '<STR_LIT>' ] , <EOL> case . split ( '<STR_LIT:_>' ) [ <NUM_LIT:1> ] , <EOL> value_iter ) <EOL> path = os . path . join ( os . getcwd ( ) , '<STR_LIT>' , case ) + '<STR_LIT>' . format ( settings [ '<STR_LIT>' ] ) + '<STR_LIT>' <EOL> results_file = os . path . isfile ( path ) <EOL> if settings [ '<STR_LIT>' ] < <NUM_LIT:3> : <EOL> path = os . path . join ( <EOL> os . getcwd ( ) , '<STR_LIT>' , name + '<STR_LIT>' ) <EOL> model_saved = os . path . isfile ( path ) <EOL> else : <EOL> path = os . path . join ( <EOL> os . getcwd ( ) , <EOL> '<STR_LIT>' , <EOL> name + '<STR_LIT>' ) <EOL> model_saved = os . path . isfile ( path ) <EOL> if results_file and model_saved : <EOL> continue_on = True <EOL> else : <EOL> continue_on = False <EOL> return continue_on , name <EOL> def get_indicies ( data , ind = <NUM_LIT:0> ) : <EOL> """<STR_LIT>""" <EOL> if len ( data [ '<STR_LIT>' ] ) > <NUM_LIT:0> : <EOL> return <NUM_LIT:10> , get_settings ( data ) <EOL> else : <EOL> return <NUM_LIT:1> , data <EOL> def get_settings ( dictionary = None , ind = <NUM_LIT:0> ) : <EOL> """<STR_LIT>""" <EOL> new_dict = dictionary . copy ( ) <EOL> for each_value in dictionary [ '<STR_LIT>' ] : <EOL> new_dict [ each_value ] = dictionary [ each_value ] [ ind ] <EOL> return new_dict <EOL> results = dict ( time_chart = [ ] , <EOL> final_location = [ ] , <EOL> best_test = [ ] , <EOL> q_plot = [ ] , <EOL> model_names = [ ] , <EOL> q_matrix = [ ] , <EOL> paths = [ ] ) <EOL> t_array = [ ] <EOL> f_array = [ ] <EOL> b_array = [ ] <EOL> path = [ ] </s>
