Esempio n. 1
0
    def __init__(self,
                 args,
                 observation_size,
                 action_size,
                 network_type,
                 task_queue,
                 result_queue,
                 worker_id,
                 name_scope='planning_worker'):

        # the multiprocessing initialization
        multiprocessing.Process.__init__(self)
        self.args = args
        self._name_scope = name_scope
        self._worker_id = worker_id
        self._network_type = network_type
        self._npr = np.random.RandomState(args.seed + self._worker_id)

        self._observation_size = observation_size
        self._action_size = action_size
        self._task_queue = task_queue
        self._result_queue = result_queue

        logger.info('Worker {} online'.format(self._worker_id))
        self._base_dir = init_path.get_base_dir()
Esempio n. 2
0
    def __init__(self,
                 args,
                 observation_size,
                 action_size,
                 network_type,
                 task_queue,
                 result_queue,
                 worker_id,
                 name_scope='planning_worker'):

        # the base agent
        super(worker,
              self).__init__(args, observation_size, action_size, network_type,
                             task_queue, result_queue, worker_id, name_scope)
        self._base_dir = init_path.get_base_dir()
Esempio n. 3
0
    def __init__(self,
                 args,
                 observation_size,
                 action_size,
                 network_type,
                 task_queue,
                 result_queue,
                 worker_id,
                 name_scope='mbmf_worker'):

        # the base agent
        super(worker,
              self).__init__(args, observation_size, action_size, network_type,
                             task_queue, result_queue, worker_id, name_scope)
        self._base_dir = init_path.get_base_dir()

        # build the environments
        self._build_env()
Esempio n. 4
0
    def __init__(self,
                 args,
                 observation_size,
                 action_size,
                 network_type,
                 task_queue,
                 result_queue,
                 worker_id,
                 name_scope='planning_worker'):

        # the base agent
        super(worker,
              self).__init__(args, observation_size, action_size, network_type,
                             task_queue, result_queue, worker_id, name_scope)
        self._base_dir = init_path.get_base_dir()
        self._alpha = args.cem_learning_rate
        self._num_iters = args.cem_num_iters
        self._elites_fraction = args.cem_elites_fraction
Esempio n. 5
0
    def __init__(self, sess, summary_name, enable=True, summary_dir=None):
        # the interface we need
        self.summary = None
        self.sess = sess
        self.enable = enable
        if not self.enable:  # the summary handler is disabled
            return
        if summary_dir is None:
            self.path = os.path.join(
                init_path.get_base_dir(), 'summary'
            )
        else:
            self.path = os.path.join(summary_dir, 'summary')
        self.path = os.path.abspath(self.path)

        if not os.path.exists(self.path):
            os.makedirs(self.path)
        self.path = os.path.join(self.path, summary_name)

        self.train_writer = tf.summary.FileWriter(self.path, self.sess.graph)

        logger.info(
            'summary write initialized, writing to {}'.format(self.path))