예제 #1
0
    def end_file(self):
        self.batch_process()
        if self.file_frame_count == 0:
            return
        per_frame_award = self.file_reward / float(self.file_frame_count)
        if not self.current_file in self.eval_compare:
            self.eval_compare[self.current_file] = []
        self.eval_compare[self.current_file].append(per_frame_award)
        print('Reward for file:', self.file_reward)
        print('Reward per frame:', per_frame_award)

        self.file_reward = 0
        self.file_frame_count = 0
        self.reward_manager = reward_manager.RewardManager()
예제 #2
0
    def __init__(self, name, team, index, bot_parameters=None):
        self.last_frame_time = None
        self.config_file = bot_parameters
        self.index = index
        self.load_config_file()
        self.reward_manager = reward_manager.RewardManager()
        config = tf.ConfigProto(device_count={'GPU': 0})
        self.sess = tf.Session(config=config)
        # self.sess = tf.Session()
        self.actions_handler = action_factory.get_handler(
            control_scheme=self.control_scheme)
        self.num_actions = self.actions_handler.get_logit_size()
        print('num_actions', self.num_actions)

        self.model = self.model_class(self.sess,
                                      self.num_actions,
                                      input_formatter_info=[team, index],
                                      player_index=self.index,
                                      action_handler=self.actions_handler,
                                      config_file=bot_parameters,
                                      is_training=False)

        self.model.add_summary_writer('random_packet', is_replay=True)

        self.model.batch_size = 1
        self.model.mini_batch_size = 1

        self.model.is_graphing = self.is_graphing

        self.model.is_online_training = self.is_online_training

        self.model.apply_feature_creation(TensorflowFeatureCreator())

        try:
            self.model.create_model(self.model.get_input_placeholder())
        except TypeError as e:
            raise Exception('failed to create model') from e

        if self.model.is_training and self.model.is_online_training:
            self.model.create_reinforcement_training_model()

        self.model.create_savers()

        self.model.initialize_model()
        if self.is_graphing:
            self.rotating_real_reward_buffer = live_data_util.RotatingBuffer(
                self.index + 10)
예제 #3
0
 def start_new_file(self):
     self.file_number += 1
     self.last_action = None
     self.reward_manager = reward_manager.RewardManager()
예제 #4
0
 def __init__(self):
     self.file_reward = 0
     self.file_frame_count = 0
     self.total_reward = 0
     self.frame_count = 0
     self.reward_manager = reward_manager.RewardManager()