Ejemplo n.º 1
0
    def __init__(self, agent_filepath=""):
        Player.__init__(self)

        # Create the experience memory database
        if not os.path.exists(REPLAY_MEMORY_FILENAME):
            self.replay_memory = ReplayMemory()
        else:
            self.replay_memory = cPickle.load(open(REPLAY_MEMORY_FILENAME,
                                                   'r'))

        # Initialize the convolutional neural network
        self.network = MinecraftNet(agent_filepath)
        self.ae_network = FeatureNet()

        # Probability of selecting non-random action
        self.epsilon = STARTING_EPSILON

        # The total number of frames this agent has been trained on
        # through all the minibatch training
        self.frames_trained = 0

        # Load old epsilon and frames learned values
        self.load()

        self.cnn_action_map = self.initActionMap()

        # The current and previous sequences of game frames and actions
        self.current_seq = None
        self.previous_seq = None
        self.previous_action = None

        # Event logging
        self.log = LogFile("run.log", True)