async def set_neighbors(self):
        '''Set neighbors for multi-environments, their slave environments,
        and agents.
        '''
        t = time.time()
        self.logger.debug("Settings grid neighbors for the multi-environments.")
        tasks = []
        for i in range(len(self.grid)):
            for j in range(len(self.grid[0])):
                addr = self.grid[i][j]
                N, E, S, W = None, None, None, None
                if i != 0:
                    W = self.grid[i-1][j]
                if i != len(self.grid) - 1:
                    E = self.grid[i+1][j]
                if j != 0:
                    N = self.grid[i][j-1]
                if j != len(self.grid[0]) - 1:
                    S = self.grid[i][j+1]
                task = asyncio.ensure_future(self._set_node_neighbors(addr, N, E, S, W))
                tasks.append(task)
        await asyncio.gather(*tasks)
        self.logger.debug("Setting grid neighbors for the slave environments "
                          "and their agents.")
        tasks = []
        for addr in self.addrs:
            task = asyncio.ensure_future(self._set_neighbors(addr))
            tasks.append(task)
        await asyncio.gather(*tasks)
        self.logger.debug("All grid neighbors set in {} seconds."
                          .format(time.time() - t))
        x = self._ngs[0] * self._gs[0] * self._n_slaves
        y = self._ngs[1] * self._gs[1]
        self.logger.info("Initialized a distributed grid with overall size "
                         "({}, {}). Total of {} agents.".format(x, y, x*y))