def __init__(self, action_space, action_space_directory): BaseAgent.__init__(self, action_space=action_space) self.actions62 = np.load(os.path.join(action_space_directory, 'actions62.npy')) self.actions146 = np.load(os.path.join(action_space_directory, 'actions146.npy'))
def __init__(self, action_space): """Initialize a new agent.""" BaseAgent.__init__(self, action_space=action_space)
def __init__(self, action_space): BaseAgent.__init__(self, action_space)
def __init__(self, *args, **kwargs): BaseAgent.__init__(self, *args, **kwargs)
def __init__(self, action_space): BaseAgent.__init__(self, action_space=action_space) self.simulate_times = 0 unitary_action_model = UnitaryActionModel() algorithm = ES(unitary_action_model) self.unitary_es_agent = UnitaryESAgent(algorithm) combined_actions_model_1 = CombinedActionsModel() combined_actions_model_2 = CombinedActionsModel() ensemble_algorithm = EnsembleES(combined_actions_model_1, combined_actions_model_2) self.combine_es_agent = CombineESAgent(ensemble_algorithm) self.unitary_es_agent.restore('./saved_files', 'unitary_action_model.ckpt') self.combine_es_agent.restore('./saved_files', 'combined_actions_model.ckpt') unitary_actions_vec = np.load( "./saved_files/v6_top500_unitary_actions.npz")["actions"] self.unitary_actions = [] for i in range(unitary_actions_vec.shape[0]): action = action_space.from_vect(unitary_actions_vec[i]) self.unitary_actions.append(action) redispatch_actions_vec = np.load( "./saved_files/redispatch_actions.npz")["actions"] self.redispatch_actions = [] for i in range(redispatch_actions_vec.shape[0]): action = action_space.from_vect(redispatch_actions_vec[i]) self.redispatch_actions.append(action) with open("./saved_files/action_to_sub_id.pickle", "rb") as f: self.action_to_sub_id = pickle.load(f) self.after_line56_or_line45_disconnect_actions = [] self.three_sub_action_to_sub_ids = {} actions_vec = np.load( "./saved_files/v10_merge_three_sub_actions.npz")["actions"] for i in range(actions_vec.shape[0]): action = action_space.from_vect(actions_vec[i]) self.after_line56_or_line45_disconnect_actions.append(action) with open("saved_files/three_sub_action_to_sub_ids.pickle", "rb") as f: self.three_sub_action_to_sub_ids = pickle.load(f) self.used_combine_actions = False self.redispatch_cnt = 0 self.max_redispatch_cnt = 3 self.serial_actions = [] self.do_nothing_action = action_space({}) self.action_space = action_space offset = 59 self.action_to_sub_topo = {} for sub_id, sub_elem_num in enumerate(action_space.sub_info): self.action_to_sub_topo[sub_id] = (offset, offset + sub_elem_num) offset += sub_elem_num self.observation = None self.redispatch_months = set([3])